From 11461b8700be5f0fce08c107bcc7e18fbedfd89b Mon Sep 17 00:00:00 2001 From: Tim Su Date: Fri, 30 Jul 2010 17:58:33 -0700 Subject: [PATCH] integrated power pack help thing with task edit page --- .../astrid/activity/TaskEditActivity.java | 12 +-------- .../todoroo/astrid/service/AddonService.java | 27 ++++++++++++------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java index d9734f370..39ddcebc7 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java @@ -41,12 +41,10 @@ import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; -import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.DatePicker; @@ -216,15 +214,7 @@ public final class TaskEditActivity extends TabActivity { controls.add(new GCalControlSet(this, addonsAddons)); controls.add(new TimerControlSet(this, addonsAddons)); } else { - Button button = new Button(this); - addonsAddons.addView(button); - button.setText(AddonService.POWER_PACK_LABEL); - button.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View view) { - AddonService.displayPowerPackHelp(TaskEditActivity.this); - } - }); + addonsAddons.addView(AddonService.displayPowerPackHelp(this)); } // read data diff --git a/astrid/src/com/todoroo/astrid/service/AddonService.java b/astrid/src/com/todoroo/astrid/service/AddonService.java index 98f71a67e..6503b5dc7 100644 --- a/astrid/src/com/todoroo/astrid/service/AddonService.java +++ b/astrid/src/com/todoroo/astrid/service/AddonService.java @@ -12,6 +12,9 @@ import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.net.Uri; +import android.view.Gravity; +import android.view.View; +import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; @@ -66,24 +69,30 @@ public class AddonService { } /** Displays power pack help */ - public static void displayPowerPackHelp(Activity activity) { + public static LinearLayout displayPowerPackHelp(final Activity activity) { LinearLayout layout = new LinearLayout(activity); - layout.setOrientation(LinearLayout.HORIZONTAL); + layout.setOrientation(LinearLayout.VERTICAL); ImageView imageView = new ImageView(activity); imageView.setImageResource(R.drawable.icon_pp); layout.addView(imageView); + TextView textView = new TextView(activity); textView.setText(R.string.DLG_power_pack); textView.setTextSize(16); + textView.setGravity(Gravity.CENTER); layout.addView(textView); - new AlertDialog.Builder(activity) - .setTitle(POWER_PACK_LABEL) - .setView(layout) - .setIcon(android.R.drawable.ic_dialog_info) - .setPositiveButton(R.string.DLG_to_market, new MarketClickListener(activity, - POWER_PACK_PACKAGE)) - .show(); + Button button = new Button(activity); + button.setText(R.string.DLG_to_market); + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + new MarketClickListener(activity, POWER_PACK_PACKAGE); + } + }); + layout.addView(button); + + return layout; } /**