Skip to content

Commit

Permalink
优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
VIPyinzhiwei committed May 26, 2021
1 parent 0303005 commit c20ac9c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/eyepetizer/android/Const.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ interface Const {
}

interface ActionUrl {

companion object {

const val TAG = "eyepetizer://tag/"
Expand Down Expand Up @@ -162,7 +163,6 @@ interface Const {
const val EVENT8 = "10008"

const val EVENT9 = "10009"

}
}

Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/com/eyepetizer/android/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
import androidx.lifecycle.Observer
import androidx.work.WorkInfo
import androidx.work.WorkManager
import com.eyepetizer.android.R
Expand Down Expand Up @@ -236,7 +235,7 @@ class MainActivity : BaseActivity() {
}

private fun observe() {
WorkManager.getInstance(this).getWorkInfoByIdLiveData(DialogAppraiseTipsWorker.showDialogWorkRequest.id).observe(this, Observer { workInfo ->
WorkManager.getInstance(this).getWorkInfoByIdLiveData(DialogAppraiseTipsWorker.showDialogWorkRequest.id).observe(this, { workInfo ->
logD(TAG, "observe: workInfo.state = ${workInfo.state}")
if (workInfo.state == WorkInfo.State.SUCCEEDED) {
WorkManager.getInstance(this).cancelAllWork()
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/com/eyepetizer/android/ui/SplashActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import android.os.Bundle
import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.view.animation.ScaleAnimation
import androidx.lifecycle.lifecycleScope
import com.eyepetizer.android.R
import com.eyepetizer.android.databinding.ActivitySplashBinding
import com.eyepetizer.android.ui.common.ui.BaseActivity
Expand All @@ -43,8 +44,6 @@ class SplashActivity : BaseActivity() {
val binding: ActivitySplashBinding
get() = _binding!!

private val job by lazy { Job() }

private val splashDuration = 3 * 1000L

private val alphaAnimation by lazy {
Expand All @@ -68,15 +67,14 @@ class SplashActivity : BaseActivity() {

override fun onDestroy() {
super.onDestroy()
job.cancel()
_binding = null
}

override fun setupViews() {
super.setupViews()
binding.ivSlogan.startAnimation(alphaAnimation)
binding.ivSplashPicture.startAnimation(scaleAnimation)
CoroutineScope(job).launch {
lifecycleScope.launch {
delay(splashDuration)
MainActivity.start(this@SplashActivity)
finish()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (c) 2020. vipyinzhiwei <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.eyepetizer.android.ui.common.ui

import android.view.LayoutInflater
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import com.eyepetizer.android.util.DateUtil

class PushAdapter(val fragment: PushFragment) : PagingDataAdapter<PushMessage.Message, PushAdapter.ViewHolder>(DIFF_CALLBACK) {


override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PushAdapter.ViewHolder {
val holder = ViewHolder(R.layout.item_notification_push.inflate(parent))
holder.itemView.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import com.umeng.analytics.MobclickAgent
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import java.util.concurrent.TimeUnit

/**
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
android:textSize="12sp"
app:typeface="fzlLTypeface" />

<com.eyepetizer.android.ui.common.view.TypefaceEditText
<com.eyepetizer.android.ui.common.view.TypefaceTextView
android:id="@+id/tvCancel"
android:layout_width="wrap_content"
android:layout_height="match_parent"
Expand Down

0 comments on commit c20ac9c

Please sign in to comment.