Working with #3129 issue (#3146)

* Replace Hard-Coded strings with those from strings.xml.
This commit is contained in:
PavelAplevich 2019-09-09 08:31:30 +03:00 committed by Ashish Kumar
parent 0349e3e069
commit 864ecad2e7
6 changed files with 15 additions and 8 deletions

View file

@ -199,7 +199,7 @@ public class AchievementsActivity extends NavigationBaseActivity {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_STREAM, fileUri); intent.putExtra(Intent.EXTRA_STREAM, fileUri);
intent.setType("image/png"); intent.setType("image/png");
startActivity(Intent.createChooser(intent, "Share image via")); startActivity(Intent.createChooser(intent, getString(R.string.share_image_via)));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -316,8 +316,8 @@ public class AchievementsActivity extends NavigationBaseActivity {
private void setZeroAchievements() { private void setZeroAchievements() {
AlertDialog.Builder builder=new AlertDialog.Builder(this) AlertDialog.Builder builder=new AlertDialog.Builder(this)
.setMessage("You haven't made any contributions yet") .setMessage(getString(R.string.no_achievements_yet))
.setPositiveButton("Ok", (dialog, which) -> { .setPositiveButton(getString(R.string.ok), (dialog, which) -> {
}); });
AlertDialog dialog = builder.create(); AlertDialog dialog = builder.create();
dialog.show(); dialog.show();

View file

@ -7,6 +7,7 @@ import android.webkit.WebViewClient;
import android.widget.Toast; import android.widget.Toast;
import fr.free.nrw.commons.BuildConfig; import fr.free.nrw.commons.BuildConfig;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.theme.BaseActivity; import fr.free.nrw.commons.theme.BaseActivity;
import timber.log.Timber; import timber.log.Timber;
@ -39,7 +40,7 @@ public class SignupActivity extends BaseActivity {
Timber.d("Overriding URL %s", url); Timber.d("Overriding URL %s", url);
Toast toast = Toast.makeText(SignupActivity.this, Toast toast = Toast.makeText(SignupActivity.this,
"Account created!", Toast.LENGTH_LONG); R.string.account_created, Toast.LENGTH_LONG);
toast.show(); toast.show();
// terminate on task completion. // terminate on task completion.
finish(); finish();

View file

@ -511,7 +511,7 @@ public class NearbyMapFragment extends DaggerFragment {
} }
title.setOnLongClickListener(view -> { title.setOnLongClickListener(view -> {
Utils.copy("place",title.getText().toString(),getContext()); Utils.copy("place",title.getText().toString(),getContext());
Toast.makeText(getContext(),"Text copied to clipboard",Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(),getString(R.string.text_copy),Toast.LENGTH_SHORT).show();
return true; return true;
} }
); );

View file

@ -87,7 +87,7 @@ public class NotificationActivity extends NavigationBaseActivity {
setAdapter(notificationList); setAdapter(notificationList);
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
Snackbar snackbar = Snackbar Snackbar snackbar = Snackbar
.make(relativeLayout,"Notification marked as read", Snackbar.LENGTH_LONG); .make(relativeLayout, getString(R.string.notification_mark_read), Snackbar.LENGTH_LONG);
snackbar.show(); snackbar.show();
if (notificationList.size()==0){ if (notificationList.size()==0){
@ -99,7 +99,7 @@ public class NotificationActivity extends NavigationBaseActivity {
else { else {
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
setAdapter(notificationList); setAdapter(notificationList);
Toast.makeText(NotificationActivity.this, "There was some error!", Toast.LENGTH_SHORT).show(); Toast.makeText(NotificationActivity.this, getString(R.string.some_error), Toast.LENGTH_SHORT).show();
} }
}, throwable -> { }, throwable -> {

View file

@ -163,7 +163,7 @@ public class QuizResultActivity extends AppCompatActivity {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
intent.setType("image/png"); intent.setType("image/png");
startActivity(Intent.createChooser(intent, "Share image via")); startActivity(Intent.createChooser(intent, getString(R.string.share_image_via)));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View file

@ -575,4 +575,10 @@ Upload your first media by tapping on the add button.</string>
<string name="delete_helper_ask_reason_copyright_logo">Logo</string> <string name="delete_helper_ask_reason_copyright_logo">Logo</string>
<string name="delete_helper_ask_reason_copyright_other">Other</string> <string name="delete_helper_ask_reason_copyright_other">Other</string>
<string name="delete_helper_ask_alert_set_positive_button_reason">Because it is</string> <string name="delete_helper_ask_alert_set_positive_button_reason">Because it is</string>
<string name="share_image_via">Share image via</string>
<string name="no_achievements_yet">You haven\'t made any contributions yet</string>
<string name="account_created">Account created!</string>
<string name="text_copy">Text copied to clipboard</string>
<string name="notification_mark_read">Notification marked as read</string>
<string name="some_error">There was some error!</string>
</resources> </resources>