Code formatting, removed dead code, fixed warning

This commit is contained in:
fkloft 2013-09-18 16:48:30 +02:00
parent daaef1575e
commit 1a1008c70e
5 changed files with 40 additions and 65 deletions

View File

@ -18,8 +18,6 @@ import android.content.res.Configuration;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@ -256,17 +254,13 @@ public class IITC_Mobile extends Activity {
throw use;
}
if (parts.length > 1) // query string present
{
if (parts.length > 1) { // query string present
// search for z=
for (String param : parts[1].split("&")) {
if (param.startsWith("z="))
{
try
{
if (param.startsWith("z=")) {
try {
z = Integer.valueOf(param.substring(2));
} catch (NumberFormatException e)
{
} catch (NumberFormatException e) {
URISyntaxException use = new URISyntaxException(uri.toString(), "could not parse zoom level");
use.initCause(e);
throw use;
@ -307,13 +301,6 @@ public class IITC_Mobile extends Activity {
@Override
protected void onStop() {
ConnectivityManager conMan =
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mobile = conMan
.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
Log.d("iitcm", "stopping iitcm");
mIitcWebView.loadUrl("javascript: window.idleSet();");
@ -651,8 +638,7 @@ public class IITC_Mobile extends Activity {
return super.getActionBar();
}
public ActionBarHelper getActionBarHelper()
{
public ActionBarHelper getActionBarHelper() {
return mActionBarHelper;
}
}

View File

@ -1,5 +1,13 @@
package com.cradle.iitc_mobile.async;
import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
@ -8,15 +16,6 @@ import android.util.Log;
import com.cradle.iitc_mobile.IITC_JSInterface;
import com.cradle.iitc_mobile.IITC_Mobile;
import com.cradle.iitc_mobile.IITC_WebView;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import java.io.IOException;
/*
* this class parses the http response of a web page.

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}