Skip to content

Commit 01fa5a9

Browse files
PavelAplevichVivek Maskara
authored and
Vivek Maskara
committed
Working with #3129 issue (#3146)
* Replace Hard-Coded strings with those from strings.xml.
1 parent a347c4a commit 01fa5a9

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed

app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void shareScreen(Bitmap bitmap) {
199199
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
200200
intent.putExtra(Intent.EXTRA_STREAM, fileUri);
201201
intent.setType("image/png");
202-
startActivity(Intent.createChooser(intent, "Share image via"));
202+
startActivity(Intent.createChooser(intent, getString(R.string.share_image_via)));
203203
} catch (IOException e) {
204204
e.printStackTrace();
205205
}
@@ -316,8 +316,8 @@ private void setUploadProgress(int uploadCount){
316316

317317
private void setZeroAchievements() {
318318
AlertDialog.Builder builder=new AlertDialog.Builder(this)
319-
.setMessage("You haven't made any contributions yet")
320-
.setPositiveButton("Ok", (dialog, which) -> {
319+
.setMessage(getString(R.string.no_achievements_yet))
320+
.setPositiveButton(getString(R.string.ok), (dialog, which) -> {
321321
});
322322
AlertDialog dialog = builder.create();
323323
dialog.show();

app/src/main/java/fr/free/nrw/commons/auth/SignupActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.widget.Toast;
88

99
import fr.free.nrw.commons.BuildConfig;
10+
import fr.free.nrw.commons.R;
1011
import fr.free.nrw.commons.theme.BaseActivity;
1112
import timber.log.Timber;
1213

@@ -39,7 +40,7 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
3940
Timber.d("Overriding URL %s", url);
4041

4142
Toast toast = Toast.makeText(SignupActivity.this,
42-
"Account created!", Toast.LENGTH_LONG);
43+
R.string.account_created, Toast.LENGTH_LONG);
4344
toast.show();
4445
// terminate on task completion.
4546
finish();

app/src/main/java/fr/free/nrw/commons/nearby/NearbyMapFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ public void onSlide(@NonNull View bottomSheet, float slideOffset) {
511511
}
512512
title.setOnLongClickListener(view -> {
513513
Utils.copy("place",title.getText().toString(),getContext());
514-
Toast.makeText(getContext(),"Text copied to clipboard",Toast.LENGTH_SHORT).show();
514+
Toast.makeText(getContext(),getString(R.string.text_copy),Toast.LENGTH_SHORT).show();
515515
return true;
516516
}
517517
);

app/src/main/java/fr/free/nrw/commons/notification/NotificationActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public void removeNotification(Notification notification) {
9292
setAdapter(notificationList);
9393
adapter.notifyDataSetChanged();
9494
Snackbar snackbar = Snackbar
95-
.make(relativeLayout, "Notification marked as read", Snackbar.LENGTH_LONG);
95+
.make(relativeLayout, getString(R.string.notification_mark_read), Snackbar.LENGTH_LONG);
9696

9797
snackbar.show();
9898
if (notificationList.size() == 0) {
@@ -103,7 +103,7 @@ public void removeNotification(Notification notification) {
103103
} else {
104104
adapter.notifyDataSetChanged();
105105
setAdapter(notificationList);
106-
Toast.makeText(NotificationActivity.this, "There was some error!", Toast.LENGTH_SHORT).show();
106+
Toast.makeText(NotificationActivity.this, getString(R.string.some_error), Toast.LENGTH_SHORT).show();
107107
}
108108
}, throwable -> {
109109

app/src/main/java/fr/free/nrw/commons/quiz/QuizResultActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void shareScreen(Bitmap bitmap) {
163163
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
164164
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
165165
intent.setType("image/png");
166-
startActivity(Intent.createChooser(intent, "Share image via"));
166+
startActivity(Intent.createChooser(intent, getString(R.string.share_image_via)));
167167
} catch (Exception e) {
168168
e.printStackTrace();
169169
}

app/src/main/res/values/strings.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,5 +576,11 @@ Upload your first media by tapping on the add button.</string>
576576
<string name="delete_helper_ask_reason_copyright_logo">Logo</string>
577577
<string name="delete_helper_ask_reason_copyright_other">Other</string>
578578
<string name="delete_helper_ask_alert_set_positive_button_reason">Because it is</string>
579+
<string name="share_image_via">Share image via</string>
580+
<string name="no_achievements_yet">You haven\'t made any contributions yet</string>
581+
<string name="account_created">Account created!</string>
582+
<string name="text_copy">Text copied to clipboard</string>
583+
<string name="notification_mark_read">Notification marked as read</string>
584+
<string name="some_error">There was some error!</string>
579585
<string name="you_must_reset_your_passsword">Something went wrong with login, you must reset your password !!</string>
580586
</resources>

0 commit comments

Comments
 (0)