mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Clearer delete/block/profile approch: A long click goes to the profile where the less freqently used options can be found.
This commit is contained in:
@@ -133,21 +133,11 @@ public class BlockedUsersActivity extends BaseFragment implements NotificationCe
|
||||
selectedUserId = blockedUserIds[i];
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
CharSequence[] items = new CharSequence[]{
|
||||
LocaleController.getString("UnblockContact", R.string.UnblockContact),
|
||||
LocaleController.getString("DeleteContact", R.string.DeleteContact)
|
||||
};
|
||||
CharSequence[] items = new CharSequence[]{LocaleController.getString("UnblockContact", R.string.UnblockContact)};
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if (i == 0) {
|
||||
MrMailbox.MrMailboxBlockContact(MrMailbox.hMailbox, selectedUserId, 0);
|
||||
}
|
||||
else if( i==1 ) {
|
||||
if( MrMailbox.MrMailboxDeleteContact(MrMailbox.hMailbox, selectedUserId) == 0 ) {
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("CannotDeleteContact", R.string.CannotDeleteContact), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
MrMailbox.MrMailboxBlockContact(MrMailbox.hMailbox, selectedUserId, 0);
|
||||
}
|
||||
});
|
||||
showDialog(builder.create());
|
||||
|
||||
@@ -446,21 +446,14 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
if (item instanceof TLRPC.User) {
|
||||
final TLRPC.User user = (TLRPC.User) item;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
CharSequence[] items = new CharSequence[]{
|
||||
LocaleController.getString("BlockContact", R.string.BlockContact),
|
||||
LocaleController.getString("DeleteContact", R.string.DeleteContact)
|
||||
};
|
||||
CharSequence[] items = new CharSequence[]{LocaleController.getString("ViewProfile", R.string.ViewProfile)};
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if (i == 0) {
|
||||
MrMailbox.MrMailboxBlockContact(MrMailbox.hMailbox, user.id, 1);
|
||||
}
|
||||
else if (i == 1) {
|
||||
if( MrMailbox.MrMailboxDeleteContact(MrMailbox.hMailbox, user.id) == 0 ) {
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("CannotDeleteContact", R.string.CannotDeleteContact), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("user_id", user.id);
|
||||
ProfileActivity fragment = new ProfileActivity(args);
|
||||
presentFragment(fragment);
|
||||
}
|
||||
});
|
||||
showDialog(builder.create());
|
||||
|
||||
@@ -288,18 +288,17 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
showDialog(builder.create());
|
||||
}
|
||||
} else if (id == delete_contact) {
|
||||
final TLRPC.User user = MessagesController.getInstance().getUser(user_id);
|
||||
if (user == null || getParentActivity() == null) {
|
||||
return;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(LocaleController.getString("AreYouSureDeleteContact", R.string.AreYouSureDeleteContact));
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
ArrayList<TLRPC.User> arrayList = new ArrayList<>();
|
||||
arrayList.add(user);
|
||||
ContactsController.getInstance().deleteContact(arrayList);
|
||||
if( MrMailbox.MrMailboxDeleteContact(MrMailbox.hMailbox, user_id)==0 ) {
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("CannotDeleteContact", R.string.CannotDeleteContact), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
else {
|
||||
finishFragment();
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
@@ -1278,13 +1277,17 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
animatingItem = null;
|
||||
|
||||
ActionBarMenuItem item = menu.addItem(10, R.drawable.ic_ab_other);
|
||||
if (user_id != 0) {
|
||||
blockTextView = item.addSubItem(block_contact, "X", 0);
|
||||
}
|
||||
|
||||
if( chat_id!=0 || MrMailbox.MrMailboxGetChatIdByContactId(MrMailbox.hMailbox, user_id)!=0 ) {
|
||||
item.addSubItem(add_shortcut, LocaleController.getString("AddShortcut", R.string.AddShortcut), 0);
|
||||
}
|
||||
|
||||
if (user_id != 0) {
|
||||
blockTextView = item.addSubItem(block_contact, "X", 0);
|
||||
item.addSubItem(delete_contact, LocaleController.getString("DeleteContact", R.string.DeleteContact), 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -721,4 +721,5 @@
|
||||
<string name="BadEmailAddress">Ungültige E-Mail-Adresse.</string>
|
||||
<string name="ContactDeleted">Benutzer gelöscht.</string>
|
||||
<string name="ContactCreated">Benutzer angelegt.</string>
|
||||
<string name="ViewProfile">Profil anzeigen</string>
|
||||
</resources>
|
||||
|
||||
@@ -721,4 +721,5 @@
|
||||
<string name="BadEmailAddress">Bad e-mail address.</string>
|
||||
<string name="ContactDeleted">User deleted.</string>
|
||||
<string name="ContactCreated">User created.</string>
|
||||
<string name="ViewProfile">View profile</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user