45
45
import org .telegram .ui .Cells .TextDetailSettingsCell ;
46
46
import org .telegram .ui .ActionBar .ActionBar ;
47
47
import org .telegram .ui .ActionBar .BaseFragment ;
48
- import org .telegram .ui .Views .AvatarDrawable ;
49
48
import org .telegram .ui .Views .ColorPickerView ;
50
49
51
50
public class NotificationsSettingsActivity extends BaseFragment implements NotificationCenter .NotificationCenterDelegate {
@@ -154,7 +153,6 @@ public void onItemClick(int id) {
154
153
listView .setDivider (null );
155
154
listView .setDividerHeight (0 );
156
155
listView .setVerticalScrollBarEnabled (false );
157
- AndroidUtilities .setListViewEdgeEffectColor (listView , AvatarDrawable .getProfileBackColorForId (5 ));
158
156
frameLayout .addView (listView );
159
157
FrameLayout .LayoutParams layoutParams = (FrameLayout .LayoutParams ) listView .getLayoutParams ();
160
158
layoutParams .width = FrameLayout .LayoutParams .MATCH_PARENT ;
@@ -164,10 +162,10 @@ public void onItemClick(int id) {
164
162
listView .setOnItemClickListener (new AdapterView .OnItemClickListener () {
165
163
@ Override
166
164
public void onItemClick (AdapterView <?> adapterView , View view , final int i , long l ) {
165
+ boolean enabled = false ;
167
166
if (i == messageAlertRow || i == groupAlertRow ) {
168
167
SharedPreferences preferences = ApplicationLoader .applicationContext .getSharedPreferences ("Notifications" , Activity .MODE_PRIVATE );
169
168
SharedPreferences .Editor editor = preferences .edit ();
170
- boolean enabled ;
171
169
if (i == messageAlertRow ) {
172
170
enabled = preferences .getBoolean ("EnableAll" , true );
173
171
editor .putBoolean ("EnableAll" , !enabled );
@@ -176,12 +174,10 @@ public void onItemClick(AdapterView<?> adapterView, View view, final int i, long
176
174
editor .putBoolean ("EnableGroup" , !enabled );
177
175
}
178
176
editor .commit ();
179
- listView .invalidateViews ();
180
177
updateServerNotificationsSettings (i == groupAlertRow );
181
178
} else if (i == messagePreviewRow || i == groupPreviewRow ) {
182
179
SharedPreferences preferences = ApplicationLoader .applicationContext .getSharedPreferences ("Notifications" , Activity .MODE_PRIVATE );
183
180
SharedPreferences .Editor editor = preferences .edit ();
184
- boolean enabled ;
185
181
if (i == messagePreviewRow ) {
186
182
enabled = preferences .getBoolean ("EnablePreviewAll" , true );
187
183
editor .putBoolean ("EnablePreviewAll" , !enabled );
@@ -190,7 +186,6 @@ public void onItemClick(AdapterView<?> adapterView, View view, final int i, long
190
186
editor .putBoolean ("EnablePreviewGroup" , !enabled );
191
187
}
192
188
editor .commit ();
193
- listView .invalidateViews ();
194
189
updateServerNotificationsSettings (i == groupPreviewRow );
195
190
} else if (i == messageSoundRow || i == groupSoundRow ) {
196
191
try {
@@ -263,55 +258,48 @@ public void run() {
263
258
} else if (i == inappSoundRow ) {
264
259
SharedPreferences preferences = ApplicationLoader .applicationContext .getSharedPreferences ("Notifications" , Activity .MODE_PRIVATE );
265
260
SharedPreferences .Editor editor = preferences .edit ();
266
- boolean enabled = preferences .getBoolean ("EnableInAppSounds" , true );
261
+ enabled = preferences .getBoolean ("EnableInAppSounds" , true );
267
262
editor .putBoolean ("EnableInAppSounds" , !enabled );
268
263
editor .commit ();
269
- listView .invalidateViews ();
270
264
} else if (i == inappVibrateRow ) {
271
265
SharedPreferences preferences = ApplicationLoader .applicationContext .getSharedPreferences ("Notifications" , Activity .MODE_PRIVATE );
272
266
SharedPreferences .Editor editor = preferences .edit ();
273
- boolean enabled = preferences .getBoolean ("EnableInAppVibrate" , true );
267
+ enabled = preferences .getBoolean ("EnableInAppVibrate" , true );
274
268
editor .putBoolean ("EnableInAppVibrate" , !enabled );
275
269
editor .commit ();
276
- listView .invalidateViews ();
277
270
} else if (i == inappPreviewRow ) {
278
271
SharedPreferences preferences = ApplicationLoader .applicationContext .getSharedPreferences ("Notifications" , Activity .MODE_PRIVATE );
279
272
SharedPreferences .Editor editor = preferences .edit ();
280
- boolean enabled = preferences .getBoolean ("EnableInAppPreview" , true );
273
+ enabled = preferences .getBoolean ("EnableInAppPreview" , true );
281
274
editor .putBoolean ("EnableInAppPreview" , !enabled );
282
275
editor .commit ();
283
- listView .invalidateViews ();
284
276
} else if (i == contactJoinedRow ) {
285
277
SharedPreferences preferences = ApplicationLoader .applicationContext .getSharedPreferences ("Notifications" , Activity .MODE_PRIVATE );
286
278
SharedPreferences .Editor editor = preferences .edit ();
287
- boolean enabled = preferences .getBoolean ("EnableContactJoined" , true );
279
+ enabled = preferences .getBoolean ("EnableContactJoined" , true );
288
280
MessagesController .getInstance ().enableJoined = !enabled ;
289
281
editor .putBoolean ("EnableContactJoined" , !enabled );
290
282
editor .commit ();
291
- listView .invalidateViews ();
292
283
} else if (i == pebbleAlertRow ) {
293
284
SharedPreferences preferences = ApplicationLoader .applicationContext .getSharedPreferences ("Notifications" , Activity .MODE_PRIVATE );
294
285
SharedPreferences .Editor editor = preferences .edit ();
295
- boolean enabled = preferences .getBoolean ("EnablePebbleNotifications" , false );
286
+ enabled = preferences .getBoolean ("EnablePebbleNotifications" , false );
296
287
editor .putBoolean ("EnablePebbleNotifications" , !enabled );
297
288
editor .commit ();
298
- listView .invalidateViews ();
299
289
} else if (i == badgeNumberRow ) {
300
290
SharedPreferences preferences = ApplicationLoader .applicationContext .getSharedPreferences ("Notifications" , Activity .MODE_PRIVATE );
301
291
SharedPreferences .Editor editor = preferences .edit ();
302
- boolean enabled = preferences .getBoolean ("badgeNumber" , true );
292
+ enabled = preferences .getBoolean ("badgeNumber" , true );
303
293
editor .putBoolean ("badgeNumber" , !enabled );
304
294
editor .commit ();
305
- listView .invalidateViews ();
306
295
NotificationsController .getInstance ().setBadgeEnabled (!enabled );
307
296
} else if (i == notificationsServiceRow ) {
308
297
final SharedPreferences preferences = ApplicationLoader .applicationContext .getSharedPreferences ("Notifications" , Activity .MODE_PRIVATE );
309
- boolean enabled = preferences .getBoolean ("pushService" , true );
298
+ enabled = preferences .getBoolean ("pushService" , true );
310
299
if (!enabled ) {
311
300
final SharedPreferences .Editor editor = preferences .edit ();
312
301
editor .putBoolean ("pushService" , !enabled );
313
302
editor .commit ();
314
- listView .invalidateViews ();
315
303
ApplicationLoader .startPushService ();
316
304
} else {
317
305
if (getParentActivity () == null ) {
@@ -442,6 +430,9 @@ public void onClick(DialogInterface dialog, int which) {
442
430
builder .setNegativeButton (LocaleController .getString ("Cancel" , R .string .Cancel ), null );
443
431
showAlertDialog (builder );
444
432
}
433
+ if (view instanceof TextCheckCell ) {
434
+ ((TextCheckCell ) view ).setChecked (!enabled );
435
+ }
445
436
}
446
437
});
447
438
} else {
0 commit comments