mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Add vertical scrollbar, where appropriate, and use system 'glow' color.
This commit is contained in:
@@ -482,28 +482,6 @@ public class AndroidUtilities {
|
||||
return src;
|
||||
}
|
||||
|
||||
public static void setListViewEdgeEffectColor(AbsListView listView, int color) {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
try {
|
||||
Field field = AbsListView.class.getDeclaredField("mEdgeGlowTop");
|
||||
field.setAccessible(true);
|
||||
EdgeEffect mEdgeGlowTop = (EdgeEffect) field.get(listView);
|
||||
if (mEdgeGlowTop != null) {
|
||||
mEdgeGlowTop.setColor(color);
|
||||
}
|
||||
|
||||
field = AbsListView.class.getDeclaredField("mEdgeGlowBottom");
|
||||
field.setAccessible(true);
|
||||
EdgeEffect mEdgeGlowBottom = (EdgeEffect) field.get(listView);
|
||||
if (mEdgeGlowBottom != null) {
|
||||
mEdgeGlowBottom.setColor(color);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e("messenger", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public static void clearDrawableAnimation(View view) {
|
||||
if (Build.VERSION.SDK_INT < 21 || view == null) {
|
||||
|
||||
@@ -118,7 +118,6 @@ public class AudioSelectActivity extends BaseFragment implements NotificationCen
|
||||
|
||||
ListView listView = new ListView(context);
|
||||
listView.setEmptyView(progressView);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setAdapter(listViewAdapter = new ListAdapter(context));
|
||||
|
||||
@@ -118,7 +118,6 @@ public class BlockedUsersActivity extends BaseFragment implements NotificationCe
|
||||
|
||||
listView = new ListView(context);
|
||||
listView.setEmptyView(emptyTextView);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setAdapter(listViewAdapter = new ListAdapter(context));
|
||||
|
||||
@@ -96,7 +96,6 @@ public class CacheControlActivity extends BaseFragment {
|
||||
ListView listView = new ListView(context);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
listView.setDrawSelectorOnTop(true);
|
||||
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||
listView.setAdapter(listAdapter);
|
||||
|
||||
@@ -592,7 +592,6 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
||||
|
||||
EmojiGridAdapter emojiGridAdapter = new EmojiGridAdapter(i - 1);
|
||||
gridView.setAdapter(emojiGridAdapter);
|
||||
AndroidUtilities.setListViewEdgeEffectColor(gridView, 0xfff5f6f7);
|
||||
adapters.add(emojiGridAdapter);
|
||||
}
|
||||
|
||||
@@ -648,7 +647,6 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
||||
}
|
||||
};
|
||||
stickersGridView.setOnItemClickListener(stickersOnItemClickListener);
|
||||
AndroidUtilities.setListViewEdgeEffectColor(stickersGridView, 0xfff5f6f7);
|
||||
|
||||
stickersWrap = new FrameLayout(context);
|
||||
stickersWrap.addView(stickersGridView);
|
||||
|
||||
@@ -274,7 +274,6 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
listView = new ListView(context);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
listView.setAdapter(listAdapter = new ListAdapter(context));
|
||||
linearLayout.addView(listView);
|
||||
layoutParams = (LinearLayout.LayoutParams) listView.getLayoutParams();
|
||||
|
||||
@@ -176,7 +176,7 @@ public class LanguageSelectActivity extends BaseFragment {
|
||||
|
||||
listView = new ListView(context);
|
||||
listView.setEmptyView(emptyTextLayout);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
listView.setDrawSelectorOnTop(true);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setAdapter(listAdapter);
|
||||
|
||||
@@ -348,7 +348,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||
if ( MrMailbox.isConfigured()==0 ) {
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("fromIntro", true);
|
||||
actionBarLayout.addFragmentToStack(new AccountSettingsActivity(args));
|
||||
actionBarLayout.addFragmentToStack(new SettingsAccountActivity(args));
|
||||
drawerLayoutContainer.setAllowOpenDrawer(false, false);
|
||||
} else {
|
||||
actionBarLayout.addFragmentToStack(new DialogsActivity(null));
|
||||
|
||||
@@ -312,7 +312,6 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
listView = new ListView(context);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
listView.setDrawSelectorOnTop(true);
|
||||
frameLayout.addView(listView);
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
|
||||
|
||||
@@ -221,7 +221,6 @@ public class PhotoAlbumPickerActivity extends BaseFragment implements Notificati
|
||||
layoutParams.bottomMargin = AndroidUtilities.dp(48);
|
||||
listView.setLayoutParams(layoutParams);
|
||||
listView.setAdapter(listAdapter = new ListAdapter(context));
|
||||
AndroidUtilities.setListViewEdgeEffectColor(listView, Theme.ACTION_BAR_COLOR);
|
||||
|
||||
emptyView = new TextView(context);
|
||||
emptyView.setTextColor(0xff808080);
|
||||
|
||||
@@ -142,7 +142,6 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen
|
||||
layoutParams.bottomMargin = singlePhoto ? 0 : AndroidUtilities.dp(48);
|
||||
listView.setLayoutParams(layoutParams);
|
||||
listView.setAdapter(listAdapter = new ListAdapter(context));
|
||||
AndroidUtilities.setListViewEdgeEffectColor(listView, Theme.ACTION_BAR_COLOR);
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
|
||||
@@ -355,7 +355,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
listView.setTag(6);
|
||||
listView.setPadding(0, AndroidUtilities.dp(88), 0, 0);
|
||||
listView.setBackgroundColor(0xffffffff);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
listView.setItemAnimator(null);
|
||||
listView.setLayoutAnimation(null);
|
||||
listView.setClipToPadding(false);
|
||||
|
||||
@@ -141,8 +141,6 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
listView = new ListView(context);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
AndroidUtilities.setListViewEdgeEffectColor(listView, Theme.ACTION_BAR_COLOR);
|
||||
frameLayout.addView(listView);
|
||||
final FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
|
||||
layoutParams.width = LayoutHelper.MATCH_PARENT;
|
||||
|
||||
+2
-3
@@ -58,7 +58,7 @@ import com.b44t.ui.Components.LayoutHelper;
|
||||
import static android.app.ProgressDialog.STYLE_HORIZONTAL;
|
||||
|
||||
|
||||
public class AccountSettingsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
public class SettingsAccountActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
// the list
|
||||
private ListView listView;
|
||||
@@ -117,7 +117,7 @@ public class AccountSettingsActivity extends BaseFragment implements Notificatio
|
||||
private boolean fromIntro;
|
||||
private boolean m_expanded = false;
|
||||
|
||||
public AccountSettingsActivity(Bundle args) {
|
||||
public SettingsAccountActivity(Bundle args) {
|
||||
super();
|
||||
if( args!=null ) {
|
||||
fromIntro = args.getBoolean("fromIntro", false);
|
||||
@@ -236,7 +236,6 @@ public class AccountSettingsActivity extends BaseFragment implements Notificatio
|
||||
listView = new ListView(context);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
listView.setDrawSelectorOnTop(true);
|
||||
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||
listView.setAdapter(listAdapter);
|
||||
@@ -53,8 +53,6 @@ import com.b44t.ui.Cells.TextDetailSettingsCell;
|
||||
import com.b44t.ui.Cells.TextSettingsCell;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
public class SettingsActivity extends BaseFragment {
|
||||
|
||||
@@ -123,24 +121,23 @@ public class SettingsActivity extends BaseFragment {
|
||||
ListView listView = new ListView(context);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
AndroidUtilities.setListViewEdgeEffectColor(listView, Theme.ACTION_BAR_COLOR);
|
||||
listView.setDrawSelectorOnTop(true);
|
||||
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||
listView.setAdapter(listAdapter);
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(final AdapterView<?> adapterView, View view, final int i, long l) {
|
||||
if (i == usernameRow) {
|
||||
presentFragment(new NameSettingsActivity());
|
||||
presentFragment(new SettingsNameActivity());
|
||||
}
|
||||
else if (i == accountSettingsRow) {
|
||||
presentFragment(new AccountSettingsActivity(null));
|
||||
presentFragment(new SettingsAccountActivity(null));
|
||||
}
|
||||
else if (i == privacyRow) {
|
||||
presentFragment(new PrivacySettingsActivity());
|
||||
presentFragment(new SettingsPrivacyActivity());
|
||||
}
|
||||
else if (i == notificationRow) {
|
||||
presentFragment(new NotificationsSettingsActivity());
|
||||
presentFragment(new SettingsNotificationsActivity());
|
||||
}
|
||||
else if (i == backgroundRow) {
|
||||
presentFragment(new WallpapersActivity());
|
||||
|
||||
@@ -118,8 +118,7 @@ public class SettingsAdvActivity extends BaseFragment {
|
||||
listView = new ListView(context);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
AndroidUtilities.setListViewEdgeEffectColor(listView, Theme.ACTION_BAR_COLOR);
|
||||
listView.setDrawSelectorOnTop(true);
|
||||
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
|
||||
listView.setAdapter(listAdapter);
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
|
||||
+1
-2
@@ -51,7 +51,7 @@ import com.b44t.ui.Cells.TextInfoCell;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
|
||||
|
||||
public class NameSettingsActivity extends BaseFragment {
|
||||
public class SettingsNameActivity extends BaseFragment {
|
||||
|
||||
// the list
|
||||
private ListAdapter listAdapter;
|
||||
@@ -119,7 +119,6 @@ public class NameSettingsActivity extends BaseFragment {
|
||||
ListView listView = new ListView(context);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
listView.setDrawSelectorOnTop(true);
|
||||
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||
listView.setAdapter(listAdapter);
|
||||
+6
-26
@@ -60,7 +60,7 @@ import com.b44t.ui.Cells.TextSettingsCell;
|
||||
import com.b44t.ui.Components.ColorPickerView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
|
||||
public class NotificationsSettingsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
public class SettingsNotificationsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
private ListView listView;
|
||||
|
||||
@@ -74,7 +74,6 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
||||
private int groupSectionRow2;
|
||||
private int groupSectionRow;
|
||||
private int groupAlertRow;
|
||||
//private int groupPreviewRow;
|
||||
private int groupVibrateRow;
|
||||
private int groupSoundRow;
|
||||
private int groupLedRow;
|
||||
@@ -83,7 +82,6 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
||||
private int inappSectionRow;
|
||||
private int inappSoundRow;
|
||||
private int inappVibrateRow;
|
||||
//private int inappPreviewRow;
|
||||
private int inchatSoundRow;
|
||||
private int inappPriorityRow;
|
||||
private int otherSectionRow2;
|
||||
@@ -113,7 +111,6 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
||||
groupSectionRow2 = rowCount++;
|
||||
groupSectionRow = rowCount++;
|
||||
groupAlertRow = rowCount++;
|
||||
//groupPreviewRow = rowCount++;
|
||||
groupSoundRow = rowCount++;
|
||||
groupVibrateRow = rowCount++;
|
||||
groupLedRow = rowCount++;
|
||||
@@ -123,7 +120,6 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
||||
inappSectionRow = rowCount++;
|
||||
inappSoundRow = rowCount++;
|
||||
inappVibrateRow = rowCount++;
|
||||
//inappPreviewRow = rowCount++;
|
||||
inappPriorityRow = Build.VERSION.SDK_INT >= 21? rowCount++ : -1;
|
||||
|
||||
otherSectionRow2 = rowCount++;
|
||||
@@ -165,7 +161,7 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
||||
listView = new ListView(context);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
listView.setDrawSelectorOnTop(true);
|
||||
frameLayout.addView(listView);
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
|
||||
layoutParams.width = LayoutHelper.MATCH_PARENT;
|
||||
@@ -187,16 +183,11 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
||||
editor.putBoolean("EnableGroup", !enabled);
|
||||
}
|
||||
editor.apply();
|
||||
} else if (i == messagePreviewRow /*|| i == groupPreviewRow*/) {
|
||||
} else if (i == messagePreviewRow ) {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
//if (i == messagePreviewRow) {
|
||||
enabled = preferences.getBoolean("EnablePreviewAll", true);
|
||||
editor.putBoolean("EnablePreviewAll", !enabled);
|
||||
//} else if (i == groupPreviewRow) {
|
||||
// enabled = preferences.getBoolean("EnablePreviewGroup", true);
|
||||
// editor.putBoolean("EnablePreviewGroup", !enabled);
|
||||
//}
|
||||
enabled = preferences.getBoolean("EnablePreviewAll", true);
|
||||
editor.putBoolean("EnablePreviewAll", !enabled);
|
||||
editor.apply();
|
||||
} else if (i == messageSoundRow || i == groupSoundRow) {
|
||||
try {
|
||||
@@ -269,12 +260,6 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
||||
enabled = preferences.getBoolean("EnableInAppVibrate", true);
|
||||
editor.putBoolean("EnableInAppVibrate", !enabled);
|
||||
editor.apply();
|
||||
/*} else if (i == inappPreviewRow) {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
enabled = preferences.getBoolean("EnableInAppPreview", true);
|
||||
editor.putBoolean("EnableInAppPreview", !enabled);
|
||||
editor.commit();*/
|
||||
} else if (i == inchatSoundRow) {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
@@ -570,14 +555,10 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
||||
checkCell.setTextAndCheck(LocaleController.getString("Alert", R.string.Alert), preferences.getBoolean("EnableGroup", true), true);
|
||||
} else if (i == messagePreviewRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("MessagePreview", R.string.MessagePreview), preferences.getBoolean("EnablePreviewAll", true), true);
|
||||
/*} else if (i == groupPreviewRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("MessagePreview", R.string.MessagePreview), preferences.getBoolean("EnablePreviewGroup", true), true);*/
|
||||
} else if (i == inappSoundRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("Sound", R.string.Sound), preferences.getBoolean("EnableInAppSounds", true), true);
|
||||
} else if (i == inappVibrateRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("Vibrate", R.string.Vibrate), preferences.getBoolean("EnableInAppVibrate", true), true);
|
||||
/*} else if (i == inappPreviewRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("MessagePreview", R.string.MessagePreview), preferences.getBoolean("EnableInAppPreview", true), true);*/
|
||||
} else if (i == badgeNumberRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("BadgeNumber", R.string.BadgeNumber), preferences.getBoolean("badgeNumber", true), true);
|
||||
} else if (i == inchatSoundRow) {
|
||||
@@ -684,8 +665,7 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
||||
i == otherSectionRow ) {
|
||||
return TYPE_HEADER;
|
||||
} else if (i == messageAlertRow || i == messagePreviewRow || i == groupAlertRow ||
|
||||
/*i == groupPreviewRow ||*/ i == inappSoundRow || i == inappVibrateRow ||
|
||||
/*i == inappPreviewRow ||*/
|
||||
i == inappSoundRow || i == inappVibrateRow ||
|
||||
i == badgeNumberRow ||
|
||||
i == inchatSoundRow ) {
|
||||
return TYPE_CHECK_CELL;
|
||||
+4
-95
@@ -36,28 +36,24 @@ import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrChat;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.UserConfig;
|
||||
import com.b44t.ui.ActionBar.ActionBar;
|
||||
import com.b44t.ui.ActionBar.BaseFragment;
|
||||
import com.b44t.ui.Adapters.BaseFragmentAdapter;
|
||||
import com.b44t.ui.Cells.HeaderCell;
|
||||
import com.b44t.ui.Cells.TextCheckCell;
|
||||
import com.b44t.ui.Cells.TextInfoCell;
|
||||
import com.b44t.ui.Cells.TextSettingsCell;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
|
||||
public class PrivacySettingsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
public class SettingsPrivacyActivity extends BaseFragment {
|
||||
|
||||
private ListAdapter listAdapter;
|
||||
|
||||
private int privacySectionRow;
|
||||
private int e2eEncryptionRow;
|
||||
private int readReceiptsRow;
|
||||
private int blockedRow;
|
||||
private int showUnknownSendersRow;
|
||||
private int securitySectionRow;
|
||||
private int passcodeRow;
|
||||
private int secretDetailRow;
|
||||
private int manageKeysRow;
|
||||
@@ -65,38 +61,25 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
|
||||
private final int TYPE_TEXTSETTING = 0;
|
||||
private final int TYPE_TEXT_INFO = 1;
|
||||
private final int TYPE_HEADER = 2;
|
||||
private final int TYPE_CHECK_CELL = 3;
|
||||
private final int TYPE_COUNT = 4;
|
||||
private final int TYPE_CHECK_CELL = 2;
|
||||
private final int TYPE_COUNT = 3;
|
||||
|
||||
@Override
|
||||
public boolean onFragmentCreate() {
|
||||
super.onFragmentCreate();
|
||||
|
||||
//ContactsController.getInstance().loadPrivacySettings();
|
||||
|
||||
rowCount = 0;
|
||||
privacySectionRow = -1;
|
||||
passcodeRow = rowCount++;
|
||||
blockedRow = rowCount++;
|
||||
showUnknownSendersRow = rowCount++;
|
||||
readReceiptsRow = rowCount++;
|
||||
e2eEncryptionRow = rowCount++;
|
||||
manageKeysRow = rowCount++;
|
||||
securitySectionRow = -1;
|
||||
secretDetailRow = rowCount++;
|
||||
|
||||
//NotificationCenter.getInstance().addObserver(this, NotificationCenter.privacyRulesUpdated);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFragmentDestroy() {
|
||||
super.onFragmentDestroy();
|
||||
//NotificationCenter.getInstance().removeObserver(this, NotificationCenter.privacyRulesUpdated);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
@@ -120,7 +103,6 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
ListView listView = new ListView(context);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
listView.setDrawSelectorOnTop(true);
|
||||
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||
listView.setAdapter(listAdapter);
|
||||
@@ -173,67 +155,6 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
return fragmentView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void didReceivedNotification(int id, Object... args) {
|
||||
/*if (id == NotificationCenter.privacyRulesUpdated) {
|
||||
if (listAdapter != null) {
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/*
|
||||
private String formatRulesString(boolean isGroup) {
|
||||
ArrayList<TLRPC.PrivacyRule> privacyRules = ContactsController.getInstance().getPrivacyRules(isGroup);
|
||||
if (privacyRules.size() == 0) {
|
||||
return LocaleController.getString("LastSeenNobody", R.string.LastSeenNobody);
|
||||
}
|
||||
int type = -1;
|
||||
int plus = 0;
|
||||
int minus = 0;
|
||||
for (int a = 0; a < privacyRules.size(); a++) {
|
||||
TLRPC.PrivacyRule rule = privacyRules.get(a);
|
||||
if (rule instanceof TLRPC.TL_privacyValueAllowUsers) {
|
||||
plus += rule.users.size();
|
||||
} else if (rule instanceof TLRPC.TL_privacyValueDisallowUsers) {
|
||||
minus += rule.users.size();
|
||||
} else if (rule instanceof TLRPC.TL_privacyValueAllowAll) {
|
||||
type = 0;
|
||||
} else if (rule instanceof TLRPC.TL_privacyValueDisallowAll) {
|
||||
type = 1;
|
||||
} else {
|
||||
type = 2;
|
||||
}
|
||||
}
|
||||
if (type == 0 || type == -1 && minus > 0) {
|
||||
if (minus == 0) {
|
||||
return LocaleController.getString("LastSeenEverybody", R.string.LastSeenEverybody);
|
||||
} else {
|
||||
return LocaleController.formatString("LastSeenEverybodyMinus", R.string.LastSeenEverybodyMinus, minus);
|
||||
}
|
||||
} else if (type == 2 || type == -1 && minus > 0 && plus > 0) {
|
||||
if (plus == 0 && minus == 0) {
|
||||
return LocaleController.getString("LastSeenContacts", R.string.LastSeenContacts);
|
||||
} else {
|
||||
if (plus != 0 && minus != 0) {
|
||||
return LocaleController.formatString("LastSeenContactsMinusPlus", R.string.LastSeenContactsMinusPlus, minus, plus);
|
||||
} else if (minus != 0) {
|
||||
return LocaleController.formatString("LastSeenContactsMinus", R.string.LastSeenContactsMinus, minus);
|
||||
} else {
|
||||
return LocaleController.formatString("LastSeenContactsPlus", R.string.LastSeenContactsPlus, plus);
|
||||
}
|
||||
}
|
||||
} else if (type == 1 || plus > 0) {
|
||||
if (plus == 0) {
|
||||
return LocaleController.getString("LastSeenNobody", R.string.LastSeenNobody);
|
||||
} else {
|
||||
return LocaleController.formatString("LastSeenNobodyPlus", R.string.LastSeenNobodyPlus, plus);
|
||||
}
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@@ -257,7 +178,7 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
@Override
|
||||
public boolean isEnabled(int i) {
|
||||
int type = getItemViewType(i);
|
||||
return type!=TYPE_HEADER && type!=TYPE_TEXT_INFO;
|
||||
return type!=TYPE_TEXT_INFO;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -307,16 +228,6 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
((TextInfoCell) view).setText("");
|
||||
view.setBackgroundResource(R.drawable.greydivider_bottom);
|
||||
}
|
||||
} else if (type == TYPE_HEADER) {
|
||||
if (view == null) {
|
||||
view = new HeaderCell(mContext);
|
||||
view.setBackgroundColor(0xffffffff);
|
||||
}
|
||||
if (i == privacySectionRow) {
|
||||
((HeaderCell) view).setText(LocaleController.getString("Settings", R.string.Settings));
|
||||
} else if (i == securitySectionRow) {
|
||||
((HeaderCell) view).setText(LocaleController.getString("SecurityTitle", R.string.SecurityTitle));
|
||||
}
|
||||
} else if (type == TYPE_CHECK_CELL ) {
|
||||
if (view == null) {
|
||||
view = new TextCheckCell(mContext);
|
||||
@@ -343,8 +254,6 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
public int getItemViewType(int i) {
|
||||
if (i == secretDetailRow) {
|
||||
return TYPE_TEXT_INFO;
|
||||
} else if (i == securitySectionRow || i == privacySectionRow ) {
|
||||
return TYPE_HEADER;
|
||||
} else if (i==showUnknownSendersRow || i==e2eEncryptionRow || i==readReceiptsRow ) {
|
||||
return TYPE_CHECK_CELL;
|
||||
}
|
||||
Reference in New Issue
Block a user