Search in sources :

Example 11 with AbsListView

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);
}
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 12 with AbsListView

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);
        }
    }
}
Also used : AbsListView(android.widget.AbsListView) AbsListView(android.widget.AbsListView) View(android.view.View)

Example 13 with AbsListView

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;
}
Also used : AbsListView(android.widget.AbsListView) AbsListView(android.widget.AbsListView) View(android.view.View)

Example 14 with AbsListView

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();
                }
            }
        }
    });
}
Also used : Explode(android.transition.Explode) ListNormalAdapter(com.example.gsyvideoplayer.adapter.ListNormalAdapter) AbsListView(android.widget.AbsListView)

Example 15 with AbsListView

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;
        }
    });
}
Also used : Locale(java.util.Locale) ArrayList(java.util.ArrayList) Handler(android.os.Handler) AbsListView(android.widget.AbsListView)

Aggregations

AbsListView (android.widget.AbsListView)218 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 RecyclerView (android.support.v7.widget.RecyclerView)21 GridView (android.widget.GridView)21 SuppressLint (android.annotation.SuppressLint)20 ScrollView (android.widget.ScrollView)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 ExpandableListView (android.widget.ExpandableListView)12 ArrayListLoader (com.klinker.android.twitter.adapters.ArrayListLoader)10 ItemManager (org.lucasr.smoothie.ItemManager)10