use of android.app.AlertDialog.Builder in project GT by Tencent.
the class GTAUTFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View autLayout = inflater.inflate(R.layout.gt_settingactivity, container, false);
tv_Appstatus = (TextView) autLayout.findViewById(R.id.app_status);
tv_select = (TextView) autLayout.findViewById(R.id.selected_app_bg);
tv_select.setOnClickListener(select);
tv_PkName = (TextView) autLayout.findViewById(R.id.select_tested_pkn);
tv_selectedApp = (TextView) autLayout.findViewById(R.id.app_pic);
tv_AppName = (TextView) autLayout.findViewById(R.id.selected_apn);
tv_refresh = (TextView) autLayout.findViewById(R.id.app_refresh);
tv_refresh.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
proDialog = ProgressDialog.show(getActivity(), "Searching..", "searching..wait....", true, false);
tv_refresh.setTextColor(Color.GREEN);
Thread loginThread = new Thread(new ProcessRefresher());
loginThread.start();
v.performClick();
}
return true;
}
});
tv_refresh.setVisibility(View.GONE);
cb_cpu = (CheckBox) autLayout.findViewById(R.id.cb_cpu);
cb_jiffies = (CheckBox) autLayout.findViewById(R.id.cb_jiffies);
cb_net = (CheckBox) autLayout.findViewById(R.id.cb_net);
cb_pss = (CheckBox) autLayout.findViewById(R.id.cb_pss);
cb_pd = (CheckBox) autLayout.findViewById(R.id.cb_pd);
cb_boxs = new CheckBox[] { cb_cpu, cb_jiffies, cb_net, cb_pss, cb_pd };
cb_cpu.setOnClickListener(cb_check);
cb_jiffies.setOnClickListener(cb_check);
cb_net.setOnClickListener(cb_check);
cb_pss.setOnClickListener(cb_check);
cb_pd.setOnClickListener(cb_check);
memOn = (TextView) autLayout.findViewById(R.id.btn_memon);
memOff = (TextView) autLayout.findViewById(R.id.btn_memoff);
memSwitch = autLayout.findViewById(R.id.memswitch);
selectDrawable = R.drawable.swbtn_selected;
defaultDrawable = R.drawable.swbtn_default;
if (isAutoGetMem) {
memOn.setText("");
memOn.setBackgroundResource(selectDrawable);
memOff.setText("off");
memOff.setBackgroundResource(defaultDrawable);
} else {
memOn.setText("on");
memOn.setBackgroundResource(selectDrawable);
memOff.setText("");
memOff.setBackgroundResource(defaultDrawable);
}
RelativeLayout rl_save = (RelativeLayout) LayoutInflater.from(getActivity()).inflate(R.layout.gt_dailog_save, container, false);
et_savePath = (EditText) rl_save.findViewById(R.id.save_editor);
dlg_save = new Builder(getActivity()).setTitle(getString(R.string.save)).setView(rl_save).setPositiveButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
GTMemHelperFloatview.memInfoList.clear();
}
}).setNegativeButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// 简单保存
String path = et_savePath.getText().toString();
LogUtils.writeTagMemData(tv_PkName.getText().toString(), path + ".csv");
GTMemHelperFloatview.memInfoList.clear();
dialog.dismiss();
}
}).create();
memSwitch.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (!tv_PkName.getText().toString().equals("n/a")) {
if (isAutoGetMem) {
isAutoGetMem = false;
memOn.setText("on");
memOn.setBackgroundResource(defaultDrawable);
memOff.setText("");
memOff.setBackgroundResource(selectDrawable);
// if(!tv_PkName.getText().toString().equals("n/a")){
Intent intent = new Intent(GTApp.getContext(), GTMemHelperFloatview.class);
intent.putExtra("pName", tv_PkName.getText().toString());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PluginManager.getInstance().getPluginControler().startService(GTMemHelperFloatview.getInstance(), intent);
// }
} else {
isAutoGetMem = true;
memOn.setText("");
memOn.setBackgroundResource(selectDrawable);
memOff.setText("off");
memOff.setBackgroundResource(defaultDrawable);
GTMemHelperFloatview.tagTimes = 0;
PluginManager.getInstance().getPluginControler().stopService(GTMemHelperFloatview.getInstance());
dlg_save.show();
}
}
v.performClick();
return false;
}
});
return autLayout;
}
use of android.app.AlertDialog.Builder in project GT by Tencent.
the class GTAUTFragment method hashistory.
private void hashistory(final int type) {
// 当去除性能指标项的勾选时,查看是否该项存在历史数据,有则提示,无则直接删除
String outparaname = cb_alias[type];
AlertDialog.Builder builder = new Builder(getActivity());
boolean hasdata = true;
ArrayList<String> tempL = new ArrayList<String>();
tempL = (ArrayList<String>) AUTManager.registOpTable.get(outparaname);
if (tempL != null) {
for (int i = 0; i < tempL.size(); i++) {
TagTimeEntry tte = OpPerfBridge.getProfilerData((String) tempL.get(i));
if (tte == null) {
hasdata = false;
} else {
if (tte.hasChild() && tte.getChildren()[0].getRecordSize() > 0) {
hasdata = true;
} else if (tte.getRecordSize() <= 0) {
hasdata = false;
}
}
}
if (!hasdata) {
unregisterOutpara(type);
} else {
builder.setMessage(getString(R.string.AUT_page_tip1));
builder.setTitle(getString(R.string.AUT_page_tip_title));
builder.setPositiveButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
cb_boxs[type].setChecked(true);
}
});
builder.setNegativeButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// UI需要清理dataSet
unregisterOutpara(type);
dialog.dismiss();
}
});
builder.setCancelable(false);
builder.show();
}
}
}
use of android.app.AlertDialog.Builder in project phonegap-facebook-plugin by Wizcorp.
the class Util method showAlert.
/**
* Display a simple alert dialog with the given text and title.
*
* @param context
* Android context in which the dialog should be displayed
* @param title
* Alert dialog title
* @param text
* Alert dialog message
*/
@Deprecated
public static void showAlert(Context context, String title, String text) {
Builder alertBuilder = new Builder(context);
alertBuilder.setTitle(title);
alertBuilder.setMessage(text);
alertBuilder.create().show();
}
use of android.app.AlertDialog.Builder in project Klyph by jonathangerbaud.
the class Util method showAlert.
/**
* Display a simple alert dialog with the given text and title.
*
* @param context
* Android context in which the dialog should be displayed
* @param title
* Alert dialog title
* @param text
* Alert dialog message
*/
public static void showAlert(Context context, String title, String text) {
Builder alertBuilder = new Builder(context);
alertBuilder.setTitle(title);
alertBuilder.setMessage(text);
alertBuilder.create().show();
}
use of android.app.AlertDialog.Builder in project k-9 by k9mail.
the class CryptoInfoDialog method onCreateDialog.
// inflating without root element is fine for creating a dialog
@SuppressLint("InflateParams")
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Builder b = new AlertDialog.Builder(getActivity());
dialogView = LayoutInflater.from(getActivity()).inflate(R.layout.message_crypto_info_dialog, null);
topIconFrame = dialogView.findViewById(R.id.crypto_info_top_frame);
topIcon_1 = (ImageView) topIconFrame.findViewById(R.id.crypto_info_top_icon_1);
topIcon_2 = (ImageView) topIconFrame.findViewById(R.id.crypto_info_top_icon_2);
topIcon_3 = (ImageView) topIconFrame.findViewById(R.id.crypto_info_top_icon_3);
topText = (TextView) dialogView.findViewById(R.id.crypto_info_top_text);
bottomIconFrame = dialogView.findViewById(R.id.crypto_info_bottom_frame);
bottomIcon_1 = (ImageView) bottomIconFrame.findViewById(R.id.crypto_info_bottom_icon_1);
bottomIcon_2 = (ImageView) bottomIconFrame.findViewById(R.id.crypto_info_bottom_icon_2);
bottomText = (TextView) dialogView.findViewById(R.id.crypto_info_bottom_text);
MessageCryptoDisplayStatus displayStatus = MessageCryptoDisplayStatus.valueOf(getArguments().getString(ARG_DISPLAY_STATUS));
setMessageForDisplayStatus(displayStatus);
b.setView(dialogView);
b.setPositiveButton(R.string.crypto_info_ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dismiss();
}
});
if (displayStatus.hasAssociatedKey()) {
b.setNeutralButton(R.string.crypto_info_view_key, new OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Fragment frag = getTargetFragment();
if (!(frag instanceof OnClickShowCryptoKeyListener)) {
throw new AssertionError("Displaying activity must implement OnClickShowCryptoKeyListener!");
}
((OnClickShowCryptoKeyListener) frag).onClickShowCryptoKey();
}
});
}
return b.create();
}
Aggregations