Compare commits

...

13 commits

Author SHA1 Message Date
ligi
12af6cda7c
Improve code style 2017-03-23 14:10:38 +01:00
ligi
5306992469
Use Mockito 2.7.19 2017-03-23 13:07:02 +01:00
ligi
5660176851
Use KAXT 0.16 2017-03-23 13:05:48 +01:00
ligi
502d6fa4a5
Use SnackEngage 0.10 with play/amazon split 2017-03-23 13:05:36 +01:00
ligi
ee56aca68b
Cleanup 2017-03-23 00:59:22 +01:00
ligi
a15cedde21
Cleanup 2017-03-23 00:41:09 +01:00
ligi
a2015a2277
Use moshi 1.4.0 2017-03-21 23:31:56 +01:00
ligi
7352e9e7b0
Use dagger 2.10 2017-03-21 23:17:29 +01:00
ligi
0b263e371f
Use Kotpref 2.1.0 2017-03-21 23:17:29 +01:00
ligi
07dd515e7a
Use Kotlin 1.1.1, support 25.3.0 and trulesk 0.18 2017-03-19 14:27:39 +01:00
ligi
7c7ef42dbe
Use mockito 2.7.18 2017-03-19 13:31:52 +01:00
ligi
446ed8ceb9
Use permissions dispatcher 2.3.2 2017-03-19 13:30:37 +01:00
ligi
9065139d8b
Use gradle 3.4.1 2017-03-19 13:05:16 +01:00
16 changed files with 55 additions and 52 deletions

View file

