Search in sources :

Example 86 with Dialog

use of android.app.Dialog in project androidquery by androidquery.

the class Common method showProgress.

public static void showProgress(Object p, String url, boolean show) {
    if (p != null) {
        if (p instanceof View) {
            View pv = (View) p;
            ProgressBar pbar = null;
            if (p instanceof ProgressBar) {
                pbar = (ProgressBar) p;
            }
            if (show) {
                pv.setTag(AQuery.TAG_URL, url);
                pv.setVisibility(View.VISIBLE);
                if (pbar != null) {
                    pbar.setProgress(0);
                    pbar.setMax(100);
                }
            } else {
                Object tag = pv.getTag(AQuery.TAG_URL);
                if (tag == null || tag.equals(url)) {
                    pv.setTag(AQuery.TAG_URL, null);
                    if (pbar == null || pbar.isIndeterminate()) {
                        pv.setVisibility(View.GONE);
                    }
                }
            }
        } else if (p instanceof Dialog) {
            Dialog pd = (Dialog) p;
            AQuery aq = new AQuery(pd.getContext());
            if (show) {
                aq.show(pd);
            } else {
                aq.dismiss(pd);
            }
        } else if (p instanceof Activity) {
            Activity act = (Activity) p;
            ;
            act.setProgressBarIndeterminateVisibility(show);
            act.setProgressBarVisibility(show);
            if (show) {
                act.setProgress(0);
            }
        }
    }
}
Also used : AQuery(com.androidquery.AQuery) Dialog(android.app.Dialog) Activity(android.app.Activity) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) ExpandableListView(android.widget.ExpandableListView) ProgressBar(android.widget.ProgressBar)

Example 87 with Dialog

use of android.app.Dialog in project androidquery by androidquery.

the class Progress method showProgress.

private void showProgress(Object p, String url, boolean show) {
    if (p != null) {
        if (p instanceof View) {
            View pv = (View) p;
            ProgressBar pbar = null;
            if (p instanceof ProgressBar) {
                pbar = (ProgressBar) p;
            }
            if (show) {
                pv.setTag(AQuery.TAG_URL, url);
                pv.setVisibility(View.VISIBLE);
                if (pbar != null) {
                    pbar.setProgress(0);
                    pbar.setMax(100);
                }
            } else {
                Object tag = pv.getTag(AQuery.TAG_URL);
                if (tag == null || tag.equals(url)) {
                    pv.setTag(AQuery.TAG_URL, null);
                    if (pbar != null && pbar.isIndeterminate()) {
                        pv.setVisibility(View.GONE);
                    }
                }
            }
        } else if (p instanceof Dialog) {
            Dialog pd = (Dialog) p;
            AQuery aq = new AQuery(pd.getContext());
            if (show) {
                aq.show(pd);
            } else {
                aq.dismiss(pd);
            }
        } else if (p instanceof Activity) {
            Activity act = (Activity) p;
            ;
            act.setProgressBarIndeterminateVisibility(show);
            act.setProgressBarVisibility(show);
            if (show) {
                act.setProgress(0);
            }
        }
    }
}
Also used : AQuery(com.androidquery.AQuery) ProgressDialog(android.app.ProgressDialog) Dialog(android.app.Dialog) Activity(android.app.Activity) View(android.view.View) ProgressBar(android.widget.ProgressBar)

Example 88 with Dialog

use of android.app.Dialog in project platform_frameworks_base by android.

the class UserController method showUserSwitchDialog.

void showUserSwitchDialog(Pair<UserInfo, UserInfo> fromToUserPair) {
    // The dialog will show and then initiate the user switch by calling startUserInForeground
    Dialog d = new UserSwitchingDialog(mService, mService.mContext, fromToUserPair.first, fromToUserPair.second, true);
    d.show();
}
Also used : Dialog(android.app.Dialog)

Example 89 with Dialog

use of android.app.Dialog in project AndroidPicker by gzu-liyujiang.

the class BasicPopup method initDialog.

