Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Entreco committed Jul 13, 2018
2 parents 0648b15 + 54842d1 commit 161bd61
Show file tree
Hide file tree
Showing 55 changed files with 1,002 additions and 856 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ deploy:
file:
- $APP_NAME
- $TRAVIS_BUILD_DIR/android/DartsScorecard/app/build/outputs/mapping/release/mapping.txt
- $TRAVIS_BUILD_DIR/android/DartsScorecard/scripts/dsc_keystore
api_key: $apikey
skip_cleanup: true
overwrite: true
Expand Down
25 changes: 21 additions & 4 deletions android/DartsScorecard/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,26 @@
android:name=".splash.SplashActivity"
android:noHistory="true"
android:theme="@style/SplashTheme">
<intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="entreco.nl"
android:pathPrefix="/dsc"
android:pathPattern="/*"
android:scheme="http" />

<data
android:host="entreco.nl"
android:pathPattern="/dsc"
android:scheme="http" />
</intent-filter>

</activity>
<activity android:name=".launch.LaunchActivity" />
<activity
Expand All @@ -44,10 +60,11 @@
android:name=".profile.edit.EditPlayerNameActivity"
android:parentActivityName=".profile.view.ProfileActivity" />

<service android:name=".archive.ArchiveJobService"
android:permission="android.permission.BIND_JOB_SERVICE"
<service
android:name=".archive.ArchiveJobService"
android:description="@string/archive_service"
android:exported="true" />
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />

