登录启动页优化
This commit is contained in:
@@ -27,6 +27,15 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.DefenseApplication">
|
android:theme="@style/Theme.DefenseApplication">
|
||||||
|
<activity
|
||||||
|
android:name=".home.StartActivity"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".personal.LoginPasswordActivity"
|
android:name=".personal.LoginPasswordActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
@@ -109,7 +118,8 @@
|
|||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".home.HomeActivity"
|
android:name=".home.HomeActivity"
|
||||||
android:exported="false" />
|
android:exported="false">
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".login.RegisterSuccessActivity"
|
android:name=".login.RegisterSuccessActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
@@ -127,13 +137,7 @@
|
|||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".login.LoginActivity"
|
android:name=".login.LoginActivity"
|
||||||
android:exported="true">
|
android:exported="false" />
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
|||||||
@@ -15,11 +15,6 @@ class MyApplication : Application() {
|
|||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
Utils.init(this) // 初始化 AndroidUtilCode
|
Utils.init(this) // 初始化 AndroidUtilCode
|
||||||
|
|
||||||
var token = UserinfoUtil.getUserInfo()?.access_token;
|
|
||||||
if (token != null) {
|
|
||||||
ApiConfig.authToken = token
|
|
||||||
};
|
|
||||||
LanguageUtil.init(this)
|
LanguageUtil.init(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.example.defenseapplication.home
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.example.defenseapplication.databinding.ActivityStartBinding
|
||||||
|
import com.example.defenseapplication.login.LoginActivity
|
||||||
|
import com.example.defenseapplication.utils.ApiConfig
|
||||||
|
import com.example.defenseapplication.utils.UserinfoUtil
|
||||||
|
|
||||||
|
class StartActivity : AppCompatActivity() {
|
||||||
|
private lateinit var binding: ActivityStartBinding
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
binding = ActivityStartBinding.inflate(layoutInflater)
|
||||||
|
setContentView(binding.root)
|
||||||
|
|
||||||
|
// 延迟2秒后再判断登录状态
|
||||||
|
Handler(Looper.getMainLooper()).postDelayed({
|
||||||
|
val userInfo = UserinfoUtil.getUserInfo()
|
||||||
|
if (userInfo != null) {
|
||||||
|
// 设置token
|
||||||
|
ApiConfig.authToken = userInfo.access_token
|
||||||
|
val intent = Intent(this, HomeActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
|
} else {
|
||||||
|
val intent = Intent(this, LoginActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
finish()
|
||||||
|
}, 2000) // 2秒延迟
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +1,11 @@
|
|||||||
package com.example.defenseapplication.liveVideo
|
package com.example.defenseapplication.liveVideo
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.ActivityInfo
|
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.media.AudioManager
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.example.defenseapplication.R
|
import com.example.defenseapplication.R
|
||||||
@@ -21,9 +15,7 @@ import com.example.defenseapplication.bean.DeviceAlarmBean
|
|||||||
import com.example.defenseapplication.databinding.LiveVideoActivityBinding
|
import com.example.defenseapplication.databinding.LiveVideoActivityBinding
|
||||||
import com.example.defenseapplication.utils.ActivityManager
|
import com.example.defenseapplication.utils.ActivityManager
|
||||||
import com.example.defenseapplication.utils.RetrofitNetwork
|
import com.example.defenseapplication.utils.RetrofitNetwork
|
||||||
import com.example.defenseapplication.view.MyGSYVideoPlayer
|
|
||||||
import com.gyf.immersionbar.ImmersionBar
|
import com.gyf.immersionbar.ImmersionBar
|
||||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
|
||||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||||
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
|
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
|
||||||
import com.shuyu.gsyvideoplayer.utils.OrientationUtils
|
import com.shuyu.gsyvideoplayer.utils.OrientationUtils
|
||||||
@@ -99,7 +91,8 @@ class LiveVideoActivity : BaseActivity() {
|
|||||||
.setLockLand(false)
|
.setLockLand(false)
|
||||||
.setShowFullAnimation(true)
|
.setShowFullAnimation(true)
|
||||||
.setNeedShowWifiTip(false)
|
.setNeedShowWifiTip(false)
|
||||||
|
.setEnlargeImageRes(R.drawable.full_size)
|
||||||
|
.setShrinkImageRes(R.drawable.full_screen)
|
||||||
.setVideoAllCallBack(object : GSYSampleCallBack() {
|
.setVideoAllCallBack(object : GSYSampleCallBack() {
|
||||||
override fun onPrepared(url: String?, vararg objects: Any?) {
|
override fun onPrepared(url: String?, vararg objects: Any?) {
|
||||||
super.onPrepared(url, *objects)
|
super.onPrepared(url, *objects)
|
||||||
|
|||||||
@@ -32,14 +32,6 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
if (UserinfoUtil.getUserInfo() != null) {
|
|
||||||
val intent = Intent(this, HomeActivity::class.java)
|
|
||||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
|
||||||
startActivity(intent)
|
|
||||||
finish()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
binding = ActivityLoginBinding.inflate(layoutInflater)
|
binding = ActivityLoginBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
|
|||||||
23
app/src/main/res/layout/activity_start.xml
Normal file
23
app/src/main/res/layout/activity_start.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/white"
|
||||||
|
tools:context=".home.StartActivity">
|
||||||
|
|
||||||
|
<!-- Logo 图片:横竖屏均居中 -->
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/logoFrame"
|
||||||
|
android:layout_width="160dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:src="@mipmap/loge1"
|
||||||
|
android:padding="5dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Reference in New Issue
Block a user