some code formatting

This commit is contained in:
Philipp Schaefer 2013-10-04 16:15:58 +02:00
parent 26754ac8c0
commit 709af1a9d9
11 changed files with 37 additions and 47 deletions

View File

@ -18,7 +18,7 @@ import java.util.Locale;
// provide communication between IITC script and android app
public class IITC_JSInterface {
// context of main activity
private IITC_Mobile mIitc;
private final IITC_Mobile mIitc;
IITC_JSInterface(IITC_Mobile iitc) {
mIitc = iitc;

View File

@ -22,7 +22,7 @@ import java.util.Comparator;
public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickListener, OnItemLongClickListener {
private class HighlighterAdapter extends ArrayAdapter<String> {
private HighlighterComparator mComparator = new HighlighterComparator();
private final HighlighterComparator mComparator = new HighlighterComparator();
private HighlighterAdapter(int resource) {
super(mIitc, resource);
@ -67,8 +67,7 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
}
}
private class LayerAdapter extends ArrayAdapter<Layer>
{
private class LayerAdapter extends ArrayAdapter<Layer> {
public LayerAdapter(int resource) {
super(mIitc, resource);
}
@ -84,15 +83,15 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
}
}
private IITC_Mobile mIitc;
private final IITC_Mobile mIitc;
private ArrayAdapter<String> mHighlighters;
private ArrayAdapter<Layer> mBaseLayers;
private ArrayAdapter<Layer> mOverlayLayers;
private final ArrayAdapter<String> mHighlighters;
private final ArrayAdapter<Layer> mBaseLayers;
private final ArrayAdapter<Layer> mOverlayLayers;
private Spinner mSpinnerBaseMap;
private Spinner mSpinnerHighlighter;
private ListView mListViewOverlayLayers;
private final Spinner mSpinnerBaseMap;
private final Spinner mSpinnerHighlighter;
private final ListView mListViewOverlayLayers;
private String mActiveHighlighter;
private int mActiveLayer;
@ -181,8 +180,7 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
if (parent.equals(mSpinnerHighlighter)) {
String name = mHighlighters.getItem(position);
mIitc.getWebView().loadUrl("javascript: window.changePortalHighlights('" + name + "')");
}
else if (parent.equals(mSpinnerBaseMap)) {
} else if (parent.equals(mSpinnerBaseMap)) {
mBaseLayers.getItem(mActiveLayer).active = false; // set old layer to hidden, but no need to really hide
Layer layer = mBaseLayers.getItem(position);
@ -253,7 +251,6 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
mBaseLayers.add(layer);
} catch (JSONException e) {
e.printStackTrace();
continue;
}
}
mBaseLayers.notifyDataSetChanged();
@ -273,7 +270,6 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
mOverlayLayers.add(layer);
} catch (JSONException e) {
e.printStackTrace();
continue;
}
}
mOverlayLayers.notifyDataSetChanged();

View File

