Skip to content

Commit

Permalink
Merge pull request #68 from Khang-NT/release/0.7.2
Browse files Browse the repository at this point in the history
Release 0.7.2
  • Loading branch information
Khang-NT committed Mar 9, 2018
2 parents d3ad3ad + dd8c777 commit 26a4487
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 34 deletions.
14 changes: 8 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ android {
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "0.7.1"
versionName "0.7.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -64,7 +64,7 @@ android {
}
}

final _versionCode = 22
final _versionCode = 23

flavorDimensions 'cpuArch'
productFlavors {
Expand Down Expand Up @@ -142,20 +142,20 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

final supportLibVersion = '27.0.2'
final supportLibVersion = '27.1.0'
implementation "com.android.support:appcompat-v7:$supportLibVersion"
implementation "com.android.support:cardview-v7:$supportLibVersion"
implementation "com.android.support:design:$supportLibVersion"

implementation 'com.android.support.constraint:constraint-layout:1.0.2'

implementation 'io.reactivex.rxjava2:rxjava:2.1.8'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.10'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'

implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'

implementation 'com.jakewharton.timber:timber:4.6.0'
implementation 'com.jakewharton.timber:timber:4.6.1'

implementation 'de.psdev.licensesdialog:licensesdialog:1.8.3'

Expand All @@ -165,6 +165,8 @@ dependencies {

implementation 'com.liulishuo.filedownloader:library:1.7.1'

implementation 'cat.ereza:customactivityoncrash:2.2.0'

debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'

Expand Down
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
android:name=".ui.presetcmd.ConvertActivity"
android:theme="@style/AppTheme.NoActionBar.TransparentStatusBar"/>

<activity
android:name="cat.ereza.customactivityoncrash.activity.DefaultErrorActivity"
android:theme="@style/CustomActivityOnCrashTheme"
android:process=":error_activity" />

</application>

</manifest>
5 changes: 3 additions & 2 deletions app/src/main/assets/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
</head>
<body>
<br>
<b>Upcoming</b>
<b>Version 0.7.2 [Mar 9, 2018]</b>
<ul>
<li>Add In-app feedback</li>
<li>Update UI</li>
<li>Bug fixes & minor improvements</li>
<li>Limit log file size (50KB) to save free space</li>
<li>Bug fixes &amp; minor improvements</li>
</ul>
</body>
</html>
4 changes: 3 additions & 1 deletion app/src/main/java/com/github/khangnt/mcp/Consts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ const val PLAY_STORE_PACKAGE = "com.github.khangnt.mcp"
const val GITHUB_REPO = "https://github.com/Khang-NT/Android-Media-Converter"
const val GITHUB_ISSUE_URL = "$GITHUB_REPO/issues"
const val GITHUB_NEW_ISSUE_URL = "$GITHUB_ISSUE_URL/new"
const val TRANSLATE_PAGE = "http://translate.ymusicapp.com/projects/media-converter/"
const val TRANSLATE_PAGE = "http://translate.ymusicapp.com/projects/media-converter/"

const val CHANGELOG_URL = "file:///android_asset/changelog.html"
8 changes: 8 additions & 0 deletions app/src/main/java/com/github/khangnt/mcp/MainApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.github.khangnt.mcp

import android.app.Application
import android.os.StrictMode
import cat.ereza.customactivityoncrash.config.CaocConfig
import com.crashlytics.android.Crashlytics
import com.github.khangnt.mcp.util.IMMLeaks
import com.liulishuo.filedownloader.FileDownloader
Expand Down Expand Up @@ -40,6 +41,13 @@ class MainApplication: Application() {

Fabric.with(this, Crashlytics())

CaocConfig.Builder.create()
.backgroundMode(CaocConfig.BACKGROUND_MODE_SILENT)
.showErrorDetails(true)
.showRestartButton(true)
.trackActivities(true)
.apply()

if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
} else {
Expand Down
36 changes: 24 additions & 12 deletions app/src/main/java/com/github/khangnt/mcp/job/DefaultJobManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,7 @@ class DefaultJobManager(private val jobDb: JobDb) : JobManager {
JobStatus.COMPLETED to mutableListOf(),
JobStatus.FAILED to mutableListOf()
)
private val mapSubject = mapOf(
JobStatus.PENDING to BehaviorSubject.create<List<Job>>(),
JobStatus.PREPARING to BehaviorSubject.create<List<Job>>(),
JobStatus.READY to BehaviorSubject.create<List<Job>>(),
JobStatus.RUNNING to BehaviorSubject.create<List<Job>>(),
JobStatus.COMPLETED to BehaviorSubject.create<List<Job>>(),
JobStatus.FAILED to BehaviorSubject.create<List<Job>>()
)
private var mapSubject = newMapSubject()

private val liveLogSubject = BehaviorSubject.create<String>()

Expand Down Expand Up @@ -159,10 +152,20 @@ class DefaultJobManager(private val jobDb: JobDb) : JobManager {
private fun loadJobToMemoryIfNeeded() {
synchronized(lock) {
if (!loadedJobToMemory) {
jobDb.getAllJob().forEach { mapJobList[it.status]!!.add(it) }
loadedJobToMemory = true
notifyJobListChanged(JobStatus.RUNNING, JobStatus.PENDING, JobStatus.PREPARING, JobStatus.READY,
JobStatus.COMPLETED, JobStatus.FAILED)
try {
jobDb.getAllJob().forEach { mapJobList[it.status]!!.add(it) }
loadedJobToMemory = true
notifyJobListChanged(JobStatus.RUNNING, JobStatus.PENDING, JobStatus.PREPARING, JobStatus.READY,
JobStatus.COMPLETED, JobStatus.FAILED)
} catch (error: Throwable) {
loadedJobToMemory = false
// notify error
mapJobList.keys.forEach { status ->
mapJobList[status]!!.clear()
mapSubject[status]!!.onError(error)
}
mapSubject = newMapSubject()
}
}
}
}
Expand All @@ -171,4 +174,13 @@ class DefaultJobManager(private val jobDb: JobDb) : JobManager {
status.forEach { mapSubject[it]!!.onNext(mapJobList[it]!!) }
}

private fun newMapSubject() = mapOf(
JobStatus.PENDING to BehaviorSubject.create<List<Job>>(),
JobStatus.PREPARING to BehaviorSubject.create<List<Job>>(),
JobStatus.READY to BehaviorSubject.create<List<Job>>(),
JobStatus.RUNNING to BehaviorSubject.create<List<Job>>(),
JobStatus.COMPLETED to BehaviorSubject.create<List<Job>>(),
JobStatus.FAILED to BehaviorSubject.create<List<Job>>()
)

}
18 changes: 10 additions & 8 deletions app/src/main/java/com/github/khangnt/mcp/ui/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import android.support.v4.graphics.drawable.DrawableCompat
import android.support.v7.app.AlertDialog
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.webkit.WebView
import android.widget.ScrollView
import com.github.khangnt.mcp.*
Expand Down Expand Up @@ -62,16 +63,17 @@ class AboutActivity : BaseActivity() {

tvAppVersion.text = getString(R.string.app_version_format, BuildConfig.VERSION_NAME)

changelog.setOnClickListener{
val paddingHorizontal = resources.getDimensionPixelOffset(R.dimen.margin_normal)
val web = WebView(this)
web.loadUrl("file:///android_asset/changelog.html")
web.setPadding(paddingHorizontal, 0, paddingHorizontal, 0)
val builder = AlertDialog.Builder(this)
builder.setTitle(R.string.changelog)
.setView(web)
changelog.setOnClickListener {
val webView = WebView(this)
AlertDialog.Builder(this).setTitle(R.string.changelog)
.setView(webView)
.setPositiveButton(getString(R.string.close), null)
.show()

val margin = resources.getDimensionPixelOffset(R.dimen.margin_normal)
(webView.layoutParams as ViewGroup.MarginLayoutParams)
.setMargins(margin, 0, margin, 0)
webView.loadUrl(CHANGELOG_URL)
}

rateUs.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package com.github.khangnt.mcp.ui.presetcmd.common
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Intent
import android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION
import android.content.Intent.FLAG_GRANT_WRITE_URI_PERMISSION
import android.content.Intent.*
import android.net.Uri
import android.os.Build
import android.os.Bundle
Expand Down Expand Up @@ -173,9 +172,12 @@ class SingleInputOutputFragment : BaseFragment() {
val uri = data!!.data
val takeFlags = data.flags and
(FLAG_GRANT_READ_URI_PERMISSION or FLAG_GRANT_WRITE_URI_PERMISSION)
context!!.contentResolver.takePersistableUriPermission(uri, takeFlags)
if (data.flags and FLAG_GRANT_PERSISTABLE_URI_PERMISSION
== FLAG_GRANT_PERSISTABLE_URI_PERMISSION) {
context!!.contentResolver.takePersistableUriPermission(uri, takeFlags)
sharedPrefs.lastOutputFolderUri = uri.toString()
}

sharedPrefs.lastOutputFolderUri = uri.toString()
outputFolderUri = uri

val path = catchAll { UriUtils.getDirectoryPathFromUri(uri) }
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@
<color name="red_500">#F44336</color>
<color name="green_600">#43A047</color>
<color name="gray_600">#757575</color>


<color name="custom_activity_on_crash_primary">#C62828</color>
<color name="custom_activity_on_crash_primary_dark">#B71C1C</color>
<color name="custom_activity_on_crash_accent">#FF5252</color>

</resources>
6 changes: 6 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@
<item name="android:textColor">?android:textColorPrimaryInverse</item>
</style>

<style name="CustomActivityOnCrashTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/custom_activity_on_crash_primary</item>
<item name="colorPrimaryDark">@color/custom_activity_on_crash_primary_dark</item>
<item name="colorAccent">@color/custom_activity_on_crash_accent</item>
</style>


</resources>

0 comments on commit 26a4487

Please sign in to comment.