butterknife

一行代码搞定Adapter

自古美人都是妖i 提交于 2019-12-17 16:50:08
15年Google I/O大会发不了三个重要支持库 >Material design (Android Support Design) >百分比布局:Percent support lib >数据绑定: Data Binding Library 如果你还不没用过Data Bind Library 没关系 那你知道ButterKnife吧 DataBindLibrary 和ButterKnife都是编译时期生成相应的注解文件 因此 在性能上不会有什么大的影响 因此放心的尝试吧。(个人感觉DataBind 比ButterKnife 稍微复杂一些 但是用起来也比较爽一些 后面会附上关于 Data Binding使用的一些链接) 一行代码搞定Adapter: 基于 RxJava + Data Binding + RxRecyclerView new RxDataSource<String>(dataSet).repeat(1).bindRecyclerView (fragmentBinding.mGridView,R.layout.item_homepage_gridview) .subscribe(stringViewDataBindingSimpleViewHolder -> { }); 详情见 github: https://github.com/ahmedrizwan

ButterKnife 8.0.1 not working

无人久伴 提交于 2019-12-17 16:05:21
问题 I am using butterknife 8.0.1 , but a nullpointerexception is appearing. This line is on my build.grade file: compile 'com.jakewharton:butterknife:8.0.1' this is my Main Class: (I wrote the includes properly) import butterknife.BindView; import butterknife.ButterKnife; public class MainActivity extends BaseActivity { @BindView(R.id.MainScreenTextView) TextView mainText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout

final field in R2.java in ButterKnife

不羁的心 提交于 2019-12-14 02:35:09
问题 this is an extension of Android: Why do we need to use R2 instead of R with butterknife? and Reference in R.java not final I understand that fields of R.java in the library project do not have final modifier to protect value collisions between library projects. However ButterKnife recovers final modifier in R2 and uses it. I think this goes to the collision problem and values can collide, but there is no problem. How does it work? === I add examples. There are one main project and one library

Button Click triggered multiple times

无人久伴 提交于 2019-12-13 21:43:01
问题 A common problem in android apps for me seems to be, that click events can be triggered multiple times, when they should not. I am using Butterknife - consider the following example @OnClick(R.id.button_foto_aufnehmen) protected void takePicture() { m_camera.takePicture(); } with a camera app with some layout containing <SurfaceView android:id="@+id/surface_view" android:layout_width="match_parent" android:layout_height="match_parent"/> ... <ImageButton android:id="@+id/button_foto_aufnehmen"

Does butterknife 7.x work with Kotlin M14?

核能气质少年 提交于 2019-12-13 12:25:58
问题 I'm trying to use Butterknife with some Kotlin code and also Java code. I know that before M12, there was bad or no support for annotation processing that ButterKnife required. So I have kept my activities in Java. It was working at least in Java with Butterknife 6.x and preM12 Kotlin. I'm trying now butterknife 7.x with M13 and M14. It should have even annotation processing support, but it's not working for me. bind() function doesn't bind anything in my adapter which is written in Java nor

Butterknife gradle error on Android Studio 3.0 due to android-apt plugin

孤街醉人 提交于 2019-12-12 10:54:04
问题 After upgrading to Android Studio 3.0 I had some issues with gradle that I was able to fix checking on the developers website However, I was not able to find how to fix the issue with the apply plugin: 'android-apt' I have tried several things such as removing it from the project gradle and add it to the app gradle as annotationProcessor 'com.neenbedankt.gradle.plugins:android-apt:1.8' . also removed the apt, etc, etc. Anyway, Studio is complaining about it. Any help is greatly appreciated.

Android Studio: ButterKnife 6.1.0 Duplicate Class: $$View Injector

白昼怎懂夜的黑 提交于 2019-12-12 09:44:47
问题 I migrated my project to AS from Eclipse as I was getting 65K methods issue. After fixing every dependency issue that I was facing initially with AS, I got stuck with this issue which doesn't seem to go away no matter what I try from the other similar posts from around the blogs and SO itself. I checked Enable Annotation Processing in Annotation Processors and also gave a processor path. (even tried with Obtain processor from project classpath) but whenever I run the project it gives the

Create a custom Annotation ButterKnife

梦想的初衷 提交于 2019-12-12 09:07:59
问题 I'm trying to create a custom listener Annotation to ButterKnife but I can't make it work. Here is my Annotation: @Target(ElementType.METHOD) @Retention(RetentionPolicy.CLASS) @ListenerClass( targetType = "com.maddogs.mymoney.views.CameraImageView", setter = "setCameraImageViewListener", type = "com.maddogs.mymoney.views.CameraImageViewListener", method = @ListenerMethod( name = "onCloseClick", parameters = {"com.maddogs.mymoney.views.CameraImageView"}, returnType = "boolean", defaultReturn =

NullPointerException with using ButterKnife

末鹿安然 提交于 2019-12-12 01:18:02
问题 I enable annotation processing like this and follow this code: public class MainFragment extends Fragment implements WeatherUpdater.AsyncResponse { @BindView(R.id.temperature_max) TextView temperature_max; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_main, container, false); ButterKnife.bind(this, view); temperature_max.setText("NULL POINTER!"); ... return view; } } I have complex

谈谈Android AOP技术方案

假装没事ソ 提交于 2019-12-11 10:08:08
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 理解AOP 之前几篇文章我们详细介绍了AOP的几种技术方案,由于AOP技术复杂多样,实际需求也不尽相同,那么我们应该如何做技术选型呢? 本篇将会对现有的AOP技术做一个统一的介绍,尤其侧重在Android方向的落地,希望对你有所帮助,文中内容、示例大都来自工作总结,如有偏颇不妥,欢迎指正。 这里先统一一下基本名词,以便表述。 切面: 对一类行为的抽象,是切点的集合,比如在用户访问所有模块前做的权限认证。 切点: 描述切面的具体的一个业务场景。 通知(Advice)类型: 通常分为切点前、切点后和切点内,比如在方法前织入代码是指切点前。 AOP是一种面向切面编程的技术的统称,AOP框架最终都会围绕class字节码的操作展开,无论是对字节码的操作增删改,为方便描述,我们统称为 代码的织入 。 虽然AOP翻译过来叫面向 切面 编程,但在实际使用过程中,切面可能退化成了一个 点 ,比如我们想统计app的冷启动时间,这就非常具体了。如果我们用AOP的技术实现统计所有函数的耗时时间,自然能统计到类似启动这个阶段的时间。 从狭义来看实现AOP技术的框架必须是能将切面编程抽象成上层可以直接使用的工具或API,但当我们将 切面 降维后,最终面向的就是 切点 而已。换句话说,只要能将代码织入到某个点那这种技术就一定可以实现AOP