个人主页动态背景初步

This commit is contained in:
Cold Mint 2022-05-10 18:53:24 +08:00
parent 17d7528b9b
commit b67a20b550
15 changed files with 53 additions and 15 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -67,6 +67,10 @@ android {
dependencies {
implementation 'com.github.CarGuo.GSYVideoPlayer:GSYVideoPlayer:v8.2.0-release-jitpack'
//
implementation 'com.guolindev.permissionx:permissionx:1.6.1'

View File

@ -2,34 +2,28 @@ package com.coldmint.rust.pro
import android.annotation.SuppressLint
import android.app.ActivityOptions
import android.os.Bundle
import com.coldmint.rust.pro.databinding.ActivityUserHomePageBinding
import com.coldmint.rust.pro.base.BaseActivity
import android.content.Context
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Bundle
import android.view.Gravity
import android.view.View
import android.view.inputmethod.EditorInfo
import android.widget.EditText
import android.widget.Toast
import androidx.core.view.isVisible
import androidx.viewpager2.widget.ViewPager2
import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.input.getInputField
import com.afollestad.materialdialogs.input.input
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.coldmint.rust.core.dataBean.ApiResponse
import com.coldmint.rust.core.dataBean.follow.FollowUserListData
import com.coldmint.rust.core.dataBean.user.SpaceInfoData
import com.coldmint.rust.core.interfaces.ApiCallBack
import com.coldmint.rust.core.web.*
import com.coldmint.rust.pro.adapters.UserHomeStateAdapter
import com.coldmint.rust.pro.base.BaseActivity
import com.coldmint.rust.pro.databinding.ActivityUserHomePageBinding
import com.coldmint.rust.pro.tool.AppSettings
import com.coldmint.rust.pro.tool.GlobalMethod
import com.google.android.material.appbar.AppBarLayout
@ -37,8 +31,10 @@ import com.google.android.material.appbar.CollapsingToolbarLayout
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import com.google.gson.Gson
import com.gyf.immersionbar.ktx.immersionBar
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
import com.shuyu.gsyvideoplayer.utils.GSYVideoHelper
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
@ -50,6 +46,9 @@ class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
val userHomeStateAdapter by lazy {
UserHomeStateAdapter(this, userId)
}
val videoHelper by lazy {
GSYVideoHelper(this)
}
val appID by lazy {
@ -97,7 +96,22 @@ class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
}
initButton()
loadVideo()
}
fun loadVideo() {
viewBinding.coverView.visibility = View.INVISIBLE
viewBinding.appBar.setBackgroundResource(R.drawable.transparent)
viewBinding.tabLayout.setBackgroundResource(R.drawable.transparent)
viewBinding.videoView.setUp("http://39.105.229.249/resources/mp4/vicious.mp4", true, null)
videoHelper.setGsyVideoOptionBuilder(
GSYVideoHelper.GSYVideoHelperBuilder().setHideActionBar(true).setHideStatusBar(false)
)
GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_FULL)
viewBinding.videoView.isLooping = true
viewBinding.videoView.isAutoFullWithSize = true
viewBinding.videoView.startPlayLogic()
}
/**
@ -193,9 +207,11 @@ class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
val gender = spaceInfoData.data.gender
if (gender > 0) {
Glide.with(this).load(R.drawable.boy).apply(GlobalMethod.getRequestOptions()).into(viewBinding.genderView)
Glide.with(this).load(R.drawable.boy).apply(GlobalMethod.getRequestOptions())
.into(viewBinding.genderView)
} else {
Glide.with(this).load(R.drawable.girl).apply(GlobalMethod.getRequestOptions()).into(viewBinding.genderView)
Glide.with(this).load(R.drawable.girl).apply(GlobalMethod.getRequestOptions())
.into(viewBinding.genderView)
}
val permission = spaceInfoData.data.permission
@ -229,7 +245,8 @@ class UserHomePageActivity : BaseActivity<ActivityUserHomePageBinding>() {
val cover = spaceInfoData.data.cover
if (cover != null) {
Glide.with(this).load(ServerConfiguration.getRealLink(cover)).apply(GlobalMethod.getRequestOptions())
Glide.with(this).load(ServerConfiguration.getRealLink(cover))
.apply(GlobalMethod.getRequestOptions())
.into(viewBinding.coverView)
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent" />
<stroke android:color="@android:color/transparent" />
</shape>

View File

@ -4,6 +4,18 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
android:id="@+id/videoView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"

View File

@ -4,5 +4,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sun Apr 24 15:32:29 CST 2022
sdk.dir=D\:\\Document\\AndroidSdk
#Tue May 10 15:48:20 CST 2022
sdk.dir=D\:\\Android_SDK