本文整理汇总了Java中com.mikepenz.fastadapter.commons.adapters.FastItemAdapter类的典型用法代码示例。如果您正苦于以下问题:Java FastItemAdapter类的具体用法?Java FastItemAdapter怎么用?Java FastItemAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FastItemAdapter类属于com.mikepenz.fastadapter.commons.adapters包,在下文中一共展示了FastItemAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOnQueryTextListener
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
@CheckResult @NonNull private SearchView.OnQueryTextListener getOnQueryTextListener(
@NonNull FastItemAdapter<? extends FilterableItem> listAdapter) {
return new SearchView.OnQueryTextListener() {
@Override public boolean onQueryTextChange(String newText) {
listAdapter.filter(newText);
return true;
}
@Override public boolean onQueryTextSubmit(String query) {
listAdapter.filter(query);
if (searchView != null) {
searchView.clearFocus();
}
return true;
}
};
}
示例2: setupList
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
private void setupList() {
final FastItemAdapter<ShowQueueItem> fastItemAdapter = new FastItemAdapter<>();
for (final Song track : queue) {
fastItemAdapter.add(new ShowQueueItem(track));
}
fastItemAdapter.withSelectable(true);
fastItemAdapter.withOnClickListener((v, adapter, item, position) -> {
final List<Song> trackList = new ArrayList<>();
//noinspection Convert2streamapi
for (final ShowQueueItem queueItem : adapter.getAdapterItems()) {
trackList.add(queueItem.getModel());
}
// TODO
//PlayerService.queueNext(v.getContext(), trackList, position);
return true;
});
binding.queueRecyclerList.setLayoutManager(new LinearLayoutManager(getContext()));
binding.queueRecyclerList.setAdapter(fastItemAdapter);
}
示例3: withItems
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
public FastAdapterDialog<Item> withItems(@NonNull List<Item> items) {
if (mFastItemAdapter == null) {
mFastItemAdapter = new FastItemAdapter<>();
mRecyclerView.setAdapter(mFastItemAdapter);
}
mFastItemAdapter.set(items);
return this;
}
示例4: show
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
/**
* Start the dialog and display it on screen. The window is placed in the
* application layer and opaque. Note that you should not override this
* method to do initialization when the dialog is shown, instead implement
* that in {@link #onStart}.
*/
public void show() {
if (mRecyclerView.getLayoutManager() == null) {
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
}
if (mFastItemAdapter == null && mRecyclerView.getAdapter() == null) {
mFastItemAdapter = new FastItemAdapter<>();
mRecyclerView.setAdapter(mFastItemAdapter);
}
super.show();
}
示例5: withItems
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
public FastAdapterBottomSheetDialog<Item> withItems(@NonNull List<Item> items) {
if (mFastItemAdapter == null) {
mFastItemAdapter = new FastItemAdapter<>();
mRecyclerView.setAdapter(mFastItemAdapter);
}
mFastItemAdapter.set(items);
return this;
}
示例6: initAdapter
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
public static FastItemAdapter<IItem> initAdapter(FastItemAdapter<IItem> adapter, List<IItem> items, Bundle savedInstanceState, String fastAdapterBundlePrefix) {
adapter.withEventHook(new BaseSettingsItem.EnableSettingsSwitchEvent());
adapter.withEventHook(new BaseSettingsItem.ShowSettingsEvent());
adapter.withEventHook(new BaseSettingsItem.ShowInfoEvent());
adapter.withEventHook(new SpinnerSettingItem.SettingsSpinnerTopEvent());
adapter.withEventHook(new SpinnerSettingItem.SettingsSpinnerBottomEvent());
adapter.withEventHook(new SwitchSettingItem.SettingsSwitchBottomEvent());
adapter.withEventHook(new SwitchSettingItem.SettingsSwitchTopEvent());
adapter.withEventHook(new EditTextSettingItem.SettingsEditTextTopEvent());
adapter.withEventHook(new EditTextSettingItem.SettingsEditTextBottomEvent());
adapter.withEventHook(new NumberSettingItem.SettingsSeekbarTopEvent());
setNewList(adapter, items, savedInstanceState, fastAdapterBundlePrefix);
return adapter;
}
示例7: setNewList
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
public static void setNewList(FastItemAdapter<IItem> adapter, List<IItem> items, Bundle savedInstanceState, String fastAdapterBundlePrefix) {
Bundle expandedStates = getFastAdapterBundle(savedInstanceState, fastAdapterBundlePrefix);
if (expandedStates == null) {
expandedStates = getExpandedIdsBundleAndResetExpanded(items, fastAdapterBundlePrefix);
} else {
// collapse all items again!
setExpandedState(items, false);
}
adapter.setNewList(items);
adapter.withSavedInstanceState(expandedStates, fastAdapterBundlePrefix);
}
示例8: expand
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
public static void expand(FastItemAdapter adapter) {
if (adapter.getExtensions() == null || adapter.getExtensions().size() == 0) {
return;
}
ExpandableExtension expandableExtension = (ExpandableExtension) adapter.getExtensions().iterator().next();
if (expandableExtension != null) {
expandableExtension.expand();
}
}
示例9: getExpandableExtension
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
public static ExpandableExtension getExpandableExtension(FastItemAdapter adapter) {
if (adapter.getExtensions() == null || adapter.getExtensions().size() == 0) {
return null;
}
ExpandableExtension expandableExtension = (ExpandableExtension) adapter.getExtensions().iterator().next();
return expandableExtension;
}
示例10: onCreateView
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
@Nullable @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
fastAdapter = new FastItemAdapter<>();
binding = DialogAlbumBinding.inflate(inflater, container, false);
return binding.getRoot();
}
示例11: onCreateView
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
@Nullable @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
listIsRefreshed = false;
fastAdapter = new FastItemAdapter<>();
binding = FragmentAllArtistListBinding.inflate(inflater, container, false);
return binding.getRoot();
}
示例12: onPrepareOptionsMenu
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
public void onPrepareOptionsMenu(@NonNull Menu menu,
@NonNull FastItemAdapter<? extends FilterableItem> listAdapter) {
searchItem = menu.findItem(R.id.menu_search);
if (searchItem != null) {
searchView = (SearchView) searchItem.getActionView();
setSearchViewOnQueryTextListener(listAdapter);
}
}
示例13: setSearchViewOnQueryTextListener
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
private void setSearchViewOnQueryTextListener(
@NonNull FastItemAdapter<? extends FilterableItem> listAdapter) {
if (searchView != null) {
Timber.d("Set Search View listeners");
searchView.setOnQueryTextListener(getOnQueryTextListener(listAdapter));
searchView.setOnCloseListener(() -> {
listAdapter.filter(null);
return true;
});
}
}
示例14: onCreate
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ButterKnife.bind((Activity) context);
adapter = new FastItemAdapter<>();
SimpleDragCallback touchCallback = new SimpleDragCallback(this);
ItemTouchHelper touchHelper = new ItemTouchHelper(touchCallback);
touchHelper.attachToRecyclerView(recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(context));
recyclerView.setAdapter(adapter);
int i = 0;
final ArrayList<String> minBarArrangement = AppSettings.get().getMinibarArrangement();
for (String act : minBarArrangement) {
LauncherAction.ActionDisplayItem item = LauncherAction.getActionItemFromString(act.substring(1));
adapter.add(new AppItem(i, item, act.charAt(0) == '0'));
i++;
}
boolean minibarEnable = AppSettings.get().getMinibarEnable();
enableSwitch.setChecked(minibarEnable);
enableSwitch.setText(minibarEnable ? R.string.on : R.string.off);
enableSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
buttonView.setText(isChecked ? R.string.on : R.string.off);
AppSettings.get().setMinibarEnable(isChecked);
if (Home.Companion.getLauncher() != null) {
Home.Companion.getLauncher().getDrawerLayout().closeDrawers();
Home.Companion.getLauncher().getDrawerLayout().setDrawerLockMode(isChecked ? DrawerLayout.LOCK_MODE_UNLOCKED : DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
}
});
}
示例15: add
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
@Override
public FastItemAdapter<Item> add(int position, List<Item> items) {
trigger(position);
super.add(position, items);
triggerListener(getAnimFinishedListener(ADD));
return this;
}