forked from REAndroid/APKEditor
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Indonesian translation by @teddysulaimanGL Add language picker in app Add border to dialogs Change background color and add border to buttons
- Loading branch information
1 parent
12adac2
commit 02f4ee9
Showing
34 changed files
with
268 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package ankur035; | ||
import android.annotation.TargetApi; | ||
import android.content.Context; | ||
import android.content.SharedPreferences; | ||
import android.content.res.Configuration; | ||
import android.content.res.Resources; | ||
import android.os.Build; | ||
import android.preference.PreferenceManager; | ||
|
||
import java.util.Locale; | ||
|
||
public class LocaleHelper { | ||
private static final String SELECTED_LANGUAGE = "Locale.Helper.Selected.Language"; | ||
|
||
// Method to set the language at runtime | ||
public static Context setLocale(Context context, String language) { | ||
persist(context, language); | ||
|
||
// Updating the language for devices above Android Nougat | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | ||
return updateResources(context, language); | ||
} | ||
// For devices with lower versions of Android OS | ||
return updateResourcesLegacy(context, language); | ||
} | ||
|
||
private static void persist(Context context, String language) { | ||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); | ||
SharedPreferences.Editor editor = preferences.edit(); | ||
editor.putString(SELECTED_LANGUAGE, language); | ||
if(Build.VERSION.SDK_INT > 8) editor.apply(); | ||
else editor.commit(); | ||
} | ||
|
||
// Method to update the language of the application by creating | ||
// an object of the inbuilt Locale class and passing the language argument to it | ||
@TargetApi(Build.VERSION_CODES.N) | ||
private static Context updateResources(Context context, String language) { | ||
Locale locale = new Locale(language); | ||
Locale.setDefault(locale); | ||
|
||
Configuration configuration = context.getResources().getConfiguration(); | ||
configuration.setLocale(locale); | ||
configuration.setLayoutDirection(locale); | ||
|
||
return context.createConfigurationContext(configuration); | ||
} | ||
|
||
private static Context updateResourcesLegacy(Context context, String language) { | ||
Locale locale = new Locale(language); | ||
Locale.setDefault(locale); | ||
|
||
Resources resources = context.getResources(); | ||
Configuration configuration = resources.getConfiguration(); | ||
configuration.locale = locale; | ||
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { | ||
configuration.setLayoutDirection(locale); | ||
} | ||
|
||
resources.updateConfiguration(configuration, resources.getDisplayMetrics()); | ||
|
||
return context; | ||
} | ||
} |
186 changes: 140 additions & 46 deletions
186
app/src/main/java/com/abdurazaaqmohammed/AntiSplit/main/MainActivity.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<background android:drawable="@drawable/ic_launcher_background" /> | ||
<foreground android:drawable="@drawable/ic_launcher_foreground" /> | ||
<monochrome android:drawable="@drawable/ic_launcher_foreground" /> | ||
<background android:drawable="@color/ic_launcher_background"/> | ||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> | ||
</adaptive-icon> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<background android:drawable="@drawable/ic_launcher_background" /> | ||
<foreground android:drawable="@drawable/ic_launcher_foreground" /> | ||
<monochrome android:drawable="@drawable/ic_launcher_foreground" /> | ||
<background android:drawable="@color/ic_launcher_background"/> | ||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> | ||
</adaptive-icon> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="ic_launcher_background">#000000</color> | ||
</resources> |
Oops, something went wrong.