Show frequently used intents on top

This commit is contained in:
fkloft
2013-11-04 23:59:23 +01:00
parent b63d3311f6
commit dae674d63f
4 changed files with 217 additions and 32 deletions

View File

@@ -19,13 +19,14 @@ import java.net.URLEncoder;
import java.util.ArrayList;
public class ShareActivity extends FragmentActivity implements ActionBar.TabListener {
private IntentComparator mComparator;
private IntentFragmentAdapter mFragmentAdapter;
private boolean mIsPortal;
private String mLl;
private SharedPreferences mSharedPrefs = null;
private String mTitle;
private ViewPager mViewPager;
private int mZoom;
IntentFragmentAdapter mFragmentAdapter;
ViewPager mViewPager;
private void addTab(ArrayList<Intent> intents, int label, int icon) {
IntentFragment fragment = new IntentFragment();
@@ -53,9 +54,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
private void setSelected(int position) {
// Activity not fully loaded yet (may occur during tab creation)
if (mSharedPrefs == null) {
return;
}
if (mSharedPrefs == null) { return; }
mSharedPrefs
.edit()
@@ -102,6 +101,8 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_share);
mComparator = new IntentComparator(this);
mFragmentAdapter = new IntentFragmentAdapter(getSupportFragmentManager());
final ActionBar actionBar = getActionBar();
@@ -158,6 +159,16 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
}
}
@Override
protected void onDestroy() {
super.onDestroy();
mComparator.save();
}
public IntentComparator getIntentComparator() {
return mComparator;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {