aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/UsefulAppsActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/UsefulAppsActivity.java')
-rw-r--r--main/src/cgeo/geocaching/UsefulAppsActivity.java30
1 files changed, 10 insertions, 20 deletions
diff --git a/main/src/cgeo/geocaching/UsefulAppsActivity.java b/main/src/cgeo/geocaching/UsefulAppsActivity.java
index af643b3..ce8bbdd 100644
--- a/main/src/cgeo/geocaching/UsefulAppsActivity.java
+++ b/main/src/cgeo/geocaching/UsefulAppsActivity.java
@@ -1,5 +1,7 @@
package cgeo.geocaching;
+import butterknife.InjectView;
+
import cgeo.geocaching.activity.AbstractActivity;
import android.content.Intent;
@@ -15,17 +17,11 @@ import java.util.Locale;
public class UsefulAppsActivity extends AbstractActivity {
- private LinearLayout parentLayout;
+ @InjectView(R.id.parent) protected LinearLayout parentLayout;
@Override
public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- // init
- setTheme();
- setContentView(R.layout.useful_apps);
- setTitle(res.getString(R.string.helpers));
- parentLayout = (LinearLayout) findViewById(R.id.parent);
+ super.onCreate(savedInstanceState, R.layout.useful_apps);
final Locale loc = Locale.getDefault();
final String language = loc.getLanguage();
@@ -45,12 +41,6 @@ public class UsefulAppsActivity extends AbstractActivity {
addApp(R.string.helper_barcode_title, R.string.helper_barcode_description, R.drawable.helper_barcode, "com.google.zxing.client.android");
}
- @Override
- public void onResume() {
- super.onResume();
-
- }
-
private void installFromMarket(String marketId) {
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:" + marketId)));
@@ -62,18 +52,18 @@ public class UsefulAppsActivity extends AbstractActivity {
}
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));
- layout.findViewById(R.id.app_layout).setOnClickListener(new OnClickListener() {
+ final View appLayout = getLayoutInflater().inflate(R.layout.useful_apps_item, null);
+ ((TextView) appLayout.findViewById(R.id.title)).setText(res.getString(titleId));
+ ((ImageView) appLayout.findViewById(R.id.image)).setImageDrawable(res.getDrawable(imageId));
+ ((TextView) appLayout.findViewById(R.id.description)).setText(res.getString(descriptionId));
+ appLayout.findViewById(R.id.app_layout).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
installFromMarket(marketUrl);
}
});
- parentLayout.addView(layout);
+ parentLayout.addView(appLayout);
}
}