本文整理汇总了Java中com.mikepenz.fastadapter.commons.adapters.FastItemAdapter类的典型用法代码示例。如果您正苦于以下问题:Java FastItemAdapter类的具体用法?Java FastItemAdapter怎么用?Java FastItemAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FastItemAdapter类属于com.mikepenz.fastadapter.commons.adapters包,在下文中一共展示了FastItemAdapter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
};
}
开发者ID:pyamsoft,项目名称:dontsuck-mp,代码行数:19,代码来源:MediaBrowserDelegate.java
示例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);
}
开发者ID:pyamsoft,项目名称:dontsuck-mp,代码行数:22,代码来源:ShowQueueDialog.java
示例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;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:FastAdapterDialog.java
示例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();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:FastAdapterDialog.java
示例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;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:FastAdapterBottomSheetDialog.java
示例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;
}
开发者ID:MFlisar,项目名称:RecyclerViewPreferences,代码行数:15,代码来源:SettingsUtil.java
示例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);
}
开发者ID:MFlisar,项目名称:RecyclerViewPreferences,代码行数:12,代码来源:SettingsUtil.java
示例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();
}
}
开发者ID:MFlisar,项目名称:RecyclerViewPreferences,代码行数:10,代码来源:FastAdapterUtil.java
示例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;
}
开发者ID:MFlisar,项目名称:RecyclerViewPreferences,代码行数:8,代码来源:FastAdapterUtil.java
示例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();
}
开发者ID:pyamsoft,项目名称:dontsuck-mp,代码行数:8,代码来源:AlbumDialog.java
示例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();
}
开发者ID:pyamsoft,项目名称:dontsuck-mp,代码行数:9,代码来源:AllArtistListFragment.java
示例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);
}
}
开发者ID:pyamsoft,项目名称:dontsuck-mp,代码行数:9,代码来源:MediaBrowserDelegate.java
示例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;
});
}
}
开发者ID:pyamsoft,项目名称:dontsuck-mp,代码行数:12,代码来源:MediaBrowserDelegate.java
示例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);
}
}
});
}
开发者ID:OpenLauncherTeam,项目名称:openlauncher,代码行数:39,代码来源:MinibarEditFragment.java
示例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;
}
开发者ID:AllanWang,项目名称:Capsule,代码行数:8,代码来源:AnimationAdapter.java
示例16: onCreateView
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_product_dialog, container);
// RecyclerView
RecyclerView productsView = v.findViewById(R.id.productsView);
productsView.setLayoutManager(new LinearLayoutManager(getContext()));
adapter = new FastItemAdapter<>();
adapter.withSelectable(true);
productsView.setAdapter(adapter);
for (Product product : Product.ALL) {
adapter.add(new ProductItem(product));
}
// Get view model and observe products
viewModel = ViewModelProviders.of(getActivity(), viewModelFactory).get(DirectionsViewModel.class);
if (savedInstanceState == null) {
viewModel.getProducts().observe(this, this::onProductsChanged);
} else {
adapter.withSavedInstanceState(savedInstanceState);
}
// OK Button
okButton = v.findViewById(R.id.okButton);
okButton.setOnClickListener(view -> {
EnumSet<Product> products = getProductsFromItems(adapter.getSelectedItems());
viewModel.setProducts(products);
getDialog().cancel();
});
// Cancel Button
Button cancelButton = v.findViewById(R.id.cancelButton);
cancelButton.setOnClickListener(view -> getDialog().cancel());
return v;
}
开发者ID:grote,项目名称:Transportr,代码行数:36,代码来源:ProductDialogFragment.java
示例17: onCreate
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);
// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(R.string.sample_image_list);
//style our ui
new MaterializeBuilder().withActivity(this).build();
//create our FastAdapter which will manage everything
mFastItemAdapter = new FastItemAdapter<>();
//init the ClickListenerHelper which simplifies custom click listeners on views of the Adapter
mClickListenerHelper = new ClickListenerHelper<>(mFastItemAdapter);
//configure our fastAdapter
mFastItemAdapter.withOnClickListener(new FastAdapter.OnClickListener<ImageItem>() {
@Override
public boolean onClick(View v, IAdapter<ImageItem> adapter, ImageItem item, int position) {
Toast.makeText(v.getContext(), item.mName, Toast.LENGTH_SHORT).show();
return false;
}
});
//get our recyclerView and do basic setup
RecyclerView rv = (RecyclerView) findViewById(R.id.rv);
//find out how many columns we display
int columns = getResources().getInteger(R.integer.wall_splash_columns);
if (columns == 1) {
//linearLayoutManager for one column
rv.setLayoutManager(new LinearLayoutManager(this));
} else {
//gridLayoutManager for more than one column ;)
rv.setLayoutManager(new GridLayoutManager(this, columns));
}
rv.setItemAnimator(new DefaultItemAnimator());
rv.setAdapter(mFastItemAdapter);
//fill with some sample data
mFastItemAdapter.add(ImageDummyData.getImageItems());
//restore selections (this has to be done after the items were added
mFastItemAdapter.withSavedInstanceState(savedInstanceState);
//a custom OnCreateViewHolder listener class which is used to create the viewHolders
//we define the listener for the imageLovedContainer here for better performance
//you can also define the listener within the items bindView method but performance is better if you do it like this
mFastItemAdapter.withItemEvent(new ImageItem.ImageItemHeartClickEvent());
//set the back arrow in the toolbar
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(false);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:59,代码来源:ImageListActivity.java
示例18: onCreate
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(R.string.sample_realm_list);
//style our ui
new MaterializeBuilder().withActivity(this).build();
//create our FastAdapter which will manage everything
mFastItemAdapter = new FastItemAdapter<>();
//configure our fastAdapter
mFastItemAdapter.withOnClickListener(new FastAdapter.OnClickListener<RealmSampleUserItem>() {
@Override
public boolean onClick(View v, IAdapter<RealmSampleUserItem> adapter, RealmSampleUserItem item, int position) {
Toast.makeText(v.getContext(), item.getName(), Toast.LENGTH_SHORT).show();
return false;
}
});
//get our recyclerView and do basic setup
RecyclerView rv = (RecyclerView) findViewById(R.id.rv);
rv.setLayoutManager(new LinearLayoutManager(this));
rv.setItemAnimator(new AlphaInAnimator());
rv.setAdapter(mFastItemAdapter);
//Get a realm instance for this activity
mRealm = Realm.getDefaultInstance();
//Add a realm on change listener (don´t forget to close this realm instance before adding this listener again)
mRealm.where(RealmSampleUserItem.class).findAllAsync().addChangeListener(new RealmChangeListener<RealmResults<RealmSampleUserItem>>() {
@Override
public void onChange(RealmResults<RealmSampleUserItem> userItems) {
//This will call twice
//1.) from findAllAsync()
//2.) from createData()
mFastItemAdapter.setNewList(userItems);
}
});
//fill with some sample data
createData();
//set the back arrow in the toolbar
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(false);
//restore selections (this has to be done after the items were added
mFastItemAdapter.withSavedInstanceState(savedInstanceState);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:57,代码来源:RealmActivity.java
示例19: onCreate
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
//as we use an icon from Android-Iconics via xml we add the IconicsLayoutInflater
//https://github.com/mikepenz/Android-Iconics
LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);
// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(R.string.sample_collapsible);
//style our ui
new MaterializeBuilder().withActivity(this).build();
//create our FastAdapter
fastItemAdapter = new FastItemAdapter<>();
fastItemAdapter.withSelectable(true);
//get our recyclerView and do basic setup
RecyclerView rv = (RecyclerView) findViewById(R.id.rv);
rv.setLayoutManager(new LinearLayoutManager(this));
rv.setItemAnimator(new SlideDownAlphaAnimator());
rv.setAdapter(fastItemAdapter);
//fill with some sample data
List<IItem> items = new ArrayList<>();
for (int i = 1; i <= 100; i++) {
if (i % 10 == 0) {
SimpleSubExpandableItem expandableItem = new SimpleSubExpandableItem();
expandableItem
.withName("Test " + i)
.withIdentifier(100 + i);
//add subitems so we can showcase the collapsible functionality
List<IItem> subItems = new LinkedList<>();
for (int ii = 1; ii <= 5; ii++) {
SimpleSubItem sampleItem = new SimpleSubItem();
sampleItem
.withName("-- Test " + ii)
.withIdentifier(1000 + ii);
subItems.add(sampleItem);
}
expandableItem.withSubItems(subItems);
items.add(expandableItem);
} else {
items.add(new SimpleSubItem().withName("Test " + i).withIdentifier(100 + i));
}
}
fastItemAdapter.add(items);
//restore selections (this has to be done after the items were added
fastItemAdapter.withSavedInstanceState(savedInstanceState);
//set the back arrow in the toolbar
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(false);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:62,代码来源:ExpandableSampleActivity.java
示例20: onCreate
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content)
.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sort);
ButterKnife.bind(this);
// Handle Toolbar
setSupportActionBar(toolbar);
//style our ui
new MaterializeBuilder().withActivity(this).build();
//create our FastAdapter which will manage everything
fastItemAdapter = new FastItemAdapter<>();
fastItemAdapter.withSelectable(true);
//configure our fastAdapter
fastItemAdapter.withOnClickListener(new FastAdapter.OnClickListener<SimpleItem>() {
@Override
public boolean onClick(View v, IAdapter<SimpleItem> adapter,
SimpleItem item, int position) {
Toast.makeText(v.getContext(), (item).name.getText(v.getContext()),
Toast.LENGTH_LONG).show();
return false;
}
});
//get our recyclerView and do basic setup
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(fastItemAdapter);
if (savedInstanceState != null) {
//Retrieve the previous sorting strategy from the instance state
sortingStrategy = toSortingStrategy(savedInstanceState.getInt("sorting_strategy"));
} else {
//Set the default so
sortingStrategy = SORT_NONE;
}
//we sort the list
fastItemAdapter.getItemAdapter().withComparator(getComparator());
//initial filling of the list
fastItemAdapter.setNewList(generateUnsortedList());
//restore selections (this has to be done after the items were added
fastItemAdapter.withSavedInstanceState(savedInstanceState);
//set the back arrow in the toolbar
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(false);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:58,代码来源:SortActivity.java
注:本文中的com.mikepenz.fastadapter.commons.adapters.FastItemAdapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论