Commit 22944c81 authored by Nishith  Khanna's avatar Nishith Khanna
Browse files

Move all toast message to strings.xml so that they can be translated

parent 2af4201c
Pipeline #183143 passed with stage
in 4 minutes and 14 seconds
...@@ -250,7 +250,7 @@ public class WeatherPreferences extends PreferenceActivity implements ...@@ -250,7 +250,7 @@ public class WeatherPreferences extends PreferenceActivity implements
if (requestCode == 203) { if (requestCode == 203) {
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (!lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { if (!lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
Toast.makeText(this, "Set custom location in weather wettings.", Toast.makeText(this, getString(R.string.toast_custom_location),
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} else { } else {
startService(new Intent(this, WeatherUpdateService.class) startService(new Intent(this, WeatherUpdateService.class)
......
...@@ -14,6 +14,7 @@ import android.util.Log ...@@ -14,6 +14,7 @@ import android.util.Log
import android.view.WindowManager import android.view.WindowManager
import android.widget.Toast import android.widget.Toast
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import foundation.e.blisslauncher.R
import foundation.e.blisslauncher.core.Utilities import foundation.e.blisslauncher.core.Utilities
import foundation.e.blisslauncher.core.runOnMainThread import foundation.e.blisslauncher.core.runOnMainThread
import foundation.e.blisslauncher.core.safeForEach import foundation.e.blisslauncher.core.safeForEach
...@@ -124,7 +125,7 @@ class BlurWallpaperProvider(val context: Context) { ...@@ -124,7 +125,7 @@ class BlurWallpaperProvider(val context: Context) {
} else { } else {
if (error is OutOfMemoryError) { if (error is OutOfMemoryError) {
runOnMainThread { runOnMainThread {
Toast.makeText(context, "Failed", Toast.LENGTH_LONG).show() Toast.makeText(context, context.getString(R.string.toast_failed), Toast.LENGTH_LONG).show()
notifyWallpaperChanged() notifyWallpaperChanged()
} }
} }
......
...@@ -605,7 +605,7 @@ public class LauncherActivity extends AppCompatActivity implements ...@@ -605,7 +605,7 @@ public class LauncherActivity extends AppCompatActivity implements
moveTo = -1; moveTo = -1;
updateOrAddShortcut(shortcutAddEvent.getShortcutItem()); updateOrAddShortcut(shortcutAddEvent.getShortcutItem());
DatabaseManager.getManager(this).saveLayouts(pages, mDock); DatabaseManager.getManager(this).saveLayouts(pages, mDock);
Toast.makeText(this, "Shortcut has been added", Toast.LENGTH_SHORT).show(); Toast.makeText(this, getString(R.string.toast_shortcut_added), Toast.LENGTH_SHORT).show();
if (moveTo != -1) { if (moveTo != -1) {
mHorizontalPager.setCurrentPage(moveTo); mHorizontalPager.setCurrentPage(moveTo);
moveTo = -1; moveTo = -1;
...@@ -1069,7 +1069,7 @@ public class LauncherActivity extends AppCompatActivity implements ...@@ -1069,7 +1069,7 @@ public class LauncherActivity extends AppCompatActivity implements
@Override @Override
public void onError(Throwable e) { public void onError(Throwable e) {
Toast.makeText(LauncherActivity.this, "Recreating Launcher", Toast.makeText(LauncherActivity.this, getString(R.string.toast_recreating_launcher),
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
e.printStackTrace(); e.printStackTrace();
recreate(); recreate();
...@@ -1556,7 +1556,7 @@ public class LauncherActivity extends AppCompatActivity implements ...@@ -1556,7 +1556,7 @@ public class LauncherActivity extends AppCompatActivity implements
if (requestCode == REQUEST_LOCATION_SOURCE_SETTING) { if (requestCode == REQUEST_LOCATION_SOURCE_SETTING) {
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (!lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { if (!lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
Toast.makeText(this, "Set custom location in weather settings.", Toast.makeText(this, getString(R.string.toast_custom_location),
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} else { } else {
startService(new Intent(this, WeatherUpdateService.class) startService(new Intent(this, WeatherUpdateService.class)
...@@ -1816,7 +1816,7 @@ public class LauncherActivity extends AppCompatActivity implements ...@@ -1816,7 +1816,7 @@ public class LauncherActivity extends AppCompatActivity implements
} else { } else {
ApplicationItem applicationItem = (ApplicationItem) launcherItem; ApplicationItem applicationItem = (ApplicationItem) launcherItem;
if (applicationItem.isDisabled) { if (applicationItem.isDisabled) {
Toast.makeText(this, "Package not available or disabled", Toast.LENGTH_SHORT).show(); Toast.makeText(this, getString(R.string.toast_package_unavailable), Toast.LENGTH_SHORT).show();
} else { } else {
if (user == null || user.equals(Process.myUserHandle())) { if (user == null || user.equals(Process.myUserHandle())) {
context.startActivity(intent); context.startActivity(intent);
...@@ -1993,7 +1993,7 @@ public class LauncherActivity extends AppCompatActivity implements ...@@ -1993,7 +1993,7 @@ public class LauncherActivity extends AppCompatActivity implements
// System applications cannot be installed. For now, show a toast explaining // System applications cannot be installed. For now, show a toast explaining
// that. // that.
// We may give them the option of disabling apps this way. // We may give them the option of disabling apps this way.
Toast.makeText(this, "Can not uninstall this app", Toast.LENGTH_SHORT).show(); Toast.makeText(this, getString(R.string.toast_cannot_uninstall), Toast.LENGTH_SHORT).show();
} else { } else {
Uri packageUri = Uri.fromParts("package", componentName.getPackageName(), Uri packageUri = Uri.fromParts("package", componentName.getPackageName(),
componentName.getClassName()); componentName.getClassName());
...@@ -2181,7 +2181,7 @@ public class LauncherActivity extends AppCompatActivity implements ...@@ -2181,7 +2181,7 @@ public class LauncherActivity extends AppCompatActivity implements
if (movingApp.getParent() == null) { if (movingApp.getParent() == null) {
if (mDock.getChildCount() >= mDeviceProfile.numColumns) { if (mDock.getChildCount() >= mDeviceProfile.numColumns) {
Toast.makeText(LauncherActivity.this, Toast.makeText(LauncherActivity.this,
"Dock is already full", getString(R.string.toast_dock_full),
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} else { } else {
addAppToDock(movingApp, EMPTY_LOCATION_DRAG); addAppToDock(movingApp, EMPTY_LOCATION_DRAG);
...@@ -2477,7 +2477,7 @@ public class LauncherActivity extends AppCompatActivity implements ...@@ -2477,7 +2477,7 @@ public class LauncherActivity extends AppCompatActivity implements
private void removeAppFromFolder() { private void removeAppFromFolder() {
if (pages.get(getCurrentAppsPageNumber()).getChildCount() if (pages.get(getCurrentAppsPageNumber()).getChildCount()
>= mDeviceProfile.maxAppsPerPage) { >= mDeviceProfile.maxAppsPerPage) {
Toast.makeText(this, "No more room in page", Toast.LENGTH_SHORT).show(); Toast.makeText(this, getString(R.string.toast_no_room), Toast.LENGTH_SHORT).show();
movingApp.setVisibility(View.VISIBLE); movingApp.setVisibility(View.VISIBLE);
int currentItem = mFolderAppsViewPager.getCurrentItem(); int currentItem = mFolderAppsViewPager.getCurrentItem();
makeAppWobble(movingApp, true, makeAppWobble(movingApp, true,
......
...@@ -207,7 +207,7 @@ public class WidgetPicker extends Activity implements WidgetPickerAdapter.OnClic ...@@ -207,7 +207,7 @@ public class WidgetPicker extends Activity implements WidgetPickerAdapter.OnClic
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
setResultData(RESULT_OK, null); setResultData(RESULT_OK, null);
} else { } else {
Toast.makeText(this, "Permission denied", Toast.LENGTH_SHORT).show(); Toast.makeText(this, getString(R.string.toast_permission_denied), Toast.LENGTH_SHORT).show();
setResultData(RESULT_CANCELED, null); setResultData(RESULT_CANCELED, null);
} }
......
...@@ -177,4 +177,14 @@ ...@@ -177,4 +177,14 @@
<string name="uninstall_shortcut_dialog">Do you want to uninstall this shortcut?</string> <string name="uninstall_shortcut_dialog">Do you want to uninstall this shortcut?</string>
<string name="ok">ok</string> <string name="ok">ok</string>
<string name="widget_is_not_resizable">Widget is not resizable</string> <string name="widget_is_not_resizable">Widget is not resizable</string>
<string name="toast_permission_denied">Permission denied</string>
<string name="toast_custom_location">Set custom location in weather settings.</string>
<string name="toast_failed">Failed</string>
<string name="toast_shortcut_added">Shortcut has been added</string>
<string name="toast_recreating_launcher">Recreating Launcher</string>
<string name="toast_package_unavailable">Package not available or disabled</string>
<string name="toast_cannot_uninstall">Can not uninstall this app</string>
<string name="toast_dock_full">Dock is already full</string>
<string name="toast_no_room">No more room in page</string>
</resources> </resources>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment