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