Add config override and per-app proxy feature
This commit is contained in:
90
app/src/main/res/layout/activity_config_override.xml
Normal file
90
app/src/main/res/layout/activity_config_override.xml
Normal file
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/perAppProxyCard"
|
||||
style="?attr/materialCardViewElevatedStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/switchPerAppProxy"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title_per_app_proxy"
|
||||
android:textAppearance="?attr/textAppearanceTitleLarge" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/per_app_proxy_description" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/perAppProxyUpdateOnChange"
|
||||
style="@style/Widget.Material3.TextInputLayout.FilledBox.ExposedDropdownMenu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:hint="@string/per_app_proxy_update_on_change">
|
||||
|
||||
<AutoCompleteTextView
|
||||
app:simpleItems="@array/per_app_proxy_update_on_change_value"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="none"
|
||||
android:text="@string/disabled" />
|
||||
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center_vertical|end"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/configureAppListButton"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/config_override_configure" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
55
app/src/main/res/layout/activity_per_app_proxy.xml
Normal file
55
app/src/main/res/layout/activity_per_app_proxy.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radio_group_per_app_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="16dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio_per_app_exclude"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/per_app_proxy_mode_exclude" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio_per_app_include"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/per_app_proxy_mode_include" />
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view_app_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:scrollbars="vertical"
|
||||
android:visibility="gone"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
19
app/src/main/res/layout/dialog_progress.xml
Normal file
19
app/src/main/res/layout/dialog_progress.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_message"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
@@ -232,6 +232,55 @@
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/configOverrideCard"
|
||||
style="?attr/materialCardViewElevatedStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title_config_override"
|
||||
android:textAppearance="?attr/textAppearanceTitleLarge">
|
||||
|
||||
</TextView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/config_override_description" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|end"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/configureOverridesButton"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/config_override_configure" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/aboutCard"
|
||||
style="?attr/materialCardViewElevatedStyle"
|
||||
|
||||
46
app/src/main/res/layout/view_app_list_item.xml
Normal file
46
app/src/main/res/layout/view_app_list_item.xml
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_app_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:contentDescription="@string/content_description_app_icon" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_app_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_app_package_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkbox_app_selected"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="false"
|
||||
android:focusable="false" />
|
||||
|
||||
</LinearLayout>
|
||||
20
app/src/main/res/menu/per_app_menu.xml
Normal file
20
app/src/main/res/menu/per_app_menu.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_hide_system"
|
||||
android:title="@string/menu_hide_system" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_scan_china_apps"
|
||||
android:title="@string/menu_scan_china_apps" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_import"
|
||||
android:title="@string/menu_import_from_clipboard" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_export"
|
||||
android:title="@string/menu_export_to_clipboard" />
|
||||
|
||||
</menu>
|
||||
4
app/src/main/res/values-night/colors.xml
Normal file
4
app/src/main/res/values-night/colors.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="divider">#565656</color>
|
||||
</resources>
|
||||
@@ -12,4 +12,9 @@
|
||||
<item>@string/enabled</item>
|
||||
<item>@string/disabled</item>
|
||||
</array>
|
||||
<array name="per_app_proxy_update_on_change_value">
|
||||
<item>@string/disabled</item>
|
||||
<item>@string/action_select</item>
|
||||
<item>@string/action_deselect</item>
|
||||
</array>
|
||||
</resources>
|
||||
@@ -12,4 +12,5 @@
|
||||
<color name="log_blue_light">#00a6b2</color>
|
||||
<color name="log_white">#ececec</color>
|
||||
|
||||
<color name="divider">#cfcfcf</color>
|
||||
</resources>
|
||||
|
||||
@@ -94,4 +94,30 @@
|
||||
<string name="import_remote_profile">Import remote profile</string>
|
||||
<string name="import_remote_profile_message">Are you sure to import remote configuration %s? You will connect to %s to download the configuration.</string>
|
||||
|
||||
<string name="title_config_override">Config Override</string>
|
||||
<string name="config_override_description">Override configuration contents.</string>
|
||||
<string name="config_override_configure">Configure</string>
|
||||
<string name="title_per_app_proxy">Per-app Proxy</string>
|
||||
<string name="per_app_proxy_description">Override include_package and exclude_package in the configuration.</string>
|
||||
<string name="per_app_proxy_mode_exclude">Do not proxy selected apps</string>
|
||||
<string name="per_app_proxy_mode_include">Proxy only selected apps</string>
|
||||
<string name="content_description_app_icon">App icon</string>
|
||||
<string name="menu_hide_system">Hide system apps</string>
|
||||
<string name="menu_show_system">Show system apps</string>
|
||||
<string name="menu_scan_china_apps">Scan China apps</string>
|
||||
<string name="menu_import_from_clipboard">Import from clipboard</string>
|
||||
<string name="menu_export_to_clipboard">Export to clipboard</string>
|
||||
<string name="toast_clipboard_empty">Clipboard is empty</string>
|
||||
<string name="toast_app_list_empty">App list is empty</string>
|
||||
<string name="toast_copied_to_clipboard">Copied to clipboard</string>
|
||||
<string name="toast_imported_from_clipboard">Imported from clipboard</string>
|
||||
<string name="message_import_from_clipboard">Importing app list from clipboard will overwrite your current list. Are you sure to continue?</string>
|
||||
<string name="message_scanning">Scanning… Please wait</string>
|
||||
<string name="message_scan_app_error">Error scanning apps</string>
|
||||
<string name="message_scan_app_no_apps_found">No matching apps found</string>
|
||||
<string name="message_scan_app_found">Found the following apps, please choose the action you want.</string>
|
||||
<string name="title_scan_result">Scan Result</string>
|
||||
<string name="action_select">Select</string>
|
||||
<string name="action_deselect">Deselect</string>
|
||||
<string name="per_app_proxy_update_on_change">Update on App Installed/Updated</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user