Search in sources :

Example 46 with AbsListView

use of android.widget.AbsListView in project SmoothRefreshLayout by dkzwm.

the class ScrollCompat method flingCompat.

public static void flingCompat(View view, int velocityY) {
    if (view instanceof ScrollView) {
        ScrollView scrollView = (ScrollView) view;
        scrollView.fling(velocityY);
    } else if (view instanceof WebView) {
        WebView webView = (WebView) view;
        webView.flingScroll(0, velocityY);
    } else if (view instanceof NestedScrollView) {
        NestedScrollView scrollView = (NestedScrollView) view;
        scrollView.fling(velocityY);
    } else if (view instanceof AbsListView) {
        AbsListView listView = (AbsListView) view;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            listView.fling(velocityY);
        }
    } else if (ViewCatcherUtil.isRecyclerView(view)) {
        RecyclerView recyclerView = (RecyclerView) view;
        recyclerView.fling(0, velocityY);
    }
}
Also used : NestedScrollView(androidx.core.widget.NestedScrollView) ScrollView(android.widget.ScrollView) AbsListView(android.widget.AbsListView) RecyclerView(androidx.recyclerview.widget.RecyclerView) WebView(android.webkit.WebView) NestedScrollView(androidx.core.widget.NestedScrollView)

Example 47 with AbsListView

use of android.widget.AbsListView in project SmoothRefreshLayout by dkzwm.

the class ScrollCompat method isScrollingView.

public static boolean isScrollingView(View view) {
    if (view instanceof AbsListView || view instanceof ScrollView || view instanceof WebView) {
        return true;
    }
    if (ViewCatcherUtil.isRecyclerView(view)) {
        RecyclerView recyclerView = (RecyclerView) view;
        RecyclerView.LayoutManager manager = recyclerView.getLayoutManager();
        if (manager != null) {
            if (manager instanceof LinearLayoutManager) {
                LinearLayoutManager linearManager = ((LinearLayoutManager) manager);
                return linearManager.getOrientation() == RecyclerView.VERTICAL;
            } else if (manager instanceof StaggeredGridLayoutManager) {
                StaggeredGridLayoutManager gridLayoutManager = (StaggeredGridLayoutManager) manager;
                return gridLayoutManager.getOrientation() == RecyclerView.VERTICAL;
            }
        }
        return true;
    } else {
        return view instanceof ScrollingView;
    }
}
Also used : NestedScrollView(androidx.core.widget.NestedScrollView) ScrollView(android.widget.ScrollView) ScrollingView(androidx.core.view.ScrollingView) AbsListView(android.widget.AbsListView) RecyclerView(androidx.recyclerview.widget.RecyclerView) StaggeredGridLayoutManager(androidx.recyclerview.widget.StaggeredGridLayoutManager) WebView(android.webkit.WebView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 48 with AbsListView

use of android.widget.AbsListView in project SmoothRefreshLayout by dkzwm.

the class ScrollCompat method stopFling.

public static void stopFling(View view) {
    if (view instanceof ScrollView) {
        ScrollView scrollView = (ScrollView) view;
        scrollView.smoothScrollBy(0, 0);
    } else if (view instanceof WebView) {
        WebView webView = (WebView) view;
        webView.flingScroll(0, 0);
    } else if (view instanceof NestedScrollView) {
        NestedScrollView scrollView = (NestedScrollView) view;
        scrollView.smoothScrollBy(0, 0);
    } else if (view instanceof AbsListView) {
        AbsListView listView = (AbsListView) view;
        listView.smoothScrollBy(0, 0);
    } else if (ViewCatcherUtil.isRecyclerView(view)) {
        RecyclerView recyclerView = (RecyclerView) view;
        recyclerView.stopScroll();
    }
}
Also used : NestedScrollView(androidx.core.widget.NestedScrollView) ScrollView(android.widget.ScrollView) AbsListView(android.widget.AbsListView) RecyclerView(androidx.recyclerview.widget.RecyclerView) WebView(android.webkit.WebView) NestedScrollView(androidx.core.widget.NestedScrollView)

Example 49 with AbsListView

use of android.widget.AbsListView in project android_packages_apps_Settings by crdroidandroid.

the class ListDialogPreference method onPrepareDialogBuilder.

@Override
protected void onPrepareDialogBuilder(AlertDialog.Builder builder, DialogInterface.OnClickListener listener) {
    super.onPrepareDialogBuilder(builder, listener);
    final Context context = getContext();
    final int dialogLayout = getDialogLayoutResource();
    final View picker = LayoutInflater.from(context).inflate(dialogLayout, null);
    final ListPreferenceAdapter adapter = new ListPreferenceAdapter();
    final AbsListView list = (AbsListView) picker.findViewById(android.R.id.list);
    list.setAdapter(adapter);
    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapter, View v, int position, long id) {
            if (callChangeListener((int) id)) {
                setValue((int) id);
            }
            final Dialog dialog = getDialog();
            if (dialog != null) {
                dialog.dismiss();
            }
        }
    });
    // Set initial selection.
    final int selectedPosition = getIndexForValue(mValue);
    if (selectedPosition != AbsListView.INVALID_POSITION) {
        list.setSelection(selectedPosition);
    }
    builder.setView(picker);
    builder.setPositiveButton(null, null);
}
Also used : Context(android.content.Context) Dialog(android.app.Dialog) AlertDialog(android.app.AlertDialog) AbsListView(android.widget.AbsListView) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 50 with AbsListView

