aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2012-01-22 13:17:36 +0100
committerBananeweizen <bananeweizen@gmx.de>2012-01-22 13:17:36 +0100
commit77102aae5ea6cf887fb9416e7c8cd0028f93cf84 (patch)
tree85c3891e5e9f20739618953497c28ee0fcbf3e6c
parentaa68184d2b6ed595660060b3e10e6f60ae8cbe1f (diff)
downloadcgeo-77102aae5ea6cf887fb9416e7c8cd0028f93cf84.zip
cgeo-77102aae5ea6cf887fb9416e7c8cd0028f93cf84.tar.gz
cgeo-77102aae5ea6cf887fb9416e7c8cd0028f93cf84.tar.bz2
fix #1018: Add add-on to useful apps
search must be retested after add-on has been published
-rw-r--r--main/res/layout/helpers.xml181
-rw-r--r--main/res/layout/useful_apps.xml25
-rw-r--r--main/res/layout/useful_apps_item.xml47
-rw-r--r--main/res/values/strings.xml2
-rw-r--r--main/src/cgeo/geocaching/UsefulAppsActivity.java73
5 files changed, 110 insertions, 218 deletions
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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical"
- android:background="?background_color" >
- <LinearLayout style="@style/action_bar">
- <ImageView style="@style/action_bar_action"
- android:onClick="goHome" />
- <View style="@style/action_bar_separator" />
- <TextView style="@style/action_bar_title" />
- </LinearLayout>
- <ScrollView
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:padding="4dip"
- android:orientation="vertical" >
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical" >
-<!-- ** -->
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_marginBottom="10dip"
- android:orientation="vertical"
- android:onClick="installManual" >
- <RelativeLayout style="@style/separator_horizontal_layout" >
- <View style="@style/separator_horizontal" />
- <TextView style="@style/separator_horizontal_headline"
- android:text="@string/helper_manual_title" />
- </RelativeLayout>
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:layout_marginBottom="5dip"
- android:orientation="horizontal" >
- <ImageView
- android:layout_width="64dip"
- android:layout_height="64dip"
- android:layout_margin="1dip"
- android:layout_gravity="center"
- android:gravity="center"
- android:scaleType="fitXY"
- android:src="@drawable/helper_manual" />
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:padding="3dip"
- android:textSize="14dip"
- android:textColor="?text_color"
- android:textColorLink="?text_color_link"
- android:linksClickable="true"
- android:text="@string/helper_manual_description" />
- </LinearLayout>
- </LinearLayout>
-<!-- ** -->
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_marginBottom="10dip"
- android:orientation="vertical"
- android:onClick="installLocus" >
- <RelativeLayout style="@style/separator_horizontal_layout" >
- <View style="@style/separator_horizontal" />
- <TextView style="@style/separator_horizontal_headline"
- android:text="@string/helper_locus_title" />
- </RelativeLayout>
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:layout_marginBottom="5dip"
- android:orientation="horizontal" >
- <ImageView
- android:layout_width="64dip"
- android:layout_height="64dip"
- android:layout_margin="1dip"
- android:layout_gravity="center"
- android:gravity="center"
- android:scaleType="fitXY"
- android:src="@drawable/helper_locus" />
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:padding="3dip"
- android:textSize="14dip"
- android:textColor="?text_color"
- android:textColorLink="?text_color_link"
- android:linksClickable="true"
- android:text="@string/helper_locus_description" />
- </LinearLayout>
- </LinearLayout>
-<!-- ** -->
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_marginBottom="10dip"
- android:orientation="vertical"
- android:onClick="installGpsStatus" >
- <RelativeLayout style="@style/separator_horizontal_layout" >
- <View style="@style/separator_horizontal" />
- <TextView style="@style/separator_horizontal_headline"
- android:text="@string/helper_gpsstatus_title" />
- </RelativeLayout>
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:layout_marginBottom="5dip"
- android:orientation="horizontal" >
- <ImageView
- android:layout_width="64dip"
- android:layout_height="64dip"
- android:layout_margin="1dip"
- android:layout_gravity="center"
- android:gravity="center"
- android:scaleType="fitXY"
- android:src="@drawable/helper_gpsstatus" />
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:padding="3dip"
- android:textSize="14dip"
- android:textColor="?text_color"
- android:textColorLink="?text_color_link"
- android:linksClickable="true"
- android:text="@string/helper_gpsstatus_description" />
- </LinearLayout>
- </LinearLayout>
-<!-- ** -->
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_marginBottom="10dip"
- android:orientation="vertical"
- android:onClick="installBluetoothGps" >
- <RelativeLayout style="@style/separator_horizontal_layout" >
- <View style="@style/separator_horizontal" />
- <TextView style="@style/separator_horizontal_headline"
- android:text="@string/helper_bluetoothgps_title" />
- </RelativeLayout>
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:layout_marginBottom="5dip"
- android:orientation="horizontal" >
- <ImageView
- android:layout_width="64dip"
- android:layout_height="64dip"
- android:layout_margin="1dip"
- android:layout_gravity="center"
- android:gravity="center"
- android:scaleType="fitXY"
- android:src="@drawable/helper_bluetoothgps" />
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:padding="3dip"
- android:textSize="14dip"
- android:textColor="?text_color"
- android:textColorLink="?text_color_link"
- android:linksClickable="true"
- android:text="@string/helper_bluetoothgps_description" />
- </LinearLayout>
- </LinearLayout>
-<!-- ** -->
- </LinearLayout>
- </ScrollView>
-</LinearLayout>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:background="?background_color" >
+ <LinearLayout style="@style/action_bar">
+ <ImageView style="@style/action_bar_action"
+ android:onClick="goHome" />
+ <View style="@style/action_bar_separator" />
+ <TextView style="@style/action_bar_title" />
+ </LinearLayout>
+ <ScrollView
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:padding="4dip"
+ android:orientation="vertical" >
+ <LinearLayout
+ android:id="@+id/parent"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical" >
+ </LinearLayout>
+ </ScrollView>
+</LinearLayout>
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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/app_layout"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_marginBottom="10dip"
+ android:orientation="vertical" >
+
+ <RelativeLayout style="@style/separator_horizontal_layout" >
+
+ <View style="@style/separator_horizontal" />
+
+ <TextView
+ android:id="@+id/title"
+ style="@style/separator_horizontal_headline" />
+ </RelativeLayout>
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_marginBottom="5dip"
+ android:layout_marginLeft="10dip"
+ android:layout_marginRight="10dip"
+ android:orientation="horizontal" >
+
+ <ImageView
+ android:id="@+id/image"
+ android:layout_width="64dip"
+ android:layout_height="64dip"
+ android:layout_gravity="center"
+ android:layout_margin="1dip"
+ android:gravity="center"
+ android:scaleType="fitXY" />
+
+ <TextView
+ android:id="@+id/description"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="left"
+ android:linksClickable="true"
+ android:padding="3dip"
+ android:textColor="?text_color"
+ android:textColorLink="?text_color_link"
+ android:textSize="14dip" />
+ </LinearLayout>
+
+</LinearLayout> \ 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 @@
<!-- helpers -->
<string name="helper_manual_title">Manual</string>
<string name="helper_manual_description">Comprehensive manual for c:geo that contains description of all possibilities of this application (even hidden ones).</string>
+ <string name="helper_calendar_title">c:geo calendar add-on</string>
+ <string name="helper_calendar_description">Enables you to export event caches into the calendar on your device.</string>
<string name="helper_locus_title">Locus</string>
<string name="helper_locus_description">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.</string>
<string name="helper_gpsstatus_title">GPS Status</string>
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");
- }
}