Add string resources

This commit is contained in:
Josephine Lim 2017-05-15 10:25:40 +02:00
parent e8f306a023
commit faa60dc824
2 changed files with 10 additions and 9 deletions

View file

@ -91,24 +91,23 @@ public class NearbyActivity extends BaseActivity {
protected void checkGps() { protected void checkGps() {
LocationManager manager = (LocationManager) LocationManager manager = (LocationManager) getSystemService(LOCATION_SERVICE);
getSystemService(LOCATION_SERVICE); if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
if(!manager.isProviderEnabled( LocationManager.GPS_PROVIDER )) {
Timber.d("GPS is not enabled"); Timber.d("GPS is not enabled");
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setMessage("GPS is disabled in your device. Would you like to enable it?") alertDialogBuilder.setMessage(R.string.gps_disabled)
.setCancelable(false) .setCancelable(false)
.setPositiveButton("Enable GPS", .setPositiveButton(R.string.enable_gps,
new DialogInterface.OnClickListener(){ new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id){ public void onClick(DialogInterface dialog, int id) {
Intent callGPSSettingIntent = new Intent( Intent callGPSSettingIntent = new Intent(
android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(callGPSSettingIntent); startActivity(callGPSSettingIntent);
} }
}); });
alertDialogBuilder.setNegativeButton("Cancel", alertDialogBuilder.setNegativeButton("Cancel",
new DialogInterface.OnClickListener(){ new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id){ public void onClick(DialogInterface dialog, int id) {
dialog.cancel(); dialog.cancel();
} }
}); });

View file

@ -51,6 +51,8 @@
<string name="categories_search_text_hint">Search categories</string> <string name="categories_search_text_hint">Search categories</string>
<string name="menu_save_categories">Save</string> <string name="menu_save_categories">Save</string>
<string name="refresh_button">Refresh</string> <string name="refresh_button">Refresh</string>
<string name="gps_disabled">GPS is disabled in your device. Would you like to enable it?</string>
<string name="enable_gps">Enable GPS</string>
<string name="contributions_subtitle_zero">No uploads yet</string> <string name="contributions_subtitle_zero">No uploads yet</string>
<plurals name="contributions_subtitle"> <plurals name="contributions_subtitle">
<!--zero is not used in english. Category mentioned here for easy reference in future--> <!--zero is not used in english. Category mentioned here for easy reference in future-->