private void initDialog() {
    contentLayout = new FrameLayout(activity);
    contentLayout.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
    contentLayout.setFocusable(true);
    contentLayout.setFocusableInTouchMode(true);
    //contentLayout.setFitsSystemWindows(true);
    dialog = new Dialog(activity);
    //触摸屏幕取消窗体
    dialog.setCanceledOnTouchOutside(true);
    //按返回键取消窗体
    dialog.setCancelable(true);
    dialog.setOnKeyListener(this);
    dialog.setOnDismissListener(this);
    Window window = dialog.getWindow();
    if (window != null) {
        window.setGravity(Gravity.BOTTOM);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        //AndroidRuntimeException: requestFeature() must be called before adding content
        window.requestFeature(Window.FEATURE_NO_TITLE);
        window.setContentView(contentLayout);
    }
    setSize(screenWidthPixels, WRAP_CONTENT);
}
Also used : Window(android.view.Window) ColorDrawable(android.graphics.drawable.ColorDrawable) ViewGroup(android.view.ViewGroup) Dialog(android.app.Dialog) FrameLayout(android.widget.FrameLayout)

Example 90 with Dialog

use of android.app.Dialog in project ListenerMusicPlayer by hefuyicoder.

the class ListenerUtil method showAddPlaylistDialog.

public static void showAddPlaylistDialog(final Context context, final long[] songIds) {
    PlaylistLoader.getPlaylists(context, true).map(new Func1<List<Playlist>, Dialog>() {

        @Override
        public Dialog call(final List<Playlist> playlists) {
            final CharSequence[] chars = new CharSequence[playlists.size() + 1];
            chars[0] = context.getResources().getString(R.string.create_new_playlist);
            for (int i = 0; i < playlists.size(); i++) {
                chars[i + 1] = playlists.get(i).name;
            }
            return new MaterialDialog.Builder(context).title(R.string.add_to_playlist).items(chars).itemsCallback(new MaterialDialog.ListCallback() {

                @Override
                public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
                    if (which == 0) {
                        CreatePlaylistDialog.newInstance(songIds).show(((AppCompatActivity) context).getSupportFragmentManager(), context.getString(R.string.create_new_playlist));
                        return;
                    } else if (which == 1) {
                        //我喜欢
                        int num = FavoriteSong.getInstance(context).addFavoriteSong(songIds);
                        Toast.makeText(getContext(), R.string.add_favorite_success, Toast.LENGTH_SHORT).show();
                        RxBus.getInstance().post(new FavourateSongEvent());
                        dialog.dismiss();
                        return;
                    }
                    MusicPlayer.addToPlaylist(context, songIds, playlists.get(which - 1).id);
                    RxBus.getInstance().post(new PlaylistUpdateEvent());
                    dialog.dismiss();
                }
            }).build();
        }
    }).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Dialog>() {

        @Override
        public void call(Dialog dialog) {
            dialog.show();
        }
    });
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) FavourateSongEvent(io.hefuyi.listener.event.FavourateSongEvent) AppCompatActivity(android.support.v7.app.AppCompatActivity) View(android.view.View) Playlist(io.hefuyi.listener.mvp.model.Playlist) PlaylistUpdateEvent(io.hefuyi.listener.event.PlaylistUpdateEvent) CreatePlaylistDialog(io.hefuyi.listener.ui.dialogs.CreatePlaylistDialog) Dialog(android.app.Dialog) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) List(java.util.List)

Aggregations

Dialog (android.app.Dialog)792 View (android.view.View)317 AlertDialog (android.app.AlertDialog)256 TextView (android.widget.TextView)219 DialogInterface (android.content.DialogInterface)200 Intent (android.content.Intent)97 Bundle (android.os.Bundle)94 Context (android.content.Context)93 AlertDialog (android.support.v7.app.AlertDialog)93 ListView (android.widget.ListView)87 EditText (android.widget.EditText)84 Button (android.widget.Button)80 AdapterView (android.widget.AdapterView)79 NonNull (android.support.annotation.NonNull)77 LayoutInflater (android.view.LayoutInflater)75 ImageView (android.widget.ImageView)70 ArrayList (java.util.ArrayList)64 LinearLayout (android.widget.LinearLayout)54 WindowManager (android.view.WindowManager)52 ProgressDialog (android.app.ProgressDialog)51