Search in sources :

Example 1 with PackageItem

use of com.dirtyunicorns.tweaks.preferences.PackageListAdapter.PackageItem in project android_packages_apps_DU-Tweaks by DirtyUnicorns.

the class NotificationLightSettings method onCreateDialog.

/**
 * Utility classes and supporting methods
 */
@Override
public Dialog onCreateDialog(int id) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    final Dialog dialog;
    switch(id) {
        case DIALOG_APPS:
            final ListView list = new ListView(getActivity());
            list.setAdapter(mPackageAdapter);
            builder.setTitle(R.string.heads_up_blacklist_choose_app);
            builder.setView(list);
            dialog = builder.create();
            list.setOnItemClickListener(new OnItemClickListener() {

                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    // Add empty application definition, the user will be able to edit it later
                    PackageItem info = (PackageItem) parent.getItemAtPosition(position);
                    addCustomApplicationPref(info.packageName);
                    dialog.cancel();
                }
            });
            break;
        default:
            dialog = null;
    }
    return dialog;
}
Also used : AlertDialog(android.app.AlertDialog) ListView(android.widget.ListView) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Dialog(android.app.Dialog) AlertDialog(android.app.AlertDialog) PackageItem(com.dirtyunicorns.tweaks.preferences.PackageListAdapter.PackageItem) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Example 2 with PackageItem

use of com.dirtyunicorns.tweaks.preferences.PackageListAdapter.PackageItem in project android_packages_apps_DU-Tweaks by DirtyUnicorns.

the class SlimRecentsBlacklist method onCreateDialog.

@Override
public Dialog onCreateDialog(int dialogId) {
    switch(dialogId) {
        case DIALOG_BLACKLIST_APPS:
            {
                Dialog dialog;
                AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
                final ListView list = new ListView(getActivity());
                list.setAdapter(mPackageAdapter);
                alertDialog.setTitle(R.string.profile_choose_app);
                alertDialog.setView(list);
                dialog = alertDialog.create();
                list.setOnItemClickListener(new OnItemClickListener() {

                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        // Add empty application definition, the user will be able to edit it later
                        PackageItem info = (PackageItem) parent.getItemAtPosition(position);
                        addCustomApplicationPref(info.packageName, mBlacklistPackages);
                        dialog.cancel();
                    }
                });
                return dialog;
            }
    }
    return super.onCreateDialog(dialogId);
}
Also used : AlertDialog(android.app.AlertDialog) ListView(android.widget.ListView) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Dialog(android.app.Dialog) AlertDialog(android.app.AlertDialog) AdapterView(android.widget.AdapterView) PackageItem(com.dirtyunicorns.tweaks.preferences.PackageListAdapter.PackageItem) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Example 3 with PackageItem

use of com.dirtyunicorns.tweaks.preferences.PackageListAdapter.PackageItem in project android_packages_apps_DU-Tweaks by DirtyUnicorns.

the class HeadsUp method onCreateDialog.

/**
 * Utility classes and supporting methods
 */
@Override
public Dialog onCreateDialog(int id) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    final Dialog dialog;
    final ListView list = new ListView(getActivity());
    list.setAdapter(mPackageAdapter);
    builder.setTitle(R.string.heads_up_blacklist_choose_app);
    builder.setView(list);
    dialog = builder.create();
    switch(id) {
        case DIALOG_BLACKLIST_APPS:
            list.setOnItemClickListener(new AdapterView.OnItemClickListener() {

                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    PackageItem info = (PackageItem) parent.getItemAtPosition(position);
                    addCustomApplicationPref(info.packageName, mBlacklistPackages);
                    dialog.cancel();
                }
            });
    }
    return dialog;
}
Also used : AlertDialog(android.app.AlertDialog) PackageItem(com.dirtyunicorns.tweaks.preferences.PackageListAdapter.PackageItem) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) ListView(android.widget.ListView) Dialog(android.app.Dialog) AlertDialog(android.app.AlertDialog) AdapterView(android.widget.AdapterView)

Aggregations

AlertDialog (android.app.AlertDialog)3 Dialog (android.app.Dialog)3 View (android.view.View)3 AdapterView (android.widget.AdapterView)3 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)3 ListView (android.widget.ListView)3 PackageItem (com.dirtyunicorns.tweaks.preferences.PackageListAdapter.PackageItem)3