leiyun 2 лет назад
Родитель
Сommit
7bcc3453da
18 измененных файлов: 143 добавлений и 10 удалений
  1. +4
    -4
      app/build.gradle
  2. +2
    -1
      app/src/main/java/com/yzx/ebrand/fragment/ClassBrandFragment.kt
  3. +3
    -2
      app/src/main/java/com/yzx/ebrand/model/CBClassInfo.kt
  4. +1
    -1
      app/src/main/java/com/yzx/ebrand/presenter/ClassBrandPresenter.kt
  5. +74
    -0
      app/src/main/java/com/yzx/ebrand/widget/ClassStar.kt
  6. +5
    -0
      app/src/main/res/drawable/gold_shadow.xml
  7. +32
    -0
      app/src/main/res/layout/class_star.xml
  8. +7
    -0
      app/src/main/res/layout/class_star_item.xml
  9. +6
    -0
      app/src/main/res/layout/fragment_class_brand.xml
  10. +2
    -2
      app/src/main/res/layout/layout_time_table_item.xml
  11. Двоичные данные
      app/src/main/res/mipmap-mdpi/icon_coppery.png
  12. Двоичные данные
      app/src/main/res/mipmap-mdpi/icon_gold.png
  13. Двоичные данные
      app/src/main/res/mipmap-mdpi/icon_silvery.png
  14. Двоичные данные
      app/src/main/res/mipmap-xhdpi/icon_coppery.png
  15. Двоичные данные
      app/src/main/res/mipmap-xhdpi/icon_gold.png
  16. Двоичные данные
      app/src/main/res/mipmap-xhdpi/icon_silvery.png
  17. +1
    -0
      app/src/main/res/values/colors.xml
  18. +6
    -0
      app/src/main/res/values/styles.xml

+ 4
- 4
app/build.gradle Просмотреть файл

