Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Commit

Permalink
Migrate to AndroidX & Kotlin 1.3 & New Coroutines & Update dependenci…
Browse files Browse the repository at this point in the history
…es in project

Signed-off-by: Fung Gwo <[email protected]>
  • Loading branch information
fython committed Jan 29, 2019
1 parent da1594b commit d388630
Show file tree
Hide file tree
Showing 80 changed files with 400 additions and 273 deletions.
45 changes: 24 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
# PackageTracker
A Material Design Shipment Tracker Android App.
一款 Material Design 风格的快递跟踪查询应用

<img src="./art/web_hi_res_512.png" width="30%"/>
A Material-Design-like Shipment Tracker Android App.

### 背景
最初项目名称叫 HoloExpress,即为 4.x 时代的 Android Design 快递应用,但当时只是个人做来玩玩并不是一个完整的应用,后来 Material Design 放出后有人建议我去做 MD 风格的快递查询应用,就拿最初 HoloExpress 做好的 API 再写个界面做了个 ExpressHelper 出来。当时还是读高二因为人比较贪玩,学习开发的进度很慢写出来的质量也很差,所以出来的时候只是凭界面吸引到了一部分用户,稳定性差加上 API 有次数限制,过了一段时间后就没有动力去更新了(代码里面越来越多坑,最后坑死自己)。
一款类 Material Design 的快递跟踪查询 Android 应用

