diff options
Diffstat (limited to 'src/net/cbaines/suma/AboutActivity.java')
-rw-r--r-- | src/net/cbaines/suma/AboutActivity.java | 118 |
1 files changed, 60 insertions, 58 deletions
diff --git a/src/net/cbaines/suma/AboutActivity.java b/src/net/cbaines/suma/AboutActivity.java index a455d70..74e0249 100644 --- a/src/net/cbaines/suma/AboutActivity.java +++ b/src/net/cbaines/suma/AboutActivity.java @@ -30,72 +30,74 @@ import android.util.Log; public class AboutActivity extends PreferenceActivity { - static final int DONATE_DIALOG_ID = 0; + static final int DONATE_DIALOG_ID = 0; - private static final String KEY_ABOUT_LICENSE = "about_license"; - private static final String KEY_ABOUT_PROJECT = "about_project"; - private static final String KEY_ABOUT_DEVELOPER = "about_developer"; - private static final String KEY_ABOUT_DATA = "about_data"; - private static final String KEY_ABOUT_ANDROID_MARKET = "about_android_market"; - private static final String KEY_ABOUT_MAP_DATA = "about_map_data"; - private static final String KEY_ABOUT_MAP_ICONS = "about_map_icons"; - private static final String KEY_ABOUT_OSM_MAP = "about_osm_map"; - private static final String KEY_ABOUT_MAP_TILES = "about_map_tiles"; - private static final String KEY_ABOUT_DATABASE = "about_database"; - private static final String KEY_ABOUT_DONATE = "about_donate"; + private static final String KEY_ABOUT_LICENSE = "about_license"; + private static final String KEY_ABOUT_PROJECT = "about_project"; + private static final String KEY_ABOUT_DEVELOPER = "about_developer"; + private static final String KEY_ABOUT_DATA = "about_data"; + private static final String KEY_ABOUT_ANDROID_MARKET = "about_android_market"; + private static final String KEY_ABOUT_MAP_DATA = "about_map_data"; + private static final String KEY_ABOUT_MAP_ICONS = "about_map_icons"; + private static final String KEY_ABOUT_OSM_MAP = "about_osm_map"; + private static final String KEY_ABOUT_MAP_TILES = "about_map_tiles"; + private static final String KEY_ABOUT_DATABASE = "about_database"; + private static final String KEY_ABOUT_DONATE = "about_donate"; - private static final String TAG = "AboutActivity"; + private static final String TAG = "AboutActivity"; - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); - addPreferencesFromResource(R.xml.about); - } + addPreferencesFromResource(R.xml.about); + } - @Override - public boolean onPreferenceTreeClick(final PreferenceScreen preferenceScreen, final Preference preference) { - try { - final String key = preference.getKey(); - if (KEY_ABOUT_LICENSE.equals(key)) { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.gnu.org/licenses/gpl-2.0.html"))); - } else if (KEY_ABOUT_PROJECT.equals(key)) { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/cbaines/SouthamptonUniversityMap"))); - } else if (KEY_ABOUT_DEVELOPER.equals(key)) { - Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); - emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "cbaines8@gmail.com" }); - emailIntent.setType("text/plain"); + @Override + public boolean onPreferenceTreeClick(final PreferenceScreen preferenceScreen, final Preference preference) { + try { + final String key = preference.getKey(); + if (KEY_ABOUT_LICENSE.equals(key)) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.gnu.org/licenses/gpl-2.0.html"))); + } else if (KEY_ABOUT_PROJECT.equals(key)) { + startActivity(new Intent(Intent.ACTION_VIEW, + Uri.parse("https://github.com/cbaines/SouthamptonUniversityMap"))); + } else if (KEY_ABOUT_DEVELOPER.equals(key)) { + Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); + emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "cbaines8@gmail.com" }); + emailIntent.setType("text/plain"); - startActivity(Intent.createChooser(emailIntent, "Email the developer")); - } else if (KEY_ABOUT_DATA.equals(key)) { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://data.southampton.ac.uk/bus-routes.html"))); - } else if (KEY_ABOUT_ANDROID_MARKET.equals(key)) { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=net.cbaines.suma"))); - } else if (KEY_ABOUT_MAP_DATA.equals(key)) { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(String.format("http://data.southampton.ac.uk/places.html")))); - } else if (KEY_ABOUT_MAP_ICONS.equals(key)) { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://mapicons.nicolasmollet.com/"))); - } else if (KEY_ABOUT_OSM_MAP.equals(key)) { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.openstreetmap.org/"))); - } else if (KEY_ABOUT_MAP_TILES.equals(key)) { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.mapquest.com/"))); - } else if (KEY_ABOUT_DATABASE.equals(key)) { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(String.format("http://ormlite.com/")))); - } else if (KEY_ABOUT_DONATE.equals(key)) { - showDialog(DONATE_DIALOG_ID); - } - } catch (Exception e) { - Log.e("Error opening one of the icons", TAG, e); + startActivity(Intent.createChooser(emailIntent, "Email the developer")); + } else if (KEY_ABOUT_DATA.equals(key)) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://data.southampton.ac.uk/bus-routes.html"))); + } else if (KEY_ABOUT_ANDROID_MARKET.equals(key)) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=net.cbaines.suma"))); + } else if (KEY_ABOUT_MAP_DATA.equals(key)) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(String + .format("http://data.southampton.ac.uk/places.html")))); + } else if (KEY_ABOUT_MAP_ICONS.equals(key)) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://mapicons.nicolasmollet.com/"))); + } else if (KEY_ABOUT_OSM_MAP.equals(key)) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.openstreetmap.org/"))); + } else if (KEY_ABOUT_MAP_TILES.equals(key)) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.mapquest.com/"))); + } else if (KEY_ABOUT_DATABASE.equals(key)) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(String.format("http://ormlite.com/")))); + } else if (KEY_ABOUT_DONATE.equals(key)) { + showDialog(DONATE_DIALOG_ID); + } + } catch (Exception e) { + Log.e("Error opening one of the icons", TAG, e); + } + return false; } - return false; - } - protected Dialog onCreateDialog(int id) { - switch (id) { - case DONATE_DIALOG_ID: - DonateDialog donateDialog = new DonateDialog(this); - return donateDialog; + protected Dialog onCreateDialog(int id) { + switch (id) { + case DONATE_DIALOG_ID: + DonateDialog donateDialog = new DonateDialog(this); + return donateDialog; + } + return null; } - return null; - } } |