Skip to content

Commit

Permalink
Merge pull request #260 from theftzoku/development
Browse files Browse the repository at this point in the history
Fix Hard-Coded Strings
  • Loading branch information
CrazyMarvin authored Apr 2, 2024
2 parents 9f16258 + 3e1df92 commit 570310a
Show file tree
Hide file tree
Showing 48 changed files with 951 additions and 45 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added app/release/baselineProfiles/0/app-release.dm
Binary file not shown.
Binary file added app/release/baselineProfiles/1/app-release.dm
Binary file not shown.
23 changes: 20 additions & 3 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,27 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 9,
"versionName": "1.9",
"versionCode": 3,
"versionName": "2.1.0",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
"elementType": "File",
"baselineProfiles": [
{
"minApi": 28,
"maxApi": 30,
"baselineProfiles": [
"baselineProfiles/1/app-release.dm"
]
},
{
"minApi": 31,
"maxApi": 2147483647,
"baselineProfiles": [
"baselineProfiles/0/app-release.dm"
]
}
],
"minSdkVersionForDexing": 26
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.
public void onSwiped(@NonNull final RecyclerView.ViewHolder viewHolder, int direction) {
if (direction == 8) {
AlertDialog.Builder builder1 = new AlertDialog.Builder(getContext());
builder1.setMessage("Do you really want to delete this?");
builder1.setMessage(R.string.delete);
builder1.setCancelable(true);

builder1.setPositiveButton(
Expand All @@ -98,7 +98,7 @@ public void onClick(DialogInterface dialog, int id) {
});

builder1.setNegativeButton(
"No",
R.string.no,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent i = new Intent(getActivity(), MainActivity.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
binding.percentage.setText(avoidedPercentage + "% Avoided");
Log.d("qqqqqq", "" + avoidedPercentage);
if (avoidedPercentage == 100) {
binding.progressText.setText((int) avoidedSize + " out of " + (int) habitsSize + " habits are avoided");
binding.progressText.setText((int) avoidedSize + getString(R.string.out_of) + (int) habitsSize + getString(R.string.habits_are_avoided));
} else {
binding.progressText.setText((int) avoidedSize + " out of " + (int) habitsSize + " habits are avoided, way to go!");
binding.progressText.setText((int) avoidedSize +getString(R.string.out_of) + (int) habitsSize + getString(R.string.habits_are_avoided_way_to_go));
}
binding.percentage.setText(avoidedPercentage + "% Avoided");
binding.before.setBackgroundResource(R.drawable.ic_backarrow);
Expand Down Expand Up @@ -108,9 +108,9 @@ public void run() {
avoidedSize = Helper.avoidedlogdata.size();
avoidedPercentage = (int) ((avoidedSize / habitsSize) * 100);
if (avoidedPercentage == 100) {
binding.progressText.setText((int) avoidedSize + " out of " + (int) habitsSize + " habits are avoided");
binding.progressText.setText((int) avoidedSize +getString(R.string.out_of) + (int) habitsSize +getString(R.string.habits_are_avoided) );
} else {
binding.progressText.setText((int) avoidedSize + " out of " + (int) habitsSize + " habits are avoided, way to go!");
binding.progressText.setText((int) avoidedSize +getString(R.string.out_of) + (int) habitsSize + getString(R.string.habits_are_avoided_way_to_go));
}
binding.percentage.setText(avoidedPercentage + "% Avoided");
funcPieChart(avoidedPercentage);
Expand Down Expand Up @@ -156,9 +156,9 @@ public void run() {
avoidedPercentage = (int) ((avoidedSize / habitsSize) * 100);
Log.d("qqqqqq", "" + avoidedPercentage);
if (avoidedPercentage == 100) {
binding.progressText.setText((int) avoidedSize + " out of " + (int) habitsSize + " habits are avoided");
binding.progressText.setText((int) avoidedSize +getString(R.string.out_of) + (int) habitsSize +getString(R.string.habits_are_avoided));
} else {
binding.progressText.setText((int) avoidedSize + " out of " + (int) habitsSize + " habits are avoided, way to go!");
binding.progressText.setText((int) avoidedSize +getString(R.string.out_of) + (int) habitsSize + getString(R.string.habits_are_avoided_way_to_go));
}
binding.percentage.setText(avoidedPercentage + "% Avoided");
funcPieChart(avoidedPercentage);
Expand Down Expand Up @@ -225,8 +225,8 @@ public void onClick(View view) {
public void funcPieChart(int avoidedPer) {
binding.pieChart.setUsePercentValues(true);
List<PieEntry> value = new ArrayList<>();
value.add(new PieEntry((float) avoidedPer, "Avoided"));
value.add(new PieEntry((float) (100.0 - avoidedPer), "Habits"));
value.add(new PieEntry((float) avoidedPer, getString(R.string.avoided_)));
value.add(new PieEntry((float) (100.0 - avoidedPer), getString(R.string.habits_)));
PieDataSet pieDataSet = new PieDataSet(value, "");
pieDataSet.setValueTextColor(Color.WHITE);
PieData pieData = new PieData(pieDataSet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.
public void onSwiped(@NonNull final RecyclerView.ViewHolder viewHolder, int direction) {
if (direction == 8) {
AlertDialog.Builder builder1 = new AlertDialog.Builder(getContext());
builder1.setMessage("Do you really want to delete this?");
builder1.setMessage(R.string.deletes);
builder1.setCancelable(true);

builder1.setPositiveButton(
"Yes",
R.string.yes,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
int i = viewHolder.getAdapterPosition();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void onClick(View view) {
showcaseFab();
} else {
if (Helper.labels_array.size() == 0) {
Toast.makeText(getActivity(), "Please Add a Label First", Toast.LENGTH_LONG).show();
Toast.makeText(getActivity(), R.string.please_add_a_label_first, Toast.LENGTH_LONG).show();
} else {
final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
final String formattedDate = df.format(c);
Expand All @@ -106,6 +106,7 @@ public void onClick(View view) {
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
d.getWindow().setAttributes(lp);


final Spinner spinner = d.findViewById(R.id.spinner);
final TextView txt = d.findViewById(R.id.txt);
if (Helper.labels_array.size() == 0) {
Expand Down Expand Up @@ -316,10 +317,10 @@ public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.
public void onSwiped(@NonNull final RecyclerView.ViewHolder viewHolder, int direction) {
if (direction == 8) {
AlertDialog.Builder builder1 = new AlertDialog.Builder(getContext());
builder1.setMessage("Do you really want to delete this?");
builder1.setMessage(R.string.do_you_really_want_to_delete_this);
builder1.setCancelable(true);

builder1.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
builder1.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
int i = viewHolder.getAdapterPosition();
db.delete_habits(i);
Expand All @@ -334,7 +335,7 @@ public void onClick(DialogInterface dialog, int id) {
}
});

builder1.setNegativeButton("No", new DialogInterface.OnClickListener() {
builder1.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Helper.SelectedButtonOfTodayTab = 0;
Intent i = new Intent(getActivity(), MainActivity.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public void onBindViewHolder(@NonNull LabelsAdapter.RecyclerViewHolder holder, f
db.getNightMode();
int count=db.countLabels(dTask);
if(count>1){
holder.tv_sum.setText(""+count+ " habits");
holder.tv_sum.setText(""+count+ R.string.habits);
}
else{
holder.tv_sum.setText(""+count+ " habit");
holder.tv_sum.setText(""+count+ R.string.habits);
}
// if(Helper.isnightmodeon.equals("no")){
holder.btnlabel.setBackgroundResource(R.drawable.ic_label_light_labels);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,40 +194,40 @@ public void run() {
public void setMonth(String s) {
switch (s) {
case "01":
curmonth = "January";
curmonth = getString(R.string.january);
break;
case "02":
curmonth = "February";
curmonth = getString(R.string.february);
break;
case "03":
curmonth = "March";
curmonth = getString(R.string.march);
break;
case "04":
curmonth = "April";
curmonth = getString(R.string.april);
break;
case "05":
curmonth = "May";
curmonth = getString(R.string.may);
break;
case "06":
curmonth = "June";
curmonth = getString(R.string.june);
break;
case "07":
curmonth = "July";
curmonth = getString(R.string.july);
break;
case "08":
curmonth = "August";
curmonth = getString(R.string.august);
break;
case "09":
curmonth = "September";
curmonth = getString(R.string.september);
break;
case "10":
curmonth = "October";
curmonth = getString(R.string.october);
break;
case "11":
curmonth = "November";
curmonth = getString(R.string.november);
break;
case "12":
curmonth = "December";
curmonth = getString(R.string.december);
break;
default:
curmonth = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void run() {
public void funcPieChart(int avoidedPer) {
pieChart.setUsePercentValues(true);
List<PieEntry> value = new ArrayList<>();
value.add(new PieEntry((float) avoidedPer, "Avoided"));
value.add(new PieEntry((float) avoidedPer, R.string.avoided));
value.add(new PieEntry((float) (100.0 - avoidedPer), "Habits"));
PieDataSet pieDataSet = new PieDataSet(value, "");
pieDataSet.setValueTextColor(Color.WHITE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ public void run() {
public void funcPieChart(int avoidedPer) {
pieChart.setUsePercentValues(true);
List<PieEntry> value = new ArrayList<>();
value.add(new PieEntry((float) avoidedPer, "Avoided"));
value.add(new PieEntry((float) (100.0 - avoidedPer), "Habits"));
value.add(new PieEntry((float) avoidedPer, R.string.avoided));
value.add(new PieEntry((float) (100.0 - avoidedPer), R.string.habits));
PieDataSet pieDataSet = new PieDataSet(value, "");
pieDataSet.setValueTextColor(Color.WHITE);
PieData pieData = new PieData(pieDataSet);
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/fragment_log2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
android:id="@+id/day"
android:layout_width="0dp"
android:layout_height="40dp"
android:text="D"
android:text="@string/d"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:textColor="@color/textcolor"
Expand All @@ -42,7 +42,7 @@
android:id="@+id/week"
android:layout_width="0dp"
android:layout_height="40dp"
android:text="W"
android:text="@string/w"
android:layout_weight="1"
android:textColor="@color/textcolor"
android:textSize="12sp" />
Expand All @@ -51,7 +51,7 @@
android:id="@+id/month"
android:layout_width="0dp"
android:layout_height="40dp"
android:text="M"
android:text="@string/m"
android:layout_weight="1"
android:textColor="@color/textcolor"
android:textSize="12sp" />
Expand All @@ -61,7 +61,7 @@
android:layout_width="0dp"
android:layout_height="40dp"

android:text="Y"
android:text="@string/y"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:textColor="@color/textcolor"
Expand Down
26 changes: 26 additions & 0 deletions app/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,30 @@
<resources>
<string name="LightMode">Лягайте</string>
<string name="app_name">Лягайте</string>
<string name="d">D</string>
<string name="w">W</string>
<string name="m">M</string>
<string name="y">Y</string>
<string name="out_of">" out of "</string>
<string name="habits_are_avoided">" habits are avoided"</string>
<string name="habits_are_avoided_way_to_go">" habits are avoided, way to go!"</string>
<string name="avoided_">Avoided</string>
<string name="habits_">Habits</string>
<string name="no">No</string>
<string name="deletes">Do you really want to delete this?</string>
<string name="yes">Yes</string>
<string name="please_add_a_label_first">Please Add a Label First</string>
<string name="do_you_really_want_to_delete_this">Do you really want to delete this?</string>
<string name="january">January</string>
<string name="february">February</string>
<string name="march">March</string>
<string name="april">April</string>
<string name="may">May</string>
<string name="june">June</string>
<string name="july">July</string>
<string name="august">August</string>
<string name="september">September</string>
<string name="october">October</string>
<string name="november">November</string>
<string name="december">December</string>
</resources>
26 changes: 26 additions & 0 deletions app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,30 @@
<string name="habits">Zvyky</string>
<string name="done">Hotovo</string>
<string name="avoided">Vyhnuto</string>
<string name="d">D</string>
<string name="w">W</string>
<string name="m">M</string>
<string name="y">Y</string>
<string name="out_of">" out of "</string>
<string name="habits_are_avoided">" habits are avoided"</string>
<string name="habits_are_avoided_way_to_go">" habits are avoided, way to go!"</string>
<string name="avoided_">Avoided</string>
<string name="habits_">Habits</string>
<string name="no">No</string>
<string name="deletes">Do you really want to delete this?</string>
<string name="yes">Yes</string>
<string name="please_add_a_label_first">Please Add a Label First</string>
<string name="do_you_really_want_to_delete_this">Do you really want to delete this?</string>
<string name="january">January</string>
<string name="february">February</string>
<string name="march">March</string>
<string name="april">April</string>
<string name="may">May</string>
<string name="june">June</string>
<string name="july">July</string>
<string name="august">August</string>
<string name="september">September</string>
<string name="october">October</string>
<string name="november">November</string>
<string name="december">December</string>
</resources>
26 changes: 26 additions & 0 deletions app/src/main/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,30 @@
<string name="habitswillshowuphere">Vaner vises her</string>
<string name="feather">Fjerikoner</string>
<string name="mpandroidchart">MPAndroidChart</string>
<string name="d">D</string>
<string name="w">W</string>
<string name="m">M</string>
<string name="y">Y</string>
<string name="out_of">" out of "</string>
<string name="habits_are_avoided">" habits are avoided"</string>
<string name="habits_are_avoided_way_to_go">" habits are avoided, way to go!"</string>
<string name="avoided_">Avoided</string>
<string name="habits_">Habits</string>
<string name="no">No</string>
<string name="deletes">Do you really want to delete this?</string>
<string name="yes">Yes</string>
<string name="please_add_a_label_first">Please Add a Label First</string>
<string name="do_you_really_want_to_delete_this">Do you really want to delete this?</string>
<string name="january">January</string>
<string name="february">February</string>
<string name="march">March</string>
<string name="april">April</string>
<string name="may">May</string>
<string name="june">June</string>
<string name="july">July</string>
<string name="august">August</string>
<string name="september">September</string>
<string name="october">October</string>
<string name="november">November</string>
<string name="december">December</string>
</resources>
Loading

0 comments on commit 570310a

Please sign in to comment.