diff --git a/app/build.gradle b/app/build.gradle index 1c486f1..e0cb3b2 100644 --- a/app/build.gradle +++ b/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/"' diff --git a/app/src/main/java/com/yzx/ebrand/fragment/ClassBrandFragment.kt b/app/src/main/java/com/yzx/ebrand/fragment/ClassBrandFragment.kt index 7e596fb..730ab5f 100644 --- a/app/src/main/java/com/yzx/ebrand/fragment/ClassBrandFragment.kt +++ b/app/src/main/java/com/yzx/ebrand/fragment/ClassBrandFragment.kt @@ -136,6 +136,7 @@ class ClassBrandFragment : BaseFragment(), 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(), 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 { diff --git a/app/src/main/java/com/yzx/ebrand/model/CBClassInfo.kt b/app/src/main/java/com/yzx/ebrand/model/CBClassInfo.kt index 49cfb2b..83ce4ca 100644 --- a/app/src/main/java/com/yzx/ebrand/model/CBClassInfo.kt +++ b/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, ) \ No newline at end of file diff --git a/app/src/main/java/com/yzx/ebrand/presenter/ClassBrandPresenter.kt b/app/src/main/java/com/yzx/ebrand/presenter/ClassBrandPresenter.kt index 12b4992..3eb4415 100644 --- a/app/src/main/java/com/yzx/ebrand/presenter/ClassBrandPresenter.kt +++ b/app/src/main/java/com/yzx/ebrand/presenter/ClassBrandPresenter.kt @@ -54,7 +54,7 @@ class ClassBrandPresenter(view: ClassBrandView) : BasePresenter( 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) } } diff --git a/app/src/main/java/com/yzx/ebrand/widget/ClassStar.kt b/app/src/main/java/com/yzx/ebrand/widget/ClassStar.kt new file mode 100644 index 0000000..5b997bf --- /dev/null +++ b/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 + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/gold_shadow.xml b/app/src/main/res/drawable/gold_shadow.xml new file mode 100644 index 0000000..97aa8ec --- /dev/null +++ b/app/src/main/res/drawable/gold_shadow.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/class_star.xml b/app/src/main/res/layout/class_star.xml new file mode 100644 index 0000000..1d9fe92 --- /dev/null +++ b/app/src/main/res/layout/class_star.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/class_star_item.xml b/app/src/main/res/layout/class_star_item.xml new file mode 100644 index 0000000..09152ec --- /dev/null +++ b/app/src/main/res/layout/class_star_item.xml @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_class_brand.xml b/app/src/main/res/layout/fragment_class_brand.xml index 61065cc..33a1f9b 100644 --- a/app/src/main/res/layout/fragment_class_brand.xml +++ b/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" /> + + + @@ -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" /> diff --git a/app/src/main/res/mipmap-mdpi/icon_coppery.png b/app/src/main/res/mipmap-mdpi/icon_coppery.png new file mode 100644 index 0000000..bf2b4fe Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/icon_coppery.png differ diff --git a/app/src/main/res/mipmap-mdpi/icon_gold.png b/app/src/main/res/mipmap-mdpi/icon_gold.png new file mode 100644 index 0000000..fe549bf Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/icon_gold.png differ diff --git a/app/src/main/res/mipmap-mdpi/icon_silvery.png b/app/src/main/res/mipmap-mdpi/icon_silvery.png new file mode 100644 index 0000000..3b0c7fa Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/icon_silvery.png differ diff --git a/app/src/main/res/mipmap-xhdpi/icon_coppery.png b/app/src/main/res/mipmap-xhdpi/icon_coppery.png new file mode 100644 index 0000000..bf2b4fe Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/icon_coppery.png differ diff --git a/app/src/main/res/mipmap-xhdpi/icon_gold.png b/app/src/main/res/mipmap-xhdpi/icon_gold.png new file mode 100644 index 0000000..fe549bf Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/icon_gold.png differ diff --git a/app/src/main/res/mipmap-xhdpi/icon_silvery.png b/app/src/main/res/mipmap-xhdpi/icon_silvery.png new file mode 100644 index 0000000..3b0c7fa Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/icon_silvery.png differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 12a6bb0..8ca32b7 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -107,4 +107,5 @@ #ffffff #CBCBCB #88000000 + #33fff87d diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 56ceb71..97a34c1 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -227,4 +227,10 @@ @dimen/d_28 bold + +