From abcf3600a65fb86a5929e8de190f5e1d1a27e6e1 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Wed, 26 Jul 2017 20:18:12 +0200 Subject: [PATCH] Add 'Blocked users' to advanced settings as it is no preferred way to block users from here or to unblock some. The preferred way is to use the 'Block user' option in the profile of the user to block. --- .../java/com/b44t/ui/SettingsActivity.java | 19 +++---------------- .../java/com/b44t/ui/SettingsAdvActivity.java | 9 +++++++++ 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/MessengerProj/src/main/java/com/b44t/ui/SettingsActivity.java b/MessengerProj/src/main/java/com/b44t/ui/SettingsActivity.java index 99faea903..8133e8451 100644 --- a/MessengerProj/src/main/java/com/b44t/ui/SettingsActivity.java +++ b/MessengerProj/src/main/java/com/b44t/ui/SettingsActivity.java @@ -26,12 +26,8 @@ package com.b44t.ui; -import android.app.Activity; -import android.app.AlertDialog; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; -import android.content.SharedPreferences; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; @@ -53,7 +49,6 @@ import com.b44t.ui.Cells.TextCheckCell; import com.b44t.ui.Cells.TextDetailSettingsCell; import com.b44t.ui.Cells.TextSettingsCell; import com.b44t.ui.Components.LayoutHelper; -import com.b44t.ui.Components.NumberPicker; public class SettingsActivity extends BaseFragment { @@ -61,7 +56,7 @@ public class SettingsActivity extends BaseFragment { // the list private int profileRow, nameAndStatusRow; private int notificationRow, backgroundRow, advRow, settingsShadowRow; - private int readReceiptsRow, blockedRow, passcodeRow; + private int readReceiptsRow, passcodeRow; private int aboutHeaderRow, aboutRow, inviteRow, helpRow, aboutShadowRow; private int rowCount; @@ -89,7 +84,6 @@ public class SettingsActivity extends BaseFragment { notificationRow = rowCount++; backgroundRow = rowCount++; passcodeRow = rowCount++; - blockedRow = rowCount++; readReceiptsRow = rowCount++; advRow = rowCount++; settingsShadowRow = rowCount++; @@ -141,9 +135,6 @@ public class SettingsActivity extends BaseFragment { if (i == nameAndStatusRow) { presentFragment(new SettingsNameActivity()); } - else if (i == blockedRow) { - presentFragment(new BlockedUsersActivity()); - } else if (i == passcodeRow) { if (UserConfig.passcodeHash.length() > 0) { presentFragment(new PasscodeActivity(PasscodeActivity.SCREEN2_ENTER_CODE2)); @@ -213,7 +204,7 @@ public class SettingsActivity extends BaseFragment { @Override public boolean isEnabled(int i) { return i == nameAndStatusRow || - i == blockedRow || i==passcodeRow || i==readReceiptsRow || i == notificationRow || i == backgroundRow || i == advRow || + i==passcodeRow || i==readReceiptsRow || i == notificationRow || i == backgroundRow || i == advRow || i == aboutRow || i == inviteRow || i == helpRow; } @@ -258,11 +249,7 @@ public class SettingsActivity extends BaseFragment { view.setBackgroundColor(0xffffffff); } TextSettingsCell textCell = (TextSettingsCell) view; - if (i == blockedRow) { - String cntStr = String.format("%d", MrMailbox.getBlockedCount()); - textCell.setTextAndValue(ApplicationLoader.applicationContext.getString(R.string.BlockedContacts), cntStr, true); - } - else if (i == passcodeRow) { + if (i == passcodeRow) { String val = UserConfig.passcodeHash.length() > 0? mContext.getString(R.string.Enabled) : mContext.getString(R.string.Disabled); textCell.setTextAndValue(mContext.getString(R.string.Passcode), val, true); } diff --git a/MessengerProj/src/main/java/com/b44t/ui/SettingsAdvActivity.java b/MessengerProj/src/main/java/com/b44t/ui/SettingsAdvActivity.java index fa30b803b..0fa75dc9f 100644 --- a/MessengerProj/src/main/java/com/b44t/ui/SettingsAdvActivity.java +++ b/MessengerProj/src/main/java/com/b44t/ui/SettingsAdvActivity.java @@ -62,6 +62,7 @@ public class SettingsAdvActivity extends BaseFragment implements NotificationCen // the list private int directShareRow, cacheRow, raiseToSpeakRow, sendByEnterRow, autoplayGifsRow, textSizeRow, showUnknownSendersRow, finalShadowRow; + private int blockedRow; private int accountSettingsRow; private int e2eEncryptionRow; private int manageKeysRow; @@ -102,6 +103,7 @@ public class SettingsAdvActivity extends BaseFragment implements NotificationCen sendByEnterRow = rowCount++; raiseToSpeakRow = rowCount++; // outgoing message cacheRow = -1;// for now, the - non-functional - page is reachable by the "storage settings" in the "android App Settings" only + blockedRow = rowCount++; e2eEncryptionRow = rowCount++; manageKeysRow = rowCount++; backupRow = -1; //rowCount++; -- disabled for now @@ -177,6 +179,9 @@ public class SettingsAdvActivity extends BaseFragment implements NotificationCen } else if (i == cacheRow) { presentFragment(new CacheControlActivity()); } + else if (i == blockedRow) { + presentFragment(new BlockedUsersActivity()); + } else if( i==showUnknownSendersRow) { int oldval = MrMailbox.getConfigInt("show_deaddrop", 0); if( oldval == 1 ) { @@ -444,6 +449,10 @@ public class SettingsAdvActivity extends BaseFragment implements NotificationCen if (i == cacheRow) { textCell.setText(mContext.getString(R.string.CacheSettings), true); } + else if (i == blockedRow) { + String cntStr = String.format("%d", MrMailbox.getBlockedCount()); + textCell.setTextAndValue(ApplicationLoader.applicationContext.getString(R.string.BlockedContacts), cntStr, true); + } else if( i==manageKeysRow ) { textCell.setText(mContext.getString(R.string.E2EManagePrivateKeys), true); }