Java Code Examples for android.widget.listview#setScrollbarFadingEnabled()

The following examples show how to use android.widget.listview#setScrollbarFadingEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CountryListSpinner.java    From FirebaseUI-Android with Apache License 2.0 6 votes vote down vote up
public void show(final int selected) {
    if (listAdapter == null) {
        return;
    }

    final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
    dialog = builder.setSingleChoiceItems(listAdapter, 0, this).create();
    dialog.setCanceledOnTouchOutside(true);
    final ListView listView = dialog.getListView();
    listView.setFastScrollEnabled(true);
    listView.setScrollbarFadingEnabled(false);
    listView.postDelayed(new Runnable() {
        @Override
        public void run() {
            listView.setSelection(selected);
        }
    }, DELAY_MILLIS);
    dialog.show();
}
 
Example 2
Source File: Util.java    From Audinaut with GNU General Public License v3.0 5 votes vote down vote up
private static void showDetailsDialog(Context context, String title, List<String> headers, final List<String> details) {
    ListView listView = new ListView(context);
    listView.setAdapter(new DetailsAdapter(context, headers, details));
    listView.setDivider(null);
    listView.setScrollbarFadingEnabled(false);

    // Let the user long-click on a row to copy its value to the clipboard
    final Context contextRef = context;
    listView.setOnItemLongClickListener((parent, view, pos, id) -> {
        TextView nameView = view.findViewById(R.id.detail_name);
        TextView detailsView = view.findViewById(R.id.detail_value);
        if (nameView == null || detailsView == null) {
            return false;
        }

        CharSequence name = nameView.getText();
        CharSequence value = detailsView.getText();

        ClipboardManager clipboard = (ClipboardManager) contextRef.getSystemService(Context.CLIPBOARD_SERVICE);
        ClipData clip = ClipData.newPlainText(name, value);
        clipboard.setPrimaryClip(clip);

        toast(contextRef, "Copied " + name + " to clipboard");

        return true;
    });

    new AlertDialog.Builder(context)
            // .setIcon(android.R.drawable.ic_dialog_info)
            .setTitle(title)
            .setView(listView)
            .setPositiveButton(R.string.common_close, (dialog, i) -> dialog.dismiss())
            .show();
}
 
Example 3
Source File: SensorListFragment.java    From Sensor-Disabler with MIT License 5 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    setEmptyText("No sensors available on your device.");
    ListView listView = getListView();
    listView.setDivider(null);
    listView.setScrollbarFadingEnabled(false);
}
 
Example 4
Source File: Util.java    From Popeens-DSub with GNU General Public License v3.0 4 votes vote down vote up
public static void showDetailsDialog(Context context, String title, List<String> headers, final List<String> details) {
	ListView listView = new ListView(context);
	listView.setAdapter(new DetailsAdapter(context, R.layout.details_item, headers, details));
	listView.setDivider(null);
	listView.setScrollbarFadingEnabled(false);

	// Let the user long-click on a row to copy its value to the clipboard
	final Context contextRef = context;
	listView.setOnItemLongClickListener(new ListView.OnItemLongClickListener() {
		@Override
		public boolean onItemLongClick(AdapterView<?> parent, View view, int pos, long id) {
			TextView nameView = (TextView) view.findViewById(R.id.detail_name);
			TextView detailsView = (TextView) view.findViewById(R.id.detail_value);
			if(nameView == null || detailsView == null) {
				return false;
			}

			CharSequence name = nameView.getText();
			CharSequence value = detailsView.getText();

			ClipboardManager clipboard = (ClipboardManager) contextRef.getSystemService(Context.CLIPBOARD_SERVICE);
			ClipData clip = ClipData.newPlainText(name, value);
			clipboard.setPrimaryClip(clip);

			toast(contextRef, "Copied " + name + " to clipboard");

			return true;
		}
	});

	new AlertDialog.Builder(context)
			// .setIcon(android.R.drawable.ic_dialog_info)
			.setTitle(title)
			.setView(listView)
			.setPositiveButton(R.string.common_close, new DialogInterface.OnClickListener() {
				@Override
				public void onClick(DialogInterface dialog, int i) {
					dialog.dismiss();
				}
			})
			.show();
}