Skip to content

Commit

Permalink
移除butterknife
Browse files Browse the repository at this point in the history
  • Loading branch information
littledou committed Dec 10, 2020
1 parent 2513eed commit 710341f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 23 deletions.
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.4.10'
ext.kotlin_version = '1.4.20'
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.1'
}
}

Expand Down
1 change: 0 additions & 1 deletion rscamera/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ dependencies {
implementation project(path: ':util')
implementation 'androidx.core:core-ktx:1.3.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class Camera1v2Activity : BaseCoreActivity() {
override fun initView() {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

launch {


}
cameraView = findViewById(R.id.cameraview)
cameraView.cameraRenderer.params.facing = 0
cameraView.cameraRenderer.params.w = 640
Expand Down
9 changes: 3 additions & 6 deletions util/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.jakewharton.butterknife'

android {
compileSdkVersion 29
compileSdkVersion 30

defaultConfig {
minSdkVersion 17
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.5.0"
versionName "1.5.1"

}

Expand All @@ -29,8 +28,6 @@ android {

dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.jakewharton:butterknife:10.2.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation "androidx.core:core-ktx:1.3.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
package cn.readsense.module.base

import android.app.ProgressDialog
import android.content.Context
import android.os.Bundle
import androidx.annotation.IdRes
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.LifecycleObserver
import butterknife.ButterKnife
import butterknife.Unbinder
import cn.readsense.module.permissions.PermissionListener
import cn.readsense.module.permissions.PermissionsUtil
import cn.readsense.module.util.DisplayUtil
import cn.readsense.module.util.ToastUtils
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.cancel
import java.util.*

abstract class BaseCoreActivity : AppCompatActivity(), CoroutineScope by MainScope() {
var progressDialog: ProgressDialog? = null
var unbinder: Unbinder? = null
private var screenWidth = 0
private var screenHeight = 0
private var permissions: MutableList<String> = mutableListOf()
private val lifecycleObservers: MutableList<LifecycleObserver> = mutableListOf()
override fun setContentView(@LayoutRes layoutResID: Int) {
super.setContentView(layoutResID)
unbinder = ButterKnife.bind(this)
}

public override fun onCreate(savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -99,7 +93,6 @@ abstract class BaseCoreActivity : AppCompatActivity(), CoroutineScope by MainSco

override fun onDestroy() {
super.onDestroy()
unbinder!!.unbind()
cancel()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import butterknife.ButterKnife;
import butterknife.Unbinder;


public abstract class BaseCoreFragment extends Fragment {
public View rootView;
public LayoutInflater inflater;
Unbinder unbinder;

@Nullable
@Override
Expand All @@ -24,7 +20,6 @@ public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bun
this.inflater = inflater;
if (rootView == null) {
rootView = inflater.inflate(this.getLayoutId(), container, false);
unbinder = ButterKnife.bind(this, rootView);
initView();
}
ViewGroup parent = (ViewGroup) rootView.getParent();
Expand All @@ -37,7 +32,6 @@ public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bun
@Override
public void onDetach() {
super.onDetach();
unbinder.unbind();
}

protected abstract int getLayoutId();
Expand Down

0 comments on commit 710341f

Please sign in to comment.