mirror of
https://github.com/wrwrabbit/Partisan-Telegram-Android.git
synced 2026-05-10 04:09:54 +00:00
Update to 8.8.2
This commit is contained in:
parent
32aef72421
commit
96dce2c9aa
2710 changed files with 40357 additions and 11958 deletions
|
|
@ -40,6 +40,7 @@ import org.telegram.messenger.DialogObject;
|
|||
import org.telegram.messenger.FileLoader;
|
||||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.NotificationCenter;
|
||||
import org.telegram.messenger.NotificationsController;
|
||||
import org.telegram.messenger.R;
|
||||
|
|
@ -64,6 +65,8 @@ import org.telegram.ui.Cells.TextColorCell;
|
|||
import org.telegram.ui.Cells.TextSettingsCell;
|
||||
import org.telegram.ui.Cells.UserCell;
|
||||
import org.telegram.ui.Components.AlertsCreator;
|
||||
import org.telegram.ui.Components.BulletinFactory;
|
||||
import org.telegram.ui.Components.ChatNotificationsPopupWrapper;
|
||||
import org.telegram.ui.Components.EmptyTextProgressView;
|
||||
import org.telegram.ui.Components.LayoutHelper;
|
||||
import org.telegram.ui.Components.RecyclerListView;
|
||||
|
|
@ -267,8 +270,93 @@ public class NotificationsCustomSettingsActivity extends BaseFragment implements
|
|||
return;
|
||||
}
|
||||
|
||||
AlertsCreator.showCustomNotificationsDialog(NotificationsCustomSettingsActivity.this, exception.did, -1, null, currentAccount, null, param -> {
|
||||
if (param == 0) {
|
||||
long did = exception.did;
|
||||
boolean defaultEnabled = NotificationsController.getInstance(currentAccount).isGlobalNotificationsEnabled(did);
|
||||
ChatNotificationsPopupWrapper chatNotificationsPopupWrapper = new ChatNotificationsPopupWrapper(context, currentAccount, null, true, true, new ChatNotificationsPopupWrapper.Callback() {
|
||||
@Override
|
||||
public void toggleSound() {
|
||||
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
|
||||
boolean enabled = !preferences.getBoolean("sound_enabled_" + did, true);
|
||||
preferences.edit().putBoolean("sound_enabled_" + did, enabled).apply();
|
||||
if (BulletinFactory.canShowBulletin(NotificationsCustomSettingsActivity.this)) {
|
||||
BulletinFactory.createSoundEnabledBulletin(NotificationsCustomSettingsActivity.this, enabled ? NotificationsController.SETTING_SOUND_ON : NotificationsController.SETTING_SOUND_OFF, getResourceProvider()).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void muteFor(int timeInSeconds) {
|
||||
if (timeInSeconds == 0) {
|
||||
if (getMessagesController().isDialogMuted(did)) {
|
||||
toggleMute();
|
||||
}
|
||||
if (BulletinFactory.canShowBulletin(NotificationsCustomSettingsActivity.this)) {
|
||||
BulletinFactory.createMuteBulletin(NotificationsCustomSettingsActivity.this, NotificationsController.SETTING_MUTE_UNMUTE, timeInSeconds, getResourceProvider()).show();
|
||||
}
|
||||
} else {
|
||||
getNotificationsController().muteUntil(did, timeInSeconds);
|
||||
if (BulletinFactory.canShowBulletin(NotificationsCustomSettingsActivity.this)) {
|
||||
BulletinFactory.createMuteBulletin(NotificationsCustomSettingsActivity.this, NotificationsController.SETTING_MUTE_CUSTOM, timeInSeconds, getResourceProvider()).show();
|
||||
}
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showCustomize() {
|
||||
if (did != 0) {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("dialog_id", did);
|
||||
ProfileNotificationsActivity fragment = new ProfileNotificationsActivity(args);
|
||||
fragment.setDelegate(new ProfileNotificationsActivity.ProfileNotificationsActivityDelegate() {
|
||||
@Override
|
||||
public void didCreateNewException(NotificationsSettingsActivity.NotificationException exception) {}
|
||||
|
||||
@Override
|
||||
public void didRemoveException(long dialog_id) {
|
||||
setDefault();
|
||||
}
|
||||
});
|
||||
presentFragment(fragment);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggleMute() {
|
||||
boolean muted = getMessagesController().isDialogMuted(did);
|
||||
getNotificationsController().muteDialog(did, !muted);
|
||||
BulletinFactory.createMuteBulletin(NotificationsCustomSettingsActivity.this, getMessagesController().isDialogMuted(did), null).show();
|
||||
update();
|
||||
}
|
||||
|
||||
private void update() {
|
||||
if (getMessagesController().isDialogMuted(did) != defaultEnabled) {
|
||||
setDefault();
|
||||
} else {
|
||||
setNotDefault();
|
||||
}
|
||||
}
|
||||
|
||||
private void setNotDefault() {
|
||||
SharedPreferences preferences = getNotificationsSettings();
|
||||
exception.hasCustom = preferences.getBoolean("custom_" + exception.did, false);
|
||||
exception.notify = preferences.getInt("notify2_" + exception.did, 0);
|
||||
if (exception.notify != 0) {
|
||||
int time = preferences.getInt("notifyuntil_" + exception.did, -1);
|
||||
if (time != -1) {
|
||||
exception.muteUntil = time;
|
||||
}
|
||||
}
|
||||
if (newException) {
|
||||
exceptions.add(exception);
|
||||
exceptionsDict.put(exception.did, exception);
|
||||
updateRows(true);
|
||||
} else {
|
||||
listView.getAdapter().notifyItemChanged(position);
|
||||
}
|
||||
actionBar.closeSearchField();
|
||||
}
|
||||
|
||||
private void setDefault() {
|
||||
if (newException) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -291,29 +379,13 @@ public class NotificationsCustomSettingsActivity extends BaseFragment implements
|
|||
checkRowsEnabled();
|
||||
} else {
|
||||
updateRows(true);
|
||||
searchAdapter.notifyDataSetChanged();
|
||||
}
|
||||
actionBar.closeSearchField();
|
||||
} else {
|
||||
SharedPreferences preferences = getNotificationsSettings();
|
||||
exception.hasCustom = preferences.getBoolean("custom_" + exception.did, false);
|
||||
exception.notify = preferences.getInt("notify2_" + exception.did, 0);
|
||||
if (exception.notify != 0) {
|
||||
int time = preferences.getInt("notifyuntil_" + exception.did, -1);
|
||||
if (time != -1) {
|
||||
exception.muteUntil = time;
|
||||
}
|
||||
}
|
||||
if (newException) {
|
||||
exceptions.add(exception);
|
||||
exceptionsDict.put(exception.did, exception);
|
||||
updateRows(true);
|
||||
} else {
|
||||
listView.getAdapter().notifyItemChanged(position);
|
||||
searchAdapter.notifyItemChanged(position);
|
||||
}
|
||||
actionBar.closeSearchField();
|
||||
}
|
||||
});
|
||||
}, getResourceProvider());
|
||||
chatNotificationsPopupWrapper.update(did);
|
||||
chatNotificationsPopupWrapper.showAsOptions(NotificationsCustomSettingsActivity.this, view, x, y);
|
||||
return;
|
||||
}
|
||||
if (position == exceptionsAddRow) {
|
||||
|
|
@ -332,7 +404,7 @@ public class NotificationsCustomSettingsActivity extends BaseFragment implements
|
|||
Bundle args2 = new Bundle();
|
||||
args2.putLong("dialog_id", dids.get(0));
|
||||
args2.putBoolean("exception", true);
|
||||
ProfileNotificationsActivity profileNotificationsActivity = new ProfileNotificationsActivity(args2);
|
||||
ProfileNotificationsActivity profileNotificationsActivity = new ProfileNotificationsActivity(args2, getResourceProvider());
|
||||
profileNotificationsActivity.setDelegate(exception -> {
|
||||
exceptions.add(0, exception);
|
||||
updateRows(true);
|
||||
|
|
@ -438,7 +510,7 @@ public class NotificationsCustomSettingsActivity extends BaseFragment implements
|
|||
try {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("type", currentType);
|
||||
presentFragment(new NotificationsSoundActivity(bundle));
|
||||
presentFragment(new NotificationsSoundActivity(bundle, getResourceProvider()));
|
||||
// SharedPreferences preferences = getNotificationsSettings();
|
||||
// Intent tmpIntent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
|
||||
// tmpIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
|
||||
|
|
@ -1357,7 +1429,7 @@ public class NotificationsCustomSettingsActivity extends BaseFragment implements
|
|||
case 7: {
|
||||
TextCell textCell = (TextCell) holder.itemView;
|
||||
if (position == exceptionsAddRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("NotificationsAddAnException", R.string.NotificationsAddAnException), R.drawable.actions_addmember2, exceptionsStartRow != -1);
|
||||
textCell.setTextAndIcon(LocaleController.getString("NotificationsAddAnException", R.string.NotificationsAddAnException), R.drawable.msg_contact_add, exceptionsStartRow != -1);
|
||||
textCell.setColors(Theme.key_windowBackgroundWhiteBlueIcon, Theme.key_windowBackgroundWhiteBlueButton);
|
||||
} else if (position == deleteAllRow) {
|
||||
textCell.setText(LocaleController.getString("NotificationsDeleteAllException", R.string.NotificationsDeleteAllException), false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue