Skip to content

Commit 87ecf83

Browse files
committed
feat: Welcome dialog, Features in About, drop Indonesian language
1 parent 8b4c85a commit 87ecf83

File tree

9 files changed

+55
-280
lines changed

9 files changed

+55
-280
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
android:supportsRtl="true"
1717
android:theme="@style/Theme.AppControlX"
1818
android:fullBackupContent="@xml/backup_rules"
19-
android:dataExtractionRules="@xml/data_extraction_rules"
20-
android:localeConfig="@xml/locales_config">
19+
android:dataExtractionRules="@xml/data_extraction_rules">
2120

2221
<!-- Setup Activity (Launcher) -->
2322
<activity

app/src/main/java/com/appcontrolx/App.kt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.appcontrolx
33
import android.app.Application
44
import android.util.Log
55
import androidx.appcompat.app.AppCompatDelegate
6-
import androidx.core.os.LocaleListCompat
76
import androidx.preference.PreferenceManager
87
import com.appcontrolx.utils.Constants
98
import com.topjohnwu.superuser.Shell
@@ -45,7 +44,6 @@ class App : Application() {
4544
override fun onCreate() {
4645
super.onCreate()
4746
applyTheme()
48-
applyLanguage()
4947
Log.d(TAG, "App initialized")
5048
}
5149

@@ -54,17 +52,4 @@ class App : Application() {
5452
val theme = prefs.getInt(Constants.PREFS_THEME, AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
5553
AppCompatDelegate.setDefaultNightMode(theme)
5654
}
57-
58-
private fun applyLanguage() {
59-
val prefs = PreferenceManager.getDefaultSharedPreferences(this)
60-
val langCode = prefs.getString(Constants.PREFS_LANGUAGE, "system") ?: "system"
61-
62-
val localeList = when (langCode) {
63-
"en" -> LocaleListCompat.forLanguageTags("en")
64-
"id" -> LocaleListCompat.forLanguageTags("id")
65-
else -> LocaleListCompat.getEmptyLocaleList()
66-
}
67-
68-
AppCompatDelegate.setApplicationLocales(localeList)
69-
}
7055
}

app/src/main/java/com/appcontrolx/ui/MainActivity.kt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,23 @@ class MainActivity : AppCompatActivity() {
4747
}
4848

4949
private fun showWhatsNewDialog() {
50-
val whatsNew = """
51-
|• MVVM Architecture + Hilt DI
52-
|• Optimized release build (ProGuard)
53-
|• Beautiful About page with stats
54-
|• Activity Launcher with expandable groups
55-
|• Enhanced batch operations
56-
|• Runtime root/shizuku validation
57-
|• Enhanced security & input validation
58-
|• Dark/Light theme toggle
59-
|• Clean UI improvements
50+
val updateLog = """
51+
|v1.0.0
52+
|• Initial release
53+
|• Freeze/Unfreeze apps
54+
|• Force Stop & Clear Cache/Data
55+
|• Restrict/Allow Background
56+
|• Batch operations with progress
57+
|• Activity Launcher
58+
|• Action Logs with rollback
59+
|• Status filter (Running/Stopped/Frozen/Restricted)
60+
|• Dark/Light theme
61+
|• Multi-language (EN/ID)
6062
""".trimMargin()
6163

6264
MaterialAlertDialogBuilder(this)
63-
.setTitle(getString(R.string.whats_new_title, BuildConfig.VERSION_NAME))
64-
.setMessage(whatsNew)
65+
.setTitle(getString(R.string.welcome_title))
66+
.setMessage(getString(R.string.welcome_message, BuildConfig.VERSION_NAME, updateLog))
6567
.setPositiveButton(android.R.string.ok, null)
6668
.show()
6769
}

app/src/main/java/com/appcontrolx/ui/SettingsFragment.kt

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import android.view.View
77
import android.view.ViewGroup
88
import android.widget.Toast
99
import androidx.appcompat.app.AppCompatDelegate
10-
import androidx.core.os.LocaleListCompat
1110
import androidx.fragment.app.Fragment
1211
import androidx.lifecycle.lifecycleScope
1312
import androidx.preference.PreferenceManager
@@ -90,64 +89,7 @@ class SettingsFragment : Fragment() {
9089
}
9190
}
9291

93-
private fun setupLanguage() {
94-
updateLanguageText()
95-
96-
binding.itemLanguage.setOnClickListener {
97-
val languages = arrayOf(
98-
getString(R.string.language_system),
99-
getString(R.string.language_english),
100-
getString(R.string.language_indonesian)
101-
)
102-
val languageCodes = arrayOf("system", "en", "id")
103-
104-
// Get current from prefs (more reliable)
105-
val savedLang = prefs.getString(Constants.PREFS_LANGUAGE, "system") ?: "system"
106-
val currentIndex = languageCodes.indexOf(savedLang).coerceAtLeast(0)
107-
108-
MaterialAlertDialogBuilder(requireContext())
109-
.setTitle(R.string.settings_language)
110-
.setSingleChoiceItems(languages, currentIndex) { dialog, which ->
111-
val selectedLang = languageCodes[which]
112-
applyLanguage(selectedLang)
113-
dialog.dismiss()
114-
}
115-
.setNegativeButton(android.R.string.cancel, null)
116-
.show()
117-
}
118-
}
119-
120-
private fun updateLanguageText() {
121-
// Check from prefs first (more reliable), then AppCompatDelegate
122-
val savedLang = prefs.getString(Constants.PREFS_LANGUAGE, null)
123-
val currentLocales = AppCompatDelegate.getApplicationLocales()
124-
val langTag = savedLang ?: if (currentLocales.isEmpty) "system" else currentLocales.toLanguageTags()
125-
126-
binding.tvCurrentLanguage.text = when {
127-
langTag.startsWith("en") -> getString(R.string.language_english)
128-
langTag.startsWith("id") -> getString(R.string.language_indonesian)
129-
else -> getString(R.string.language_system)
130-
}
131-
}
132-
133-
private fun applyLanguage(langCode: String) {
134-
// Save to prefs for persistence
135-
prefs.edit().putString(Constants.PREFS_LANGUAGE, langCode).apply()
136-
137-
// Use AppCompatDelegate for proper locale handling (Android 13+ compatible)
138-
val localeList = when (langCode) {
139-
"en" -> LocaleListCompat.forLanguageTags("en")
140-
"id" -> LocaleListCompat.forLanguageTags("id")
141-
else -> LocaleListCompat.getEmptyLocaleList() // System default
142-
}
143-
144-
AppCompatDelegate.setApplicationLocales(localeList)
145-
146-
// For older Android versions, we need to restart the app
147-
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.TIRAMISU) {
148-
restartApp()
149-
}
150-
}
92+
15193

15294
private fun setupCurrentMode() {
15395
updateModeDisplay()

app/src/main/res/layout/fragment_about.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,41 @@
173173
</com.google.android.material.card.MaterialCardView>
174174
</LinearLayout>
175175

176+
<!-- Features Card -->
177+
<com.google.android.material.card.MaterialCardView
178+
android:layout_width="match_parent"
179+
android:layout_height="wrap_content"
180+
android:layout_marginBottom="12dp"
181+
app:cardCornerRadius="12dp"
182+
app:cardElevation="0dp"
183+
app:strokeWidth="1dp"
184+
app:strokeColor="@color/outline">
185+
186+
<LinearLayout
187+
android:layout_width="match_parent"
188+
android:layout_height="wrap_content"
189+
android:orientation="vertical"
190+
android:padding="12dp">
191+
192+
<TextView
193+
android:layout_width="wrap_content"
194+
android:layout_height="wrap_content"
195+
android:text="@string/about_features_title"
196+
android:textSize="13sp"
197+
android:textStyle="bold"
198+
android:textColor="?attr/colorPrimary" />
199+
200+
<TextView
201+
android:layout_width="match_parent"
202+
android:layout_height="wrap_content"
203+
android:layout_marginTop="4dp"
204+
android:text="@string/about_features_short"
205+
android:textSize="12sp"
206+
android:textColor="@color/on_surface_secondary"
207+
android:lineSpacingExtra="2dp" />
208+
</LinearLayout>
209+
</com.google.android.material.card.MaterialCardView>
210+
176211
<!-- Device Info Card with Made with love -->
177212
<com.google.android.material.card.MaterialCardView
178213
android:layout_width="match_parent"

app/src/main/res/layout/fragment_settings.xml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -71,41 +71,6 @@
7171
</LinearLayout>
7272
</LinearLayout>
7373

74-
<View
75-
android:layout_width="match_parent"
76-
android:layout_height="1dp"
77-
android:background="@color/outline"
78-
android:layout_marginVertical="8dp" />
79-
80-
<LinearLayout
81-
android:id="@+id/itemLanguage"
82-
android:layout_width="match_parent"
83-
android:layout_height="wrap_content"
84-
android:orientation="horizontal"
85-
android:gravity="center_vertical"
86-
android:paddingVertical="8dp"
87-
android:background="?attr/selectableItemBackground">
88-
89-
<LinearLayout
90-
android:layout_width="0dp"
91-
android:layout_height="wrap_content"
92-
android:layout_weight="1"
93-
android:orientation="vertical">
94-
95-
<TextView
96-
android:layout_width="wrap_content"
97-
android:layout_height="wrap_content"
98-
android:text="@string/settings_language"
99-
android:textSize="16sp" />
100-
101-
<TextView
102-
android:id="@+id/tvCurrentLanguage"
103-
android:layout_width="wrap_content"
104-
android:layout_height="wrap_content"
105-
android:textColor="@color/on_surface_secondary"
106-
android:textSize="14sp" />
107-
</LinearLayout>
108-
</LinearLayout>
10974
</LinearLayout>
11075
</com.google.android.material.card.MaterialCardView>
11176

app/src/main/res/values-id/strings.xml

Lines changed: 0 additions & 150 deletions
This file was deleted.

0 commit comments

Comments
 (0)