@ -283,8 +283,7 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
if (mReloadNeeded) {
Log.d("iitcm", "preference had changed...reload needed");
reloadIITC();
}
else {
} else {
// iitc is not fully booted...timer will be reset by the script itself
if (findViewById(R.id.imageLoading).getVisibility() == View.GONE) {
mIitcWebView.loadUrl("javascript: window.idleReset();");
@ -353,7 +352,6 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
if (mBackButtonPressed || !mSharedPrefs.getBoolean("pref_press_twice_to_exit", false)) {
super.onBackPressed();
return;
} else {
mBackButtonPressed = true;
Toast.makeText(this, "Press twice to exit", Toast.LENGTH_SHORT).show();
@ -621,8 +619,8 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
}
/**
* @deprecated ActionBar related stuff should be handled by IITC_NavigationHelper
* @see getNavigationHelper()
* @deprecated ActionBar related stuff should be handled by IITC_NavigationHelper
*/
@Deprecated
@Override

View File

@ -60,8 +60,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
view.setText(getPaneTitle(item));
int icon = 0;
switch (item)
{
switch (item) {
case MAP:
icon = R.drawable.location_map;
break;
@ -100,13 +99,13 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
public static final int NOTICE_INFO = 1 << 1;
// next one would be 1<<2; (this results in 1,2,4,8,...)
private IITC_Mobile mIitc;
private ActionBar mActionBar;
private SharedPreferences mPrefs;
private NavigationAdapter mNavigationAdapter;
private DrawerLayout mDrawerLayout;
private ListView mDrawerLeft;
private View mDrawerRight;
private final IITC_Mobile mIitc;
private final ActionBar mActionBar;
private final SharedPreferences mPrefs;
private final NavigationAdapter mNavigationAdapter;
private final DrawerLayout mDrawerLayout;
private final ListView mDrawerLeft;
private final View mDrawerRight;
private boolean mDesktopMode = false;
private boolean mFullscreen = false;
@ -236,8 +235,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
mDrawerLayout.closeDrawers();
}
public String getPaneTitle(Pane pane)
{
public String getPaneTitle(Pane pane) {
switch (pane) {
case INFO:
return "Info";

View File

@ -227,7 +227,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
// now we have all stuff together and can build the preference
// first check if we need a new category
if (sPlugins.containsKey(plugin_cat) == false) {
if (!sPlugins.containsKey(plugin_cat)) {
sPlugins.put(plugin_cat, new ArrayList<IITC_PluginPreference>());
Log.d("iitcm", "create " + plugin_cat + " and add " + plugin_name);
}
@ -288,7 +288,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
TextView summary;
}
private LayoutInflater mInflater;
private final LayoutInflater mInflater;
static int getHeaderType(Header header) {
if (header.fragment == null && header.intent == null) {

View File

@ -24,13 +24,13 @@ import java.io.IOException;
*/
public class CheckHttpResponse extends AsyncTask<String, Void, Boolean> {
private IITC_JSInterface mJsInterface;
private Context mContext;
private final IITC_JSInterface mJsInterface;
private final Context mContext;
public CheckHttpResponse(IITC_JSInterface jsInterface, Context c) {
mContext = c;
mJsInterface = jsInterface;
};
}
@Override
protected Boolean doInBackground(String... urls) {

View File

@ -8,7 +8,7 @@ import java.util.ArrayList;
import java.util.List;
public class IntentFragmentAdapter extends FragmentPagerAdapter {
private List<IntentFragment> mTabs;
private final List<IntentFragment> mTabs;
public IntentFragmentAdapter(FragmentManager fm) {
super(fm);

View File

@ -74,7 +74,7 @@ public class IntentListView extends ListView {
private IntentAdapter mAdapter;
private PackageManager mPackageManager;
HashMap<ComponentName, Intent> mActivities = new HashMap<ComponentName, Intent>();
private final HashMap<ComponentName, Intent> mActivities = new HashMap<ComponentName, Intent>();
public IntentListView(Context context) {
super(context);
@ -155,7 +155,6 @@ public class IntentListView extends ListView {
if (hasCopyIntent || !activity.name.equals(SendToClipboard.class.getCanonicalName())) {
activityList.remove(i);
i--;
continue;
}
}
}
@ -172,8 +171,7 @@ public class IntentListView extends ListView {
if (resolveInfo.activityInfo.packageName.equals(defaultTarget.activityInfo.packageName)
&& resolveInfo.activityInfo.name.equals(defaultTarget.activityInfo.name)) {
allActivities.add(0, resolveInfo);
}
else {
} else {
allActivities.add(resolveInfo);
}
}

View File

@ -108,7 +108,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
Intent intent = getIntent();
// from portallinks/permalinks we build 3 intents (share / geo / vanilla-intel-link)
if (intent.getBooleanExtra("onlyShare", false) == false) {
if (!intent.getBooleanExtra("onlyShare", false)) {
mTitle = intent.getStringExtra("title");
mLl = intent.getDoubleExtra("lat", 0) + "," + intent.getDoubleExtra("lng", 0);
mZoom = intent.getIntExtra("zoom", 0);