integrated power pack help thing with task edit page

pull/14/head
Tim Su 14 years ago
parent e66e252f62
commit 11461b8700

@ -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

@ -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;
}
/**

Loading…
Cancel
Save