Search in sources :

Example 31 with MaterialDialog

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();
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) ImageView(android.widget.ImageView) ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) View(android.view.View) MyGridView(com.nightonke.saver.ui.MyGridView) PieChartView(lecho.lib.hellocharts.view.PieChartView) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) LineChartView(lecho.lib.hellocharts.view.LineChartView) ExpandedListView(com.nightonke.saver.ui.ExpandedListView) MaterialIconView(net.steamcrafted.materialiconlib.MaterialIconView) DialogSelectListDataAdapter(com.nightonke.saver.adapter.DialogSelectListDataAdapter)

Example 32 with MaterialDialog

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"));
        }
    });
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) ProgressPieIndicator(com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator) BigImageView(com.github.piasy.biv.view.BigImageView) View(android.view.View) ImageSaveCallback(com.github.piasy.biv.view.ImageSaveCallback)

Example 33 with MaterialDialog

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();
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) DialogAction(com.afollestad.materialdialogs.DialogAction) NonNull(android.support.annotation.NonNull) Intent(android.content.Intent)

Example 34 with MaterialDialog

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();
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) DialogAction(com.afollestad.materialdialogs.DialogAction) NonNull(android.support.annotation.NonNull) Intent(android.content.Intent) ComponentName(android.content.ComponentName)

Example 35 with MaterialDialog

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();
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) RunnableWithParam(de.robv.android.xposed.installer.util.RunnableWithParam) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) SuppressLint(android.annotation.SuppressLint) LocalFrameworkZip(de.robv.android.xposed.installer.util.FrameworkZips.LocalFrameworkZip) File(java.io.File)

Aggregations

MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)90 View (android.view.View)57 DialogAction (com.afollestad.materialdialogs.DialogAction)45 TextView (android.widget.TextView)36 NonNull (android.support.annotation.NonNull)33 Intent (android.content.Intent)21 File (java.io.File)21 RecyclerView (android.support.v7.widget.RecyclerView)20 ImageView (android.widget.ImageView)19 SuppressLint (android.annotation.SuppressLint)18 List (java.util.List)16 LayoutInflater (android.view.LayoutInflater)14 MenuItem (android.view.MenuItem)14 Context (android.content.Context)13 PopupMenu (android.widget.PopupMenu)12 Activity (android.app.Activity)11 ListView (android.widget.ListView)11 Toast (android.widget.Toast)11 ArrayList (java.util.ArrayList)11 Bundle (android.os.Bundle)8