终究还是决定把项目重构,把之前的代码全部推掉(也不打算兼容旧数据了,但或许会做一个迁移功能),重头开始尽自己最大的能力去做一个更好的版本,所以英文名字根据 @zacyu 提交的 PR (https://github.com/PaperAirplane-Dev-Team/ExpressHelper/pull/1) 里面的指导更换表示这是个全新的“水表助手”应用。
<img src="./art/web_hi_res_512.png" width="20%"/>

### 开发环境需求
## 安装

- Android SDK Platform 26
- Android Support Library 26.0.0
- Gradle + Android Studio 2.3 / IntelliJ IDEA 2017.1
直接下载 APK:

[GitHub Releases](https://github.com/fython/PackageTracker/releases)

从应用商店安装:

[Google Play](https://play.google.com/store/apps/details?id=info.papdt.express.helper) 或在 “酷安” 中搜寻 “水表助手” 进行安装

## 开发环境需求

- Android SDK Platform 28
- Gradle + Android Studio 3.3+ / IntelliJ IDEA 2018+
- Windows / Linux / Mac

### 应用安装需求
## 应用安装需求

- 一台 Android 智能手机
- 最低系统版本 Android 5.0
- Wi-Fi 或移动网络数据等联网方式
- 最低 Android 6.0

### 作者
## 作者

Fung Go (fython) Email: fython@163.com
Email: fythonx@gmail.com

联系 QQ: 2850029060
Telegram: [@fython](https://t.me/fython)

捐赠支持(支付宝): [email protected]

博客地址: https://feng.moe

### License
## License

```
GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
Copyright (C) 2016-2017 Fung Go
Copyright (C) 2016-2019 Fung Gwo
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions.
```
3 changes: 1 addition & 2 deletions StatusBarCompat/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apply plugin: 'kotlin-android'

android {
compileSdkVersion rootProject.ext.targetSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
Expand All @@ -20,6 +19,6 @@ android {
}

dependencies {
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "androidx.appcompat:appcompat:1.0.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import android.util.AttributeSet;
import android.widget.LinearLayout;

Expand Down
15 changes: 7 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
ext {
supportLibraryVersion = '28.0.0'
minSdkVersion = 23
targetSdkVersion = 28
buildToolsVersion = "28.0.2"
versionCode = 58
versionName = '3.1.4'
versionCode = 60
versionName = '5.0.0'
kotlinyanVersion = '0.3.0'
ankoVersion = '0.10.5'
materialPrefLibVersion = '2.2.3'
ankoVersion = '0.10.8'
materialPrefLibVersion = '3.0.0'
}

buildscript {
ext.kotlin_version = '1.2.61'
ext.kotlin_version = '1.3.20'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.1.0'
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
org.gradle.jvmargs=-Xmx1536m
android.injected.build.model.only.versioned=3
android.injected.build.model.only.versioned=3
android.useAndroidX=true
android.enableJetifier=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
26 changes: 13 additions & 13 deletions mobile/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'

android {
compileSdkVersion rootProject.ext.targetSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
applicationId "info.papdt.express.helper"
minSdkVersion rootProject.ext.minSdkVersion
Expand Down Expand Up @@ -38,7 +38,7 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// wearApp project(':wear')

implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.multidex:multidex:2.0.0'

// Kotlin & Kotlinyan
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Expand All @@ -48,20 +48,20 @@ dependencies {
implementation "moe.feng.kotlinyan:kotlinyan-appcompat-support:$kotlinyanVersion"

// Android Support Libraries
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.android.support:cardview-v7:$supportLibraryVersion"
implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
implementation "com.android.support:design:$supportLibraryVersion"
implementation "com.android.support:support-v13:$supportLibraryVersion"
implementation "com.android.support:customtabs:$supportLibraryVersion"
implementation "androidx.appcompat:appcompat:1.0.2"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.0.0"
implementation "com.google.android.material:material:1.0.0"
implementation "androidx.legacy:legacy-support-v13:1.0.0"
implementation "androidx.browser:browser:1.0.0"

// Network & Data
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.9.1'
implementation 'com.google.code.gson:gson:2.8.5'

// Common UI Library
implementation 'me.drakeet.multitype:multitype:3.4.4'
implementation 'me.drakeet.multitype:multitype:3.5.0'
implementation "moe.shizuku.preference:preference:$materialPrefLibVersion"
implementation "moe.shizuku.preference:preference-simplemenu:$materialPrefLibVersion"
implementation "moe.shizuku.preference:preference-dialog-android:$materialPrefLibVersion"
Expand All @@ -78,7 +78,7 @@ dependencies {
implementation 'io.alterac.blurkit:blurkit:1.0.0'

// Reactive X
implementation 'io.reactivex.rxjava2:rxjava:2.2.2'
implementation 'io.reactivex.rxjava2:rxjava:2.2.4'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'com.github.nekocode.rxlifecycle:rxlifecycle:1.1'

Expand All @@ -87,8 +87,8 @@ dependencies {
api 'moe.feng:AlipayZeroSdk:1.1'

// Firebase SDK
implementation "com.google.firebase:firebase-core:16.0.4"
implementation "com.google.firebase:firebase-messaging:17.3.3"
implementation "com.google.firebase:firebase-core:16.0.6"
implementation "com.google.firebase:firebase-messaging:17.3.4"
}

apply plugin: 'com.google.gms.google-services'
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import android.app.NotificationManager
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.support.multidex.MultiDexApplication
import android.support.v7.app.AppCompatDelegate
import androidx.multidex.MultiDexApplication
import androidx.appcompat.app.AppCompatDelegate

import com.tencent.bugly.crashreport.CrashReport
import info.papdt.express.helper.model.MaterialIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import android.graphics.Paint
import android.graphics.Typeface
import android.text.TextPaint
import android.text.TextUtils
import kotlinx.coroutines.experimental.CommonPool
import kotlinx.coroutines.experimental.Deferred
import kotlinx.coroutines.experimental.async
import kotlinx.coroutines.*

class MaterialIcon(val code: String) {

Expand All @@ -27,7 +25,7 @@ class MaterialIcon(val code: String) {
}

fun toBitmapAsync(size: Int): Deferred<Bitmap> {
return async(CommonPool) { toBitmap(size) }
return CoroutineScope(Dispatchers.IO).async { toBitmap(size) }
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.app.Activity
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.support.annotation.RequiresApi
import androidx.annotation.RequiresApi
import android.text.TextUtils
import android.widget.Toast
import info.papdt.express.helper.R
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import android.app.Notification
import android.app.PendingIntent
import android.content.*
import android.os.Build
import android.support.v4.app.NotificationCompat
import android.support.v4.content.ContextCompat
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
import android.text.TextUtils
import android.util.Log
import android.view.accessibility.AccessibilityEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.IBinder
import android.support.v4.app.NotificationCompat
import androidx.core.app.NotificationCompat
import android.util.Log
import info.papdt.express.helper.CHANNEL_ID_PACKAGE_STATUS

Expand All @@ -20,6 +20,7 @@ import info.papdt.express.helper.dao.PackageDatabase
import info.papdt.express.helper.model.Kuaidi100Package
import info.papdt.express.helper.support.PushUtils
import info.papdt.express.helper.support.Settings
import info.papdt.express.helper.support.SettingsInstance
import info.papdt.express.helper.ui.DetailsActivity
import info.papdt.express.helper.ui.launcher.AppWidgetProvider
import moe.feng.kotlinyan.common.*
Expand All @@ -44,7 +45,7 @@ class ReminderService : IntentService(TAG) {

val db = PackageDatabase.getInstance(applicationContext)

db.pullDataFromNetwork(false)
db.pullDataFromNetwork(SettingsInstance.forceUpdateAllPackages)
db.save()

AppWidgetProvider.updateManually(application)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package info.papdt.express.helper.support

import android.content.res.Configuration
import android.graphics.Rect
import android.support.v4.content.ContextCompat
import androidx.core.content.ContextCompat
import android.text.TextUtils
import android.view.Gravity
import android.view.View
Expand Down Expand Up @@ -95,9 +95,9 @@ object CheatSheet {
val isNightMode = currentNightMode == Configuration.UI_MODE_NIGHT_YES
cheatSheet.view.setBackgroundResource(
if (!isNightMode)
android.support.v7.appcompat.R.drawable.tooltip_frame_dark
androidx.appcompat.R.drawable.tooltip_frame_dark
else
android.support.v7.appcompat.R.drawable.tooltip_frame_light)
androidx.appcompat.R.drawable.tooltip_frame_light)
val textView = cheatSheet.view.findViewById<TextView>(android.R.id.message)
textView.setTextAppearance(context, R.style.TextAppearance_AppCompat_Body1)
textView.setTextColor(ContextCompat.getColor(context, R.color.white_in_dark))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package info.papdt.express.helper.support

import android.content.Context
import android.support.v4.content.LocalBroadcastManager
import androidx.localbroadcastmanager.content.LocalBroadcastManager

inline val Context.localBroadcastManager get() = LocalBroadcastManager.getInstance(this)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package info.papdt.express.helper.support

import android.content.Context
import android.os.Build
import android.support.annotation.IntDef
import androidx.annotation.IntDef
import info.papdt.express.helper.ui.adapter.NewHomePackageListAdapter
import moe.feng.kotlinyan.common.SharedPreferencesProvider
import kotlin.properties.Delegates
Expand Down Expand Up @@ -35,6 +35,8 @@ class PTSettings(context: Context): SharedPreferencesProvider(context, "settings

var lastSortBy by intValue(defValue = NewHomePackageListAdapter.SORT_BY_UPDATE_TIME)

var forceUpdateAllPackages by booleanValue(defValue = false)

}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package info.papdt.express.helper.support

import android.support.annotation.AttrRes
import androidx.annotation.AttrRes
import android.content.res.ColorStateList
import android.content.res.Resources
import android.support.annotation.ColorInt
import androidx.annotation.ColorInt
import android.util.TypedValue

object ResourcesUtils {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.support.annotation.RequiresApi
import android.support.v7.app.ActionBar
import android.support.v7.widget.AppCompatEditText
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import androidx.annotation.RequiresApi
import androidx.appcompat.app.ActionBar
import androidx.appcompat.widget.AppCompatEditText
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import android.text.Editable
import android.text.TextWatcher
import android.view.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import android.content.Intent
import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.support.v4.content.ContextCompat
import android.support.v4.graphics.drawable.DrawableCompat
import android.support.v7.app.ActionBar
import android.support.v7.widget.AppCompatEditText
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.DrawableCompat
import androidx.appcompat.app.ActionBar
import androidx.appcompat.widget.AppCompatEditText
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import android.text.Editable
import android.text.TextWatcher
import android.view.View
Expand Down
Loading

0 comments on commit d388630

Please sign in to comment.