2017-01-20 09:09:10 +01:00
|
|
|
/* Copyright 2017 Andrew Dawson
|
|
|
|
*
|
|
|
|
* This file is part of Tusky.
|
|
|
|
*
|
|
|
|
* Tusky is free software: you can redistribute it and/or modify it under the terms of the GNU
|
|
|
|
* General Public License as published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
|
|
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
|
|
* Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with Tusky. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>. */
|
|
|
|
|
2017-01-03 00:30:27 +01:00
|
|
|
package com.keylesspalace.tusky;
|
|
|
|
|
2017-01-25 05:35:54 +01:00
|
|
|
import android.app.AlarmManager;
|
|
|
|
import android.app.PendingIntent;
|
2017-01-03 00:30:27 +01:00
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.SharedPreferences;
|
2017-03-10 23:31:08 +01:00
|
|
|
import android.graphics.Typeface;
|
2017-02-17 03:11:05 +01:00
|
|
|
import android.graphics.drawable.Drawable;
|
2017-03-09 19:31:15 +01:00
|
|
|
import android.net.Uri;
|
2017-01-25 05:35:54 +01:00
|
|
|
import android.os.SystemClock;
|
2017-02-05 08:34:55 +01:00
|
|
|
import android.preference.PreferenceManager;
|
2017-03-07 01:38:22 +01:00
|
|
|
import android.support.design.widget.FloatingActionButton;
|
2017-01-07 23:24:02 +01:00
|
|
|
import android.support.design.widget.TabLayout;
|
|
|
|
import android.support.v4.view.ViewPager;
|
2017-01-03 00:30:27 +01:00
|
|
|
import android.os.Bundle;
|
|
|
|
import android.support.v7.widget.Toolbar;
|
2017-03-10 23:31:08 +01:00
|
|
|
import android.text.Html;
|
|
|
|
import android.text.SpannableStringBuilder;
|
|
|
|
import android.text.Spanned;
|
|
|
|
import android.text.TextUtils;
|
2017-03-07 01:38:22 +01:00
|
|
|
import android.view.View;
|
2017-03-09 19:31:15 +01:00
|
|
|
import android.widget.ImageView;
|
2017-03-10 23:31:08 +01:00
|
|
|
import android.widget.TextView;
|
2017-01-03 00:30:27 +01:00
|
|
|
|
2017-03-10 04:35:08 +01:00
|
|
|
import com.arlib.floatingsearchview.FloatingSearchView;
|
2017-03-10 23:31:08 +01:00
|
|
|
import com.arlib.floatingsearchview.suggestions.SearchSuggestionsAdapter;
|
|
|
|
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion;
|
2017-03-09 16:59:18 +01:00
|
|
|
import com.keylesspalace.tusky.entity.Account;
|
2017-03-10 04:00:09 +01:00
|
|
|
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
2017-03-09 19:31:15 +01:00
|
|
|
import com.mikepenz.materialdrawer.AccountHeader;
|
|
|
|
import com.mikepenz.materialdrawer.AccountHeaderBuilder;
|
|
|
|
import com.mikepenz.materialdrawer.Drawer;
|
|
|
|
import com.mikepenz.materialdrawer.DrawerBuilder;
|
2017-03-10 04:00:09 +01:00
|
|
|
import com.mikepenz.materialdrawer.model.DividerDrawerItem;
|
2017-03-09 19:31:15 +01:00
|
|
|
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
|
|
|
|
import com.mikepenz.materialdrawer.model.ProfileDrawerItem;
|
2017-03-10 04:35:08 +01:00
|
|
|
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem;
|
2017-03-09 19:31:15 +01:00
|
|
|
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
|
|
|
|
import com.mikepenz.materialdrawer.model.interfaces.IProfile;
|
|
|
|
import com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader;
|
|
|
|
import com.mikepenz.materialdrawer.util.DrawerImageLoader;
|
|
|
|
import com.squareup.picasso.Picasso;
|
2017-01-28 04:33:43 +01:00
|
|
|
|
2017-03-10 23:31:08 +01:00
|
|
|
import java.util.List;
|
2017-03-07 11:02:41 +01:00
|
|
|
import java.util.Stack;
|
2017-01-28 04:33:43 +01:00
|
|
|
|
2017-03-09 16:59:18 +01:00
|
|
|
import retrofit2.Call;
|
|
|
|
import retrofit2.Callback;
|
2017-03-10 23:31:08 +01:00
|
|
|
import retrofit2.Response;
|
2017-03-09 16:59:18 +01:00
|
|
|
|
2017-02-16 19:52:55 +01:00
|
|
|
public class MainActivity extends BaseActivity {
|
2017-02-24 01:32:45 +01:00
|
|
|
private static final String TAG = "MainActivity"; // logging tag and Volley request tag
|
2017-01-31 05:51:02 +01:00
|
|
|
|
2017-01-25 05:35:54 +01:00
|
|
|
private AlarmManager alarmManager;
|
|
|
|
private PendingIntent serviceAlarmIntent;
|
|
|
|
private boolean notificationServiceEnabled;
|
2017-01-28 04:33:43 +01:00
|
|
|
private String loggedInAccountId;
|
|
|
|
private String loggedInAccountUsername;
|
2017-03-07 11:02:41 +01:00
|
|
|
Stack<Integer> pageHistory = new Stack<Integer>();
|
|
|
|
private ViewPager viewPager;
|
2017-03-09 19:31:15 +01:00
|
|
|
private AccountHeader headerResult;
|
|
|
|
private Drawer drawer;
|
2017-01-25 05:35:54 +01:00
|
|
|
|
2017-01-03 00:30:27 +01:00
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
setContentView(R.layout.activity_main);
|
2017-01-07 23:24:02 +01:00
|
|
|
|
2017-01-28 04:33:43 +01:00
|
|
|
// Fetch user info while we're doing other things.
|
|
|
|
fetchUserInfo();
|
|
|
|
|
2017-03-10 04:35:08 +01:00
|
|
|
//Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
|
|
|
//setSupportActionBar(toolbar);
|
2017-01-03 00:30:27 +01:00
|
|
|
|
2017-03-07 01:38:22 +01:00
|
|
|
FloatingActionButton floatingBtn = (FloatingActionButton) findViewById(R.id.floating_btn);
|
|
|
|
floatingBtn.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
Intent intent = new Intent(getApplicationContext(), ComposeActivity.class);
|
|
|
|
startActivity(intent);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-03-10 04:35:08 +01:00
|
|
|
final FloatingSearchView searchView = (FloatingSearchView) findViewById(R.id.floating_search_view);
|
|
|
|
|
2017-03-09 19:31:15 +01:00
|
|
|
headerResult = new AccountHeaderBuilder()
|
|
|
|
.withActivity(this)
|
|
|
|
.withSelectionListEnabledForSingleProfile(false)
|
2017-03-10 04:00:09 +01:00
|
|
|
.withDividerBelowHeader(false)
|
2017-03-09 19:31:15 +01:00
|
|
|
.withCompactStyle(true)
|
|
|
|
.build();
|
|
|
|
|
|
|
|
DrawerImageLoader.init(new AbstractDrawerImageLoader() {
|
|
|
|
@Override
|
|
|
|
public void set(ImageView imageView, Uri uri, Drawable placeholder) {
|
|
|
|
Picasso.with(imageView.getContext()).load(uri).placeholder(placeholder).into(imageView);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void cancel(ImageView imageView) {
|
|
|
|
Picasso.with(imageView.getContext()).cancelRequest(imageView);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
drawer = new DrawerBuilder()
|
|
|
|
.withActivity(this)
|
2017-03-10 04:35:08 +01:00
|
|
|
//.withToolbar(toolbar)
|
2017-03-09 19:31:15 +01:00
|
|
|
.withAccountHeader(headerResult)
|
|
|
|
.withHasStableIds(true)
|
|
|
|
.withSelectedItem(-1)
|
|
|
|
.addDrawerItems(
|
2017-03-10 04:00:09 +01:00
|
|
|
new PrimaryDrawerItem().withIdentifier(0).withName(R.string.action_view_profile).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_person),
|
|
|
|
new PrimaryDrawerItem().withIdentifier(1).withName(getString(R.string.action_view_favourites)).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_star),
|
|
|
|
new PrimaryDrawerItem().withIdentifier(2).withName(getString(R.string.action_view_blocks)).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_block),
|
|
|
|
new DividerDrawerItem(),
|
|
|
|
new SecondaryDrawerItem().withIdentifier(3).withName(getString(R.string.action_view_preferences)).withSelectable(false),
|
|
|
|
new SecondaryDrawerItem().withIdentifier(4).withName(getString(R.string.action_logout)).withSelectable(false)
|
2017-03-09 19:31:15 +01:00
|
|
|
)
|
|
|
|
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
|
|
|
|
@Override
|
|
|
|
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
|
|
|
|
if (drawerItem != null) {
|
|
|
|
long drawerItemIdentifier = drawerItem.getIdentifier();
|
|
|
|
|
2017-03-10 04:00:09 +01:00
|
|
|
if (drawerItemIdentifier == 0) {
|
|
|
|
Intent intent = new Intent(MainActivity.this, AccountActivity.class);
|
|
|
|
intent.putExtra("id", loggedInAccountId);
|
|
|
|
startActivity(intent);
|
|
|
|
} else if (drawerItemIdentifier == 1) {
|
2017-03-09 19:31:15 +01:00
|
|
|
Intent intent = new Intent(MainActivity.this, FavouritesActivity.class);
|
|
|
|
startActivity(intent);
|
|
|
|
} else if (drawerItemIdentifier == 2) {
|
|
|
|
Intent intent = new Intent(MainActivity.this, BlocksActivity.class);
|
|
|
|
startActivity(intent);
|
|
|
|
} else if (drawerItemIdentifier == 3) {
|
|
|
|
Intent intent = new Intent(MainActivity.this, PreferencesActivity.class);
|
|
|
|
startActivity(intent);
|
|
|
|
} else if (drawerItemIdentifier == 4) {
|
|
|
|
if (notificationServiceEnabled) {
|
|
|
|
alarmManager.cancel(serviceAlarmIntent);
|
|
|
|
}
|
|
|
|
SharedPreferences preferences = getSharedPreferences(
|
|
|
|
getString(R.string.preferences_file_key), Context.MODE_PRIVATE);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.remove("domain");
|
|
|
|
editor.remove("accessToken");
|
|
|
|
editor.apply();
|
|
|
|
Intent intent = new Intent(MainActivity.this, SplashActivity.class);
|
|
|
|
startActivity(intent);
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.build();
|
|
|
|
|
2017-03-10 04:35:08 +01:00
|
|
|
searchView.attachNavigationDrawerToMenuButton(drawer.getDrawerLayout());
|
|
|
|
|
2017-03-10 23:31:08 +01:00
|
|
|
searchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onSearchTextChanged(String oldQuery, String newQuery) {
|
|
|
|
if (!oldQuery.equals("") && newQuery.equals("")) {
|
|
|
|
searchView.clearSuggestions();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (newQuery.length() < 3) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
searchView.showProgress();
|
|
|
|
|
|
|
|
mastodonAPI.searchAccounts(newQuery, false, 5).enqueue(new Callback<List<Account>>() {
|
|
|
|
@Override
|
|
|
|
public void onResponse(Call<List<Account>> call, Response<List<Account>> response) {
|
|
|
|
searchView.swapSuggestions(response.body());
|
|
|
|
searchView.hideProgress();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(Call<List<Account>> call, Throwable t) {
|
|
|
|
searchView.hideProgress();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
searchView.setOnSearchListener(new FloatingSearchView.OnSearchListener() {
|
|
|
|
@Override
|
|
|
|
public void onSuggestionClicked(SearchSuggestion searchSuggestion) {
|
|
|
|
Account accountSuggestion = (Account) searchSuggestion;
|
|
|
|
Intent intent = new Intent(MainActivity.this, AccountActivity.class);
|
|
|
|
intent.putExtra("id", accountSuggestion.id);
|
|
|
|
startActivity(intent);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSearchAction(String currentQuery) {
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
searchView.setOnBindSuggestionCallback(new SearchSuggestionsAdapter.OnBindSuggestionCallback() {
|
|
|
|
@Override
|
|
|
|
public void onBindSuggestion(View suggestionView, ImageView leftIcon, TextView textView, SearchSuggestion item, int itemPosition) {
|
|
|
|
Account accountSuggestion = ((Account) item);
|
|
|
|
|
|
|
|
Picasso.with(MainActivity.this)
|
|
|
|
.load(accountSuggestion.avatar)
|
|
|
|
.placeholder(R.drawable.avatar_default)
|
|
|
|
.into(leftIcon);
|
|
|
|
|
|
|
|
String searchStr = accountSuggestion.getDisplayName() + " " + accountSuggestion.username;
|
|
|
|
final SpannableStringBuilder str = new SpannableStringBuilder(searchStr);
|
|
|
|
|
|
|
|
str.setSpan(new android.text.style.StyleSpan(Typeface.BOLD), 0, accountSuggestion.getDisplayName().length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
|
|
textView.setText(str);
|
|
|
|
textView.setMaxLines(1);
|
|
|
|
textView.setEllipsize(TextUtils.TruncateAt.END);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-01-25 05:35:54 +01:00
|
|
|
// Setup the tabs and timeline pager.
|
2017-02-22 20:13:51 +01:00
|
|
|
TimelinePagerAdapter adapter = new TimelinePagerAdapter(getSupportFragmentManager());
|
2017-01-07 23:24:02 +01:00
|
|
|
String[] pageTitles = {
|
2017-03-11 02:50:49 +01:00
|
|
|
getString(R.string.title_home),
|
|
|
|
getString(R.string.title_notifications),
|
|
|
|
getString(R.string.title_public)
|
2017-01-04 01:23:57 +01:00
|
|
|
};
|
2017-01-07 23:24:02 +01:00
|
|
|
adapter.setPageTitles(pageTitles);
|
2017-03-07 11:02:41 +01:00
|
|
|
viewPager = (ViewPager) findViewById(R.id.pager);
|
2017-02-13 06:18:17 +01:00
|
|
|
int pageMargin = getResources().getDimensionPixelSize(R.dimen.tab_page_margin);
|
2017-02-03 01:18:41 +01:00
|
|
|
viewPager.setPageMargin(pageMargin);
|
2017-02-17 03:11:05 +01:00
|
|
|
Drawable pageMarginDrawable = ThemeUtils.getDrawable(this, R.attr.tab_page_margin_drawable,
|
|
|
|
R.drawable.tab_page_margin_dark);
|
2017-03-03 01:25:35 +01:00
|
|
|
viewPager.setPageMarginDrawable(pageMarginDrawable);
|
2017-01-07 23:24:02 +01:00
|
|
|
viewPager.setAdapter(adapter);
|
2017-03-07 11:02:41 +01:00
|
|
|
|
2017-01-07 23:24:02 +01:00
|
|
|
TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
|
|
|
|
tabLayout.setupWithViewPager(viewPager);
|
2017-01-25 05:35:54 +01:00
|
|
|
|
2017-03-07 11:02:41 +01:00
|
|
|
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
|
|
|
@Override
|
|
|
|
public void onTabSelected(TabLayout.Tab tab) {
|
|
|
|
viewPager.setCurrentItem(tab.getPosition());
|
|
|
|
|
|
|
|
if (pageHistory.empty()) {
|
|
|
|
pageHistory.push(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pageHistory.contains(tab.getPosition())) {
|
|
|
|
pageHistory.remove(pageHistory.indexOf(tab.getPosition()));
|
|
|
|
}
|
|
|
|
|
|
|
|
pageHistory.push(tab.getPosition());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onTabUnselected(TabLayout.Tab tab) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onTabReselected(TabLayout.Tab tab) {
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-01-25 05:35:54 +01:00
|
|
|
// Retrieve notification update preference.
|
2017-02-05 08:34:55 +01:00
|
|
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
|
|
|
notificationServiceEnabled = preferences.getBoolean("pullNotifications", true);
|
|
|
|
String minutesString = preferences.getString("pullNotificationCheckInterval", "15");
|
|
|
|
long notificationCheckInterval = 60 * 1000 * Integer.valueOf(minutesString);
|
2017-01-31 05:51:02 +01:00
|
|
|
// Start up the PullNotificationsService.
|
2017-01-25 05:35:54 +01:00
|
|
|
alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
2017-01-31 05:51:02 +01:00
|
|
|
Intent intent = new Intent(this, PullNotificationService.class);
|
2017-01-25 05:35:54 +01:00
|
|
|
final int SERVICE_REQUEST_CODE = 8574603; // This number is arbitrary.
|
|
|
|
serviceAlarmIntent = PendingIntent.getService(this, SERVICE_REQUEST_CODE, intent,
|
|
|
|
PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
if (notificationServiceEnabled) {
|
|
|
|
alarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
|
|
|
|
SystemClock.elapsedRealtime(), notificationCheckInterval, serviceAlarmIntent);
|
|
|
|
} else {
|
|
|
|
alarmManager.cancel(serviceAlarmIntent);
|
|
|
|
}
|
2017-01-03 00:30:27 +01:00
|
|
|
}
|
|
|
|
|
2017-01-28 04:33:43 +01:00
|
|
|
private void fetchUserInfo() {
|
|
|
|
SharedPreferences preferences = getSharedPreferences(
|
|
|
|
getString(R.string.preferences_file_key), Context.MODE_PRIVATE);
|
2017-03-09 19:31:15 +01:00
|
|
|
final String domain = preferences.getString("domain", null);
|
2017-01-28 04:33:43 +01:00
|
|
|
String id = preferences.getString("loggedInAccountId", null);
|
|
|
|
String username = preferences.getString("loggedInAccountUsername", null);
|
2017-03-09 16:59:18 +01:00
|
|
|
|
2017-03-10 04:00:09 +01:00
|
|
|
if (id != null && username != null) {
|
|
|
|
loggedInAccountId = id;
|
|
|
|
loggedInAccountUsername = username;
|
|
|
|
}
|
|
|
|
|
|
|
|
mastodonAPI.accountVerifyCredentials().enqueue(new Callback<Account>() {
|
|
|
|
@Override
|
|
|
|
public void onResponse(Call<Account> call, retrofit2.Response<Account> response) {
|
|
|
|
Account me = response.body();
|
|
|
|
ImageView background = headerResult.getHeaderBackgroundView();
|
|
|
|
|
|
|
|
Picasso.with(MainActivity.this)
|
|
|
|
.load(me.header)
|
|
|
|
.placeholder(R.drawable.account_header_missing)
|
|
|
|
.resize(background.getWidth(), background.getHeight())
|
|
|
|
.centerCrop()
|
|
|
|
.into(background);
|
|
|
|
|
|
|
|
headerResult.addProfiles(
|
|
|
|
new ProfileDrawerItem()
|
2017-03-10 23:31:08 +01:00
|
|
|
.withName(me.getDisplayName())
|
2017-03-10 04:00:09 +01:00
|
|
|
.withEmail(String.format("%s@%s", me.username, domain))
|
|
|
|
.withIcon(me.avatar)
|
|
|
|
);
|
|
|
|
|
2017-03-10 23:31:08 +01:00
|
|
|
onFetchUserInfoSuccess(me.id, me.username);
|
2017-03-10 04:00:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(Call<Account> call, Throwable t) {
|
|
|
|
onFetchUserInfoFailure((Exception) t);
|
|
|
|
}
|
|
|
|
});
|
2017-01-28 04:33:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private void onFetchUserInfoSuccess(String id, String username) {
|
|
|
|
loggedInAccountId = id;
|
|
|
|
loggedInAccountUsername = username;
|
|
|
|
SharedPreferences preferences = getSharedPreferences(
|
|
|
|
getString(R.string.preferences_file_key), Context.MODE_PRIVATE);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putString("loggedInAccountId", loggedInAccountId);
|
|
|
|
editor.putString("loggedInAccountUsername", loggedInAccountUsername);
|
|
|
|
editor.apply();
|
|
|
|
}
|
|
|
|
|
2017-02-07 08:05:50 +01:00
|
|
|
private void onFetchUserInfoFailure(Exception exception) {
|
|
|
|
Log.e(TAG, "Failed to fetch user info. " + exception.getMessage());
|
2017-01-31 05:51:02 +01:00
|
|
|
}
|
|
|
|
|
2017-03-07 11:02:41 +01:00
|
|
|
@Override
|
|
|
|
public void onBackPressed() {
|
2017-03-09 19:31:15 +01:00
|
|
|
if(drawer != null && drawer.isDrawerOpen()) {
|
|
|
|
drawer.closeDrawer();
|
|
|
|
} else if(pageHistory.empty()) {
|
2017-03-07 11:02:41 +01:00
|
|
|
super.onBackPressed();
|
|
|
|
} else {
|
|
|
|
pageHistory.pop();
|
|
|
|
viewPager.setCurrentItem(pageHistory.lastElement());
|
|
|
|
}
|
|
|
|
}
|
2017-03-11 02:50:49 +01:00
|
|
|
}
|