Skip to content

Commit

Permalink
use rxflux 1.3.7 androidx
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyShieh committed Jul 26, 2019
1 parent f790c1c commit 83faa16
Show file tree
Hide file tree
Showing 96 changed files with 1,354 additions and 2,558 deletions.
71 changes: 33 additions & 38 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

def releaseTime() {
static def releaseTime() {
return new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("UTC"))
}

Expand All @@ -17,20 +16,20 @@ repositories {

android {

compileSdkVersion 26
compileSdkVersion 29

defaultConfig {
applicationId 'com.johnny.gank'
minSdkVersion 19
targetSdkVersion 26
targetSdkVersion 29
versionCode 2
versionName '1.1'
flavorDimensions 'market'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

sourceSets {
Expand Down Expand Up @@ -70,17 +69,6 @@ android {
println "using johnnyshieh's key"
signingConfig signingConfigs.release
}
applicationVariants.all { variant ->
if (variant.buildType.name == 'release') {
variant.outputs.all { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "Gank_v${defaultConfig.versionName}_${releaseTime()}_${variant.flavorName}.apk"
output.outputFileName = new File(outputFile.parent, fileName)
}
}
}
}

productFlavors.all { flavor ->
manifestPlaceholders.put("UMENG_CHANNEL_VALUE",name)
Expand All @@ -93,35 +81,50 @@ android {
}
}
}

applicationVariants.all { variant ->
if (variant.buildType.name == 'release') {
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "Gank_v${defaultConfig.versionName}_${releaseTime()}_${variant.flavorName}.apk"
output.outputFileName = fileName
}
}
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation "junit:junit:$junit_version"
implementation(name:'feedbacksdk', ext:'aar')

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.anko:anko-commons:$anko_version"
implementation 'androidx.core:core-ktx:1.0.2'

// Support
implementation "com.android.support:appcompat-v7:$appcompat_version"
implementation "com.android.support:design:$design_version"
implementation "com.android.support:recyclerview-v7:$recycler_view_version"
implementation "com.android.support:cardview-v7:$card_view_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

implementation "android.arch.lifecycle:extensions:$lifecycle_version"
implementation "android.arch.lifecycle:common-java8:$lifecycle_version"
// architecture component
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"

// Dagger 2
implementation "com.google.dagger:dagger:$dagger_version"
implementation "com.google.dagger:dagger-android:$dagger_version"
implementation "com.google.dagger:dagger-android-support:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"
kapt "com.google.dagger:dagger-android-processor:$dagger_version"
// koin
implementation "org.koin:koin-core:$koin_version"
implementation "org.koin:koin-android:$koin_version"
implementation "org.koin:koin-android-viewmodel:$koin_version"

// RxJava 2
implementation "io.reactivex.rxjava2:rxjava:$rxjava_version"
implementation "io.reactivex.rxjava2:rxandroid:$rxandroid_version"

// RxFlux
implementation "com.johnny.rxflux:rxflux:$rxflux_version"
implementation "com.johnny.rxflux:rxflux-androidx:$rxflux_version"

// Retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
Expand All @@ -131,18 +134,10 @@ dependencies {
implementation "com.google.code.gson:gson:$gson_version"
implementation "com.github.bumptech.glide:glide:$glide_version"

implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

// Anko
implementation "org.jetbrains.anko:anko-commons:$anko_version"

implementation "com.umeng.analytics:analytics:latest.integration"

// LeakCanary
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"

// log
implementation "com.jakewharton.timber:timber:$timber_version"
implementation "com.github.tianzhijiexian:logger:$logger_version"
}
25 changes: 13 additions & 12 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@

<application
android:name=".GankApp"
android:allowBackup="true"
tools:replace="android:allowBackup"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning"
>
<activity
android:name=".ui.activity.MainActivity"
android:name=".main.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar">
Expand All @@ -48,42 +49,42 @@
</intent-filter>
</activity>
<activity
android:name=".ui.activity.SearchActivity"
android:name=".search.SearchActivity"
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateVisible"
android:launchMode="singleTop"
>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.activity.MainActivity"
android:value=".main.MainActivity"
/>
</activity>
<activity
android:name=".ui.activity.WebviewActivity"
android:name=".main.WebviewActivity"
android:theme="@style/AppTheme.NoActionBar"
>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.activity.MainActivity"
android:value=".main.MainActivity"
/>
</activity>
<activity
android:name=".ui.activity.PictureActivity"
android:name=".main.PictureActivity"
android:theme="@style/AppTheme.NoActionBar"
>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.activity.MainActivity"
android:value=".main.MainActivity"
/>
</activity>
<activity
android:name=".ui.activity.AboutActivity"
android:name=".about.AboutActivity"
android:theme="@style/AppTheme.NoActionBar"
>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.activity.MainActivity"
android:value=".main.MainActivity"
/>
</activity>

Expand Down
55 changes: 20 additions & 35 deletions app/src/main/kotlin/com/johnny/gank/GankApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,63 +16,48 @@ package com.johnny.gank
* limitations under the License.
*/

import android.app.Activity
import android.app.Application
import android.util.Log
import com.alibaba.sdk.android.feedback.impl.FeedbackAPI
import com.johnny.gank.di.component.AppComponent
import com.johnny.gank.di.component.DaggerAppComponent
import com.johnny.gank.di.module.AppModule
import com.johnny.gank.util.AppUtil
import com.orhanobut.logger.Logger
import com.orhanobut.logger.Settings
import com.johnny.gank.di.actionCreatorModule
import com.johnny.gank.di.appModule
import com.johnny.gank.di.storeModule
import com.johnny.gank.util.AppHolder
import com.johnny.rxflux.RxFlux
import com.squareup.leakcanary.LeakCanary
import com.umeng.analytics.MobclickAgent
import dagger.android.DispatchingAndroidInjector
import dagger.android.HasActivityInjector
import javax.inject.Inject
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.startKoin

/**
* @author Johnny Shieh (JohnnyShieh17@gmail.com)
* *
* @version 1.0
*/
class GankApp : Application(), HasActivityInjector {

@Inject
lateinit var dispatchingActivityInjector: DispatchingAndroidInjector<Activity>

private lateinit var appComponent: AppComponent
class GankApp : Application() {

override fun onCreate() {
super.onCreate()

MobclickAgent.openActivityDurationTrack(false)
MobclickAgent.enableEncrypt(true)
FeedbackAPI.initAnnoy(this, getString(R.string.ali_app_key))
AppUtil.init(this)
Logger.initialize(
Settings()
.isShowMethodLink(true)
.isShowThreadInfo(false)
.setMethodOffset(0)
.setLogPriority(if (BuildConfig.DEBUG) Log.VERBOSE else Log.ASSERT)
)
AppHolder.init(this)
RxFlux.enableRxFluxLog(BuildConfig.DEBUG)
initInjector()
LeakCanary.install(this)
}

override fun activityInjector() = dispatchingActivityInjector

private fun initInjector() {
appComponent = DaggerAppComponent.builder()
.appModule(AppModule(this))
.build()
appComponent.inject(this)
}

fun getAppComponent(): AppComponent {
return appComponent
startKoin {
androidLogger()
androidContext(this@GankApp)
modules(listOf(
appModule,
actionCreatorModule,
storeModule
))
}
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.johnny.gank.ui.activity
package com.johnny.gank.about
/*
* Copyright (C) 2016 Johnny Shieh Open Source Project
*
Expand All @@ -15,12 +15,10 @@ package com.johnny.gank.ui.activity
* limitations under the License.
*/

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.johnny.gank.R
import com.johnny.gank.stat.StatName
import com.umeng.analytics.MobclickAgent
import com.johnny.gank.base.BaseActivity
import com.johnny.gank.model.StatName
import kotlinx.android.synthetic.main.activity_about.*

/**
Expand All @@ -31,10 +29,7 @@ import kotlinx.android.synthetic.main.activity_about.*
*/
class AboutActivity : BaseActivity() {

companion object {
@JvmStatic
fun newIntent(context: Context) = Intent(context, AboutActivity::class.java)
}
override val pageName = StatName.PAGE_ABOUT

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -46,16 +41,4 @@ class AboutActivity : BaseActivity() {

setTitle(R.string.nav_about)
}

override fun onResume() {
super.onResume()
MobclickAgent.onPageStart(StatName.PAGE_ABOUT)
MobclickAgent.onResume(this)
}

override fun onPause() {
super.onPause()
MobclickAgent.onPageEnd(StatName.PAGE_ABOUT)
MobclickAgent.onPause(this)
}
}
35 changes: 0 additions & 35 deletions app/src/main/kotlin/com/johnny/gank/action/ActionType.kt

This file was deleted.

Loading

0 comments on commit 83faa16

Please sign in to comment.