Add icon to tabs

This commit is contained in:
fkloft 2013-07-26 19:59:36 +02:00
parent 50d1b643fc
commit ffad17a33d
14 changed files with 10 additions and 4 deletions

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -16,6 +16,10 @@ public class IntentFragment extends Fragment implements OnScrollListener, OnItem
private IntentListView mListView; private IntentListView mListView;
private int mScrollIndex, mScrollTop; private int mScrollIndex, mScrollTop;
public int getIcon() {
return getArguments().getInt("icon");
}
public String getTitle() { public String getTitle() {
return getArguments().getString("title"); return getArguments().getString("title");
} }

View File

@ -20,12 +20,13 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
IntentFragmentAdapter mFragmentAdapter; IntentFragmentAdapter mFragmentAdapter;
ViewPager mViewPager; ViewPager mViewPager;
private void addTab(Intent intent, String label) private void addTab(Intent intent, String label, int icon)
{ {
IntentFragment fragment = new IntentFragment(); IntentFragment fragment = new IntentFragment();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putParcelable("intent", intent); args.putParcelable("intent", intent);
args.putString("title", label); args.putString("title", label);
args.putInt("icon", icon);
fragment.setArguments(args); fragment.setArguments(args);
mFragmentAdapter.add(fragment); mFragmentAdapter.add(fragment);
} }
@ -43,14 +44,14 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
intent.setType("text/plain"); intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, getUrl()); intent.putExtra(Intent.EXTRA_TEXT, getUrl());
intent.putExtra(Intent.EXTRA_SUBJECT, mTitle); intent.putExtra(Intent.EXTRA_SUBJECT, mTitle);
addTab(intent, "Share"); addTab(intent, "Share", R.drawable.share);
String geoUri = "geo:" + mLl; String geoUri = "geo:" + mLl;
intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(geoUri)); intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(geoUri));
addTab(intent, "Map"); addTab(intent, "Map", R.drawable.location_map);
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getUrl())); intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getUrl()));
addTab(intent, "Browser"); addTab(intent, "Browser", R.drawable.browser);
} }
@Override @Override
@ -91,6 +92,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
actionBar.addTab(actionBar actionBar.addTab(actionBar
.newTab() .newTab()
.setText(fragment.getTitle()) .setText(fragment.getTitle())
.setIcon(fragment.getIcon())
.setTabListener(this)); .setTabListener(this));
} }
} }