Skip to content

Commit

Permalink
update privacy show rule and upgrade version (#969)
Browse files Browse the repository at this point in the history
* Update build.gradle

* update privacy show rule
  • Loading branch information
zhwanng authored Apr 24, 2023
1 parent a8ab658 commit 2779c82
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/seafile/seadroid2/SettingsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ protected void onPostExecute(List<Avatar> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -143,7 +143,7 @@ public void onClick(View v) {
}
}

public interface OncloseListener {
public interface OnCloseListener {
void onClick(boolean confirm);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/xml/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
</PreferenceCategory>

<PreferenceCategory
android:key="settings_section_about_key"
android:layout="@layout/bg_settings_section_about"
android:title="@string/settings_about_title">
<Preference
Expand Down

0 comments on commit 2779c82

Please sign in to comment.