diff --git a/app/build.gradle b/app/build.gradle index 2161c1b88..d5352b311 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId 'com.seafile.seadroid2' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 128 - versionName "2.3.1" + versionCode 129 + versionName "2.3.2" multiDexEnabled true resValue "string", "authorities", applicationId + '.cameraupload.provider' resValue "string", "account_type", "com.seafile.seadroid2.account.api2" diff --git a/app/src/main/java/com/seafile/seadroid2/SettingsManager.java b/app/src/main/java/com/seafile/seadroid2/SettingsManager.java index 9b6e3a494..1a07a8a8b 100644 --- a/app/src/main/java/com/seafile/seadroid2/SettingsManager.java +++ b/app/src/main/java/com/seafile/seadroid2/SettingsManager.java @@ -79,6 +79,9 @@ private SettingsManager() { //contacts public static final String CONTACTS_UPLOAD_CATEGORY_KEY = "category_contacts_upload_key"; public static final String CONTACTS_UPLOAD_SWITCH_KEY = "contacts_upload_switch_key"; + + //ABOUT + public static final String SETTINGS_ABOUT_CATEGORY_KEY = "settings_section_about_key"; public static final String SETTINGS_ABOUT_VERSION_KEY = "settings_about_version_key"; public static final String SETTINGS_ABOUT_AUTHOR_KEY = "settings_about_author_key"; public static final String SETTINGS_PRIVACY_POLICY_KEY = "settings_privacy_policy_key"; diff --git a/app/src/main/java/com/seafile/seadroid2/ui/activity/AccountsActivity.java b/app/src/main/java/com/seafile/seadroid2/ui/activity/AccountsActivity.java index 95f580e0a..1d8927f9d 100644 --- a/app/src/main/java/com/seafile/seadroid2/ui/activity/AccountsActivity.java +++ b/app/src/main/java/com/seafile/seadroid2/ui/activity/AccountsActivity.java @@ -423,7 +423,7 @@ protected void onPostExecute(List avatars) { private void showDialog() { PolicyDialog mDialog = new PolicyDialog(AccountsActivity.this, R.style.PolicyDialog, - new PolicyDialog.OncloseListener() { + new PolicyDialog.OnCloseListener() { @Override public void onClick(boolean confirm) { if (confirm) { diff --git a/app/src/main/java/com/seafile/seadroid2/ui/dialog/PolicyDialog.java b/app/src/main/java/com/seafile/seadroid2/ui/dialog/PolicyDialog.java index 2eddeb3cf..a39c61edf 100644 --- a/app/src/main/java/com/seafile/seadroid2/ui/dialog/PolicyDialog.java +++ b/app/src/main/java/com/seafile/seadroid2/ui/dialog/PolicyDialog.java @@ -25,7 +25,7 @@ public class PolicyDialog extends Dialog implements View.OnClickListener { private Context mContext; private String content; - private OncloseListener listener; + private OnCloseListener listener; private String positiveName; private String negativeName; private String title; @@ -43,13 +43,13 @@ public PolicyDialog(@NonNull Context context, int themeResId, String content) { this.content = content; } - public PolicyDialog(@NonNull Context context, int themeResId, OncloseListener listener) { + public PolicyDialog(@NonNull Context context, int themeResId, OnCloseListener listener) { super(context, themeResId); this.mContext = context; this.listener = listener; } - public PolicyDialog(@NonNull Context context, int themeResId, String content, OncloseListener listener) { + public PolicyDialog(@NonNull Context context, int themeResId, String content, OnCloseListener listener) { super(context, themeResId); this.mContext = context; this.content = content; @@ -143,7 +143,7 @@ public void onClick(View v) { } } - public interface OncloseListener { + public interface OnCloseListener { void onClick(boolean confirm); } } diff --git a/app/src/main/java/com/seafile/seadroid2/ui/fragment/SettingsFragment.java b/app/src/main/java/com/seafile/seadroid2/ui/fragment/SettingsFragment.java index b42f6ec7d..649359d96 100644 --- a/app/src/main/java/com/seafile/seadroid2/ui/fragment/SettingsFragment.java +++ b/app/src/main/java/com/seafile/seadroid2/ui/fragment/SettingsFragment.java @@ -69,6 +69,7 @@ import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; +import java.util.Locale; import java.util.Map; public class SettingsFragment extends CustomPreferenceFragment { @@ -543,15 +544,21 @@ public boolean onPreferenceClick(Preference preference) { } }); - findPreference(SettingsManager.SETTINGS_PRIVACY_POLICY_KEY).setOnPreferenceClickListener(new OnPreferenceClickListener() { - @Override - public boolean onPreferenceClick(Preference preference) { - - Intent intent = new Intent(mActivity, PrivacyPolicyActivity.class); - mActivity.startActivity(intent); - return true; - } - }); + PreferenceCategory cAboutCategory = (PreferenceCategory) findPreference(SettingsManager.SETTINGS_ABOUT_CATEGORY_KEY); + String country = Locale.getDefault().getCountry(); + String language = Locale.getDefault().getLanguage(); + if (TextUtils.equals("CN", country) || TextUtils.equals("zh", language)) { + findPreference(SettingsManager.SETTINGS_PRIVACY_POLICY_KEY).setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + Intent intent = new Intent(mActivity, PrivacyPolicyActivity.class); + mActivity.startActivity(intent); + return true; + } + }); + } else { + cAboutCategory.removePreference(findPreference(SettingsManager.SETTINGS_PRIVACY_POLICY_KEY)); + } // Cache size calculateCacheSize(); diff --git a/app/src/main/res/xml/settings.xml b/app/src/main/res/xml/settings.xml index c514278a1..c49f905a0 100644 --- a/app/src/main/res/xml/settings.xml +++ b/app/src/main/res/xml/settings.xml @@ -176,6 +176,7 @@