Skip to content

Commit a680f2c

Browse files
committed
feat: add Unknown Sources & Manage Apps tools, enhance activity launcher display, remove AOSP info button
1 parent 6d28343 commit a680f2c

File tree

7 files changed

+114
-52
lines changed

7 files changed

+114
-52
lines changed

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

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ class AppDetailBottomSheet : BottomSheetDialogFragment() {
276276

277277
binding.btnLaunchApp.setOnClickListener { launchApp() }
278278
binding.btnOpenSettings.setOnClickListener { openAppSettings() }
279-
binding.btnAospInfo.setOnClickListener { openAospAppInfo() }
280279
}
281280

282281
private fun launchApp() {
@@ -414,7 +413,6 @@ class AppDetailBottomSheet : BottomSheetDialogFragment() {
414413
binding.btnUninstall.isEnabled = enabled
415414
binding.btnLaunchApp.isEnabled = enabled
416415
binding.btnOpenSettings.isEnabled = enabled
417-
binding.btnAospInfo.isEnabled = enabled
418416
}
419417

420418
private fun setButtonEnabled(button: MaterialButton, enabled: Boolean) {
@@ -433,28 +431,7 @@ class AppDetailBottomSheet : BottomSheetDialogFragment() {
433431
}
434432
}
435433

436-
private fun openAospAppInfo() {
437-
val packageName = appInfo?.packageName ?: return
438-
try {
439-
// Use explicit AOSP Settings intent that won't be overridden by custom ROMs
440-
val intent = Intent().apply {
441-
setClassName("com.android.settings", "com.android.settings.applications.InstalledAppDetails")
442-
putExtra("package", packageName)
443-
putExtra("com.android.settings.ApplicationPkgName", packageName)
444-
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
445-
}
446-
startActivity(intent)
447-
} catch (e: Exception) {
448-
// Fallback to standard settings
449-
try {
450-
startActivity(Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
451-
data = Uri.parse("package:$packageName")
452-
})
453-
} catch (e2: Exception) {
454-
Toast.makeText(context, R.string.error_open_settings, Toast.LENGTH_SHORT).show()
455-
}
456-
}
457-
}
434+
458435

459436
private fun formatFileSize(size: Long): String = when {
460437
size >= 1024 * 1024 * 1024 -> String.format("%.2f GB", size / (1024.0 * 1024 * 1024))

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,24 @@ class ToolsFragment : Fragment() {
108108
)
109109
tryOpenSettings(intents)
110110
}
111+
112+
// Unknown Sources / Install from unknown apps
113+
binding.itemUnknownSources.setOnClickListener {
114+
val intents = listOf(
115+
"com.android.settings" to "com.android.settings.Settings\$ManageExternalSourcesActivity",
116+
"com.android.settings" to "com.android.settings.applications.manageapplications.ManageExternalSourcesActivity"
117+
)
118+
tryOpenSettings(intents)
119+
}
120+
121+
// Manage Apps (AOSP)
122+
binding.itemManageApps.setOnClickListener {
123+
val intents = listOf(
124+
"com.android.settings" to "com.android.settings.Settings\$ManageApplicationsActivity",
125+
"com.android.settings" to "com.android.settings.applications.ManageApplications"
126+
)
127+
tryOpenSettings(intents)
128+
}
111129
}
112130

