use of android.widget.AbsListView in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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 UltimateAndroid by cymcsg.
the class ContextualUndoAdapter method swipeViewAtPosition.
/**
* Animate the item at given position away and show the undo {@link android.view.View}.
* @param position the position.
*/
public void swipeViewAtPosition(final int position) {
mCurrentRemovedId = getItemId(position);
for (int i = 0; i < getAbsListView().getChildCount(); i++) {
AbsListView absListView = getAbsListView();
View childView = absListView.getChildAt(i);
int positionForView = AdapterViewUtil.getPositionForView(absListView, childView);
if (positionForView == position) {
swipeView(childView, positionForView);
}
}
}
use of android.widget.AbsListView in project UltimateAndroid by cymcsg.
the class ContextualUndoAdapter method getContextualUndoView.
private ContextualUndoView getContextualUndoView(final long dismissViewItemId) {
ContextualUndoView contextualUndoView = null;
AbsListView listView = getAbsListView();
int childCount = listView.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = listView.getChildAt(i);
if (child instanceof ContextualUndoView) {
ContextualUndoView listItem = (ContextualUndoView) child;
if (listItem.getItemId() == dismissViewItemId) {
contextualUndoView = listItem;
}
}
}
return contextualUndoView;
}
use of android.widget.AbsListView in project GSYVideoPlayer by CarGuo.
the class ListVideoActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
// 设置一个exit transition
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
getWindow().setEnterTransition(new Explode());
getWindow().setExitTransition(new Explode());
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_video);
ButterKnife.bind(this);
final ListNormalAdapter listNormalAdapter = new ListNormalAdapter(this);
videoList.setAdapter(listNormalAdapter);
videoList.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
int lastVisibleItem = firstVisibleItem + visibleItemCount;
//大于0说明有播放
if (GSYVideoManager.instance().getPlayPosition() >= 0) {
//当前播放的位置
int position = GSYVideoManager.instance().getPlayPosition();
//对应的播放列表TAG
if (GSYVideoManager.instance().getPlayTag().equals(ListNormalAdapter.TAG) && (position < firstVisibleItem || position > lastVisibleItem)) {
//如果滑出去了上面和下面就是否,和今日头条一样
GSYVideoPlayer.releaseAllVideos();
listNormalAdapter.notifyDataSetChanged();
}
}
}
});
}
use of android.widget.AbsListView in project FloatingActionButton by Clans.
the class HomeFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Locale[] availableLocales = Locale.getAvailableLocales();
List<String> locales = new ArrayList<>();
for (Locale locale : availableLocales) {
locales.add(locale.getDisplayName());
}
mListView.setAdapter(new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, android.R.id.text1, locales));
mFab.hide(false);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mFab.show(true);
mFab.setShowAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.show_from_bottom));
mFab.setHideAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.hide_to_bottom));
}
}, 300);
mListView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if (firstVisibleItem > mPreviousVisibleItem) {
mFab.hide(true);
} else if (firstVisibleItem < mPreviousVisibleItem) {
mFab.show(true);
}
mPreviousVisibleItem = firstVisibleItem;
}
});
}
Aggregations