changed icon and added system default setting

This commit is contained in:
Bnyro 2022-05-06 09:30:48 +02:00
parent 3c37d8e310
commit b60fe7b3f1
6 changed files with 22 additions and 5 deletions

View File

@ -42,9 +42,13 @@ class MainActivity : AppCompatActivity() {
RetrofitInstance.url = sharedPreferences.getString("instance", "https://pipedapi.kavin.rocks/")!! RetrofitInstance.url = sharedPreferences.getString("instance", "https://pipedapi.kavin.rocks/")!!
DynamicColors.applyToActivitiesIfAvailable(application) DynamicColors.applyToActivitiesIfAvailable(application)
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
var languageName = sharedPreferences.getString("language", "en")!! val languageName = sharedPreferences.getString("language", "sys")
if (languageName != "") { if (languageName != "") {
val locale = Locale(languageName) var locale = if (languageName != "sys") {
Locale(languageName)
} else {
Locale.getDefault()
}
val res = resources val res = resources
val dm = res.displayMetrics val dm = res.displayMetrics
val conf = res.configuration val conf = res.configuration

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M14.4,6L14,4H5v17h2v-7h5.6l0.4,2h7V6z"/>
</vector>

View File

@ -406,6 +406,7 @@
</string-array> </string-array>
<string-array name="languages"> <string-array name="languages">
<item>@string/systemLanguage</item>
<item>Arabic</item> <item>Arabic</item>
<item>Czech</item> <item>Czech</item>
<item>English</item> <item>English</item>
@ -428,6 +429,7 @@
</string-array> </string-array>
<string-array name="languagesValue"> <string-array name="languagesValue">
<item>sys</item>
<item>ar</item> <item>ar</item>
<item>cs</item> <item>cs</item>
<item>en</item> <item>en</item>

View File

@ -54,4 +54,5 @@
<string name="fail">Failed :(</string> <string name="fail">Failed :(</string>
<string name="about">About</string> <string name="about">About</string>
<string name="changeLanguage">Change Language</string> <string name="changeLanguage">Change Language</string>
<string name="systemLanguage">System Language</string>
</resources> </resources>

View File

@ -8,7 +8,7 @@
app:entryValues="@array/regionsValue" app:entryValues="@array/regionsValue"
app:defaultValue="US" app:defaultValue="US"
app:useSimpleSummaryProvider="true" app:useSimpleSummaryProvider="true"
android:icon="@drawable/ic_language" android:icon="@drawable/ic_region"
/> />
<ListPreference <ListPreference
@ -16,9 +16,9 @@
app:title="@string/changeLanguage" app:title="@string/changeLanguage"
app:entries="@array/languages" app:entries="@array/languages"
app:entryValues="@array/languagesValue" app:entryValues="@array/languagesValue"
app:defaultValue="en" app:defaultValue="sys"
app:useSimpleSummaryProvider="true" app:useSimpleSummaryProvider="true"
android:icon="@drawable/ic_language" android:icon="@drawable/ic_flag"
/> />
<ListPreference <ListPreference