113131
private fun tryOpenSettings(intents: List<Pair<String, String>>) {

app/src/main/java/com/appcontrolx/ui/adapter/AppActivityAdapter.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,13 @@ class ActivitySimpleAdapter(
9999
) : RecyclerView.ViewHolder(binding.root) {
100100

101101
fun bind(item: ActivityItem) {
102+
// Show activity short name (e.g., "ManageExternalSourcesActivity")
102103
binding.tvActivityName.text = item.shortName
104+
105+
// Show full path (e.g., "com.android.settings$ManageExternalSourcesActivity")
106+
val fullPath = "${item.packageName}\$${item.shortName}"
107+
binding.tvFullPath.text = fullPath
108+
103109
binding.tvExported.visibility = if (item.isExported) View.VISIBLE else View.GONE
104110

105111
binding.root.setOnClickListener {

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -389,18 +389,7 @@
389389
app:iconPadding="2dp"
390390
style="@style/Widget.Material3.Button.TonalButton" />
391391

392-
<com.google.android.material.button.MaterialButton
393-
android:id="@+id/btnAospInfo"
394-
android:layout_width="0dp"
395-
android:layout_height="wrap_content"
396-
android:layout_columnWeight="1"
397-
android:text="@string/action_aosp_info"
398-
android:textSize="10sp"
399-
app:icon="@drawable/ic_settings"
400-
app:iconSize="20dp"
401-
app:iconGravity="top"
402-
app:iconPadding="2dp"
403-
style="@style/Widget.Material3.Button.TonalButton" />
392+
404393

405394
</GridLayout>
406395
</LinearLayout>

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,57 @@
196196
</LinearLayout>
197197
</com.google.android.material.card.MaterialCardView>
198198

199+
<!-- Apps Section -->
200+
<TextView
201+
android:layout_width="wrap_content"
202+
android:layout_height="wrap_content"
203+
android:text="@string/tools_section_apps"
204+
android:textColor="?attr/colorPrimary"
205+
android:textStyle="bold"
206+
android:layout_marginBottom="8dp" />
207+
208+
<com.google.android.material.card.MaterialCardView
209+
android:layout_width="match_parent"
210+
android:layout_height="wrap_content"
211+
android:layout_marginBottom="16dp"
212+
app:cardElevation="0dp"
213+
app:strokeWidth="1dp"
214+
app:strokeColor="@color/outline">
215+
216+
<LinearLayout
217+
android:layout_width="match_parent"
218+
android:layout_height="wrap_content"
219+
android:orientation="vertical"
220+
android:padding="4dp">
221+
222+
<LinearLayout
223+
android:id="@+id/itemUnknownSources"
224+
android:layout_width="match_parent"
225+
android:layout_height="wrap_content"
226+
android:padding="12dp"
227+
android:background="?attr/selectableItemBackground">
228+
<TextView
229+
android:layout_width="wrap_content"
230+
android:layout_height="wrap_content"
231+
android:text="@string/tools_unknown_sources"
232+
android:textSize="15sp" />
233+
</LinearLayout>
234+
235+
<LinearLayout
236+
android:id="@+id/itemManageApps"
237+
android:layout_width="match_parent"
238+
android:layout_height="wrap_content"
239+
android:padding="12dp"
240+
android:background="?attr/selectableItemBackground">
241+
<TextView
242+
android:layout_width="wrap_content"
243+
android:layout_height="wrap_content"
244+
android:text="@string/tools_manage_apps"
245+
android:textSize="15sp" />
246+
</LinearLayout>
247+
</LinearLayout>
248+
</com.google.android.material.card.MaterialCardView>
249+
199250
<!-- Developer Section -->
200251
<TextView
201252
android:layout_width="wrap_content"

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

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,47 @@
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
44
android:layout_height="wrap_content"
5-
android:orientation="horizontal"
6-
android:gravity="center_vertical"
5+
android:orientation="vertical"
76
android:paddingHorizontal="16dp"
87
android:paddingVertical="10dp"
98
android:background="?attr/selectableItemBackground">
109

11-
<TextView
12-
android:id="@+id/tvActivityName"
13-
android:layout_width="0dp"
10+
<LinearLayout
11+
android:layout_width="match_parent"
1412
android:layout_height="wrap_content"
15-
android:layout_weight="1"
16-
android:textSize="13sp"
17-
android:ellipsize="end"
18-
android:maxLines="1" />
13+
android:orientation="horizontal"
14+
android:gravity="center_vertical">
15+
16+
<TextView
17+
android:id="@+id/tvActivityName"
18+
android:layout_width="0dp"
19+
android:layout_height="wrap_content"
20+
android:layout_weight="1"
21+
android:textSize="14sp"
22+
android:textStyle="bold"
23+
android:ellipsize="end"
24+
android:maxLines="1" />
25+
26+
<TextView
27+
android:id="@+id/tvExported"
28+
android:layout_width="wrap_content"
29+
android:layout_height="wrap_content"
30+
android:text="@string/badge_exported"
31+
android:textSize="10sp"
32+
android:textColor="@color/status_positive"
33+
android:textStyle="bold"
34+
android:visibility="gone" />
35+
</LinearLayout>
1936

2037
<TextView
21-
android:id="@+id/tvExported"
22-
android:layout_width="wrap_content"
38+
android:id="@+id/tvFullPath"
39+
android:layout_width="match_parent"
2340
android:layout_height="wrap_content"
24-
android:text="@string/badge_exported"
25-
android:textSize="10sp"
26-
android:textColor="@color/status_positive"
27-
android:textStyle="bold"
28-
android:visibility="gone" />
41+
android:textSize="11sp"
42+
android:textColor="@color/on_surface_secondary"
43+
android:fontFamily="monospace"
44+
android:ellipsize="middle"
45+
android:maxLines="1"
46+
android:layout_marginTop="2dp" />
2947

3048
</LinearLayout>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@
260260
<string name="tools_section_battery">Battery</string>
261261
<string name="tools_section_developer">Device</string>
262262
<string name="tools_section_advanced">Advanced</string>
263+
<string name="tools_section_apps">Apps</string>
264+
<string name="tools_unknown_sources">Manage Unknown Sources</string>
265+
<string name="tools_manage_apps">Manage Apps (AOSP)</string>
263266
<string name="tools_extra_dim">Extra Dim</string>
264267
<string name="tools_extra_dim_desc">Reduce screen brightness below minimum</string>
265268
<string name="tools_notification_log">Notification Log</string>

0 commit comments

Comments
 (0)