@ -56,6 +56,10 @@ android {
forPlay {
dimension "distribution"
}
forAmazon {
dimension "distribution"
}
}
packagingOptions {
@ -90,15 +94,15 @@ dependencies {
compile "com.google.dagger:dagger:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"
compile 'com.github.hotchemi:permissionsdispatcher:2.3.1'
kapt 'com.github.hotchemi:permissionsdispatcher-processor:2.3.1'
compile 'com.github.hotchemi:permissionsdispatcher:2.3.2'
kapt 'com.github.hotchemi:permissionsdispatcher-processor:2.3.2'
provided 'org.glassfish:javax.annotation:10.0-b28'
kaptAndroidTest "com.google.dagger:dagger-compiler:$dagger_version"
androidTestCompile "com.android.support:support-annotations:$support_version"
androidTestCompile('com.github.ligi:trulesk:0.16') {
androidTestCompile('com.github.ligi:trulesk:0.18') {
// http://stackoverflow.com/questions/30578243/why-would-adding-espresso-contrib-cause-an-inflateexception
exclude group: 'javax.inject'
}
@ -111,11 +115,6 @@ dependencies {
exclude module: 'recyclerview-v7'
}
androidTestCompile('com.android.support.test.espresso:espresso-web:2.2.2') {
// http://stackoverflow.com/questions/30578243/why-would-adding-espresso-contrib-cause-an-inflateexception
exclude group: 'javax.inject'
}
androidTestCompile 'com.squareup.assertj:assertj-android:1.1.1'
androidTestCompile "org.mockito:mockito-core:$mockito_version"
@ -144,23 +143,21 @@ dependencies {
compile 'net.i2p.android.ext:floatingactionbutton:1.10.1'
compile 'com.github.ligi:KAXT:0.15'
compile 'com.github.ligi:KAXT:0.16'
compile 'com.github.ligi:loadtoast:1.10.11'
compile 'com.github.ligi:tracedroid:1.4'
compile 'com.github.ligi:snackengage:0.9'
forPlayCompile 'com.github.ligi.snackengage:snackengage-playrate:0.10'
forFDroidCompile 'com.github.ligi.snackengage:snackengage-playrate:0.10'
forAmazonCompile 'com.github.ligi.snackengage:snackengage-amazonrate:0.10'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.larswerkman:HoloColorPicker:1.5'
compile 'com.google.code.findbugs:jsr305:3.0.1'
compile 'com.squareup.moshi:moshi:1.2.0'
compile 'com.squareup.moshi:moshi:1.4.0'
compile("com.chibatching.kotpref:kotpref:2.0.0") {
exclude group: 'org.jetbrains.kotlin'
}
compile("com.chibatching.kotpref:initializer:2.0.0") {
exclude group: 'org.jetbrains.kotlin'
}
compile "com.chibatching.kotpref:kotpref:2.1.0"
compile "com.chibatching.kotpref:initializer:2.1.0"
testCompile "com.android.support:support-annotations:$support_version"
testCompile 'com.squareup.assertj:assertj-android:1.1.1'

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="market_url" translatable="false">amzn://apps/android?p=%s</string>
<string name="nav_market" translatable="false">Play</string>
</resources>

View file

@ -18,7 +18,7 @@ fun tryAddDateToCalendar(pass: Pass, contextView: View, timeSpan: PassImpl.TimeS
AlertDialog.Builder(contextView.context).setMessage(R.string.expiration_date_to_calendar_warning_message)
.setTitle(R.string.expiration_date_to_calendar_warning_title)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok) { dialog, which -> reallyAddToCalendar(pass, contextView, timeSpan) }
.setPositiveButton(android.R.string.ok) { _, _ -> reallyAddToCalendar(pass, contextView, timeSpan) }
.show()
} else {
reallyAddToCalendar(pass, contextView, timeSpan)

View file

@ -17,7 +17,7 @@ internal class MoveToNewTopicUI(private val context: Activity, private val passS
.setTitle(context.getString(R.string.move_to_new_topic))
.setView(R.layout.dialog_move_to_new_topic)
.setPositiveButton(android.R.string.ok, null)
.setNegativeButton(android.R.string.cancel) { dialog, which -> passStore.notifyChange() }
.setNegativeButton(android.R.string.cancel) { _, _ -> passStore.notifyChange() }
.setOnCancelListener { passStore.notifyChange() }
.show()
@ -48,7 +48,7 @@ internal class MoveToNewTopicUI(private val context: Activity, private val passS
val button = Button(context)
button.text = it
suggestionButtonContainer.addView(button)
button.setOnClickListener { view -> move(it) }
button.setOnClickListener { _ -> move(it) }
}
}
}

View file

@ -28,7 +28,7 @@ fun Activity.showNavigateToLocationsDialog(pass: Pass, finishOnDone: Boolean) {
locationDescriptions[i++] = loc.getNameWithFallback(pass)
}
AlertDialog.Builder(this).setTitle(this.getString(R.string.choose_location))
.setItems(locationDescriptions) { dialog, which ->
.setItems(locationDescriptions) { _, which ->
startIntentForLocation(this, locations[which], pass)
done(this, finishOnDone)
}
@ -60,13 +60,10 @@ private fun startIntentForLocation(activity: Activity, location: PassLocation, p
}
private fun getEncodedDescription(location: PassLocation, pass: Pass): String {
try {
return URLEncoder.encode(location.getNameWithFallback(pass), "UTF-8")
} catch (e1: UnsupportedEncodingException) {
// OK - no description
return ""
}
private fun getEncodedDescription(location: PassLocation, pass: Pass) = try {
URLEncoder.encode(location.getNameWithFallback(pass), "UTF-8")
} catch (e1: UnsupportedEncodingException) {
// OK - no description
""
}

View file

@ -35,7 +35,7 @@ open class PassAndroidActivity : AppCompatActivity() {
override fun onResume() {
super.onResume()
if (lastSetNightMode != null && lastSetNightMode !== settings.getNightMode()) {
if (lastSetNightMode != null && lastSetNightMode != settings.getNightMode()) {
recreateWhenPossible()
}
lastSetNightMode = settings.getNightMode()

View file

@ -58,7 +58,7 @@ class PassEditActivity : AppCompatActivity() {
setContentView(R.layout.edit)
categoryView.setOnClickListener {
AlertDialog.Builder(this).setItems(R.array.category_edit_options) { dialogInterface, i ->
AlertDialog.Builder(this).setItems(R.array.category_edit_options) { _, i ->
when (i) {
0 -> showCategoryPickDialog(this@PassEditActivity, currentPass, bus)
1 -> showColorPickDialog(this@PassEditActivity, currentPass, bus)

View file

@ -17,11 +17,11 @@ import android.support.v7.app.AlertDialog
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.view.View.GONE
import kotlinx.android.synthetic.main.pass_list.*
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import org.ligi.kaxt.setButton
import org.ligi.kaxt.setVisibility
import org.ligi.kaxt.startActivityFromClass
import org.ligi.kaxt.startActivityFromURL
import org.ligi.passandroid.App
@ -137,7 +137,6 @@ class PassListActivity : PassAndroidActivity() {
setSupportActionBar(toolbar)
fab_action_open_file.setVisibility(Build.VERSION.SDK_INT >= VERSION_STARTING_TO_SUPPORT_STORAGE_FRAMEWORK)
// don't want too many windows in worst case - so check for errors first
if (TraceDroid.getStackTraceFiles().isNotEmpty()) {
@ -189,7 +188,7 @@ class PassListActivity : PassAndroidActivity() {
if (tab_layout.selectedTabPosition < 0) {
newTitle = getString(R.string.topic_new)
} else {
newTitle = adapter.getPageTitle(tab_layout.selectedTabPosition).toString()
newTitle = adapter.getPageTitle(tab_layout.selectedTabPosition)
}
passStore.classifier.moveToTopic(pass, newTitle)
@ -205,8 +204,12 @@ class PassListActivity : PassAndroidActivity() {
fam.collapse()
}
fab_action_open_file.setOnClickListener {
onAddOpenFileClick()
if (Build.VERSION.SDK_INT >= VERSION_STARTING_TO_SUPPORT_STORAGE_FRAMEWORK) {
fab_action_open_file.setOnClickListener {
onAddOpenFileClick()
}
} else {
fab_action_open_file.visibility = GONE
}
}

View file

@ -54,7 +54,7 @@ class PassMenuOptions(val activity: Activity, val pass: Pass) {
builder.setView(sourceDeleteCheckBoxView)
}
builder.setPositiveButton(activity.getString(R.string.delete)) { dialog, which ->
builder.setPositiveButton(activity.getString(R.string.delete)) { _, _ ->
if (sourceDeleteCheckBoxView.sourceDeleteCheckbox.isChecked) {
File(source!!.replace("file://", "")).delete()

View file

@ -15,7 +15,7 @@ object UnzipPassDialog {
private fun displayError(activity: Activity, title: String, err: String) {
AlertDialog.Builder(activity).setTitle(title)
.setMessage(err)
.setPositiveButton(android.R.string.ok) { dialogInterface, i -> activity.finish() }
.setPositiveButton(android.R.string.ok) { _, _ -> activity.finish() }
.show()
}

View file

@ -18,7 +18,7 @@ fun showBarcodeEditDialog(context: AppCompatActivity, bus: EventBus, pass: Pass,
AlertDialog.Builder(context).setView(view)
.setTitle(R.string.edit_barcode_dialog_title)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok) { dialog, which ->
.setPositiveButton(android.R.string.ok) { _, _ ->
pass.barCode = barcodeEditController.getBarCode()
bus.post(PassRefreshEvent(pass))
}

View file

@ -45,7 +45,7 @@ fun showCategoryPickDialog(context: Context, pass: Pass, bus: EventBus) {
}
val builder = AlertDialog.Builder(context)
builder.setAdapter(adapter) { dialog, position ->
builder.setAdapter(adapter) { _, position ->
pass.type = passTypes[position]
bus.post(PassRefreshEvent(pass))
}

View file

@ -1,9 +1,9 @@
buildscript {
ext {
support_version = '25.2.0'
dagger_version = '2.7'
kotlin_version = '1.1.0'
mockito_version = '2.7.9'
support_version = '25.3.0'
dagger_version = '2.10'
kotlin_version = '1.1.1'
mockito_version = '2.7.19'
play_version = '10.0.1'
}

Binary file not shown.

View file

@ -1,6 +1,6 @@
#Fri Mar 03 23:10:43 CET 2017
#Mon Mar 06 23:47:44 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip

11
gradlew vendored
View file

@ -155,13 +155,14 @@ if $cygwin ; then
fi
# Escape application args
for s in "${@}" ; do
s=\"$s\"
APP_ARGS=$APP_ARGS" "$s
done
save ( ) {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- "$DEFAULT_JVM_OPTS" "$JAVA_OPTS" "$GRADLE_OPTS" "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then