use of android.support.v7.app.AppCompatDialog in project mosby by sockeqwe.
the class StatisticsDialog method onCreateDialog.
//
// End delegates
//
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AppCompatDialog dialog = new AppCompatDialog(getActivity(), getTheme());
dialog.setTitle(R.string.menu_statistics);
return dialog;
}
use of android.support.v7.app.AppCompatDialog in project Rashr by DsLNeXuS.
the class BackupRestoreFragment method createBackup.
public void createBackup(final boolean RecoveryBackup) {
String prefix;
String CurrentName;
String EXT;
if (RecoveryBackup) {
prefix = "recovery";
EXT = RashrApp.DEVICE.getRecoveryExt();
CurrentName = RashrApp.DEVICE.getRecoveryVersion();
} else {
prefix = "kernel";
EXT = RashrApp.DEVICE.getKernelExt();
CurrentName = RashrApp.DEVICE.getKernelVersion();
}
final AppCompatDialog dialog = new AppCompatDialog(mContext);
dialog.setTitle(R.string.setname);
dialog.setContentView(R.layout.dialog_input);
final AppCompatButton bGoBackup = (AppCompatButton) dialog.findViewById(R.id.bGoBackup);
final AppCompatEditText etFileName = (AppCompatEditText) dialog.findViewById(R.id.etFileName);
final AppCompatCheckBox optName = (AppCompatCheckBox) dialog.findViewById(R.id.cbOptInput);
if (bGoBackup == null || etFileName == null || optName == null)
return;
final String NameHint = prefix + "-from-" + Calendar.getInstance().get(Calendar.DATE) + "-" + Calendar.getInstance().get(Calendar.MONTH) + "-" + Calendar.getInstance().get(Calendar.YEAR) + "-" + Calendar.getInstance().get(Calendar.HOUR) + "-" + Calendar.getInstance().get(Calendar.MINUTE) + EXT;
optName.setText(CurrentName);
optName.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
etFileName.setEnabled(!optName.isChecked());
}
});
etFileName.setHint(NameHint);
bGoBackup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String EXT;
File Path;
final int JOB;
if (RecoveryBackup) {
EXT = RashrApp.DEVICE.getRecoveryExt();
Path = Const.PathToRecoveryBackups;
JOB = FlashUtil.JOB_BACKUP_RECOVERY;
} else {
EXT = RashrApp.DEVICE.getKernelExt();
Path = Const.PathToKernelBackups;
JOB = FlashUtil.JOB_BACKUP_KERNEL;
}
CharSequence Name = "";
if (optName.isChecked()) {
Name = optName.getText() + EXT;
} else {
if (etFileName.getText() != null && !etFileName.getText().toString().equals("")) {
Name = etFileName.getText().toString();
}
if (Name.equals("")) {
Name = String.valueOf(etFileName.getHint());
}
if (!Name.toString().endsWith(EXT)) {
Name = Name + EXT;
}
}
final File fBACKUP = new File(Path, Name.toString());
if (fBACKUP.exists()) {
Toast.makeText(mActivity, R.string.backupalready, Toast.LENGTH_SHORT).show();
} else {
final FlashUtil BackupCreator = new FlashUtil(mActivity, fBACKUP, JOB);
BackupCreator.setOnTaskDoneListener(new FlashUtil.OnTaskDoneListener() {
@Override
public void onSuccess() {
mAdapter.reload();
}
@Override
public void onFail(Exception e) {
String msg;
if (e != null) {
msg = e.toString();
} else {
msg = getString(R.string.bak_error);
}
Toast.makeText(mContext, msg, Toast.LENGTH_SHORT).show();
}
});
BackupCreator.execute();
}
dialog.dismiss();
}
});
dialog.show();
}
use of android.support.v7.app.AppCompatDialog in project Rashr by DsLNeXuS.
the class FlashFragment method showUnifiedBuildsDialog.
/**
* Check if Device uses a Unified base like some Galaxy S4: htle, htltespr htltexx uses the same
* sources so they can use the unified kernels and recoveries. Let the User choice which one is
* the correct for him. PLEASE BE CAREFUL!
*/
public void showUnifiedBuildsDialog() {
final AppCompatDialog UnifiedBuildsDialog = new AppCompatDialog(mContext);
UnifiedBuildsDialog.setTitle(R.string.make_choice);
final ArrayList<String> DevName = new ArrayList<>();
ArrayList<String> DevNamesCarriers = new ArrayList<>();
UnifiedBuildsDialog.setContentView(R.layout.dialog_unified_build);
ListView UnifiedList = (ListView) UnifiedBuildsDialog.findViewById(R.id.lvUnifiedList);
ArrayAdapter<String> UnifiedAdapter = new ArrayAdapter<>(mContext, android.R.layout.simple_list_item_1, DevNamesCarriers);
if (UnifiedList != null) {
UnifiedList.setAdapter(UnifiedAdapter);
UnifiedList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
UnifiedBuildsDialog.dismiss();
final ProgressDialog reloading = new ProgressDialog(mContext);
reloading.setMessage(mContext.getString(R.string.reloading));
reloading.setCancelable(false);
reloading.show();
new Thread(new Runnable() {
@Override
public void run() {
Common.setBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SHOW_UNIFIED, false);
RashrApp.DEVICE.setName(DevName.get(position));
RashrApp.DEVICE.loadRecoveryList();
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
reloading.dismiss();
mActivity.switchTo(FlashFragment.newInstance(mActivity));
}
});
}
}).start();
}
});
}
if (RashrApp.DEVICE.getManufacture().equals("samsung")) {
String[] unifiedGalaxyS3 = { "d2lte", "d2att", "d2cri", "d2mtr", "d2spr", "d2tmo", "d2usc", "d2vzw" };
String[] unifiedGalaxyNote3 = { "hlte", "hltespr", "hltetmo", "hltevzw", "htlexx" };
String[] unifiedGalaxyS4 = { "jflte", "jflteatt", "jfltecan", "jfltecri", "jfltecsp", "jfltespr", "jfltetmo", "jflteusc", "jfltevzw", "jfltexx", "jgedlte" };
String[] unifiedGalaxyNote4 = { "trlte", "trltecan", "trltedt", "trltexx", "trltespr", "trltetmo", "trltevzw", "trlteusc" };
if (Common.stringEndsWithArray(RashrApp.DEVICE.getName(), unifiedGalaxyS3)) {
DevName.addAll(Arrays.asList(unifiedGalaxyS3));
} else if (Common.stringEndsWithArray(RashrApp.DEVICE.getName(), unifiedGalaxyS3)) {
DevName.addAll(Arrays.asList(unifiedGalaxyNote3));
} else if (Common.stringEndsWithArray(RashrApp.DEVICE.getName(), unifiedGalaxyS4)) {
DevName.addAll(Arrays.asList(unifiedGalaxyS4));
} else if (Common.stringEndsWithArray(RashrApp.DEVICE.getName(), unifiedGalaxyNote4)) {
DevName.addAll(Arrays.asList(unifiedGalaxyNote4));
}
}
if (RashrApp.DEVICE.getManufacture().equals("motorola")) {
String[] unifiedMsm8960 = { "moto_msm8960" };
if (RashrApp.DEVICE.getBOARD().equals("msm8960")) {
DevName.addAll(Arrays.asList(unifiedMsm8960));
}
}
for (String i : DevName) {
if (i.contains("att")) {
DevNamesCarriers.add(i + " (AT&T Mobility)");
} else if (i.contains("can")) {
DevNamesCarriers.add(i + " (Canada)");
} else if (i.contains("cri")) {
DevNamesCarriers.add(i + " (Cricket Wireless)");
} else if (i.contains("csp")) {
DevNamesCarriers.add(i + " (C Spire Wireless)");
} else if (i.contains("mtr")) {
DevNamesCarriers.add(i + " (MetroPCS)");
} else if (i.contains("spr")) {
DevNamesCarriers.add(i + " (Sprint Corporation)");
} else if (i.contains("tmo")) {
DevNamesCarriers.add(i + " (T-Mobile US)");
} else if (i.contains("usc")) {
DevNamesCarriers.add(i + " (U.S. Cellular)");
} else if (i.contains("vzw")) {
DevNamesCarriers.add(i + " (Verizon Wireless)");
} else if (i.contains("xx")) {
DevNamesCarriers.add(i + " (International)");
} else if (i.contains("ged")) {
DevNamesCarriers.add(i + " (Google Play Edition)");
} else if (i.contains("dt")) {
DevNamesCarriers.add(i + " (India)");
} else {
DevNamesCarriers.add(i + " (Unified)");
}
}
AppCompatButton KeepCurrent = (AppCompatButton) UnifiedBuildsDialog.findViewById(R.id.bKeepCurrent);
if (KeepCurrent != null) {
KeepCurrent.setText(String.format(getString(R.string.keep_current_name), RashrApp.DEVICE.getName()));
KeepCurrent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Common.setBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SHOW_UNIFIED, false);
UnifiedBuildsDialog.dismiss();
}
});
}
if (DevName.size() > 0) {
UnifiedBuildsDialog.show();
UnifiedBuildsDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
Common.setBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SHOW_UNIFIED, false);
}
});
}
}
use of android.support.v7.app.AppCompatDialog in project Douya by DreaminginCodeZH.
the class BroadcastActivityDialogFragment method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AppCompatDialog dialog = (AppCompatDialog) super.onCreateDialog(savedInstanceState);
// We are using a custom title, as in AlertDialog.
dialog.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
return dialog;
}
use of android.support.v7.app.AppCompatDialog in project wire-android by wireapp.
the class AssetDialogUtils method showFileActionSheet.
public static void showFileActionSheet(final Context context, final Asset asset, final Uri uri, boolean fileCanBeOpened, final AssetDialogCallback callback) {
final AppCompatDialog fileActionSheetDialog = new AppCompatDialog(context);
fileActionSheetDialog.setTitle(asset.getName());
fileActionSheetDialog.setContentView(R.layout.file_action_sheet_dialog);
TextView title = ViewUtils.getView(fileActionSheetDialog, R.id.title);
title.setEllipsize(TextUtils.TruncateAt.MIDDLE);
title.setTypeface(TypefaceUtils.getTypeface(context.getResources().getString(R.string.wire__typeface__medium)));
title.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getResources().getDimensionPixelSize(R.dimen.wire__text_size__regular));
title.setGravity(Gravity.CENTER);
TextView openButton = ViewUtils.getView(fileActionSheetDialog, R.id.ttv__file_action_dialog__open);
View noAppFoundLabel = ViewUtils.getView(fileActionSheetDialog, R.id.ttv__file_action_dialog__open__no_app_found);
View saveButton = ViewUtils.getView(fileActionSheetDialog, R.id.ttv__file_action_dialog__save);
// Opening file
if (fileCanBeOpened) {
noAppFoundLabel.setVisibility(View.GONE);
openButton.setAlpha(1f);
openButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
callback.onOpenedFile(uri);
fileActionSheetDialog.dismiss();
}
});
} else {
noAppFoundLabel.setVisibility(View.VISIBLE);
float disabledAlpha = ResourceUtils.getResourceFloat(context.getResources(), R.dimen.button__disabled_state__alpha);
openButton.setAlpha(disabledAlpha);
}
// Saving file
final Asset.LoadCallback<Uri> saveFileLoadCallback = new Asset.LoadCallback<Uri>() {
@Override
public void onLoaded(Uri uri) {
callback.onSavedFile(uri);
}
@Override
public void onLoadFailed() {
}
};
saveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fileActionSheetDialog.dismiss();
asset.saveToDownloads(saveFileLoadCallback);
}
});
fileActionSheetDialog.show();
}
Aggregations