Ask confirmation when starting secret chat and sharing contact info

Thanks to https://github.com/DrKLO/Telegram/pull/401
This commit is contained in:
DrKLO 2014-06-04 23:27:43 +04:00
parent 63ba8a5ac1
commit cdb39ac30f
4 changed files with 31 additions and 10 deletions

View file

@ -82,7 +82,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 237
versionCode 238
versionName "1.4.15"
}
}

View file

@ -2566,15 +2566,26 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
topPanel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MessagesController.getInstance().hidenAddToContacts.put(currentUser.id, currentUser);
topPanel.setVisibility(View.GONE);
MessagesController.getInstance().sendMessage(UserConfig.currentUser, dialog_id);
chatListView.post(new Runnable() {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void run() {
chatListView.setSelectionFromTop(messages.size() - 1, -100000 - chatListView.getPaddingTop());
public void onClick(DialogInterface dialogInterface, int i) {
MessagesController.getInstance().hidenAddToContacts.put(currentUser.id, currentUser);
topPanel.setVisibility(View.GONE);
MessagesController.getInstance().sendMessage(UserConfig.currentUser, dialog_id);
chatListView.post(new Runnable() {
@Override
public void run() {
chatListView.setSelectionFromTop(messages.size() - 1, -100000 - chatListView.getPaddingTop());
}
});
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
visibleDialog = builder.show();
visibleDialog.setCanceledOnTouchOutside(true);
}
});
}

View file

@ -211,8 +211,18 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
startSecretButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
creatingChat = true;
MessagesController.getInstance().startSecretChat(getParentActivity(), MessagesController.getInstance().users.get(user_id));
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
creatingChat = true;
MessagesController.getInstance().startSecretChat(getParentActivity(), MessagesController.getInstance().users.get(user_id));
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.show().setCanceledOnTouchOutside(true);
}
});
if (dialog_id == 0) {

View file

@ -326,7 +326,7 @@ public class ActionBarActivity extends Activity {
});
velocityTracker.recycle();
velocityTracker = null;
} else if (ev == null) {
} else if (ev == null || ev != null && (ev.getAction() == MotionEvent.ACTION_CANCEL || ev.getAction() == MotionEvent.ACTION_UP)) {
maybeStartTracking = false;
startedTracking = false;
if (velocityTracker != null) {