Skip to content

Commit

Permalink
Bump version to 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
edipo2s committed Jan 17, 2017
1 parent 4ffd5c8 commit f28d029
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,28 +67,32 @@ class PrivateInteractor : BaseInteractor() {
fun setUserCardFavorite(card: Card, favorite: Boolean, onSuccess: () -> Unit) {
dbUserCards(card.set, card.attr)?.apply {
child(card.shortName).apply {
val childEventListener = object : SimpleChildEventListener() {
override fun onChildAdded(snapshot: DataSnapshot?, previousChildName: String?) {
Timber.d(snapshot.toString())
if (snapshot?.key == KEY_CARD_FAVORITE) {
removeEventListener(this)
onSuccess.invoke()
}
}
execSetUserCardFavorite(this, favorite, onSuccess)
}
}
}

override fun onChildRemoved(snapshot: DataSnapshot?) {
removeEventListener(this)
Timber.d(snapshot.toString())
onSuccess.invoke()
}
}
addChildEventListener(childEventListener)
if (favorite) {
child(KEY_CARD_FAVORITE).setValue(true).addOnFailureListener { removeEventListener(childEventListener) }
} else {
child(KEY_CARD_FAVORITE).removeValue().addOnFailureListener { removeEventListener(childEventListener) }
private fun execSetUserCardFavorite(dr: DatabaseReference, favorite: Boolean, onSuccess: () -> Unit) {
val childEventListener = object : SimpleChildEventListener() {
override fun onChildAdded(snapshot: DataSnapshot?, previousChildName: String?) {
Timber.d(snapshot.toString())
if (snapshot?.key == KEY_CARD_FAVORITE) {
dr.removeEventListener(this)
onSuccess.invoke()
}
}

override fun onChildRemoved(snapshot: DataSnapshot?) {
dr.removeEventListener(this)
Timber.d(snapshot.toString())
onSuccess.invoke()
}
}
dr.addChildEventListener(childEventListener)
if (favorite) {
dr.child(KEY_CARD_FAVORITE).setValue(true).addOnFailureListener { dr.removeEventListener(childEventListener) }
} else {
dr.child(KEY_CARD_FAVORITE).removeValue().addOnFailureListener { dr.removeEventListener(childEventListener) }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,24 @@ class MatchesHistoryFragment : BaseFragment() {
match_history_rank.text = context.getString(rankText, match.rank)
match_history_rank.visibility = if (match.mode == MatchMode.RANKED) View.VISIBLE else View.INVISIBLE
match_history_delete.setOnClickListener {
val opponentClass = match.opponent.cls.name.toLowerCase().capitalize()
val title = context.getString(R.string.match_history_delete, opponentClass)
context.alertThemed(title, context.getString(R.string.confirm_message), R.style.AppDialog) {
positiveButton(android.R.string.yes, {
PrivateInteractor().deleteMatch(match) {
onDelete.invoke()
}
})
negativeButton(android.R.string.no, { })
}.show()
onHistoryClick(itemView, match, onDelete)
}
}
}

private fun onHistoryClick(view: View, match: Match, onDelete: () -> Unit) {
val opponentClass = match.opponent.cls.name.toLowerCase().capitalize()
val title = view.context.getString(R.string.match_history_delete, opponentClass)
view.context.alertThemed(title, view.context.getString(R.string.confirm_message), R.style.AppDialog) {
positiveButton(android.R.string.yes, {
PrivateInteractor().deleteMatch(match) {
onDelete.invoke()
}
})
negativeButton(android.R.string.no, { })
}.show()
}

fun bindSection(date: LocalDate) {
itemView.match_history_date.text = date.format(DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL))
}
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">TESL Tracker</string>
<string name="app_exit_confirm">Pressione novamente para sair</string>
<string name="app_bd_under_updating">O banco de dados de TESL Tracker está em atualização. Você será notificado quando estiver concluído.</string>
<string name="app_version_unsupported">Esta versão tornou-se não obsoleta. Por favor atualize para continuar usando o app.</string>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="app_name">TESL Tracker</string>
<string name="app_name_full">TES Legends Tracker</string>
<string name="app_name" translatable="false">TESL Tracker</string>
<string name="app_name_full" translatable="false">TES Legends Tracker</string>
<string name="app_ads_card_list" translatable="false">ca-app-pub-7881623561544201/7976661172</string>
<string name="app_ads_card_list_size" translatable="false">280x80</string>
<string name="app_ads_card_full" translatable="false">ca-app-pub-7881623561544201/1511325179</string>
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

buildscript {
ext {
appVersionName = "0.2.3"
appVersionCode = 5
appVersionName = "0.3.0"
appVersionCode = 7

kotlin_version = "1.0.6"
prepareToRelease = false
prepareToRelease = true
}

repositories {
Expand All @@ -16,7 +16,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:2.3.0-beta2'
classpath "com.google.gms:google-services:3.0.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.fabric.tools:gradle:1.22.0"
Expand Down

0 comments on commit f28d029

Please sign in to comment.