Merge branch 'tryton-vanmeer-logout-confirm-dialogue' Closes #235
This commit is contained in:
commit
6a397478da
2 changed files with 21 additions and 8 deletions
|
@ -16,6 +16,7 @@
|
||||||
package com.keylesspalace.tusky;
|
package com.keylesspalace.tusky;
|
||||||
|
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
@ -30,6 +31,7 @@ import android.support.design.widget.TabLayout;
|
||||||
import android.support.graphics.drawable.VectorDrawableCompat;
|
import android.support.graphics.drawable.VectorDrawableCompat;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -337,6 +339,12 @@ public class MainActivity extends BaseActivity implements SFragment.OnUserRemove
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logout() {
|
private void logout() {
|
||||||
|
new AlertDialog.Builder(this)
|
||||||
|
.setTitle(R.string.action_logout)
|
||||||
|
.setMessage(R.string.action_logout_confirm)
|
||||||
|
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if (arePushNotificationsEnabled()) disablePushNotifications();
|
if (arePushNotificationsEnabled()) disablePushNotifications();
|
||||||
|
|
||||||
getPrivatePreferences().edit()
|
getPrivatePreferences().edit()
|
||||||
|
@ -348,6 +356,10 @@ public class MainActivity extends BaseActivity implements SFragment.OnUserRemove
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(android.R.string.no, null)
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
private void setupSearchView() {
|
private void setupSearchView() {
|
||||||
searchView.attachNavigationDrawerToMenuButton(drawer.getDrawerLayout());
|
searchView.attachNavigationDrawerToMenuButton(drawer.getDrawerLayout());
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
<string name="action_compose">Compose</string>
|
<string name="action_compose">Compose</string>
|
||||||
<string name="action_login">Login with Mastodon</string>
|
<string name="action_login">Login with Mastodon</string>
|
||||||
<string name="action_logout">Log Out</string>
|
<string name="action_logout">Log Out</string>
|
||||||
|
<string name="action_logout_confirm">Do you wish to logout</string>
|
||||||
<string name="action_follow">Follow</string>
|
<string name="action_follow">Follow</string>
|
||||||
<string name="action_unfollow">Unfollow</string>
|
<string name="action_unfollow">Unfollow</string>
|
||||||
<string name="action_block">Block</string>
|
<string name="action_block">Block</string>
|
||||||
|
|
Loading…
Reference in a new issue