Skip to content

Commit

Permalink
use viewbinding.
Browse files Browse the repository at this point in the history
  • Loading branch information
xbdcc committed Mar 14, 2020
1 parent 75139d6 commit 5687903
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 24 deletions.
19 changes: 11 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ android {
applicationId "com.carlos.grabredenvelope"
minSdkVersion 18
targetSdkVersion 28
versionCode 10
versionName "3.0.0"
flavorDimensions "10" //和versionCode相同
versionCode 11
versionName "3.1.0"
flavorDimensions "11" //和versionCode相同
ndk {
//选择要添加的对应 cpu 类型的 .so 库。
abiFilters 'armeabi-v7a', 'x86'
Expand All @@ -58,8 +58,8 @@ android {
signingConfig signingConfigs.release
}
debug {
shrinkResources true
minifyEnabled true
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
Expand All @@ -79,6 +79,9 @@ android {
}
}

viewBinding {
enabled = true
}

}

Expand Down Expand Up @@ -128,8 +131,8 @@ dependencies {

testImplementation 'junit:junit:4.12'

// implementation 'com.carlos.cutils:cutils:0.0.26'
implementation 'com.github.xbdcc:cutils:0.0.28.7-SNAPSHOT'
implementation 'com.carlos.cutils:cutils:0.0.28'
// implementation 'com.github.xbdcc:cutils:0.0.28.7-SNAPSHOT'

//jpush
implementation 'cn.jiguang.sdk:jpush:3.5.8'
Expand All @@ -142,7 +145,7 @@ dependencies {
implementation 'io.sentry:sentry-android:1.7.27'
implementation 'com.google.android.material:material:1.0.0'

// implementation 'org.greenrobot:greendao:3.2.2' // add library
implementation 'org.greenrobot:greendao:3.2.2' // add library

}
repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import android.os.Bundle
import androidx.fragment.app.Fragment
import com.carlos.cutils.base.adapter.CBaseMyPagerAdapter
import com.carlos.cutils.listener.PermissionListener
import com.carlos.grabredenvelope.R
import com.carlos.grabredenvelope.databinding.ActivityMainBinding
import com.carlos.grabredenvelope.fragment.*
import com.carlos.grabredenvelope.util.Update
import kotlinx.android.synthetic.main.activity_main.*
Expand Down Expand Up @@ -48,6 +48,8 @@ import kotlinx.android.synthetic.main.activity_main.*
*/
open class MainActivity : BaseActivity() {

private lateinit var binding: ActivityMainBinding

private val WECHAT_SERVICE_NAME = "com.carlos.grabredenvelope/.services.WechatService"

var fragments = mutableListOf<Fragment>(ControlFragment(), GuideFragment(), AboutFragment(),
Expand All @@ -57,11 +59,13 @@ open class MainActivity : BaseActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
binding = ActivityMainBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)

val adapter = CBaseMyPagerAdapter(supportFragmentManager, fragments, titles)
viewpager.adapter = adapter
sliding_tabs.setupWithViewPager(viewpager)
binding.viewPager.adapter = adapter
binding.slidingTabs.setupWithViewPager(viewPager)

getPermissions()
checkVersion()
Expand Down Expand Up @@ -91,7 +95,7 @@ open class MainActivity : BaseActivity() {
}

fun checkItem(item: Int) {
viewpager.currentItem = item
viewPager.currentItem = item
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ import com.carlos.cutils.base.fragment.CBaseWebFragment
* Github: https://github.com/xbdcc/.
* Created by Carlos on 2019/2/23.
*/
class AboutFragment : CBaseWebFragment("http://xbdcc.cn/GrabRedEnvelope/index.html")
class AboutFragment : CBaseWebFragment("http://xbdcc.cn/GrabRedEnvelope/index.html", false)
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ import com.carlos.cutils.base.fragment.CBaseWebFragment
* Github: https://github.com/xbdcc/.
* Created by Carlos on 2019/2/23.
*/
class CodeFragment : CBaseWebFragment("https://github.com/xbdcc/GrabRedEnvelope")
class CodeFragment : CBaseWebFragment("https://github.com/xbdcc/GrabRedEnvelope", false)
8 changes: 4 additions & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
layout="@layout/include_toolbar" />

<androidx.viewpager.widget.ViewPager
android:id="@+id/viewpager"
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="@id/sliding_tabs"
android:layout_below="@id/slidingTabs"
android:background="#ffffff"
android:flipInterval="30"
android:persistentDrawingCache="animation"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/sliding_tabs"
app:layout_constraintTop_toBottomOf="@id/slidingTabs"
app:layout_constraintBottom_toBottomOf="parent"/>
<!-- <View-->
<!-- android:id="@+id/v_menu_line"-->
<!-- style="@style/menu_line"-->
<!-- />-->
<com.google.android.material.tabs.TabLayout
android:id="@+id/sliding_tabs"
android:id="@+id/slidingTabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/gray_light"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/include_toolbar.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.appbar.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<string name="grab_dingding_envelope">抢钉钉红包</string>

<string name="how_to_use">
该版本适配微信7.0.3,7.0.4,7.0.5,7.0.8,7.0.9,7.0.10,7.0.11,7.0.12,其他版本下可能无效,最好在已适配的微信版本下使用,长时间后台可能被杀,如果失效请重新开启无障碍服务
该版本适配微信7.0.3,7.0.4,7.0.5,7.0.8,7.0.9,7.0.10,7.0.11,7.0.12,其他版本未适配可能无效。长时间服务后台可能被杀,如果服务被杀需要重新开启无障碍服务
\n\n控制说明:
\n1.微信红包监控开关:点击进入设置找到无障碍服务辅助功能开启【抢微信红包】,开启后下面操作才有效;
\n2.通知监控开关:开启后通知收到微信红包则会自动点击该通知,若开启后无效请确认通知权限是否开启;
Expand All @@ -32,10 +32,10 @@

<string name="wechat_description">
使用指南:使用前仔细看APP使用说明。辅助功能开启【抢微信红包】,APP 抢微信红包设置是否监控通知和聊天列表页面,同时可设置延迟时间。代码开源仅供学习使用,请勿用作商业用途。
\n\n如果有遇到说明里除已知bug外的问题, 欢迎通过 GitHub Issue 反馈:https://github.com/xbdcc/GrabRedEnvelope
\n\n主要基于自己手上的Android机测试,因Android机型众多,可能有些机型没设备适配,待后续完善
\n\n如果有遇到说明里除已知bug外的问题, 欢迎通过 GitHub Issue 反馈:https://github.com/xbdcc/GrabRedEnvelope
\n\n有问题也可联系偶尔会使用的微信:xbdcc1
\n\n ——made by 小不点</string>
<string name="dingding_description">待开发。</string>
<string name="dingding_description">基于钉钉5.0.5版本开发,不做版本适配,只监听当前对话页面红包</string>


<string name="sure">确定</string>
Expand Down

0 comments on commit 5687903

Please sign in to comment.