Commit 2149c94f 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 #183189 passed with stage
in 2 minutes and 8 seconds
......@@ -250,7 +250,7 @@ public class WeatherPreferences extends PreferenceActivity implements
if (requestCode == 203) {
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
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();
} else {
startService(new Intent(this, WeatherUpdateService.class)
......
......@@ -14,6 +14,7 @@ import android.util.Log
import android.view.WindowManager
import android.widget.Toast
import androidx.core.app.ActivityCompat
import foundation.e.blisslauncher.R
import foundation.e.blisslauncher.core.Utilities
import foundation.e.blisslauncher.core.runOnMainThread
import foundation.e.blisslauncher.core.safeForEach
......@@ -124,7 +125,7 @@ class BlurWallpaperProvider(val context: Context) {
} else {
if (error is OutOfMemoryError) {
runOnMainThread {
Toast.makeText(context, "Failed", Toast.LENGTH_LONG).show()
Toast.makeText(context, context.getString(R.string.toast_failed), Toast.LENGTH_LONG).show()
notifyWallpaperChanged()
}
}
......
......@@ -605,7 +605,7 @@ public class LauncherActivity extends AppCompatActivity implements
moveTo = -1;
updateOrAddShortcut(shortcutAddEvent.getShortcutItem());
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) {
mHorizontalPager.setCurrentPage(moveTo);
moveTo = -1;
......@@ -1069,7 +1069,7 @@ public class LauncherActivity extends AppCompatActivity implements
@Override
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();
e.printStackTrace();
recreate();
......@@ -1556,7 +1556,7 @@ public class LauncherActivity extends AppCompatActivity implements
if (requestCode == REQUEST_LOCATION_SOURCE_SETTING) {
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
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();
} else {
startService(new Intent(this, WeatherUpdateService.class)
......@@ -1816,7 +1816,7 @@ public class LauncherActivity extends AppCompatActivity implements
} else {
ApplicationItem applicationItem = (ApplicationItem) launcherItem;
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 {
if (user == null || user.equals(Process.myUserHandle())) {
context.startActivity(intent);
......@@ -1993,7 +1993,7 @@ public class LauncherActivity extends AppCompatActivity implements
// System applications cannot be installed. For now, show a toast explaining
// that.
// 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 {
Uri packageUri = Uri.fromParts("package", componentName.getPackageName(),
componentName.getClassName());
......@@ -2181,7 +2181,7 @@ public class LauncherActivity extends AppCompatActivity implements
if (movingApp.getParent() == null) {
if (mDock.getChildCount() >= mDeviceProfile.numColumns) {
Toast.makeText(LauncherActivity.this,
"Dock is already full",
getString(R.string.toast_dock_full),
Toast.LENGTH_SHORT).show();
} else {
addAppToDock(movingApp, EMPTY_LOCATION_DRAG);
......@@ -2477,7 +2477,7 @@ public class LauncherActivity extends AppCompatActivity implements
private void removeAppFromFolder() {
if (pages.get(getCurrentAppsPageNumber()).getChildCount()
>= 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);
int currentItem = mFolderAppsViewPager.getCurrentItem();
makeAppWobble(movingApp, true,
......
......@@ -207,7 +207,7 @@ public class WidgetPicker extends Activity implements WidgetPickerAdapter.OnClic
if (resultCode == RESULT_OK) {
setResultData(RESULT_OK, null);
} 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);
}
......
......@@ -177,4 +177,14 @@
<string name="uninstall_shortcut_dialog">Do you want to uninstall this shortcut?</string>
<string name="ok">ok</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 to set blur wallpaper</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>
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