diff options
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/cgeo/geocaching/AboutActivity.java | 71 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/MainActivity.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/StaticMapsActivity.java | 61 |
3 files changed, 50 insertions, 84 deletions
diff --git a/main/src/cgeo/geocaching/AboutActivity.java b/main/src/cgeo/geocaching/AboutActivity.java index 3164602..f947655 100644 --- a/main/src/cgeo/geocaching/AboutActivity.java +++ b/main/src/cgeo/geocaching/AboutActivity.java @@ -1,85 +1,72 @@ package cgeo.geocaching; -import butterknife.InjectView; - import cgeo.geocaching.activity.AbstractActivity; import cgeo.geocaching.ui.AnchorAwareLinkMovementMethod; import cgeo.geocaching.utils.Version; +import com.googlecode.androidannotations.annotations.AfterViews; +import com.googlecode.androidannotations.annotations.Click; +import com.googlecode.androidannotations.annotations.EActivity; +import com.googlecode.androidannotations.annotations.ViewById; + import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import android.view.View; import android.widget.TextView; +@EActivity public class AboutActivity extends AbstractActivity { - @InjectView(R.id.about_version_string) protected TextView version; - @InjectView(R.id.contributors) protected TextView contributors; - @InjectView(R.id.changelog) protected TextView changeLog; + @ViewById(R.id.about_version_string) protected TextView version; + @ViewById(R.id.contributors) protected TextView contributors; + @ViewById(R.id.changelog) protected TextView changeLog; @Override public void onCreate(Bundle savedInstanceState) { + // TODO remove this after the theme has been fixed super.onCreate(savedInstanceState, R.layout.about_activity); + } + @AfterViews + void initializeViews() { version.setText(Version.getVersionName(this)); contributors.setMovementMethod(AnchorAwareLinkMovementMethod.getInstance()); changeLog.setMovementMethod(AnchorAwareLinkMovementMethod.getInstance()); } - /** - * @param view - * unused here but needed since this method is referenced from XML layout - */ - public void donate(View view) { + @Click(R.id.donate) + public void donate() { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FMLNN8GXZKJEE"))); } - /** - * @param view - * unused here but needed since this method is referenced from XML layout - */ - public void support(View view) { + @Click(R.id.support) + public void support() { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:support@cgeo.org"))); } - /** - * @param view - * unused here but needed since this method is referenced from XML layout - */ - public void website(View view) { + + @Click(R.id.website) + void webSite() { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.cgeo.org/"))); } - /** - * @param view - * unused here but needed since this method is referenced from XML layout - */ - public void facebook(View view) { + @Click(R.id.facebook) + public void facebook() { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.facebook.com/pages/cgeo/297269860090"))); } - /** - * @param view - * unused here but needed since this method is referenced from XML layout - */ - public void twitter(View view) { + @Click(R.id.twitter) + public void twitter() { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://twitter.com/android_gc"))); } - /** - * @param view - * unused here but needed since this method is referenced from XML layout - */ - public void nutshellmanual(View view) { + @Click(R.id.nutshellmanual) + public void nutshellmanual() { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://manual.cgeo.org/"))); } - /** - * @param view - * unused here but needed since this method is referenced from XML layout - */ - public void market(View view) { - Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName())); + @Click(R.id.market) + public void market() { + final Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName())); marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(marketIntent); } diff --git a/main/src/cgeo/geocaching/MainActivity.java b/main/src/cgeo/geocaching/MainActivity.java index 87f7ffd..e8de1f7 100644 --- a/main/src/cgeo/geocaching/MainActivity.java +++ b/main/src/cgeo/geocaching/MainActivity.java @@ -756,7 +756,7 @@ public class MainActivity extends AbstractActivity { * unused here but needed since this method is referenced from XML layout */ public void showAbout(View view) { - startActivity(new Intent(this, AboutActivity.class)); + AboutActivity_.intent(this).start(); } /** diff --git a/main/src/cgeo/geocaching/StaticMapsActivity.java b/main/src/cgeo/geocaching/StaticMapsActivity.java index a6a81d5..d8bc614 100644 --- a/main/src/cgeo/geocaching/StaticMapsActivity.java +++ b/main/src/cgeo/geocaching/StaticMapsActivity.java @@ -1,36 +1,43 @@ package cgeo.geocaching; +import cgeo.geocaching.StaticMapsActivity_.IntentBuilder_; import cgeo.geocaching.activity.AbstractActivity; import cgeo.geocaching.enumerations.LoadFlags; import cgeo.geocaching.utils.Log; +import com.googlecode.androidannotations.annotations.EActivity; +import com.googlecode.androidannotations.annotations.Extra; +import com.googlecode.androidannotations.annotations.OptionsItem; +import com.googlecode.androidannotations.annotations.OptionsMenu; + import org.apache.commons.collections.CollectionUtils; import android.app.ProgressDialog; import android.content.Context; -import android.content.Intent; import android.graphics.Bitmap; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuItem; import android.widget.ImageView; import android.widget.LinearLayout; import java.util.ArrayList; import java.util.List; +@EActivity +@OptionsMenu(R.menu.static_maps_activity_options) public class StaticMapsActivity extends AbstractActivity { private static final String EXTRAS_WAYPOINT = "waypoint"; private static final String EXTRAS_DOWNLOAD = "download"; private static final String EXTRAS_GEOCODE = "geocode"; + + @Extra(EXTRAS_DOWNLOAD) boolean download = false; + @Extra(EXTRAS_WAYPOINT) Integer waypoint_id = null; + @Extra(EXTRAS_GEOCODE) String geocode = null; + private final List<Bitmap> maps = new ArrayList<Bitmap>(); - private boolean download = false; - private Integer waypoint_id = null; - private String geocode = null; private LayoutInflater inflater = null; private ProgressDialog waitDialog = null; private LinearLayout smapsView = null; @@ -89,18 +96,6 @@ public class StaticMapsActivity extends AbstractActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState, R.layout.map_static); - // get parameters - final Bundle extras = getIntent().getExtras(); - - // try to get data from extras - if (extras != null) { - download = extras.getBoolean(EXTRAS_DOWNLOAD, false); - geocode = extras.getString(EXTRAS_GEOCODE); - if (extras.containsKey(EXTRAS_WAYPOINT)) { - waypoint_id = extras.getInt(EXTRAS_WAYPOINT); - } - } - if (geocode == null) { showToast("Sorry, c:geo forgot for what cache you want to load static maps."); finish(); @@ -156,20 +151,10 @@ public class StaticMapsActivity extends AbstractActivity { } } - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.static_maps_activity_options, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == R.id.menu_refresh) { - downloadStaticMaps(); - restartActivity(); - return true; - } - return super.onOptionsItemSelected(item); + @OptionsItem(R.id.menu_refresh) + void refreshMaps() { + downloadStaticMaps(); + restartActivity(); } private boolean downloadStaticMaps() { @@ -192,16 +177,10 @@ public class StaticMapsActivity extends AbstractActivity { } public static void startActivity(final Context activity, final String geocode, final boolean download, final Waypoint waypoint) { - final Intent intent = new Intent(activity, StaticMapsActivity.class); - // if resuming our app within this activity, finish it and return to the cache activity - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); - intent.putExtra(EXTRAS_GEOCODE, geocode); - if (download) { - intent.putExtra(EXTRAS_DOWNLOAD, true); - } + IntentBuilder_ builder = StaticMapsActivity_.intent(activity).geocode(geocode).download(download); if (waypoint != null) { - intent.putExtra(EXTRAS_WAYPOINT, waypoint.getId()); + builder.waypoint_id(waypoint.getId()); } - activity.startActivity(intent); + builder.start(); } }
\ No newline at end of file |