Modify: 基类调整,不再使用构造方法,采用反射进行初始化
This commit is contained in:
@ -65,9 +65,6 @@ android {
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@ -21,15 +21,7 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/base_AppTheme"
|
||||
tools:ignore="UnusedAttribute">
|
||||
<activity
|
||||
android:name=".MyActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/base_AppTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- 屏幕适配基准DP -->
|
||||
<meta-data
|
||||
android:name="design_width_in_dp"
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
package com.quyunshuo.androidbaseframemvvm;
|
||||
|
||||
|
||||
import com.quyunshuo.androidbaseframemvvm.databinding.MyActivityLayoutBinding;
|
||||
import com.quyunshuo.base.mvvm.v.BaseFrameActivity;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author DBoy
|
||||
* @date 2020/9/26
|
||||
* Class 描述 :
|
||||
*/
|
||||
public class MyActivity extends BaseFrameActivity<MyActivityLayoutBinding, MyViewModel> {
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
getMViewModel().test();
|
||||
getMBinding().testTv.setText("反射初始化 ViewBinding");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViewObserve() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package com.quyunshuo.androidbaseframemvvm;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
/**
|
||||
* @author DBoy
|
||||
* @date 2020/9/26
|
||||
* Class 描述 :
|
||||
*/
|
||||
public class MyViewModel extends ViewModel {
|
||||
|
||||
public void test(){
|
||||
Log.e("DJC", "AAA");
|
||||
}
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#fff">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_Tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:textColor="#000"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user