use of android.widget.BaseAdapter in project remusic by aa112901.
the class ThemeUtils method refreshView.
private static void refreshView(View view, ExtraRefreshable extraRefreshable) {
if (view == null)
return;
view.destroyDrawingCache();
if (view instanceof Tintable) {
((Tintable) view).tint();
if (view instanceof ViewGroup) {
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
refreshView(((ViewGroup) view).getChildAt(i), extraRefreshable);
}
}
} else {
if (extraRefreshable != null) {
extraRefreshable.refreshSpecificView(view);
}
if (view instanceof AbsListView) {
ListAdapter adapter = ((AbsListView) view).getAdapter();
while (adapter instanceof WrapperListAdapter) {
adapter = ((WrapperListAdapter) adapter).getWrappedAdapter();
}
if (adapter instanceof BaseAdapter) {
((BaseAdapter) adapter).notifyDataSetChanged();
}
}
if (view instanceof RecyclerView) {
try {
if (mRecycler == null) {
mRecycler = RecyclerView.class.getDeclaredField("mRecycler");
mRecycler.setAccessible(true);
}
if (mClearMethod == null) {
mClearMethod = Class.forName("android.support.v7.widget.RecyclerView$Recycler").getDeclaredMethod("clear");
mClearMethod.setAccessible(true);
}
mClearMethod.invoke(mRecycler.get(view));
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
((RecyclerView) view).getRecycledViewPool().clear();
((RecyclerView) view).invalidateItemDecorations();
}
if (view instanceof ViewGroup) {
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
refreshView(((ViewGroup) view).getChildAt(i), extraRefreshable);
}
}
}
}
use of android.widget.BaseAdapter in project PreLollipopTransition by takahirom.
the class ListViewFragment method onCreateView.
@Nullable
@Override
public View onCreateView(final LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View inflate = inflater.inflate(R.layout.fragment_list_view, container, false);
final ListView listView = (ListView) inflate.findViewById(R.id.list);
listView.setAdapter(new BaseAdapter() {
@Override
public int getCount() {
return 10;
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return inflater.inflate(R.layout.list_row, parent, false);
}
});
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final Intent intent = new Intent(getContext(), SubActivity.class);
ActivityTransitionLauncher.with(getActivity()).from(view.findViewById(R.id.image)).launch(intent);
}
});
return inflate;
}
use of android.widget.BaseAdapter in project android-flip by openaphid.
the class FlipButtonActivity method onCreate.
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(R.string.activity_title);
flipView = new FlipViewController(this);
flipView.setAdapter(new BaseAdapter() {
@Override
public int getCount() {
return 10;
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
NumberButton button;
if (convertView == null) {
final Context context = parent.getContext();
button = new NumberButton(context, position);
button.setTextSize(context.getResources().getDimension(R.dimen.textSize));
} else {
button = (NumberButton) convertView;
button.setNumber(position);
}
return button;
}
});
setContentView(flipView);
}
use of android.widget.BaseAdapter in project ListViewAnimations by nhaarman.
the class DynamicListView method setAdapter.
/**
* Sets the {@link ListAdapter} for this {@code DynamicListView}.
* If the drag and drop functionality is or will be enabled, the adapter should have stable ids,
* and should implement {@link com.nhaarman.listviewanimations.util.Swappable}.
*
* @param adapter the adapter.
*
* @throws java.lang.IllegalStateException if the drag and drop functionality is enabled
* and the adapter does not have stable ids.
* @throws java.lang.IllegalArgumentException if the drag and drop functionality is enabled
* and the adapter does not implement {@link com.nhaarman.listviewanimations.util.Swappable}.
*/
@Override
public void setAdapter(final ListAdapter adapter) {
ListAdapter wrappedAdapter = adapter;
mSwipeUndoAdapter = null;
if (adapter instanceof BaseAdapter) {
BaseAdapter rootAdapter = (BaseAdapter) wrappedAdapter;
while (rootAdapter instanceof BaseAdapterDecorator) {
if (rootAdapter instanceof SwipeUndoAdapter) {
mSwipeUndoAdapter = (SwipeUndoAdapter) rootAdapter;
}
rootAdapter = ((BaseAdapterDecorator) rootAdapter).getDecoratedBaseAdapter();
}
if (rootAdapter instanceof Insertable) {
mAnimateAdditionAdapter = new AnimateAdditionAdapter((BaseAdapter) wrappedAdapter);
mAnimateAdditionAdapter.setListView(this);
wrappedAdapter = mAnimateAdditionAdapter;
}
}
super.setAdapter(wrappedAdapter);
if (mDragAndDropHandler != null) {
mDragAndDropHandler.setAdapter(adapter);
}
}
use of android.widget.BaseAdapter in project android-flip by openaphid.
the class FlipTextViewFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
flipView = new FlipViewController(inflater.getContext());
flipView.setAdapter(new BaseAdapter() {
@Override
public int getCount() {
return 10;
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
NumberTextView view;
if (convertView == null) {
final Context context = parent.getContext();
view = new NumberTextView(context, position);
view.setTextSize(context.getResources().getDimension(R.dimen.textSize));
} else {
view = (NumberTextView) convertView;
view.setNumber(position);
}
return view;
}
});
return flipView;
}
Aggregations