</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ class DialogHelper @Inject constructor(private val builder: AlertDialog.Builder)
var selectedIndex = previousIndex
builder
.setTitle(R.string.select_starting_team)
.setSingleChoiceItems(teams.map { it.toString() }.toTypedArray(), previousIndex, { _, which ->
.setSingleChoiceItems(teams.map { it.toString() }.toTypedArray(), previousIndex) { _, which ->
selectedIndex = which
})
.setPositiveButton(android.R.string.ok, { dialog, _ ->
}
.setPositiveButton(android.R.string.ok) { dialog, _ ->
select(selectedIndex)
dialog.dismiss()
})
.setNegativeButton(R.string.cancel, { dialog, _ ->
}
.setNegativeButton(R.string.cancel) { dialog, _ ->
dialog.dismiss()
})
}
.create()
.show()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import kotlin.math.max
*/
class RevealAnimator(private val target: View) {

fun setupEnterAnimation(inflater: TransitionInflater?, window: Window, root: View, reverse: Boolean = true) {
fun setupEnterAnimation(inflater: TransitionInflater?, window: Window, reverse: Boolean = true) {
if (inflater == null) return
val boundsTransition = inflater.inflateTransition(R.transition.change_bound_with_arc)
boundsTransition.duration = 100
window.sharedElementEnterTransition = boundsTransition
boundsTransition.addListener(object : Transition.TransitionListener {
override fun onTransitionEnd(transition: Transition?) {
if (!reverse) {
animateRevealShow(root)
animateRevealShow(target.rootView)
}
boundsTransition.removeListener(this)
}
Expand All @@ -35,7 +35,7 @@ class RevealAnimator(private val target: View) {

override fun onTransitionStart(transition: Transition?) {
if (!reverse) {
root.visibility = View.INVISIBLE
target.visibility = View.INVISIBLE
}
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class BetaActivity : ViewModelActivity(), DonateCallback, BetaAnimator.Swapper {

private fun showTankYouToast() {
val snack = Snackbar.make(binding.root, R.string.donation_thanks, Snackbar.LENGTH_INDEFINITE)
snack.setAction(R.string.donation_ok, { snack.dismiss() })
snack.setAction(R.string.donation_ok) { snack.dismiss() }
snack.setActionTextColor(getColor(R.color.colorAccent))
snack.show()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.os.Bundle
import android.support.v7.widget.Toolbar
import android.view.Menu
import android.view.MenuItem
import android.view.WindowManager
import nl.entreco.dartsscorecard.R
import nl.entreco.dartsscorecard.base.ViewModelActivity
import nl.entreco.dartsscorecard.databinding.ActivityPlay01Binding
Expand All @@ -31,6 +32,7 @@ class Play01Activity : ViewModelActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

val binding = DataBindingUtil.setContentView<ActivityPlay01Binding>(this, R.layout.activity_play_01)
binding.viewModel = viewModel
Expand All @@ -52,6 +54,7 @@ class Play01Activity : ViewModelActivity() {
override fun onDestroy() {
super.onDestroy()
viewModel.stop()
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}

private fun initGame() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Play01Navigator @Inject constructor(private val activity: Play01Activity)
val teams = team.players.map { it.id }.filter { it > 0 }.toLongArray()
if (teams.isEmpty()) {
Snackbar.make(view, R.string.err_player_was_deleted, Snackbar.LENGTH_INDEFINITE)
.setAction(android.R.string.ok, { })
.setAction(android.R.string.ok) { }
.show()
} else {
ProfileActivity.launch(activity, view, teams)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,29 @@ object InputBindings {
}

private fun clear(view: TextView, delay: Long) {
view.animate().translationX(-clearTranslation).setStartDelay(delay).withEndAction({
view.animate().translationX(-clearTranslation).setStartDelay(delay).withEndAction {
view.text = ""
}).setDuration(defaultAnimationDuration).start()
}.setDuration(defaultAnimationDuration).start()
}

private fun handleThrown(view: TextView, describe: String) {
view.text = describe
view.animate().translationX(horizontalTranslation).setDuration(defaultAnimationDuration).withEndAction({
view.animate().translationX(horizontalTranslation).setDuration(defaultAnimationDuration).withEndAction {
clear(view, delay)
}).start()
}.start()
}

private fun handleNoScore(view: TextView) {
view.setText(R.string.no_score)
view.animate().translationX(horizontalTranslation).setDuration(defaultAnimationDuration).withEndAction({
view.animate().translationX(horizontalTranslation).setDuration(defaultAnimationDuration).withEndAction {
clear(view, delay)
}).start()
}.start()
}

private fun handleBust(view: TextView) {
view.setText(R.string.bust)
view.animate().translationX(horizontalTranslation).setDuration(defaultAnimationDuration).withEndAction({
view.animate().translationX(horizontalTranslation).setDuration(defaultAnimationDuration).withEndAction {
clear(view, delay)
}).start()
}.start()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ class ScoreViewModel @Inject constructor(val adapter: ScoreAdapter, private val

override fun onNext(next: Next) {
currentTeam.set(teams.indexOf(next.team))
teams.forEachIndexed({ index, _ -> adapter.teamAtIndexTurnUpdate(index, next) })
teams.forEachIndexed { index, _ -> adapter.teamAtIndexTurnUpdate(index, next) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ object TeamScoreBindings {
.withStartAction {
view.pivotY = view.height.toFloat()
}
.withEndAction({
.withEndAction {
view.scaleY = 0F
view.translationY = 0F
view.setText(R.string.empty)
}).setDuration(if (delay == 0L) 0 else DEFAULT_ANIMATION_TIME).start()
}.setDuration(if (delay == 0L) 0 else DEFAULT_ANIMATION_TIME).start()
}

private fun handle180(view: TextView) {
Expand All @@ -79,10 +79,10 @@ object TeamScoreBindings {
view.scaleY = 0F
view.pivotY = 0F
}
.withEndAction({
.withEndAction {
animateColor(view, R.attr.colorOneEighty, R.attr.scoreText, 1200L)
clear(view, 1200L)
}).start()
}.start()
}

private fun animateColor(view: TextView, attr: Int, attr2: Int, duration: Long) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class TeamScoreViewModel(val team: Team, startScore: Score,

private fun calculateFinish(input: Score, player: Player, turn: Turn = Turn()) {
finishFuture?.cancel(true)
finishFuture = getFinishUsecase.calculate(GetFinishRequest(input, turn, player.prefs.favoriteDouble), { finish.set(it.finish) })
finishFuture = getFinishUsecase.calculate(GetFinishRequest(input, turn, player.prefs.favoriteDouble)) { finish.set(it.finish) }
}

private fun removeScoredBadgeAfter(duration: Long) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ class EditPlayerNameAnimator(binding: ActivityEditPlayerNameBinding, inflater: T
private val revealAnimator = RevealAnimator(editArea)

init {
revealAnimator.setupEnterAnimation(inflater, window, editArea, false)
revealAnimator.setupEnterAnimation(inflater, window, false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object EditPlayerNameBinding {
val revealAnimator = RevealAnimator(view)
val imm = view.context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
if (show) {
revealAnimator.setupEnterAnimation(TransitionInflater.from(view.context), window, view.rootView)
revealAnimator.setupEnterAnimation(TransitionInflater.from(view.context), window)
view.selectAll()
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SelectProfileSwiper(view: View, onSwiped: (Int) -> Unit, deleteAction: ()
onSwiped(viewHolder.adapterPosition)

val snack = Snackbar.make(view, R.string.confirm_delete_profile, Snackbar.LENGTH_LONG)
snack.setAction(R.string.undo, {})
snack.setAction(R.string.undo) {}
snack.addCallback(object : Snackbar.Callback() {
override fun onDismissed(transientBottomBar: Snackbar?, event: Int) {
if (event == Snackbar.Callback.DISMISS_EVENT_TIMEOUT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.Intent
import android.databinding.DataBindingUtil
import android.os.Bundle
import android.support.v4.app.ActivityOptionsCompat
import android.support.v7.widget.Toolbar
import android.transition.TransitionInflater
import android.view.Menu
import android.view.MenuItem
Expand Down Expand Up @@ -42,11 +41,8 @@ class ProfileActivity : ViewModelActivity() {

viewModel.fetchProfile(idsFromIntent(intent))

initToolbar(toolbar(binding), R.string.empty)
}

private fun toolbar(binding: ActivityProfileBinding): Toolbar {
return binding.includeAppbar.toolbar
initToolbar(binding.mainToolbar, R.string.empty, true)
// binding.mainToolbar.inflateMenu(R.menu.profile)
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
Expand Down Expand Up @@ -111,7 +107,7 @@ class ProfileActivity : ViewModelActivity() {

@JvmStatic
fun selectName(activity: Activity, name: String, fav: Int) {
val view = activity.findViewById<TextView>(R.id.profileHeaderName)
val view = activity.findViewById<TextView>(R.id.mainTextviewTitle)
val pickName = EditPlayerNameActivity.launch(activity, name, activity.resources.getStringArray(R.array.fav_doubles)[fav])
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, view, view.transitionName)
activity.startActivityForResult(pickName, REQUEST_CODE_CHANGE_NAME, options.toBundle())//one can be replaced with any action code
Expand Down
Loading

0 comments on commit 161bd61

Please sign in to comment.