10000 +):添加了AndroidAnnotations注解测试实例... · lhwCoding/FastDev4Android@0f46fb7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0f46fb7

Browse files
committed
+):添加了AndroidAnnotations注解测试实例...
1 parent ad20848 commit 0f46fb7

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ android {
99
minSdkVersion 15
1010
targetSdkVersion 22
1111
versionCode 4
12-
versionName "1.1.1"
12+
versionName "1.1.2"
1313
}
1414
buildTypes {
1515
release {

app/src/main/java/com/chinaztt/fda/test/AnnotationsTestActivity.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
import com.chinaztt.fda.ui.R;
88
import com.chinaztt.fda.ui.base.BaseActivity;
99

10+
import org.androidannotations.annotations.AfterInject;
11+
import org.androidannotations.annotations.AfterViews;
12+
import org.androidannotations.annotations.Click;
1013
import org.androidannotations.annotations.EActivity;
14+
import org.androidannotations.annotations.ViewById;
1115

1216

1317
/**
@@ -19,22 +23,24 @@
1923
* QQ: 781931404
2024
* 公司:江苏中天科技软件技术有限公司
2125
*/
22-
2326
@EActivity(R.layout.dragger_inject_layout)
2427
public class AnnotationsTestActivity extends BaseActivity {
25-
private Button btn_show;
26-
private TextView tv_show;
28+
@ViewById
29+
Button btn_show;
30+
@ViewById
31+
TextView tv_show;
2732
@Override
2833
protected void onCreate(Bundle savedInstanceState) {
2934
super.onCreate(savedInstanceState);
3035
setContentView(R.layout.dragger_inject_layout);
31-
btn_show=(Button)this.findViewById(R.id.btn_show);
32-
tv_show=(TextView)this.findViewById(R.id.tv_show);
33-
btn_show.setOnClickListener(new View.OnClickListener() {
34-
@Override
35-
public void onClick(View v) {
36+
}
37+
@Click(R.id.btn_show)
38+
public void btnShowClick(){
39+
tv_show.setText("按钮被点击了...");
40+
}
3641

37-
}
38-
});
42+
@AfterViews
43+
public void setTv_show(){
44+
tv_show.setText("我已经被注入啦...");
3945
}
4046
}

app/src/main/res/layout/dragger_inject_layout.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
android:id="@+id/btn_show"
2020
android:layout_width="wrap_content"
2121
android:layout_height="wrap_content"
22-
android:text="点击显示数据"/>
22+
android:text="按钮点击"/>
2323
<TextView
2424
android:id="@+id/tv_show"
2525
android:layout_margin="5dp"

0 commit comments

Comments
 (0)
0