问题标签 [fastadapter]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
1310 浏览

android - 即使数据保持不变,从 LiveData 加载后 FastAdapter 也会闪烁

对于这个问题,我在 Github 准备了一个简单且有效的示例

应用截图

我的示例应用程序使用 okhttp 下载了一个包含游戏中前 30 名玩家的 JSON 数组,并将它们存储到 SQLite Room 中。在片段中,我观察了相应的LiveData<List<TopEntity>>对象并更新了 FastAdapter 实例:

我的问题是:每次下载数据时,回收站视图都会闪烁一次。

尽管前 30 名并不经常变化,即数据保持不变。

当我查看 Penz 先生出色的FastAdapter库中的示例应用程序时,我看不到那里有任何闪烁。

更新:

我有一个提示,闪烁显然是由调用方法引起mItemAdapter.clear();onChanged,我应该改用 DiffUtil 类。

所以我添加了一个新类:

然后我试图在onChanged方法中使用它而不是仅仅调用mItemAdapter.clear()但是 RecyclerView 保持为空,即使tops有元素:

我的问题的简短摘要:

我的真实应用程序使用FastAdapter有几个原因,我正在寻找一种方法将其与DiffUtil “结合” ,以消除通过 HTTPS 下载数据并在 Room 中更新数据时的一次性闪烁。

0 投票
2 回答
269 浏览

android - FastAdapter:滑动后撤消按钮不显示

我正在尝试在带有模型适配器的列表上使用 swipeCallback。为了使其正常工作,我剥离了所有自定义项并将其建模为接近示例应用程序,但这种组合会产生不允许撤消的错误。当我滑动时,会发生这种情况:

在此处输入图像描述

滑动有效,但未显示撤消图标。任何想法我做错了什么?底层片段是这样的:

这是可滑动的 ModelItem(模型“ModelSongCounter”只是一个 POJO):

这是 List-Item 的 XML 视图:

0 投票
1 回答
583 浏览

android - FastAdapter 和 ConstraintLayout 的滚动问题:跳过 211 帧

对于我的问题,我在 Github 上准备了一个非常简单的 AndroidX 测试应用程序

截屏

我在MainActivity中使用了非常好的 FastAdapter 库:

对于项目布局,我使用带有 8 个 TextView 和 4 个 ImageView 的 ConstraintLayout:

在手机上调试应用程序(我使用 Moto G2 和 Moto G4 Play)并滚动只有 10 个项目的列表时,我不断收到警告:

在我的真实应用程序中,我有其他布局的片段不会产生此类错误,所以我不认为旧手机是原因。我也不会滚动得特别快或太慢。

0 投票
1 回答
1324 浏览

android - FastAdapter 项目内视图的单击侦听器

我正在尝试为 CardView 中的按钮实现单击侦听器。当我按下此按钮时,该项目将被删除。但我找不到实现它的方法。FastAdapter 文档位于 Kotlin 中,因此没有 Java 示例。

通常这是在 onBindView 中完成的,但对于 FastAdapter,方法是不同的。这是我的模型(RequestBuyer)

模型.java

这是我的片段活动(RequestActivityBuyer)

活动.java

我试图遵循这个例子,但它没有工作,因为图书馆从那时起逐渐改变。链接:FastAdapter ViewHolder 监听器

0 投票
1 回答
165 浏览

android - Android FastAdapter ClickEventHook isn't working properly

I am seeking forgiveness for this simple problem. I am using FastAdapter for the first time and I am new to Kotlin. Let me share the problem. I have a layout for the recyclerview item holder, an adapter which extends AbstractItem class.

Actually I couldn't format the code correctly here on Stack overflow. So I created the code at GitHub Gist. Here is the link.

In the layout_add_item.xml file, I have two buttons, one's id is addStudent and another one's id is addTeacher.

So, my problem is, these two button's onClickListener is not triggered until I click on the root layout once on every onCreate method is called. If I click on the LinearLayout once, then these two button's onClickEvent get fired normally.

I don't know what's wrong here :-(

Any help would be appreciated. Thanks in advance.

0 投票
1 回答
249 浏览

android - 扩展嵌套项 FastAdapter

我找不到使用 FastAdapter 库扩展嵌套项目的方法。

示例:
类别 1
  -- 子类别 1 // 类别的子项
    ++ SubSubCategory 1 // 子类别的子
    项 ++ SubSubCategory 2
  -- 子类别 2
    ++ SubSubCategory 3
    ++ SubSubCategory 4
类别 2
  -- 子类别 1
  -- 子类别 2

I'我想扩展“SubSubCategory 2”。当我通过单击(显然)手动执行此操作时,它可以工作。但在某些情况下,我想以编程方式打开它。如果我想打开 Subcategory - ,我知道该怎么做getExpandableExtension().expand(globalPosition)。但是如何使用 SubSubCategory 做到这一点?我不知道有什么办法可以得到他们的位置。更改 isExpanded 标志也无济于事。我知道我要打开的项目的标识符。

0 投票
1 回答
209 浏览

android - FastAdapter 组合标题和项目

我使用 mikepenz 的库 fastadapter https://github.com/mikepenz/FastAdapter

需要结合不同的观点

项目类别

显示标题类

用于生成项目

我不知道如何组装适配器,以便它可以有两种不同类型的视图。

一个简单的例子?因为存储库中的内容太复杂而无法理解

0 投票
0 回答
45 浏览

android - Is there any way to add Native Ad to the adapter with fast adapter?

I am developing an app that will show AdMob Native Ad in Recycler View. I know how can I code the Recycler View adapter for it without any 3rd party libraries. But I am using fast adapter library and I don't know how can I show the ad in fast adapter.

The adapter class:

There is fragment:

Is there any way to add Native Ad to the adapter with fast adapter?