Add icon to tabs
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
BIN
mobile/res/drawable-hdpi/copy.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
BIN
mobile/res/drawable-mdpi/copy.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
BIN
mobile/res/drawable-xhdpi/copy.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@ -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");
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|