use of android.widget.AbsListView in project android_packages_apps_Settings by SudaMod.

the class ListDialogPreference method onPrepareDialogBuilder.

@Override
protected void onPrepareDialogBuilder(AlertDialog.Builder builder, DialogInterface.OnClickListener listener) {
    super.onPrepareDialogBuilder(builder, listener);
    final Context context = getContext();
    final int dialogLayout = getDialogLayoutResource();
    final View picker = LayoutInflater.from(context).inflate(dialogLayout, null);
    final ListPreferenceAdapter adapter = new ListPreferenceAdapter();
    final AbsListView list = (AbsListView) picker.findViewById(android.R.id.list);
    list.setAdapter(adapter);
    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapter, View v, int position, long id) {
            if (callChangeListener((int) id)) {
                setValue((int) id);
            }
            final Dialog dialog = getDialog();
            if (dialog != null) {
                dialog.dismiss();
            }
        }
    });
    // Set initial selection.
    final int selectedPosition = getIndexForValue(mValue);
    if (selectedPosition != AbsListView.INVALID_POSITION) {
        list.setSelection(selectedPosition);
    }
    builder.setView(picker);
    builder.setPositiveButton(null, null);
}
Also used : Context(android.content.Context) Dialog(android.app.Dialog) AlertDialog(android.app.AlertDialog) AbsListView(android.widget.AbsListView) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView)

Aggregations

AbsListView (android.widget.AbsListView)223 View (android.view.View)126 ListView (android.widget.ListView)80 AdapterView (android.widget.AdapterView)54 TextView (android.widget.TextView)46 ViewGroup (android.view.ViewGroup)33 ImageView (android.widget.ImageView)29 ScrollView (android.widget.ScrollView)23 RecyclerView (android.support.v7.widget.RecyclerView)21 GridView (android.widget.GridView)21 SuppressLint (android.annotation.SuppressLint)20 OnScrollListener (android.widget.AbsListView.OnScrollListener)19 Intent (android.content.Intent)17 ArrayList (java.util.ArrayList)16 Context (android.content.Context)12 Point (android.graphics.Point)12 Handler (android.os.Handler)12 WebView (android.webkit.WebView)12 ExpandableListView (android.widget.ExpandableListView)12 ArrayListLoader (com.klinker.android.twitter.adapters.ArrayListLoader)10