diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 93512f7..edd8fde 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -8,7 +8,7 @@ - + diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml index a5f05cd..35ffc9d 100644 --- a/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -21,5 +21,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index a4defd1..ce4ca8e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,6 +8,7 @@ + diff --git a/app/build.gradle b/app/build.gradle index 0244167..fb50143 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -30,10 +30,10 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - - implementation 'androidx.appcompat:appcompat:1.4.2' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.preference:preference:1.2.0' + implementation 'com.google.android.material:material:1.7.0' + implementation('com.github.knightwood:material3-preference:1.3'){ + exclude group: "androidx.lifecycle", module: "lifecycle-viewmodel-ktx" + } testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4648bfc..fdf06f4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -10,7 +10,7 @@ android:label="@string/app_name" android:roundIcon="@mipmap/open2share_icon_round" android:supportsRtl="true" - android:theme="@style/AppTheme" + android:theme="@style/Theme.Open2Share.Material3" tools:ignore="GoogleAppIndexingWarning"> { Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); @@ -61,18 +66,19 @@ public boolean onPreferenceClick(Preference preference) { public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.root_preferences, rootKey); guidePreference = findPreference("guide"); - if(guidePreference != null){ + if (guidePreference != null) { guidePreference.setOnPreferenceClickListener(this); } hidePreference = findPreference("hide_icon"); - if(hidePreference != null){ + if (hidePreference != null) { hidePreference.setOnPreferenceChangeListener(this); } + fileUriPreference = findPreference("use_file_uri"); + if (fileUriPreference != null) { + fileUriPreference.setOnPreferenceChangeListener(this); + } aboutPreference = findPreference("about"); aboutPreference.setOnPreferenceClickListener(this); - - - } /** @@ -86,30 +92,44 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { // Log.d("onPreferenceChange", "onPreferenceChange: 被触发"); - if(preference == hidePreference){ + if (preference == hidePreference) { // Toast.makeText(getContext(),"当前值为:"+newValue,Toast.LENGTH_LONG).show(); PackageManager pm = requireContext().getPackageManager(); ComponentName hideComponentName = new ComponentName(requireContext(), "top.linesoft.open2share.hide_icon"); ComponentName unhideComponentName = new ComponentName(getContext(), "top.linesoft.open2share.unhide_icon"); - if((Boolean) newValue){ + if ((Boolean) newValue) { - AlertDialog.Builder mDialogBuilder = new AlertDialog.Builder(getContext()); + MaterialAlertDialogBuilder mDialogBuilder = new MaterialAlertDialogBuilder(requireActivity()); mDialogBuilder.setTitle(R.string.warn) .setMessage(R.string.hide_tips) .setPositiveButton(R.string.yes, (dialog, which) -> { - pm.setComponentEnabledSetting(hideComponentName,PackageManager.COMPONENT_ENABLED_STATE_ENABLED,PackageManager.DONT_KILL_APP); - pm.setComponentEnabledSetting(unhideComponentName,PackageManager.COMPONENT_ENABLED_STATE_DISABLED,PackageManager.DONT_KILL_APP); + pm.setComponentEnabledSetting(hideComponentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); + pm.setComponentEnabledSetting(unhideComponentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); SettingsFragment.this.hidePreference.setChecked(true); - }).setNegativeButton(R.string.no,null).create().show(); + }).setNegativeButton(R.string.no, null).create().show(); return false; - }else{ - pm.setComponentEnabledSetting(hideComponentName,PackageManager.COMPONENT_ENABLED_STATE_DISABLED,PackageManager.DONT_KILL_APP); - pm.setComponentEnabledSetting(unhideComponentName,PackageManager.COMPONENT_ENABLED_STATE_ENABLED,PackageManager.DONT_KILL_APP); + } else { + pm.setComponentEnabledSetting(hideComponentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); + pm.setComponentEnabledSetting(unhideComponentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); return true; } + } else if (preference == fileUriPreference) { + if ((Boolean) newValue) { + MaterialAlertDialogBuilder mDialogBuilder = new MaterialAlertDialogBuilder(requireActivity()); + mDialogBuilder.setTitle(R.string.warn) + .setMessage(R.string.open_file_uri_msg) + .setPositiveButton(R.string.yes, (dialog, which) -> { + SettingsFragment.this.fileUriPreference.setChecked(true); + }).setNegativeButton(R.string.no, (dialog, which) -> { + SettingsFragment.this.fileUriPreference.setChecked(false); + }).create().show(); + return false; + } else { + return true; + } } return false; } diff --git a/app/src/main/res/drawable/ic_baseline_healing_24.xml b/app/src/main/res/drawable/ic_baseline_healing_24.xml new file mode 100644 index 0000000..40cf2e6 --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_healing_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..ec071f0 --- /dev/null +++ b/app/src/main/res/values-night/themes.xml @@ -0,0 +1,48 @@ + + + + + + diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 5a72ba7..616fa67 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -17,4 +17,7 @@ 作者:双霖 (LineSoft) 确定 网站 + 兼容fileUri类型 + android7以上,因为安全问题不提倡使用fileUri,因此,打开此选项将同意带来的安全风险 + 未允许打开fileUri兼容 \ No newline at end of file diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 420ef7c..95ab9e7 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -17,4 +17,7 @@ 作者:雙霖 (LineSoft) 確定 網站 + 相容fileUri類型 + android7以上,因為安全問題不提倡使用fileUri,因此,打開此選項將同意帶來的安全風險 + 未允許打開fileUri相容 \ No newline at end of file diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 85498f9..97970a4 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -17,4 +17,7 @@ 作者:雙霖 (LineSoft) 確定 網站 + 相容fileUri類型 + android7以上,因為安全問題不提倡使用fileUri,因此,打開此選項將同意帶來的安全風險 + 未允許打開fileUri相容 \ No newline at end of file diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 5a72ba7..616fa67 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -17,4 +17,7 @@ 作者:双霖 (LineSoft) 确定 网站 + 兼容fileUri类型 + android7以上,因为安全问题不提倡使用fileUri,因此,打开此选项将同意带来的安全风险 + 未允许打开fileUri兼容 \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 17917bb..6a110d9 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -3,4 +3,75 @@ #2962ff #0039cb #2962ff + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + + #00231B + #44655B + #FFFFFF + #C6EADD + #002019 + #58605D + #FFFFFF + #DDE4E0 + #161D1B + #566067 + #FFFFFF + #DAE4EC + #131D23 + #BA1A1A + #FFFFFF + #FFDAD6 + #410002 + #FEFCFA + #1B1C1B + #FEFCFA + #1B1C1B + #E1E3E0 + #454746 + #757876 + #000000 + #303030 + #F2F0EF + #AACEC1 + #44655B + #44655B + #AACEC1 + #15362D + #2C4D43 + #C6EADD + #C1C8C4 + #2B322F + #414845 + #DDE4E0 + #BEC8D0 + #283238 + #3F484F + #DAE4EC + #FFB4AB + #690005 + #93000A + #FFB4AB + #1B1C1B + #E4E2E1 + #1B1C1B + #E4E2E1 + #454746 + #C5C7C5 + #8F918F + #000000 + #E4E2E1 + #303030 + #44655B + #AACEC1 + #AACEC1 + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 26ca6c8..3212a27 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -16,4 +16,7 @@ Author: 双霖 (LineSoft) OK Website + compatible fileUri types + Android 7 and above, because security issues do not discourage the use of fileUri, therefore, turning on this option will consent to the security risk it brings + FileUri is not turned on diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..e93c822 --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,47 @@ + + + + + + diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml index b6d6bae..b5156a8 100644 --- a/app/src/main/res/xml/root_preferences.xml +++ b/app/src/main/res/xml/root_preferences.xml @@ -1,5 +1,5 @@ - + - + - + + - +