From 77102aae5ea6cf887fb9416e7c8cd0028f93cf84 Mon Sep 17 00:00:00 2001 From: Bananeweizen Date: Sun, 22 Jan 2012 13:17:36 +0100 Subject: fix #1018: Add add-on to useful apps search must be retested after add-on has been published --- main/res/layout/helpers.xml | 181 ----------------------- main/res/layout/useful_apps.xml | 25 ++++ main/res/layout/useful_apps_item.xml | 47 ++++++ main/res/values/strings.xml | 2 + main/src/cgeo/geocaching/UsefulAppsActivity.java | 73 +++++---- 5 files changed, 110 insertions(+), 218 deletions(-) delete mode 100644 main/res/layout/helpers.xml create mode 100644 main/res/layout/useful_apps.xml create mode 100644 main/res/layout/useful_apps_item.xml diff --git a/main/res/layout/helpers.xml b/main/res/layout/helpers.xml deleted file mode 100644 index a08d9eb..0000000 --- a/main/res/layout/helpers.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/main/res/layout/useful_apps.xml b/main/res/layout/useful_apps.xml new file mode 100644 index 0000000..d9dbd62 --- /dev/null +++ b/main/res/layout/useful_apps.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + diff --git a/main/res/layout/useful_apps_item.xml b/main/res/layout/useful_apps_item.xml new file mode 100644 index 0000000..7dcb777 --- /dev/null +++ b/main/res/layout/useful_apps_item.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml index f24ef6e..888374e 100644 --- a/main/res/values/strings.xml +++ b/main/res/values/strings.xml @@ -741,6 +741,8 @@ Manual Comprehensive manual for c:geo that contains description of all possibilities of this application (even hidden ones). + c:geo calendar add-on + Enables you to export event caches into the calendar on your device. Locus Simple usable application showing Online maps and allowing to download them directly into Offline mode (raster maps only). Also support track recording, POI handling and many other useful functions. GPS Status diff --git a/main/src/cgeo/geocaching/UsefulAppsActivity.java b/main/src/cgeo/geocaching/UsefulAppsActivity.java index 6a08d56..d4418ab 100644 --- a/main/src/cgeo/geocaching/UsefulAppsActivity.java +++ b/main/src/cgeo/geocaching/UsefulAppsActivity.java @@ -6,19 +6,42 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; +import android.view.View.OnClickListener; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; import java.util.Locale; public class UsefulAppsActivity extends AbstractActivity { + private LinearLayout parentLayout; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // init setTheme(); - setContentView(R.layout.helpers); + setContentView(R.layout.useful_apps); setTitle(res.getString(R.string.helpers)); + parentLayout = (LinearLayout) findViewById(R.id.parent); + + final Locale loc = Locale.getDefault(); + final String language = loc.getLanguage(); + + final String tutorialUrl; + if ("de".equalsIgnoreCase(language)) { + tutorialUrl = "gnu.android.app.cgeomanual.de"; + } + else { + tutorialUrl = "gnu.android.app.cgeomanual.en"; + } + addApp(R.string.helper_manual_title, R.string.helper_manual_description, R.drawable.helper_manual, tutorialUrl); + addApp(R.string.helper_calendar_title, R.string.helper_calendar_description, R.drawable.cgeo, "cgeo.calendar"); + addApp(R.string.helper_locus_title, R.string.helper_locus_description, R.drawable.helper_locus, "menion.android.locus"); + addApp(R.string.helper_gpsstatus_title, R.string.helper_gpsstatus_description, R.drawable.helper_gpsstatus, "com.eclipsim.gpsstatus2"); + addApp(R.string.helper_bluetoothgps_title, R.string.helper_bluetoothgps_description, R.drawable.helper_bluetoothgps, "googoo.android.btgps"); } @Override @@ -37,43 +60,19 @@ public class UsefulAppsActivity extends AbstractActivity { finish(); } - /** - * @param view - * unused here but needed since this method is referenced from XML layout - */ - public void installManual(View view) { - final Locale loc = Locale.getDefault(); - final String language = loc.getLanguage(); - - if ("de".equalsIgnoreCase(language)) { - installFromMarket("gnu.android.app.cgeomanual.de"); - } - else { - installFromMarket("gnu.android.app.cgeomanual.en"); - } - } - - /** - * @param view - * unused here but needed since this method is referenced from XML layout - */ - public void installLocus(View view) { - installFromMarket("menion.android.locus"); - } + private void addApp(final int titleId, final int descriptionId, final int imageId, final String marketUrl) { + final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.useful_apps_item, null); + ((TextView) layout.findViewById(R.id.title)).setText(res.getString(titleId)); + ((ImageView) layout.findViewById(R.id.image)).setImageDrawable(res.getDrawable(imageId)); + ((TextView) layout.findViewById(R.id.description)).setText(res.getString(descriptionId)); + ((LinearLayout) layout.findViewById(R.id.app_layout)).setOnClickListener(new OnClickListener() { - /** - * @param view - * unused here but needed since this method is referenced from XML layout - */ - public void installGpsStatus(View view) { - installFromMarket("com.eclipsim.gpsstatus2"); + @Override + public void onClick(View v) { + installFromMarket(marketUrl); + } + }); + parentLayout.addView(layout); } - /** - * @param view - * unused here but needed since this method is referenced from XML layout - */ - public void installBluetoothGps(View view) { - installFromMarket("googoo.android.btgps"); - } } -- cgit v1.1