use of android.widget.CheckBox in project CountdownView by iwgang.
the class DynamicShowActivity method handlerCheckBoxSel.
private void handlerCheckBoxSel() {
final CheckBox cbDay = (CheckBox) findViewById(R.id.cb_day);
final CheckBox cbHour = (CheckBox) findViewById(R.id.cb_hour);
final CheckBox cbMinute = (CheckBox) findViewById(R.id.cb_minute);
final CheckBox cbSecond = (CheckBox) findViewById(R.id.cb_second);
final CheckBox cbMillisecond = (CheckBox) findViewById(R.id.cb_millisecond);
cbDay.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
DynamicShowActivity.this.isShowDay = isChecked;
}
});
cbHour.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
DynamicShowActivity.this.isShowHour = isChecked;
}
});
cbMinute.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
DynamicShowActivity.this.isShowMinute = isChecked;
}
});
cbSecond.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
DynamicShowActivity.this.isShowSecond = isChecked;
if (!isChecked && DynamicShowActivity.this.isShowMillisecond) {
cbMillisecond.setChecked(false);
}
}
});
cbMillisecond.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
DynamicShowActivity.this.isShowMillisecond = isChecked;
if (isChecked && !DynamicShowActivity.this.isShowSecond) {
cbSecond.setChecked(true);
}
}
});
}
use of android.widget.CheckBox in project CountdownView by iwgang.
the class DynamicShowActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dynamic);
mCvCountdownViewTest = (CountdownView) findViewById(R.id.cv_countdownViewTest);
mCvCountdownViewTestHasBg = (CountdownView) findViewById(R.id.cv_countdownViewTestHasBg);
mLlBackgroundConfigContainer = findViewById(R.id.ll_backgroundConfigContainer);
mLlConvertDaysToHoursContainer = findViewById(R.id.ll_convertDaysToHoursContainer);
mCvCountdownViewTest.start(TIME);
findViewById(R.id.btn_theme1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
if (hasBackgroundCountdownView) {
DynamicConfig.BackgroundInfo backgroundInfo = new DynamicConfig.BackgroundInfo();
backgroundInfo.setColor(0xFFFF54BC).setSize(30f).setRadius(0f).setShowTimeBgDivisionLine(false);
dynamicConfigBuilder.setTimeTextSize(15).setTimeTextColor(0xFFFFFFFF).setTimeTextBold(true).setSuffixTextColor(0xFF000000).setSuffixTextSize(15).setBackgroundInfo(backgroundInfo).setShowDay(false).setShowHour(true).setShowMinute(true).setShowSecond(true).setShowMillisecond(true);
} else {
dynamicConfigBuilder.setTimeTextSize(35).setTimeTextColor(0xFFFF5000).setTimeTextBold(true).setSuffixTextColor(0xFFFF5000).setSuffixTextSize(30).setSuffixTextBold(false).setSuffix(":").setSuffixMillisecond(// Remove millisecond suffix
"").setSuffixGravity(DynamicConfig.SuffixGravity.CENTER).setShowDay(false).setShowHour(false).setShowMinute(true).setShowSecond(true).setShowMillisecond(true);
}
if (hasBackgroundCountdownView) {
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
} else {
mCvCountdownViewTest.dynamicShow(dynamicConfigBuilder.build());
}
}
});
findViewById(R.id.btn_theme2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
if (hasBackgroundCountdownView) {
DynamicConfig.BackgroundInfo backgroundInfo = new DynamicConfig.BackgroundInfo();
backgroundInfo.setColor(0xFFFF5000).setSize(60f).setRadius(30f).setShowTimeBgDivisionLine(false);
dynamicConfigBuilder.setTimeTextSize(42).setTimeTextColor(0xFFFFFFFF).setTimeTextBold(true).setSuffixTextColor(0xFF000000).setSuffixTextSize(42).setSuffixTextBold(true).setBackgroundInfo(backgroundInfo).setShowDay(false).setShowHour(true).setShowMinute(true).setShowSecond(true).setShowMillisecond(false);
} else {
dynamicConfigBuilder.setTimeTextSize(60).setTimeTextColor(0xFF444444).setTimeTextBold(false).setSuffixTextColor(0xFF444444).setSuffixTextSize(20).setSuffixTextBold(false).setSuffixMinute("m").setSuffixMinuteLeftMargin(5).setSuffixMinuteRightMargin(10).setSuffixSecond("s").setSuffixSecondLeftMargin(5).setSuffixGravity(DynamicConfig.SuffixGravity.BOTTOM).setShowDay(false).setShowHour(false).setShowMinute(true).setShowSecond(true).setShowMillisecond(false);
}
if (hasBackgroundCountdownView) {
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
} else {
mCvCountdownViewTest.dynamicShow(dynamicConfigBuilder.build());
}
}
});
findViewById(R.id.btn_theme3).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
if (hasBackgroundCountdownView) {
DynamicConfig.BackgroundInfo backgroundInfo = new DynamicConfig.BackgroundInfo();
backgroundInfo.setColor(0xFF444444).setSize(40f).setRadius(3f).setShowTimeBgDivisionLine(true).setDivisionLineColor(Color.parseColor("#30FFFFFF")).setDivisionLineSize(1f);
dynamicConfigBuilder.setTimeTextSize(22).setTimeTextColor(0xFFFFFFFF).setTimeTextBold(true).setSuffixTextColor(0xFF000000).setSuffixTextSize(18).setSuffixTextBold(true).setBackgroundInfo(backgroundInfo).setShowDay(true).setShowHour(true).setShowMinute(true).setShowSecond(true).setShowMillisecond(true);
} else {
dynamicConfigBuilder.setTimeTextSize(22).setTimeTextColor(0xFF000000).setTimeTextBold(false).setSuffixTextColor(0xFF000000).setSuffixTextSize(12).setSuffixTextBold(false).setSuffixDay("天").setSuffixHour("小时").setSuffixMinute("分钟").setSuffixSecond("秒").setSuffixMillisecond("毫秒").setSuffixGravity(DynamicConfig.SuffixGravity.TOP).setShowDay(true).setShowHour(true).setShowMinute(true).setShowSecond(true).setShowMillisecond(true);
}
if (hasBackgroundCountdownView) {
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
} else {
mCvCountdownViewTest.dynamicShow(dynamicConfigBuilder.build());
}
}
});
findViewById(R.id.btn_timeTextSizePlus).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setTimeTextSize(++timeTextSize);
if (hasBackgroundCountdownView) {
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
} else {
mCvCountdownViewTest.dynamicShow(dynamicConfigBuilder.build());
}
}
});
findViewById(R.id.btn_timeTextSizeSubtract).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (timeTextSize == 0)
return;
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setTimeTextSize(--timeTextSize);
if (hasBackgroundCountdownView) {
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
} else {
mCvCountdownViewTest.dynamicShow(dynamicConfigBuilder.build());
}
}
});
findViewById(R.id.btn_modTimeTextColor).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ColorPicker picker = new ColorPicker(DynamicShowActivity.this);
picker.setOnColorPickListener(new ColorPicker.OnColorPickListener() {
@Override
public void onColorPicked(int pickedColor) {
DynamicConfig dynamicConfig = new DynamicConfig.Builder().setTimeTextColor(pickedColor).build();
if (hasBackgroundCountdownView) {
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfig);
} else {
mCvCountdownViewTest.dynamicShow(dynamicConfig);
}
}
});
picker.show();
}
});
findViewById(R.id.btn_suffixTextSizePlus).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setSuffixTextSize(++suffixTextSize);
if (hasBackgroundCountdownView) {
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
} else {
mCvCountdownViewTest.dynamicShow(dynamicConfigBuilder.build());
}
}
});
findViewById(R.id.btn_suffixTextSizeSubtract).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (timeTextSize == 0)
return;
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setSuffixTextSize(--suffixTextSize);
if (hasBackgroundCountdownView) {
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
} else {
mCvCountdownViewTest.dynamicShow(dynamicConfigBuilder.build());
}
}
});
findViewById(R.id.btn_modSuffixTextColor).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ColorPicker picker = new ColorPicker(DynamicShowActivity.this);
picker.setOnColorPickListener(new ColorPicker.OnColorPickListener() {
@Override
public void onColorPicked(int pickedColor) {
DynamicConfig dynamicConfig = new DynamicConfig.Builder().setSuffixTextColor(pickedColor).build();
if (hasBackgroundCountdownView) {
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfig);
} else {
mCvCountdownViewTest.dynamicShow(dynamicConfig);
}
}
});
picker.show();
}
});
findViewById(R.id.btn_suffixGravityTop).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DynamicConfig dynamicConfig = new DynamicConfig.Builder().setSuffixGravity(DynamicConfig.SuffixGravity.TOP).build();
if (hasBackgroundCountdownView) {
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfig);
} else {
mCvCountdownViewTest.dynamicShow(dynamicConfig);
}
}
});
findViewById(R.id.btn_suffixGravityCenter).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DynamicConfig dynamicConfig = new DynamicConfig.Builder().setSuffixGravity(DynamicConfig.SuffixGravity.CENTER).build();
if (hasBackgroundCountdownView) {
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfig);
} else {
mCvCountdownViewTest.dynamicShow(dynamicConfig);
}
}
});
findViewById(R.id.btn_suffixGravityBottom).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DynamicConfig dynamicConfig = new DynamicConfig.Builder().setSuffixGravity(DynamicConfig.SuffixGravity.BOTTOM).build();
if (hasBackgroundCountdownView) {
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfig);
} else {
mCvCountdownViewTest.dynamicShow(dynamicConfig);
}
}
});
findViewById(R.id.btn_refTimeShow).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!isShowDay && !isShowHour && !isShowMinute && !isShowSecond && !isShowMillisecond) {
Toast.makeText(DynamicShowActivity.this, "Select at least one item", Toast.LENGTH_LONG).show();
return;
}
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setShowDay(isShowDay).setShowHour(isShowHour).setShowMinute(isShowMinute).setShowSecond(isShowSecond).setShowMillisecond(isShowMillisecond);
if (hasBackgroundCountdownView) {
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
} else {
mCvCountdownViewTest.dynamicShow(dynamicConfigBuilder.build());
}
}
});
findViewById(R.id.btn_bgSizePlus).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setBackgroundInfo(new DynamicConfig.BackgroundInfo().setSize(++timeBgSize));
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
}
});
findViewById(R.id.btn_bgSizeSubtract).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (timeBgSize == 0)
return;
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setBackgroundInfo(new DynamicConfig.BackgroundInfo().setSize(--timeBgSize));
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
}
});
findViewById(R.id.btn_modBgColor).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ColorPicker picker = new ColorPicker(DynamicShowActivity.this);
picker.setOnColorPickListener(new ColorPicker.OnColorPickListener() {
@Override
public void onColorPicked(int pickedColor) {
DynamicConfig dynamicConfig = new DynamicConfig.Builder().setBackgroundInfo(new DynamicConfig.BackgroundInfo().setColor(pickedColor)).build();
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfig);
}
});
picker.show();
}
});
findViewById(R.id.btn_bgRadiusPlus).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setBackgroundInfo(new DynamicConfig.BackgroundInfo().setRadius(++bgRadius));
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
}
});
findViewById(R.id.btn_bgRadiusSubtract).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (bgRadius == 0)
return;
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setBackgroundInfo(new DynamicConfig.BackgroundInfo().setRadius(--bgRadius));
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
}
});
final Button btnModBgDivisionLineColor = (Button) findViewById(R.id.btn_modBgDivisionLineColor);
btnModBgDivisionLineColor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ColorPicker picker = new ColorPicker(DynamicShowActivity.this);
picker.setOnColorPickListener(new ColorPicker.OnColorPickListener() {
@Override
public void onColorPicked(int pickedColor) {
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setBackgroundInfo(new DynamicConfig.BackgroundInfo().setShowTimeBgDivisionLine(true).setDivisionLineColor(pickedColor));
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
}
});
picker.show();
}
});
((CheckBox) findViewById(R.id.cb_bgDivisionLine)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
btnModBgDivisionLineColor.setEnabled(isChecked);
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setBackgroundInfo(new DynamicConfig.BackgroundInfo().setShowTimeBgDivisionLine(isChecked));
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
}
});
final Button btnBgBorderSizePlus = (Button) findViewById(R.id.btn_bgBorderSizePlus);
final Button btnBgBorderSizeSubtract = (Button) findViewById(R.id.btn_bgBorderSizeSubtract);
final Button btnBgBorderRadiusPlus = (Button) findViewById(R.id.btn_bgBorderRadiusPlus);
final Button btnBgBorderRadiusSubtract = (Button) findViewById(R.id.btn_bgBorderRadiusSubtract);
btnBgBorderSizePlus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setBackgroundInfo(new DynamicConfig.BackgroundInfo().setShowTimeBgBorder(true).setBorderSize(++bgBorderSize));
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
}
});
btnBgBorderSizeSubtract.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (bgBorderSize == 0)
return;
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setBackgroundInfo(new DynamicConfig.BackgroundInfo().setShowTimeBgBorder(true).setBorderSize(--bgBorderSize));
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
}
});
btnBgBorderRadiusPlus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setBackgroundInfo(new DynamicConfig.BackgroundInfo().setShowTimeBgBorder(true).setBorderRadius(++bgBorderRadius));
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
}
});
btnBgBorderRadiusSubtract.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (bgBorderRadius == 0)
return;
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setBackgroundInfo(new DynamicConfig.BackgroundInfo().setShowTimeBgBorder(true).setBorderRadius(--bgBorderRadius));
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
}
});
final Button btnModBgBorderColor = (Button) findViewById(R.id.btn_modBgBorderColor);
btnModBgBorderColor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ColorPicker picker = new ColorPicker(DynamicShowActivity.this);
picker.setOnColorPickListener(new ColorPicker.OnColorPickListener() {
@Override
public void onColorPicked(int pickedColor) {
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setBackgroundInfo(new DynamicConfig.BackgroundInfo().setShowTimeBgBorder(true).setBorderColor(pickedColor));
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
}
});
picker.show();
}
});
((CheckBox) findViewById(R.id.cb_bgBorder)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
btnModBgBorderColor.setEnabled(isChecked);
btnBgBorderSizePlus.setEnabled(isChecked);
btnBgBorderSizeSubtract.setEnabled(isChecked);
btnBgBorderRadiusPlus.setEnabled(isChecked);
btnBgBorderRadiusSubtract.setEnabled(isChecked);
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setBackgroundInfo(new DynamicConfig.BackgroundInfo().setShowTimeBgBorder(isChecked));
mCvCountdownViewTestHasBg.dynamicShow(dynamicConfigBuilder.build());
}
});
((CheckBox) findViewById(R.id.cb_bgBorder)).setChecked(false);
final EditText etSuffixDay = (EditText) findViewById(R.id.et_suffixDay);
final EditText etSuffixHour = (EditText) findViewById(R.id.et_suffixHour);
final EditText etSuffixMinute = (EditText) findViewById(R.id.et_suffixMinute);
final EditText etSuffixSecond = (EditText) findViewById(R.id.et_suffixSecond);
final EditText etSuffixMillisecond = (EditText) findViewById(R.id.et_suffixMillisecond);
findViewById(R.id.btm_refSuffix).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setSuffixDay(etSuffixDay.getText().toString()).setSuffixHour(etSuffixHour.getText().toString()).setSuffixMinute(etSuffixMinute.getText().toString()).setSuffixSecond(etSuffixSecond.getText().toString()).setSuffixMillisecond(etSuffixMillisecond.getText().toString());
mCvCountdownViewTest.dynamicShow(dynamicConfigBuilder.build());
}
});
((CheckBox) findViewById(R.id.cb_hasBackground)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
hasBackgroundCountdownView = isChecked;
mLlBackgroundConfigContainer.setVisibility(isChecked ? View.VISIBLE : View.GONE);
mCvCountdownViewTest.setVisibility(!isChecked ? View.VISIBLE : View.GONE);
mCvCountdownViewTestHasBg.setVisibility(isChecked ? View.VISIBLE : View.GONE);
if (isChecked) {
mCvCountdownViewTest.stop();
mCvCountdownViewTestHasBg.start(TIME);
mLlConvertDaysToHoursContainer.setVisibility(View.GONE);
} else {
mCvCountdownViewTestHasBg.stop();
mCvCountdownViewTest.start(TIME);
mLlConvertDaysToHoursContainer.setVisibility(View.VISIBLE);
}
}
});
final Button btnConvertDaysToHours = (Button) findViewById(R.id.btn_convertDaysToHours);
findViewById(R.id.btn_convertDaysToHours).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
isConvertDaysToHours = !isConvertDaysToHours;
btnConvertDaysToHours.setText(isConvertDaysToHours ? "转换" : "不转换");
DynamicConfig.Builder dynamicConfigBuilder = new DynamicConfig.Builder();
dynamicConfigBuilder.setConvertDaysToHours(isConvertDaysToHours);
dynamicConfigBuilder.setShowDay(!isConvertDaysToHours);
mCvCountdownViewTest.dynamicShow(dynamicConfigBuilder.build());
}
});
handlerCheckBoxSel();
}
use of android.widget.CheckBox in project XPrivacy by M66B.
the class PrivacyService method getOnDemandView.
@SuppressLint("InflateParams")
private View getOnDemandView(final PRestriction restriction, final Hook hook, ApplicationInfoEx appInfo, final PRestriction result, Context context, final OnDemandDialogHolder holder, final OnDemandResult oResult) throws NameNotFoundException, RemoteException {
// Get resources
String self = PrivacyService.class.getPackage().getName();
Resources resources = context.getPackageManager().getResourcesForApplication(self);
// Reference views
final View view = LayoutInflater.from(context.createPackageContext(self, 0)).inflate(R.layout.ondemand, null);
ImageView ivAppIcon = (ImageView) view.findViewById(R.id.ivAppIcon);
TextView tvUid = (TextView) view.findViewById(R.id.tvUid);
TextView tvAppName = (TextView) view.findViewById(R.id.tvAppName);
TextView tvCategory = (TextView) view.findViewById(R.id.tvCategory);
TextView tvFunction = (TextView) view.findViewById(R.id.tvFunction);
TextView tvParameters = (TextView) view.findViewById(R.id.tvParameters);
TableRow rowParameters = (TableRow) view.findViewById(R.id.rowParameters);
TextView tvDefault = (TextView) view.findViewById(R.id.tvDefault);
TextView tvInfoCategory = (TextView) view.findViewById(R.id.tvInfoCategory);
final CheckBox cbExpert = (CheckBox) view.findViewById(R.id.cbExpert);
final CheckBox cbCategory = (CheckBox) view.findViewById(R.id.cbCategory);
final CheckBox cbOnce = (CheckBox) view.findViewById(R.id.cbOnce);
final Spinner spOnce = (Spinner) view.findViewById(R.id.spOnce);
final LinearLayout llWhiteList = (LinearLayout) view.findViewById(R.id.llWhiteList);
final CheckBox cbWhitelist = (CheckBox) view.findViewById(R.id.cbWhitelist);
final CheckBox cbWhitelistExtra1 = (CheckBox) view.findViewById(R.id.cbWhitelistExtra1);
final CheckBox cbWhitelistExtra2 = (CheckBox) view.findViewById(R.id.cbWhitelistExtra2);
final CheckBox cbWhitelistExtra3 = (CheckBox) view.findViewById(R.id.cbWhitelistExtra3);
ProgressBar mProgress = (ProgressBar) view.findViewById(R.id.pbProgress);
Button btnDeny = (Button) view.findViewById(R.id.btnDeny);
Button btnDontKnow = (Button) view.findViewById(R.id.btnDontKnow);
Button btnAllow = (Button) view.findViewById(R.id.btnAllow);
final int userId = Util.getUserId(Process.myUid());
boolean expert = getSettingBool(userId, PrivacyManager.cSettingODExpert, false);
boolean category = getSettingBool(userId, PrivacyManager.cSettingODCategory, true);
boolean once = getSettingBool(userId, PrivacyManager.cSettingODOnce, false);
expert = expert || !category || once;
final boolean whitelistDangerous = (hook != null && hook.isDangerous() && hook.whitelist() != null);
// Set values
if ((hook != null && hook.isDangerous()) || appInfo.isSystem())
view.setBackgroundResource(R.color.color_dangerous_dialog);
else
view.setBackgroundResource(android.R.color.background_dark);
// Application information
ivAppIcon.setImageDrawable(appInfo.getIcon(context));
tvUid.setText(Integer.toString(appInfo.getUid()));
tvAppName.setText(TextUtils.join(", ", appInfo.getApplicationName()));
// Restriction information
int catId = resources.getIdentifier("restrict_" + restriction.restrictionName, "string", self);
tvCategory.setText(resources.getString(catId));
tvFunction.setText(restriction.methodName);
if (restriction.extra == null)
rowParameters.setVisibility(View.GONE);
else
tvParameters.setText(restriction.extra);
String defaultAction = resources.getString(result.restricted ? R.string.title_deny : R.string.title_allow);
tvDefault.setText(defaultAction);
// Help
int helpId = resources.getIdentifier("restrict_help_" + restriction.restrictionName, "string", self);
tvInfoCategory.setText(resources.getString(helpId));
// Expert mode
cbExpert.setChecked(expert);
if (expert) {
for (View child : Util.getViewsByTag((ViewGroup) view, "details")) child.setVisibility(View.VISIBLE);
for (View child : Util.getViewsByTag((ViewGroup) view, "nodetails")) child.setVisibility(View.GONE);
}
if (expert || whitelistDangerous)
llWhiteList.setVisibility(View.VISIBLE);
// Category
cbCategory.setChecked(category);
// Once
cbOnce.setChecked(once);
int osel = Integer.parseInt(getSetting(new PSetting(userId, "", PrivacyManager.cSettingODOnceDuration, "0")).value);
spOnce.setSelection(osel);
// Whitelisting
if (hook != null && hook.whitelist() != null && restriction.extra != null) {
cbWhitelist.setText(resources.getString(R.string.title_whitelist, restriction.extra));
cbWhitelist.setVisibility(View.VISIBLE);
String[] xextra = getXExtra(restriction, hook);
if (xextra.length > 0) {
cbWhitelistExtra1.setText(resources.getString(R.string.title_whitelist, xextra[0]));
cbWhitelistExtra1.setVisibility(View.VISIBLE);
}
if (xextra.length > 1) {
cbWhitelistExtra2.setText(resources.getString(R.string.title_whitelist, xextra[1]));
cbWhitelistExtra2.setVisibility(View.VISIBLE);
}
if (xextra.length > 2) {
cbWhitelistExtra3.setText(resources.getString(R.string.title_whitelist, xextra[2]));
cbWhitelistExtra3.setVisibility(View.VISIBLE);
}
}
cbExpert.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
setSettingBool(userId, "", PrivacyManager.cSettingODExpert, isChecked);
if (!isChecked) {
setSettingBool(userId, "", PrivacyManager.cSettingODCategory, true);
setSettingBool(userId, "", PrivacyManager.cSettingODOnce, false);
cbCategory.setChecked(true);
cbOnce.setChecked(false);
cbWhitelist.setChecked(false);
cbWhitelistExtra1.setChecked(false);
cbWhitelistExtra2.setChecked(false);
cbWhitelistExtra3.setChecked(false);
}
for (View child : Util.getViewsByTag((ViewGroup) view, "details")) child.setVisibility(isChecked ? View.VISIBLE : View.GONE);
for (View child : Util.getViewsByTag((ViewGroup) view, "nodetails")) child.setVisibility(isChecked ? View.GONE : View.VISIBLE);
if (!whitelistDangerous)
llWhiteList.setVisibility(isChecked ? View.VISIBLE : View.GONE);
}
});
// Category, once and whitelist exclude each other
cbCategory.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
cbWhitelist.setChecked(false);
cbWhitelistExtra1.setChecked(false);
cbWhitelistExtra2.setChecked(false);
cbWhitelistExtra3.setChecked(false);
}
}
});
cbOnce.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
cbWhitelist.setChecked(false);
cbWhitelistExtra1.setChecked(false);
cbWhitelistExtra2.setChecked(false);
cbWhitelistExtra3.setChecked(false);
}
}
});
cbWhitelist.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
cbCategory.setChecked(false);
cbOnce.setChecked(false);
cbWhitelistExtra1.setChecked(false);
cbWhitelistExtra2.setChecked(false);
cbWhitelistExtra3.setChecked(false);
}
}
});
cbWhitelistExtra1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
cbCategory.setChecked(false);
cbOnce.setChecked(false);
cbWhitelist.setChecked(false);
cbWhitelistExtra2.setChecked(false);
cbWhitelistExtra3.setChecked(false);
}
}
});
cbWhitelistExtra2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
cbCategory.setChecked(false);
cbOnce.setChecked(false);
cbWhitelist.setChecked(false);
cbWhitelistExtra1.setChecked(false);
cbWhitelistExtra3.setChecked(false);
}
}
});
cbWhitelistExtra3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
cbCategory.setChecked(false);
cbOnce.setChecked(false);
cbWhitelist.setChecked(false);
cbWhitelistExtra1.setChecked(false);
cbWhitelistExtra2.setChecked(false);
}
}
});
// Setup progress bar
mProgress.setMax(cMaxOnDemandDialog * 20);
mProgress.setProgress(cMaxOnDemandDialog * 20);
btnAllow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Allow
result.restricted = false;
result.asked = true;
if (cbWhitelist.isChecked())
onDemandWhitelist(restriction, null, result, oResult, hook);
else if (cbWhitelistExtra1.isChecked())
onDemandWhitelist(restriction, getXExtra(restriction, hook)[0], result, oResult, hook);
else if (cbWhitelistExtra2.isChecked())
onDemandWhitelist(restriction, getXExtra(restriction, hook)[1], result, oResult, hook);
else if (cbWhitelistExtra3.isChecked())
onDemandWhitelist(restriction, getXExtra(restriction, hook)[2], result, oResult, hook);
else {
setSettingBool(userId, "", PrivacyManager.cSettingODCategory, cbCategory.isChecked());
setSettingBool(userId, "", PrivacyManager.cSettingODOnce, cbOnce.isChecked());
if (cbOnce.isChecked())
onDemandOnce(restriction, cbCategory.isChecked(), result, oResult, spOnce);
else
onDemandChoice(restriction, cbCategory.isChecked(), false);
}
holder.latch.countDown();
}
});
btnDontKnow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Deny once
result.restricted = !(hook != null && hook.isDangerous());
result.asked = true;
onDemandOnce(restriction, false, result, oResult, spOnce);
holder.latch.countDown();
}
});
btnDeny.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Deny
result.restricted = true;
result.asked = true;
if (cbWhitelist.isChecked())
onDemandWhitelist(restriction, null, result, oResult, hook);
else if (cbWhitelistExtra1.isChecked())
onDemandWhitelist(restriction, getXExtra(restriction, hook)[0], result, oResult, hook);
else if (cbWhitelistExtra2.isChecked())
onDemandWhitelist(restriction, getXExtra(restriction, hook)[1], result, oResult, hook);
else if (cbWhitelistExtra3.isChecked())
onDemandWhitelist(restriction, getXExtra(restriction, hook)[2], result, oResult, hook);
else {
setSettingBool(userId, "", PrivacyManager.cSettingODCategory, cbCategory.isChecked());
setSettingBool(userId, "", PrivacyManager.cSettingODOnce, cbOnce.isChecked());
if (cbOnce.isChecked())
onDemandOnce(restriction, cbCategory.isChecked(), result, oResult, spOnce);
else
onDemandChoice(restriction, cbCategory.isChecked(), true);
}
holder.latch.countDown();
}
});
return view;
}
use of android.widget.CheckBox in project XPrivacy by M66B.
the class ActivityShare method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Check privacy service client
if (!PrivacyService.checkClient())
return;
// Get data
int userId = Util.getUserId(Process.myUid());
final Bundle extras = getIntent().getExtras();
final String action = getIntent().getAction();
final int[] uids = (extras != null && extras.containsKey(cUidList) ? extras.getIntArray(cUidList) : new int[0]);
final String restrictionName = (extras != null ? extras.getString(cRestriction) : null);
int choice = (extras != null && extras.containsKey(cChoice) ? extras.getInt(cChoice) : -1);
if (action.equals(ACTION_EXPORT))
mFileName = (extras != null && extras.containsKey(cFileName) ? extras.getString(cFileName) : null);
// License check
if (action.equals(ACTION_IMPORT) || action.equals(ACTION_EXPORT)) {
if (!Util.isProEnabled() && Util.hasProLicense(this) == null) {
Util.viewUri(this, ActivityMain.cProUri);
finish();
return;
}
} else if (action.equals(ACTION_FETCH) || (action.equals(ACTION_TOGGLE) && uids.length > 1)) {
if (Util.hasProLicense(this) == null) {
Util.viewUri(this, ActivityMain.cProUri);
finish();
return;
}
}
// Registration check
if (action.equals(ACTION_SUBMIT) && !registerDevice(this)) {
finish();
return;
}
// Check whether we need a user interface
if (extras != null && extras.containsKey(cInteractive) && extras.getBoolean(cInteractive, false))
mInteractive = true;
// Set layout
setContentView(R.layout.sharelist);
setSupportActionBar((Toolbar) findViewById(R.id.widgetToolbar));
// Reference controls
final TextView tvDescription = (TextView) findViewById(R.id.tvDescription);
final ScrollView svToggle = (ScrollView) findViewById(R.id.svToggle);
final RadioGroup rgToggle = (RadioGroup) findViewById(R.id.rgToggle);
final Spinner spRestriction = (Spinner) findViewById(R.id.spRestriction);
RadioButton rbClear = (RadioButton) findViewById(R.id.rbClear);
RadioButton rbTemplateFull = (RadioButton) findViewById(R.id.rbTemplateFull);
RadioButton rbODEnable = (RadioButton) findViewById(R.id.rbEnableOndemand);
RadioButton rbODDisable = (RadioButton) findViewById(R.id.rbDisableOndemand);
final Spinner spTemplate = (Spinner) findViewById(R.id.spTemplate);
final CheckBox cbClear = (CheckBox) findViewById(R.id.cbClear);
final Button btnOk = (Button) findViewById(R.id.btnOk);
final Button btnCancel = (Button) findViewById(R.id.btnCancel);
// Set title
if (action.equals(ACTION_TOGGLE)) {
mActionId = R.string.menu_toggle;
getSupportActionBar().setSubtitle(R.string.menu_toggle);
} else if (action.equals(ACTION_IMPORT)) {
mActionId = R.string.menu_import;
getSupportActionBar().setSubtitle(R.string.menu_import);
} else if (action.equals(ACTION_EXPORT)) {
mActionId = R.string.menu_export;
getSupportActionBar().setSubtitle(R.string.menu_export);
} else if (action.equals(ACTION_FETCH)) {
mActionId = R.string.menu_fetch;
getSupportActionBar().setSubtitle(R.string.menu_fetch);
} else if (action.equals(ACTION_SUBMIT)) {
mActionId = R.string.menu_submit;
getSupportActionBar().setSubtitle(R.string.menu_submit);
} else {
finish();
return;
}
// Get localized restriction name
List<String> listRestrictionName = new ArrayList<String>(PrivacyManager.getRestrictions(this).navigableKeySet());
listRestrictionName.add(0, getString(R.string.menu_all));
// Build restriction adapter
SpinnerAdapter saRestriction = new SpinnerAdapter(this, android.R.layout.simple_spinner_item);
saRestriction.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
saRestriction.addAll(listRestrictionName);
// Setup restriction spinner
int pos = 0;
if (restrictionName != null)
for (String restriction : PrivacyManager.getRestrictions(this).values()) {
pos++;
if (restrictionName.equals(restriction))
break;
}
spRestriction.setAdapter(saRestriction);
spRestriction.setSelection(pos);
// Build template adapter
SpinnerAdapter spAdapter = new SpinnerAdapter(this, android.R.layout.simple_spinner_item);
spAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
String defaultName = PrivacyManager.getSetting(userId, Meta.cTypeTemplateName, "0", getString(R.string.title_default));
spAdapter.add(defaultName);
for (int i = 1; i <= 4; i++) {
String alternateName = PrivacyManager.getSetting(userId, Meta.cTypeTemplateName, Integer.toString(i), getString(R.string.title_alternate) + " " + i);
spAdapter.add(alternateName);
}
spTemplate.setAdapter(spAdapter);
// Build application list
AppListTask appListTask = new AppListTask();
appListTask.executeOnExecutor(mExecutor, uids);
// Import/export filename
if (action.equals(ACTION_EXPORT) || action.equals(ACTION_IMPORT)) {
// Check for availability of sharing intent
Intent file = new Intent(Intent.ACTION_GET_CONTENT);
file.setType("file/*");
boolean hasIntent = Util.isIntentAvailable(ActivityShare.this, file);
// Get file name
if (mFileName == null)
if (action.equals(ACTION_EXPORT)) {
String packageName = null;
if (uids.length == 1)
try {
ApplicationInfoEx appInfo = new ApplicationInfoEx(this, uids[0]);
packageName = appInfo.getPackageName().get(0);
} catch (Throwable ex) {
Util.bug(null, ex);
}
mFileName = getFileName(this, hasIntent, packageName);
} else
mFileName = (hasIntent ? null : getFileName(this, false, null));
if (mFileName == null)
fileChooser();
else
showFileName();
if (action.equals(ACTION_IMPORT))
cbClear.setVisibility(View.VISIBLE);
} else if (action.equals(ACTION_FETCH)) {
tvDescription.setText(getBaseURL());
cbClear.setVisibility(View.VISIBLE);
} else if (action.equals(ACTION_TOGGLE)) {
tvDescription.setVisibility(View.GONE);
spRestriction.setVisibility(View.VISIBLE);
svToggle.setVisibility(View.VISIBLE);
// Listen for radio button
rgToggle.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
btnOk.setEnabled(checkedId >= 0);
spRestriction.setVisibility(checkedId == R.id.rbEnableOndemand || checkedId == R.id.rbDisableOndemand ? View.GONE : View.VISIBLE);
spTemplate.setVisibility(checkedId == R.id.rbTemplateCategory || checkedId == R.id.rbTemplateFull || checkedId == R.id.rbTemplateMergeSet || checkedId == R.id.rbTemplateMergeReset ? View.VISIBLE : View.GONE);
}
});
boolean ondemand = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingOnDemand, true);
rbODEnable.setVisibility(ondemand ? View.VISIBLE : View.GONE);
rbODDisable.setVisibility(ondemand ? View.VISIBLE : View.GONE);
if (choice == CHOICE_CLEAR)
rbClear.setChecked(true);
else if (choice == CHOICE_TEMPLATE)
rbTemplateFull.setChecked(true);
} else
tvDescription.setText(getBaseURL());
if (mInteractive) {
// (showFileName does this for export/import)
if (action.equals(ACTION_SUBMIT) || action.equals(ACTION_FETCH))
btnOk.setEnabled(true);
// Listen for ok
btnOk.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
btnOk.setEnabled(false);
// Toggle
if (action.equals(ACTION_TOGGLE)) {
mRunning = true;
for (int i = 0; i < rgToggle.getChildCount(); i++) ((RadioButton) rgToggle.getChildAt(i)).setEnabled(false);
int pos = spRestriction.getSelectedItemPosition();
String restrictionName = (pos == 0 ? null : (String) PrivacyManager.getRestrictions(ActivityShare.this).values().toArray()[pos - 1]);
new ToggleTask().executeOnExecutor(mExecutor, restrictionName);
// Import
} else if (action.equals(ACTION_IMPORT)) {
mRunning = true;
cbClear.setEnabled(false);
new ImportTask().executeOnExecutor(mExecutor, new File(mFileName), cbClear.isChecked());
} else // Export
if (action.equals(ACTION_EXPORT)) {
mRunning = true;
new ExportTask().executeOnExecutor(mExecutor, new File(mFileName));
// Fetch
} else if (action.equals(ACTION_FETCH)) {
if (uids.length > 0) {
mRunning = true;
cbClear.setEnabled(false);
new FetchTask().executeOnExecutor(mExecutor, cbClear.isChecked());
}
} else // Submit
if (action.equals(ACTION_SUBMIT)) {
if (uids.length > 0) {
if (uids.length <= cSubmitLimit) {
mRunning = true;
new SubmitTask().executeOnExecutor(mExecutor);
} else {
String message = getString(R.string.msg_limit, cSubmitLimit + 1);
Toast.makeText(ActivityShare.this, message, Toast.LENGTH_LONG).show();
btnOk.setEnabled(false);
}
}
}
}
});
} else
btnOk.setEnabled(false);
// Listen for cancel
btnCancel.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
if (mRunning) {
mAbort = true;
Toast.makeText(ActivityShare.this, getString(R.string.msg_abort), Toast.LENGTH_LONG).show();
} else
finish();
}
});
}
use of android.widget.CheckBox in project XPrivacy by M66B.
the class ActivityMain method optionSort.
@SuppressLint("InflateParams")
private void optionSort() {
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.sort, null);
final RadioGroup rgSMode = (RadioGroup) view.findViewById(R.id.rgSMode);
final CheckBox cbSInvert = (CheckBox) view.findViewById(R.id.cbSInvert);
// Initialise controls
switch(mSortMode) {
case SORT_BY_NAME:
rgSMode.check(R.id.rbSName);
break;
case SORT_BY_UID:
rgSMode.check(R.id.rbSUid);
break;
case SORT_BY_INSTALL_TIME:
rgSMode.check(R.id.rbSInstalled);
break;
case SORT_BY_UPDATE_TIME:
rgSMode.check(R.id.rbSUpdated);
break;
case SORT_BY_MODIFY_TIME:
rgSMode.check(R.id.rbSModified);
break;
case SORT_BY_STATE:
rgSMode.check(R.id.rbSState);
break;
}
cbSInvert.setChecked(mSortInvert);
// Build dialog
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ActivityMain.this);
alertDialogBuilder.setTitle(R.string.menu_sort);
alertDialogBuilder.setIcon(getThemed(R.attr.icon_launcher));
alertDialogBuilder.setView(view);
alertDialogBuilder.setPositiveButton(ActivityMain.this.getString(android.R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch(rgSMode.getCheckedRadioButtonId()) {
case R.id.rbSName:
mSortMode = SORT_BY_NAME;
break;
case R.id.rbSUid:
mSortMode = SORT_BY_UID;
break;
case R.id.rbSInstalled:
mSortMode = SORT_BY_INSTALL_TIME;
break;
case R.id.rbSUpdated:
mSortMode = SORT_BY_UPDATE_TIME;
break;
case R.id.rbSModified:
mSortMode = SORT_BY_MODIFY_TIME;
break;
case R.id.rbSState:
mSortMode = SORT_BY_STATE;
break;
}
mSortInvert = cbSInvert.isChecked();
int userId = Util.getUserId(Process.myUid());
PrivacyManager.setSetting(userId, PrivacyManager.cSettingSortMode, Integer.toString(mSortMode));
PrivacyManager.setSetting(userId, PrivacyManager.cSettingSortInverted, Boolean.toString(mSortInvert));
applySort();
}
});
alertDialogBuilder.setNegativeButton(ActivityMain.this.getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Do nothing
}
});
// Show dialog
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
Aggregations