use of android.widget.AdapterView.OnItemClickListener in project KeePassDX by Kunzisoft.
the class IconPickerDialogFragment method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Get the layout inflater
LayoutInflater inflater = getActivity().getLayoutInflater();
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
View root = inflater.inflate(R.layout.icon_picker, null);
builder.setView(root);
GridView currIconGridView = (GridView) root.findViewById(R.id.IconGridView);
currIconGridView.setAdapter(new ImageAdapter(this.getContext()));
currIconGridView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
Bundle bundle = new Bundle();
bundle.putInt(KEY_ICON_ID, position);
iconPickerListener.iconPicked(bundle);
dismiss();
}
});
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
IconPickerDialogFragment.this.getDialog().cancel();
}
});
return builder.create();
}
use of android.widget.AdapterView.OnItemClickListener in project OpenCamera by ageback.
the class FolderChooserDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
if (MyDebug.LOG)
Log.d(TAG, "onCreateDialog");
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this.getActivity());
String folder_name = sharedPreferences.getString(PreferenceKeys.getSaveLocationPreferenceKey(), "OpenCamera");
if (MyDebug.LOG)
Log.d(TAG, "folder_name: " + folder_name);
File new_folder = StorageUtils.getImageFolder(folder_name);
if (MyDebug.LOG)
Log.d(TAG, "start in folder: " + new_folder);
list = new ListView(getActivity());
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (MyDebug.LOG)
Log.d(TAG, "onItemClick: " + position);
FileWrapper file_wrapper = (FileWrapper) parent.getItemAtPosition(position);
if (MyDebug.LOG)
Log.d(TAG, "clicked: " + file_wrapper.toString());
File file = file_wrapper.getFile();
if (MyDebug.LOG)
Log.d(TAG, "file: " + file.toString());
refreshList(file);
}
});
// good to use as short a text as possible for the icons, to reduce chance that the three buttons will have to appear on top of each other rather than in a row, in portrait mode
folder_dialog = new AlertDialog.Builder(getActivity()).setView(list).setPositiveButton(android.R.string.ok, // we set the listener in onShowListener, so we can prevent the dialog from closing (if chosen folder isn't writable)
null).setNeutralButton(R.string.new_folder, // we set the listener in onShowListener, so we can prevent the dialog from closing
null).setNegativeButton(android.R.string.cancel, null).create();
folder_dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog_interface) {
Button b_positive = folder_dialog.getButton(AlertDialog.BUTTON_POSITIVE);
b_positive.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (MyDebug.LOG)
Log.d(TAG, "choose folder: " + current_folder.toString());
if (useFolder()) {
folder_dialog.dismiss();
}
}
});
Button b_neutral = folder_dialog.getButton(AlertDialog.BUTTON_NEUTRAL);
b_neutral.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (MyDebug.LOG)
Log.d(TAG, "new folder in: " + current_folder.toString());
newFolder();
}
});
}
});
if (!new_folder.exists()) {
if (MyDebug.LOG)
Log.d(TAG, "create new folder" + new_folder);
if (!new_folder.mkdirs()) {
if (MyDebug.LOG)
Log.d(TAG, "failed to create new folder");
// don't do anything yet, this is handled below
}
}
refreshList(new_folder);
if (!canWrite()) {
// see testFolderChooserInvalid()
if (MyDebug.LOG)
Log.d(TAG, "failed to read folder");
// note that we reset to DCIM rather than DCIM/OpenCamera, just to increase likelihood of getting back to a valid state
refreshList(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM));
if (current_folder == null) {
if (MyDebug.LOG)
Log.d(TAG, "can't even read DCIM?!");
refreshList(new File("/"));
}
}
return folder_dialog;
}
use of android.widget.AdapterView.OnItemClickListener in project LanSoEditor_advance by LanSoSdk.
the class Demo3LayerFilterActivity method initView.
private void initView() {
findViewById(R.id.id_filterLayer_demo_next).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mplayer != null) {
mplayer.stop();
mplayer.release();
mplayer = null;
}
drawPadView.stopDrawPad();
filterExecute();
}
});
listFilterView = (HorizontalListView) findViewById(R.id.id_filterlayer_filterlist);
listFilterView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
if (filterLayer != null) {
GPUImageFilter filter = filterList.getFilter(getApplicationContext(), arg2);
currrentFilterName = filterList.getName(arg2);
filterLayer.switchFilterTo(filter);
}
}
});
drawPadView = (DrawPadView) findViewById(R.id.id_filterLayer_demo_view);
skbarFilterAdjuster = (SeekBar) findViewById(R.id.id_filterLayer_demo_seek1);
skbarFilterAdjuster.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (mFilterAdjuster != null) {
mFilterAdjuster.adjust(progress);
}
}
});
skbarFilterAdjuster.setMax(100);
findViewById(R.id.id_filterLayer_demo_selectbtn).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
selectFilter();
}
});
findViewById(R.id.id_filterdemo_saveplay).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (SDKFileUtils.fileExist(dstPath)) {
Intent intent = new Intent(Demo3LayerFilterActivity.this, VideoPlayerActivity.class);
intent.putExtra("videopath", dstPath);
startActivity(intent);
} else {
Toast.makeText(Demo3LayerFilterActivity.this, "目标文件不存在", Toast.LENGTH_SHORT).show();
}
}
});
findViewById(R.id.id_filterdemo_saveplay).setVisibility(View.GONE);
}
use of android.widget.AdapterView.OnItemClickListener in project android_packages_apps_CMParts by LineageOS.
the class ContributorsCloudFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state) {
View v = inflater.inflate(R.layout.contributors_view, container, false);
mLoadingView = v.findViewById(R.id.contributors_cloud_loading);
mFailedView = v.findViewById(R.id.contributors_cloud_failed);
mImageView = (ImageView) v.findViewById(R.id.contributors_cloud_image);
mViewController = new ContributorsCloudViewController(mImageView);
mViewController.setMaximumScale(20f);
mViewController.setMediumScale(7f);
mSearchResults = (ListView) v.findViewById(R.id.contributors_cloud_search_results);
mSearchAdapter = new ContributorsAdapter(getActivity());
mSearchResults.setAdapter(mSearchAdapter);
mSearchResults.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
ContributorsDataHolder contributor = (ContributorsDataHolder) parent.getItemAtPosition(position);
onContributorSelected(contributor);
}
});
// Load the data from the database and fill the image
ContributorCloudLoaderTask task = new ContributorCloudLoaderTask(true, false);
task.execute();
return v;
}
use of android.widget.AdapterView.OnItemClickListener in project android_packages_apps_CMParts by LineageOS.
the class AppGroupConfig method onCreateDialog.
@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(mAppAdapter);
builder.setTitle(R.string.profile_choose_app);
builder.setView(list);
dialog = builder.create();
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
PackageItem info = (PackageItem) parent.getItemAtPosition(position);
mNotificationGroup.addPackage(info.packageName);
updatePackages();
dialog.cancel();
}
});
break;
case DELETE_CONFIRM:
builder.setMessage(R.string.profile_app_delete_confirm);
builder.setTitle(R.string.profile_menu_delete_title);
builder.setIconAttribute(android.R.attr.alertDialogIcon);
builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
doDelete();
}
});
builder.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
dialog = builder.create();
break;
case DELETE_GROUP_CONFIRM:
builder.setMessage(R.string.profile_delete_appgroup);
builder.setTitle(R.string.profile_menu_delete_title);
builder.setIconAttribute(android.R.attr.alertDialogIcon);
builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mProfileManager.removeNotificationGroup(mNotificationGroup);
mNotificationGroup = null;
finish();
}
});
builder.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
dialog = builder.create();
break;
default:
dialog = null;
}
return dialog;
}
Aggregations