Removed unused drawable reference and save last tab on page selected

This commit is contained in:
Phillip Hsu 2016-09-26 17:52:34 -07:00
parent 1ca23e4a5f
commit 9fe07c763f
2 changed files with 6 additions and 12 deletions

View File

@ -1,8 +1,6 @@
package com.philliphsu.clock2; package com.philliphsu.clock2;
import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.PersistableBundle; import android.os.PersistableBundle;
@ -48,7 +46,6 @@ public class MainActivity extends BaseActivity {
* {@link android.support.v4.app.FragmentStatePagerAdapter}. * {@link android.support.v4.app.FragmentStatePagerAdapter}.
*/ */
private SectionsPagerAdapter mSectionsPagerAdapter; private SectionsPagerAdapter mSectionsPagerAdapter;
private Drawable mAddItemDrawable;
@Bind(R.id.container) @Bind(R.id.container)
ViewPager mViewPager; ViewPager mViewPager;
@ -194,15 +191,8 @@ public class MainActivity extends BaseActivity {
mViewPager.removeOnPageChangeListener(mModifyFabPositionListener); mViewPager.removeOnPageChangeListener(mModifyFabPositionListener);
} }
@SuppressLint("CommitPrefEdits")
@Override @Override
protected void onDestroy() { protected void onDestroy() {
final int currentTab = mViewPager.getCurrentItem();
PreferenceManager.getDefaultSharedPreferences(this)
.edit()
.putInt(getString(R.string.key_last_tab), currentTab)
.commit();
super.onDestroy(); super.onDestroy();
this.mModifyFabPositionListener = null; this.mModifyFabPositionListener = null;
} }
@ -382,6 +372,12 @@ public class MainActivity extends BaseActivity {
if (f != null) { if (f != null) {
f.onPageSelected(); f.onPageSelected();
} }
final int currentTab = mViewPager.getCurrentItem();
PreferenceManager.getDefaultSharedPreferences(mViewPager.getContext())
.edit()
.putInt(LAST_TAB, currentTab)
.commit();
} }
} }
} }

View File

@ -71,8 +71,6 @@ public class StopwatchFragment extends RecyclerViewFragment<
// onCreateView() or any other callback that is guaranteed to be called. // onCreateView() or any other callback that is guaranteed to be called.
mStartDrawable = ContextCompat.getDrawable(getActivity(), R.drawable.ic_start_24dp); mStartDrawable = ContextCompat.getDrawable(getActivity(), R.drawable.ic_start_24dp);
mPauseDrawable = ContextCompat.getDrawable(getActivity(), R.drawable.ic_pause_24dp); mPauseDrawable = ContextCompat.getDrawable(getActivity(), R.drawable.ic_pause_24dp);
// TODO: Load the current lap here
} }
@Nullable @Nullable