Removed unused drawable reference and save last tab on page selected
This commit is contained in:
parent
1ca23e4a5f
commit
9fe07c763f
@ -1,8 +1,6 @@
|
||||
package com.philliphsu.clock2;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PersistableBundle;
|
||||
@ -48,7 +46,6 @@ public class MainActivity extends BaseActivity {
|
||||
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
|
||||
*/
|
||||
private SectionsPagerAdapter mSectionsPagerAdapter;
|
||||
private Drawable mAddItemDrawable;
|
||||
|
||||
@Bind(R.id.container)
|
||||
ViewPager mViewPager;
|
||||
@ -194,15 +191,8 @@ public class MainActivity extends BaseActivity {
|
||||
mViewPager.removeOnPageChangeListener(mModifyFabPositionListener);
|
||||
}
|
||||
|
||||
@SuppressLint("CommitPrefEdits")
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
final int currentTab = mViewPager.getCurrentItem();
|
||||
PreferenceManager.getDefaultSharedPreferences(this)
|
||||
.edit()
|
||||
.putInt(getString(R.string.key_last_tab), currentTab)
|
||||
.commit();
|
||||
|
||||
super.onDestroy();
|
||||
this.mModifyFabPositionListener = null;
|
||||
}
|
||||
@ -382,6 +372,12 @@ public class MainActivity extends BaseActivity {
|
||||
if (f != null) {
|
||||
f.onPageSelected();
|
||||
}
|
||||
|
||||
final int currentTab = mViewPager.getCurrentItem();
|
||||
PreferenceManager.getDefaultSharedPreferences(mViewPager.getContext())
|
||||
.edit()
|
||||
.putInt(LAST_TAB, currentTab)
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,8 +71,6 @@ public class StopwatchFragment extends RecyclerViewFragment<
|
||||
// onCreateView() or any other callback that is guaranteed to be called.
|
||||
mStartDrawable = ContextCompat.getDrawable(getActivity(), R.drawable.ic_start_24dp);
|
||||
mPauseDrawable = ContextCompat.getDrawable(getActivity(), R.drawable.ic_pause_24dp);
|
||||
|
||||
// TODO: Load the current lap here
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Loading…
Reference in New Issue
Block a user