use of com.afollestad.materialdialogs.MaterialDialog in project CoCoin by Nightonke.
the class ReportViewFragment method showSelectListDataDialog.
private void showSelectListDataDialog() {
if (selectListDataAdapter == null) {
selectListDataAdapter = new DialogSelectListDataAdapter(selectListData);
}
new MaterialDialog.Builder(mContext).title(R.string.report_select_list_title).cancelable(false).negativeText(R.string.cancel).adapter(selectListDataAdapter, new MaterialDialog.ListCallback() {
@Override
public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
dialog.dismiss();
makeReport(which);
}
}).show();
}
use of com.afollestad.materialdialogs.MaterialDialog in project BigImageViewer by Piasy.
the class LongImageActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_big_image);
mBigImageView = (BigImageView) findViewById(R.id.mBigImage);
mBigImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
mBigImageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
new MaterialDialog.Builder(LongImageActivity.this).items(R.array.big_image_ops).itemsCallback(new MaterialDialog.ListCallback() {
@Override
public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) {
if (TextUtils.equals(text, getString(R.string.save_image))) {
saveImage();
} else if (TextUtils.equals(text, getString(R.string.scan_qr_code))) {
decodeQrCode();
}
}
}).show();
return true;
}
});
mBigImageView.setImageSaveCallback(new ImageSaveCallback() {
@Override
public void onSuccess(String uri) {
Toast.makeText(LongImageActivity.this, "Success", Toast.LENGTH_SHORT).show();
}
@Override
public void onFail(Throwable t) {
t.printStackTrace();
Toast.makeText(LongImageActivity.this, "Fail", Toast.LENGTH_SHORT).show();
}
});
mBigImageView.setProgressIndicator(new ProgressPieIndicator());
findViewById(R.id.mBtnLoad).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mBigImageView.showImage(Uri.parse("http://ww1.sinaimg.cn/mw690/005Fj2RDgw1f9mvl4pivvj30c82ougw3.jpg"));
}
});
}
use of com.afollestad.materialdialogs.MaterialDialog in project Timber by naman14.
the class SubStyleSelectorFragment method showPurchaseDialog.
private void showPurchaseDialog() {
MaterialDialog dialog = new MaterialDialog.Builder(getActivity()).title("Purchase").content("This now playing style is available after a one time purchase of any amount. Support development and unlock this style?").positiveText("Support development").neutralText("Restore purchases").onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
startActivity(new Intent(getActivity(), DonateActivity.class));
dialog.dismiss();
}
}).onNeutral(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
Intent intent = new Intent(getActivity(), DonateActivity.class);
intent.putExtra("title", "Restoring purchases..");
intent.setAction("restore");
startActivity(intent);
dialog.dismiss();
}
}).show();
}
use of com.afollestad.materialdialogs.MaterialDialog in project Weather by Sparker0i.
the class WeatherFragment method showNoInternet.
public void showNoInternet() {
new MaterialDialog.Builder(getContext()).title(getString(R.string.no_internet_title)).cancelable(false).content(getString(R.string.no_internet_content)).positiveText(getString(R.string.no_internet_mobile_data)).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.Settings$DataUsageSummaryActivity"));
startActivityForResult(intent, 0);
}
}).negativeText(getString(R.string.no_internet_wifi)).onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
startActivityForResult(new Intent(Settings.ACTION_WIFI_SETTINGS), 0);
}
}).show();
}
use of com.afollestad.materialdialogs.MaterialDialog in project XposedInstaller by rovo89.
the class StatusInstallerFragment method showActionDialog.
private void showActionDialog(final Context context, final String title, final FrameworkZips.Type type) {
final int ACTION_FLASH = 0;
final int ACTION_FLASH_RECOVERY = 1;
final int ACTION_SAVE = 2;
final int ACTION_DELETE = 3;
boolean isDownloaded = FrameworkZips.hasLocal(title, type);
int itemCount = isDownloaded ? 3 : 2;
String[] texts = new String[itemCount];
int[] ids = new int[itemCount];
int i = 0;
texts[i] = context.getString(type.text_flash);
ids[i++] = ACTION_FLASH;
texts[i] = context.getString(type.text_flash_recovery);
ids[i++] = ACTION_FLASH_RECOVERY;
if (FrameworkZips.hasLocal(title, type)) {
texts[i] = context.getString(R.string.framework_delete);
ids[i++] = ACTION_DELETE;
}
new MaterialDialog.Builder(context).title(title).items(texts).itemsIds(ids).itemsCallback(new MaterialDialog.ListCallback() {
@Override
public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) {
final int action = itemView.getId();
// Handle delete simple actions.
if (action == ACTION_DELETE) {
FrameworkZips.delete(context, title, type);
LOCAL_ZIP_LOADER.triggerReload(true);
return;
}
// Handle actions that need a download first.
RunnableWithParam<File> runAfterDownload = null;
if (action == ACTION_FLASH) {
runAfterDownload = new RunnableWithParam<File>() {
@Override
public void run(File file) {
flash(context, new FlashDirectly(file, type, title, false));
}
};
} else if (action == ACTION_FLASH_RECOVERY) {
runAfterDownload = new RunnableWithParam<File>() {
@Override
public void run(File file) {
flash(context, new FlashRecoveryAuto(file, type, title));
}
};
} else if (action == ACTION_SAVE) {
runAfterDownload = new RunnableWithParam<File>() {
@Override
public void run(File file) {
saveTo(context, file);
}
};
}
LocalFrameworkZip local = FrameworkZips.getLocal(title, type);
if (local != null) {
runAfterDownload.run(local.path);
} else {
download(context, title, type, runAfterDownload);
}
}
}).show();
}
Aggregations