|
|
|
@ -15,7 +15,6 @@ |
|
|
|
|
|
|
|
|
|
package com.keylesspalace.tusky; |
|
|
|
|
|
|
|
|
|
import android.content.DialogInterface; |
|
|
|
|
import android.content.Intent; |
|
|
|
|
import android.content.SharedPreferences; |
|
|
|
|
import android.content.res.Configuration; |
|
|
|
@ -97,24 +96,16 @@ public class MainActivity extends BaseActivity implements ActionButtonActivity { |
|
|
|
|
TabLayout tabLayout = findViewById(R.id.tab_layout); |
|
|
|
|
viewPager = findViewById(R.id.pager); |
|
|
|
|
|
|
|
|
|
floatingBtn.setOnClickListener(new View.OnClickListener() { |
|
|
|
|
@Override |
|
|
|
|
public void onClick(View v) { |
|
|
|
|
floatingBtn.setOnClickListener(v -> { |
|
|
|
|
Intent intent = new Intent(getApplicationContext(), ComposeActivity.class); |
|
|
|
|
startActivityForResult(intent, COMPOSE_RESULT); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
setupDrawer(); |
|
|
|
|
|
|
|
|
|
// Setup the navigation drawer toggle button.
|
|
|
|
|
ThemeUtils.setDrawableTint(this, drawerToggle.getDrawable(), R.attr.toolbar_icon_tint); |
|
|
|
|
drawerToggle.setOnClickListener(new View.OnClickListener() { |
|
|
|
|
@Override |
|
|
|
|
public void onClick(View v) { |
|
|
|
|
drawer.openDrawer(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
drawerToggle.setOnClickListener(v -> drawer.openDrawer()); |
|
|
|
|
|
|
|
|
|
/* Fetch user info while we're doing other things. This has to be after setting up the |
|
|
|
|
* drawer, though, because its callback touches the header in the drawer. */ |
|
|
|
@ -302,7 +293,7 @@ public class MainActivity extends BaseActivity implements ActionButtonActivity { |
|
|
|
|
|
|
|
|
|
DrawerImageLoader.init(new AbstractDrawerImageLoader() { |
|
|
|
|
@Override |
|
|
|
|
public void set(ImageView imageView, Uri uri, Drawable placeholder) { |
|
|
|
|
public void set(ImageView imageView, Uri uri, Drawable placeholder, String tag) { |
|
|
|
|
Picasso.with(imageView.getContext()).load(uri).placeholder(placeholder).into(imageView); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -338,9 +329,7 @@ public class MainActivity extends BaseActivity implements ActionButtonActivity { |
|
|
|
|
.withHasStableIds(true) |
|
|
|
|
.withSelectedItem(-1) |
|
|
|
|
.addDrawerItems(array) |
|
|
|
|
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { |
|
|
|
|
@Override |
|
|
|
|
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { |
|
|
|
|
.withOnDrawerItemClickListener((view, position, drawerItem) -> { |
|
|
|
|
if (drawerItem != null) { |
|
|
|
|
long drawerItemIdentifier = drawerItem.getIdentifier(); |
|
|
|
|
|
|
|
|
@ -380,7 +369,6 @@ public class MainActivity extends BaseActivity implements ActionButtonActivity { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.build(); |
|
|
|
|
} |
|
|
|
@ -389,9 +377,7 @@ public class MainActivity extends BaseActivity implements ActionButtonActivity { |
|
|
|
|
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) { |
|
|
|
|
.setPositiveButton(android.R.string.yes, (dialog, which) -> { |
|
|
|
|
if (arePushNotificationsEnabled()) disablePushNotifications(); |
|
|
|
|
|
|
|
|
|
getPrivatePreferences().edit() |
|
|
|
@ -403,7 +389,6 @@ public class MainActivity extends BaseActivity implements ActionButtonActivity { |
|
|
|
|
Intent intent = new Intent(MainActivity.this, LoginActivity.class); |
|
|
|
|
startActivity(intent); |
|
|
|
|
finish(); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.setNegativeButton(android.R.string.no, null) |
|
|
|
|
.show(); |
|
|
|
|