desc:BaseActivity

main
xiaowusky 2 years ago
parent c7ffa8146d
commit 83cfee24fe

@ -49,5 +49,6 @@ dependencies {
implementation project(path: ':library-serialPort')
//excel
implementation rootProject.ext.dependencies.jxl
implementation 'com.google.android.material:material:1.5.0'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.0.0'
}

@ -25,10 +25,9 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name="com.yinuo.safetywatcher.MainActivity"
android:name=".watcher.HomeActivity"
android:exported="true"
android:launchMode="singleInstance">
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -36,7 +35,11 @@
</intent-filter>
</activity>
<activity
android:name="com.yinuo.safetywatcher.UVCActivity"
android:name=".MainActivity"
android:exported="false"
android:launchMode="singleInstance" />
<activity
android:name=".UVCActivity"
android:exported="false"
android:launchMode="singleInstance">
<intent-filter>
@ -50,11 +53,11 @@
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</activity>
<activity
android:name="com.yinuo.safetywatcher.player.ProVideoActivity"
android:name=".player.ProVideoActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="false"
android:theme="@style/FullscreenTheme" />
</application>
</manifest>

@ -0,0 +1,16 @@
package com.yinuo.safetywatcher.watcher
import android.view.View
import com.yinuo.safetywatcher.databinding.ActivityHomeBinding
import com.yinuo.safetywatcher.watcher.base.BaseActivity
class HomeActivity : BaseActivity() {
private val mBinding: ActivityHomeBinding by lazy {
ActivityHomeBinding.inflate(layoutInflater)
}
override fun generateContentView(): View {
return mBinding.root
}
}

@ -0,0 +1,22 @@
package com.yinuo.safetywatcher.watcher.base
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.yinuo.safetywatcher.R
import com.yinuo.safetywatcher.databinding.ActivityBaseBinding
abstract class BaseActivity : AppCompatActivity() {
private val baseBinding: ActivityBaseBinding by lazy {
ActivityBaseBinding.inflate(layoutInflater)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(baseBinding.root)
baseBinding.container.addView(generateContentView())
}
open abstract fun generateContentView(): View
}

@ -0,0 +1,8 @@
package com.yinuo.safetywatcher.watcher.view
import android.content.Context
import android.widget.LinearLayout
class CommonTopBar(context: Context) : LinearLayout(context) {
}

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.yinuo.safetywatcher.watcher.view.CommonTopBar
android:id="@+id/topBar"
android:layout_width="match_parent"
android:layout_height="@dimen/_87dp"/>
</LinearLayout>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</RelativeLayout>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="_87dp">87dp</dimen>
</resources>

@ -131,6 +131,7 @@ project.ext {
extension.apply plugin: 'kotlin-android'
extension.apply plugin: 'kotlin-parcelize'
extension.apply plugin: 'kotlin-kapt'
extension.apply plugin: 'org.jetbrains.kotlin.android'
extension.description "lib"
setAndroidConfig extension.android

Loading…
Cancel
Save