Code formatting, removed dead code, fixed warning
This commit is contained in:
@ -42,8 +42,7 @@ public class IntentFragment extends Fragment implements OnScrollListener, OnItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
||||
{
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Intent intent = mListView.getTargetIntent(position);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
@ -35,10 +35,8 @@ public class IntentListView extends ListView {
|
||||
}
|
||||
}
|
||||
|
||||
private class IntentAdapter extends ArrayAdapter<ResolveInfo>
|
||||
{
|
||||
private IntentAdapter()
|
||||
{
|
||||
private class IntentAdapter extends ArrayAdapter<ResolveInfo> {
|
||||
private IntentAdapter() {
|
||||
super(IntentListView.this.getContext(), android.R.layout.simple_list_item_1);
|
||||
}
|
||||
|
||||
@ -126,8 +124,7 @@ public class IntentListView extends ListView {
|
||||
setIntents(intentList);
|
||||
}
|
||||
|
||||
public void setIntents(ArrayList<Intent> intents)
|
||||
{
|
||||
public void setIntents(ArrayList<Intent> intents) {
|
||||
mAdapter.setNotifyOnChange(false);
|
||||
mAdapter.clear();
|
||||
|
||||
@ -154,10 +151,8 @@ public class IntentListView extends ListView {
|
||||
ActivityInfo activity = info.activityInfo;
|
||||
|
||||
// remove all IITCm intents, except for SendToClipboard in case Drive is not installed
|
||||
if (activity.packageName.equals(packageName))
|
||||
{
|
||||
if (hasCopyIntent || !activity.name.equals(SendToClipboard.class.getCanonicalName()))
|
||||
{
|
||||
if (activity.packageName.equals(packageName)) {
|
||||
if (hasCopyIntent || !activity.name.equals(SendToClipboard.class.getCanonicalName())) {
|
||||
activityList.remove(i);
|
||||
i--;
|
||||
continue;
|
||||
|
@ -1,5 +1,9 @@
|
||||
package com.cradle.iitc_mobile.share;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Intent;
|
||||
@ -14,11 +18,6 @@ import android.view.MenuItem;
|
||||
|
||||
import com.cradle.iitc_mobile.R;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ShareActivity extends FragmentActivity implements ActionBar.TabListener {
|
||||
private boolean mIsPortal;
|
||||
private String mLl;
|
||||
@ -28,15 +27,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
||||
IntentFragmentAdapter mFragmentAdapter;
|
||||
ViewPager mViewPager;
|
||||
|
||||
private void addTab(Intent intent, int label, int icon)
|
||||
{
|
||||
ArrayList<Intent> intents = new ArrayList<Intent>(1);
|
||||
intents.add(intent);
|
||||
addTab(intents, label, icon);
|
||||
}
|
||||
|
||||
private void addTab(ArrayList<Intent> intents, int label, int icon)
|
||||
{
|
||||
private void addTab(ArrayList<Intent> intents, int label, int icon) {
|
||||
IntentFragment fragment = new IntentFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelableArrayList("intents", intents);
|
||||
@ -46,6 +37,12 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
||||
mFragmentAdapter.add(fragment);
|
||||
}
|
||||
|
||||
private void addTab(Intent intent, int label, int icon) {
|
||||
ArrayList<Intent> intents = new ArrayList<Intent>(1);
|
||||
intents.add(intent);
|
||||
addTab(intents, label, icon);
|
||||
}
|
||||
|
||||
private String getUrl() {
|
||||
String url = "http://www.ingress.com/intel?ll=" + mLl + "&z=" + mZoom;
|
||||
if (mIsPortal)
|
||||
@ -64,15 +61,6 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
||||
.apply();
|
||||
}
|
||||
|
||||
private void setupShareIntent(String str) {
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, str);
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, mTitle);
|
||||
addTab(intent, R.string.tab_share, R.drawable.share);
|
||||
}
|
||||
|
||||
private void setupIntents() {
|
||||
setupShareIntent(getUrl());
|
||||
|
||||
@ -98,6 +86,15 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
||||
addTab(intent, R.string.tab_browser, R.drawable.browser);
|
||||
}
|
||||
|
||||
private void setupShareIntent(String str) {
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, str);
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, mTitle);
|
||||
addTab(intent, R.string.tab_share, R.drawable.share);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -146,8 +143,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
||||
|
||||
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
int selected = mSharedPrefs.getInt("pref_share_selected_tab", 0);
|
||||
if (selected < mFragmentAdapter.getCount())
|
||||
{
|
||||
if (selected < mFragmentAdapter.getCount()) {
|
||||
mViewPager.setCurrentItem(selected);
|
||||
actionBar.setSelectedNavigationItem(selected);
|
||||
}
|
||||
|
Reference in New Issue
Block a user