清理无用代码

master
Z 4 years ago
parent 14c40c159e
commit f57a981cc0
  1. 17
      app/proguard-rules.pro
  2. 13
      app/src/main/java/com/novel/read/help/ReadBookConfig.kt
  3. 2
      app/src/main/java/com/novel/read/ui/MainActivity.kt
  4. 30
      app/src/main/java/com/novel/read/ui/read/ReadBookActivity.kt
  5. 5
      app/src/main/java/com/novel/read/user/UserManager.kt
  6. 28
      app/src/main/java/com/novel/read/user/VipHelper.kt
  7. 10
      app/src/main/res/layout/activity_read_book.xml

@ -225,28 +225,11 @@
-keep class com.allenliu.versionchecklib.**{*;}
-dontwarn com.tencent.bugly.**
-keep public class com.tencent.bugly.**{*;}
-keep class com.uc.** {*;}
-keep class com.zui.** {*;}
-keep class com.miui.** {*;}
-keep class com.heytap.** {*;}
-keep class a.** {*;}
-keep class com.vivo.** {*;}
-keep class com.umeng.** {*;}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-dontwarn com.google.ads.**
-keep public class com.google.ads.**{
public protected *;
}
-dontwarn com.youth.banner.**
-keep class com.youth.banner.**{*;}

@ -8,7 +8,6 @@ import androidx.annotation.Keep
import com.novel.read.App
import com.novel.read.R
import com.novel.read.constant.PreferKey
import com.novel.read.user.VipHelper
import com.novel.read.utils.BitmapUtils
import com.novel.read.utils.FileUtils
import com.novel.read.utils.ext.*
@ -236,11 +235,7 @@ object ReadBookConfig {
var paddingBottom: Int
// get() = config.paddingBottom
get() = if (VipHelper.showAd()) {
10
} else {
20
}
get() = 20
set(value) {
config.paddingBottom = value
}
@ -289,11 +284,7 @@ object ReadBookConfig {
var footerPaddingBottom: Int
// get() = config.footerPaddingBottom
get() = if (VipHelper.showAd()) {
60
} else {
10
}
get() = 10
set(value) {
config.footerPaddingBottom = value
}

@ -23,7 +23,6 @@ import com.novel.read.ui.main.bookshelf.BookshelfFragment
import com.novel.read.ui.main.mail.MailFragment
import com.novel.read.ui.main.my.MyFragment
import com.novel.read.ui.widget.dialog.AppraiseDialog
import com.novel.read.user.VipHelper
import com.novel.read.utils.ext.*
import kotlinx.android.synthetic.main.activity_main.*
import org.jetbrains.anko.toast
@ -67,7 +66,6 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main),
private fun initData() {
VipHelper.notifyUser()
viewModel.appResp.observe(this) {
updateApk(it)
}

@ -40,7 +40,6 @@ import com.novel.read.ui.read.page.TextPageFactory
import com.novel.read.ui.read.page.delegate.PageDelegate
import com.novel.read.ui.widget.dialog.AutoReadDialog
import com.novel.read.ui.widget.dialog.TextDialog
import com.novel.read.user.VipHelper
import com.novel.read.utils.ext.*
import kotlinx.android.synthetic.main.activity_read_book.*
import kotlinx.android.synthetic.main.view_read_menu.*
@ -207,36 +206,8 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
startActivity(intent)
}
}
adView.setBackgroundColor(ReadBookConfig.bgMeanColor)
adView.alpha = 0.3f
if (VipHelper.showAd()) {
// adView.visibility = View.VISIBLE
// //底部banner google
// val mPublisherAdView = PublisherAdView(this)
// mPublisherAdView.adUnitId = "ca-app-pub-5528897088703176/7116750145"
// adView.removeAllViews()
// adView.addView(mPublisherAdView)
// val adRequest = PublisherAdRequest.Builder().build()
// mPublisherAdView.setAdSizes(getAdSize(), AdSize.BANNER)
// mPublisherAdView.loadAd(adRequest)
} else {
adView.visibility = View.GONE
}
}
// private fun getAdSize(): AdSize? {
// val display = windowManager.defaultDisplay
// val outMetrics = DisplayMetrics()
// display.getMetrics(outMetrics)
// val widthPixels = outMetrics.widthPixels.toFloat()
// val density = outMetrics.density
// val adWidth = (widthPixels / density).toInt()
// return AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(this, adWidth)
// }
override fun clickCenter() {
when {
BaseReadAloudService.isRun -> {
@ -468,7 +439,6 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
} else {
page_view.upContent(resetPageOffset = false)
}
adView.setBackgroundColor(ReadBookConfig.bgMeanColor)
}
observeEvent<Int>(EventBus.ALOUD_STATE) {
if (it == Status.STOP || it == Status.PAUSE) {

@ -1,5 +0,0 @@
package com.novel.read.user
object UserManager {
}

@ -1,28 +0,0 @@
package com.novel.read.user
import com.novel.read.App
import com.novel.read.data.db.entity.User
object VipHelper {
var user: User? = null
fun notifyUser() {
user = App.db.getUserDao().getUser()
}
fun showAd(): Boolean {
return false
// return if (user == null) {
// true
// } else {
// !isVip(user)
// }
}
private fun isVip(user: User?): Boolean {
val currentTime = System.currentTimeMillis()
return user?.vipStatus == 1 && currentTime > user.vipStartTime!! && currentTime < user.vipEndTime!!
}
}

@ -11,16 +11,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<LinearLayout
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="vertical"
android:visibility="visible"
android:layout_gravity="bottom"
app:layout_constraintBottom_toBottomOf="parent"/>
<View
android:id="@+id/text_menu_position"
android:layout_width="0dp"

Loading…
Cancel
Save