@@ -19,8 +19,8 @@ android {
// minSdkVersion 26
minSdkVersion 21
targetSdkVersion 25
versionCode 30001
versionName "3.0.1"
versionCode 30003
versionName "3.0.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

ndk {
@@ -87,11 +87,11 @@ android {
shrinkResources false
// buildConfigField "String", "BASE_URL", '"http://192.168.69.99:9009"'
// buildConfigField "String", "M_URL", '"http://192.168.69.112:8098"'
buildConfigField "String", "BASE_URL", '"https://oa.qbjjyyun.net/api"'
// buildConfigField "String", "BASE_URL", '"https://oa.qbjjyyun.net/api"'
buildConfigField "String", "OA_URL", '"https://oa.live.educlouddata.com"'
// buildConfigField "String", "OA_URL", '"http://192.168.69.114:3000"'
buildConfigField "String", "M_URL", '"https://m.live.educlouddata.com/"'
// buildConfigField "String", "BASE_URL", '"https://oa.live.educlouddata.com/api"'
buildConfigField "String", "BASE_URL", '"https://oa.live.educlouddata.com/api"'
buildConfigField "String", "APP_NAME", '"一体化平台(开发)"'
buildConfigField "String", "MP_APPID", '"wxbb397ddae71bb14c"'
// buildConfigField "String", "WS_URL", '"ws://192.168.69.114:9801/"'


+ 2
- 1
app/src/main/java/com/yzx/ebrand/fragment/ClassBrandFragment.kt Просмотреть файл

@@ -136,6 +136,7 @@ class ClassBrandFragment : BaseFragment<ClassBrandPresenter>(), ClassBrandView {
getOtherData()
dialog.dismiss()
classNameTv.text = "${currClass.grade_name}${currClass.class_name}"
classStar.setStar(currClass.star_num)
SPUtils.getInstance().put("local_class_id", currClass.class_id)
}
}
@@ -216,7 +217,7 @@ class ClassBrandFragment : BaseFragment<ClassBrandPresenter>(), ClassBrandView {
getClassInfo()
mClassInfoHandler.postDelayed(mClassInfoRunnable,mClassInfoLoopTime)
classNameTv.text = "${currClass.grade_name}${currClass.class_name}"
classStar.setStar(currClass.star_num)
classSwIcon.visibility = if (list.size > 1) {
View.VISIBLE
} else {


+ 3
- 2
app/src/main/java/com/yzx/ebrand/model/CBClassInfo.kt Просмотреть файл

@@ -18,8 +18,8 @@ data class ClassTeacher(
)

data class UserPhoto(
val head_portrait: String = "",
val identity: String = ""
val head_portrait: String ?= "",
val identity: String ?= ""
)

data class ClassTeaInfo(
@@ -72,4 +72,5 @@ data class HeadClassInfo(
val class_name: String = "",
val grade_id: Int = 0,
val grade_name: String = "",
val star_num: Int = 0,
)

+ 1
- 1
app/src/main/java/com/yzx/ebrand/presenter/ClassBrandPresenter.kt Просмотреть файл

@@ -54,7 +54,7 @@ class ClassBrandPresenter(view: ClassBrandView) : BasePresenter<ClassBrandView>(
LogUtils.d(response)
if (response?.isSuccessful == true) {
val info = response.body().data
mView?.onAvatarSuccess(info.user_photo.identity,info.user_photo.head_portrait)
mView?.onAvatarSuccess(info.user_photo.identity?:"",info.user_photo.head_portrait?:"")
mView?.onClassInfoSuccess(response.body().data)
}
}


+ 74
- 0
app/src/main/java/com/yzx/ebrand/widget/ClassStar.kt Просмотреть файл

@@ -0,0 +1,74 @@
package com.yzx.ebrand.widget

import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.view.animation.LinearInterpolator
import android.widget.FrameLayout
import android.widget.ImageView
import androidx.appcompat.widget.LinearLayoutCompat
import com.yzx.ebrand.R
import kotlinx.android.synthetic.main.view_time.view.*
import org.jetbrains.anko.dip

class ClassStar(context: Context, attrs: AttributeSet) :
FrameLayout(context, attrs) {

lateinit var p: LinearLayoutCompat

init {
p = LayoutInflater.from(context).inflate(R.layout.class_star, null) as LinearLayoutCompat
addView(p)

// setStar()
}

@SuppressLint("SetTextI18n")
fun setStar(num: Int = 1) {
for (i in 0 until p.childCount) {
val child = p.getChildAt(i)
child.clearAnimation()
}
p.removeAllViews()
p.clearAnimation()
if (num <= 0) {
return
}


val resId = when {
num >= 6 -> R.mipmap.icon_gold
num == 5 -> R.mipmap.icon_silvery
else -> R.mipmap.icon_coppery
}
for (i in 1..num) {
val startView = ImageView(context)
val lp = LinearLayoutCompat.LayoutParams(dip(35), dip(32))
lp.leftMargin = dip(15)
lp.setMargins(dip(15), 0, 0, 0)
startView.setImageResource(resId)
startView.clearAnimation()
// startView.setBackgroundResource(R.drawable.gold_shadow)
// (startView.background as AnimationDrawable).start()
if (num >= 6) {
flicker(startView, i, num)
}
p.addView(startView, lp)
}
p.requestLayout()

}

private fun flicker(startView: ImageView, index: Int, total: Int) {
val anim = AlphaAnimation(0.3f, 1f)
anim.duration = 200L
anim.interpolator = LinearInterpolator()
anim.repeatCount = Animation.INFINITE
anim.repeatMode = Animation.REVERSE
anim.startOffset = (index - 1) * (200L/total)
startView.animation = anim
}
}

+ 5
- 0
app/src/main/res/drawable/gold_shadow.xml Просмотреть файл

@@ -0,0 +1,5 @@
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@color/gold" android:duration="300" />
<item android:drawable="@android:color/transparent" android:duration="300" />
</animation-list>

+ 32
- 0
app/src/main/res/layout/class_star.xml Просмотреть файл

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">

<!-- <ImageView-->
<!-- android:src="@mipmap/icon_gold"-->
<!-- style="@style/star_item"-->
<!-- />-->
<!-- <ImageView-->
<!-- android:src="@mipmap/icon_gold"-->
<!-- style="@style/star_item"-->
<!-- />-->
<!-- <ImageView-->
<!-- android:src="@mipmap/icon_gold"-->
<!-- style="@style/star_item"-->
<!-- />-->
<!-- <ImageView-->
<!-- android:src="@mipmap/icon_gold"-->
<!-- style="@style/star_item"-->
<!-- />-->
<!-- <ImageView-->
<!-- android:src="@mipmap/icon_gold"-->
<!-- style="@style/star_item"-->
<!-- />-->
<!-- <ImageView-->
<!-- android:src="@mipmap/icon_gold"-->
<!-- style="@style/star_item"-->
<!-- />-->
</androidx.appcompat.widget.LinearLayoutCompat>

+ 7
- 0
app/src/main/res/layout/class_star_item.xml Просмотреть файл

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="35dp"
android:layout_height="32dp"
android:layout_marginStart="20dp">
</ImageView>

+ 6
- 0
app/src/main/res/layout/fragment_class_brand.xml Просмотреть файл

@@ -67,6 +67,12 @@
android:layout_height="32dp"
android:layout_marginStart="@dimen/d_20"
android:src="@mipmap/icon_class_sw" />

<com.yzx.ebrand.widget.ClassStar
android:id="@+id/classStar"
android:layout_width="wrap_content"
android:layout_height="32dp"/>

</androidx.appcompat.widget.LinearLayoutCompat>

<ImageView


+ 2
- 2
app/src/main/res/layout/layout_time_table_item.xml Просмотреть файл

@@ -13,7 +13,7 @@
android:id="@+id/lessonNoTv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:layout_weight="1"
android:text="第一节"
android:textColor="@color/white"
android:textSize="@dimen/d_20" />
@@ -22,7 +22,7 @@
android:id="@+id/lessonNameTv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="2"
android:text="语文"
android:textColor="@color/white"
android:textSize="@dimen/d_20" />

Двоичные данные
app/src/main/res/mipmap-mdpi/icon_coppery.png Просмотреть файл

До После
Ширина: 35  |  Высота: 32  |  Размер: 2.4 KiB

Двоичные данные
app/src/main/res/mipmap-mdpi/icon_gold.png Просмотреть файл

До После
Ширина: 35  |  Высота: 32  |  Размер: 2.3 KiB

Двоичные данные
app/src/main/res/mipmap-mdpi/icon_silvery.png Просмотреть файл

До После
Ширина: 35  |  Высота: 32  |  Размер: 2.4 KiB

Двоичные данные
app/src/main/res/mipmap-xhdpi/icon_coppery.png Просмотреть файл

До После
Ширина: 35  |  Высота: 32  |  Размер: 2.4 KiB

Двоичные данные
app/src/main/res/mipmap-xhdpi/icon_gold.png Просмотреть файл

До После
Ширина: 35  |  Высота: 32  |  Размер: 2.3 KiB

Двоичные данные
app/src/main/res/mipmap-xhdpi/icon_silvery.png Просмотреть файл

До После
Ширина: 35  |  Высота: 32  |  Размер: 2.4 KiB

+ 1
- 0
app/src/main/res/values/colors.xml Просмотреть файл

@@ -107,4 +107,5 @@
<color name="nb.read.menu.bg">#ffffff</color>
<color name="nb.read.menu.text">#CBCBCB</color>
<color name="nb.read.bar.translucent">#88000000</color>
<color name="gold">#33fff87d</color>
</resources>

+ 6
- 0
app/src/main/res/values/styles.xml Просмотреть файл

@@ -227,4 +227,10 @@
<item name="android:textSize">@dimen/d_28</item>
<item name="android:textStyle">bold</item>
</style>

<style name="star_item">
<item name="android:layout_width">35dp</item>
<item name="android:layout_height">32dp</item>
<item name="android:layout_marginStart">20dp</item>
</style>
</resources>

Загрузка…
Отмена
Сохранить