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);
}
}
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;
}
}
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();
}
}
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);
}
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);
}
Aggregations