Search in sources :

Example 1 with PackageItem

use of com.crdroid.settings.preferences.PackageListAdapter.PackageItem in project android_packages_apps_crDroidSettings by crdroidandroid.

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.crdroid.settings.preferences.PackageListAdapter.PackageItem) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Aggregations

AlertDialog (android.app.AlertDialog)1 Dialog (android.app.Dialog)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 ListView (android.widget.ListView)1 PackageItem (com.crdroid.settings.preferences.PackageListAdapter.PackageItem)1