reformat code

This commit is contained in:
Philipp Schaefer
2013-10-22 20:05:58 +02:00
parent 7fae77099f
commit 3d7192ecd6
12 changed files with 120 additions and 66 deletions

View File

@ -33,8 +33,9 @@ public class IntentFragment extends Fragment implements OnScrollListener, OnItem
mIntents = args.getParcelableArrayList("intents");
mListView = new IntentListView(getActivity());
mListView.setIntents(mIntents);
if (mScrollIndex != -1 && mScrollTop != -1)
if (mScrollIndex != -1 && mScrollTop != -1) {
mListView.setSelectionFromTop(mScrollIndex, mScrollTop);
}
mListView.setOnScrollListener(this);
mListView.setOnItemClickListener(this);

View File

@ -60,8 +60,9 @@ public class IntentListView extends ListView {
private static final HashSet<CopyHandler> KNOWN_COPY_HANDLERS = new HashSet<CopyHandler>();
private static void setupKnownCopyHandlers() {
if (!KNOWN_COPY_HANDLERS.isEmpty())
if (!KNOWN_COPY_HANDLERS.isEmpty()) {
return;
}
KNOWN_COPY_HANDLERS.add(new CopyHandler(
"com.google.android.apps.docs",
@ -141,8 +142,9 @@ public class IntentListView extends ListView {
for (ResolveInfo resolveInfo : activityList) { // search for "Copy to clipboard" handler
CopyHandler handler = new CopyHandler(resolveInfo);
if (KNOWN_COPY_HANDLERS.contains(handler))
if (KNOWN_COPY_HANDLERS.contains(handler)) {
hasCopyIntent = true;
}
}
// use traditional loop since list may change during iteration

View File

@ -45,15 +45,17 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
private String getUrl() {
String url = "http://www.ingress.com/intel?ll=" + mLl + "&z=" + mZoom;
if (mIsPortal)
if (mIsPortal) {
url += "&pll=" + mLl;
}
return url;
}
private void setSelected(int position) {
// Activity not fully loaded yet (may occur during tab creation)
if (mSharedPrefs == null)
if (mSharedPrefs == null) {
return;
}
mSharedPrefs
.edit()
@ -125,8 +127,9 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD)
if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD) {
actionBar.setSelectedNavigationItem(position);
}
setSelected(position);
}
});
@ -141,15 +144,17 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
.setTabListener(this));
}
if (mFragmentAdapter.getCount() > 1)
if (mFragmentAdapter.getCount() > 1) {
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
}
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
int selected = mSharedPrefs.getInt("pref_share_selected_tab", 0);
if (selected < mFragmentAdapter.getCount()) {
mViewPager.setCurrentItem(selected);
if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD)
if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD) {
actionBar.setSelectedNavigationItem(selected);
}
}
}