Search in sources :

Example 41 with BaseAdapter

use of android.widget.BaseAdapter in project NewXmPluginSDK by MiEcosystem.

the class MenuDialog method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().setGravity(Gravity.TOP);
    TitleBarUtil.enableWhiteTranslucentStatus(getWindow());
    try {
        XmPluginCommonApi.instance().setMenuDialogWindowAnimations(getWindow());
    } catch (Throwable e) {
    }
    mLayoutInflater = LayoutInflater.from(getContext());
    mRootView = mLayoutInflater.inflate(R.layout.menu_dialog, null);
    getWindow().setContentView(mRootView);
    TitleBarUtil.setTitleBarPadding(getContext().getResources().getDimensionPixelSize(R.dimen.title_bar_top_padding), mRootView);
    if (mBackgroundColor > 0) {
        mRootView.setBackgroundColor(mBackgroundColor);
    }
    WindowManager.LayoutParams lp = this.getWindow().getAttributes();
    lp.y = 0;
    lp.width = WindowManager.LayoutParams.FILL_PARENT;
    lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
    getWindow().setAttributes(lp);
    setCancelable(true);
    setCanceledOnTouchOutside(true);
    mListView = (ListView) findViewById(R.id.select_dialog_listview);
    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            if (onClickListener != null) {
                dismiss();
                onClickListener.onClick(null, i);
            }
        }
    });
    findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            dismiss();
        }
    });
    if (mListViewAdapter == null && mItems != null) {
        mListViewAdapter = new BaseAdapter() {

            @Override
            public int getCount() {
                return mItems.length;
            }

            @Override
            public Object getItem(int i) {
                return mItems[i];
            }

            @Override
            public long getItemId(int i) {
                return 0;
            }

            @Override
            public View getView(int i, View view, ViewGroup viewGroup) {
                if (view == null) {
                    view = mLayoutInflater.inflate(R.layout.menu_dialog_item, null);
                }
                TextView textView = (TextView) view.findViewById(R.id.text1);
                textView.setText(mItems[i]);
                return view;
            }
        };
    }
    if (mListViewAdapter != null)
        mListView.setAdapter(mListViewAdapter);
}
Also used : ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) WindowManager(android.view.WindowManager) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) BaseAdapter(android.widget.BaseAdapter)

Example 42 with BaseAdapter

use of android.widget.BaseAdapter in project robolectric by robolectric.

the class ShadowBaseAdapterTest method canResetNotifyDataSetChangedFlag.

@Test
public void canResetNotifyDataSetChangedFlag() throws Exception {
    BaseAdapter adapter = new TestBaseAdapter();
    adapter.notifyDataSetChanged();
    shadowOf(adapter).clearWasDataSetChangedCalledFlag();
    assertFalse(shadowOf(adapter).wasNotifyDataSetChangedCalled());
}
Also used : BaseAdapter(android.widget.BaseAdapter) Test(org.junit.Test)

Example 43 with BaseAdapter

use of android.widget.BaseAdapter in project SuperRecyclerView by Malinskiy.

the class SwipeLayout method isDisabledInAdapterView.

/**
 * if working in {@link android.widget.AdapterView}, we should response {@link android.widget.Adapter}
 * isEnable(int position).
 *
 * @return true when item is enabled, else disabled.
 */
private boolean isDisabledInAdapterView() {
    AdapterView adapterView = getAdapterView();
    boolean enable = true;
    if (adapterView != null) {
        Adapter adapter = adapterView.getAdapter();
        if (adapter != null) {
            int p = adapterView.getPositionForView(SwipeLayout.this);
            if (adapter instanceof BaseAdapter) {
                enable = ((BaseAdapter) adapter).isEnabled(p);
            } else if (adapter instanceof ListAdapter) {
                enable = ((ListAdapter) adapter).isEnabled(p);
            }
        }
    }
    return !enable;
}
Also used : AdapterView(android.widget.AdapterView) Adapter(android.widget.Adapter) BaseAdapter(android.widget.BaseAdapter) ListAdapter(android.widget.ListAdapter) BaseAdapter(android.widget.BaseAdapter) ListAdapter(android.widget.ListAdapter)

Aggregations

BaseAdapter (android.widget.BaseAdapter)43 View (android.view.View)22 AdapterView (android.widget.AdapterView)21 ViewGroup (android.view.ViewGroup)16 Adapter (android.widget.Adapter)15 TextView (android.widget.TextView)15 ListAdapter (android.widget.ListAdapter)8 ListView (android.widget.ListView)7 RemoteAdapterConnectionCallback (android.widget.RemoteViewsAdapter.RemoteAdapterConnectionCallback)7 LayoutInflater (android.view.LayoutInflater)5 Context (android.content.Context)4 AbsListView (android.widget.AbsListView)4 RecipeInformation (com.se491.chef_ly.model.RecipeInformation)4 SuppressLint (android.annotation.SuppressLint)3 Intent (android.content.Intent)3 GridView (android.widget.GridView)3 HeaderViewListAdapter (android.widget.HeaderViewListAdapter)3 ImageView (android.widget.ImageView)3 FlipViewController (com.aphidmobile.flip.FlipViewController)3 NumberTextView (com.aphidmobile.flip.demo.views.NumberTextView)3