diff --git a/.idea/misc.xml b/.idea/misc.xml index 3adce03..5484635 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -27,7 +27,7 @@ - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index fa7fc31..bb0f2ad 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -38,6 +38,12 @@ android { println(e.message) } } + release { + storeFile file('debug.keystore') + keyAlias 'androiddebugkey' + keyPassword 'android' + storePassword 'android' + } } buildTypes { debug { @@ -46,7 +52,7 @@ android { } release { debuggable false - signingConfig signingConfigs.release + signingConfig signingConfigs.debug minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } @@ -54,10 +60,11 @@ android { sourceSets { main.java.srcDirs += 'src/main/kotlin' } + } ext { - anko_version = "0.9" + anko_version = "0.9.1a" icePickVersion = "3.2.+" okIOVersion = "1.11.+" okHttpVersion = "3.6.+" @@ -65,8 +72,8 @@ ext { supportLibraryVersion = "25.1.1" threetenabpVersion = "1.0.+" - testMockitoVersion = "2.1.+" - testRoboletricVersion = "3.1.+" + testMockitoVersion = "2.7.+" + testRoboletricVersion = "3.2.+" } configurations.all { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5d29ace..1d088ac 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -18,11 +18,12 @@ + android:theme="@style/AppTheme"> + android:enabled="true" + android:permission="android.permission.INSTALL_PACKAGES"> diff --git a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/arena/ArenaFragment.kt b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/arena/ArenaFragment.kt index c9e3d72..02499b3 100644 --- a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/arena/ArenaFragment.kt +++ b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/arena/ArenaFragment.kt @@ -1,6 +1,7 @@ package com.ediposouza.teslesgendstracker.ui.matches.tabs import android.os.Bundle +import android.support.v4.app.ActivityCompat import android.support.v4.app.ActivityOptionsCompat import android.view.* import com.ediposouza.teslesgendstracker.R @@ -35,7 +36,7 @@ class ArenaFragment : MatchesHistoryFragment() { super.onViewCreated(view, savedInstanceState) arena_fab_add.setOnClickListener { val anim = ActivityOptionsCompat.makeCustomAnimation(context, R.anim.slide_up, R.anim.slide_down) - startActivity(context.intentFor(), anim.toBundle()) + ActivityCompat.startActivity(activity, context.intentFor(), anim.toBundle()) } MetricsManager.trackScreen(MetricScreen.SCREEN_ARENA()) } diff --git a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/arena/widget/ArenaDraftCards.kt b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/arena/widget/ArenaDraftCards.kt index 2bb010e..0244b21 100644 --- a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/arena/widget/ArenaDraftCards.kt +++ b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/arena/widget/ArenaDraftCards.kt @@ -149,7 +149,7 @@ class ArenaDraftCards(ctx: Context?, attrs: AttributeSet?, defStyleAttr: Int) : private fun updateCardList(cards: List, cardsAdapter: CardsAllFragment.CardsAllAdapter) { cardsAdapter.showCards(cards.filter { it.attr == currentAttr } - .filter { currentMagika == -1 || it.cost == currentMagika } + .filter { currentMagika == -1 || (if (currentMagika < 7) it.cost == currentMagika else it.cost >= currentMagika) } .filter { currentRarity == null || it.rarity == currentRarity } .filter { !it.evolves } .sortedBy { it.cost }) diff --git a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/cards/tabs/CardsCollectionFragment.kt b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/cards/tabs/CardsCollectionFragment.kt index 9aa06e3..1224160 100644 --- a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/cards/tabs/CardsCollectionFragment.kt +++ b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/cards/tabs/CardsCollectionFragment.kt @@ -58,7 +58,9 @@ class CardsCollectionFragment : CardsAllFragment() { var isEditStarted: Boolean = false - val view_statistics by lazy { activity.find(R.id.cards_collection_statistics) } + val view_statistics: CollectionStatistics + get() = activity.find(R.id.cards_collection_statistics) + val statisticsSheetBehavior: BottomSheetBehavior get() = BottomSheetBehavior.from(view_statistics) diff --git a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/decks/tabs/DecksPublicFragment.kt b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/decks/tabs/DecksPublicFragment.kt index b41d7d9..d7e5f09 100644 --- a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/decks/tabs/DecksPublicFragment.kt +++ b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/decks/tabs/DecksPublicFragment.kt @@ -1,6 +1,8 @@ package com.ediposouza.teslesgendstracker.ui.decks.tabs +import android.os.Build import android.os.Bundle +import android.support.v4.app.ActivityCompat import android.support.v4.app.ActivityOptionsCompat import android.support.v4.util.Pair import android.support.v7.widget.LinearLayoutManager @@ -20,6 +22,7 @@ import com.ediposouza.teslesgendstracker.ui.base.* import com.ediposouza.teslesgendstracker.ui.cards.CmdFilterSearch import com.ediposouza.teslesgendstracker.ui.decks.DeckActivity import com.ediposouza.teslesgendstracker.ui.util.firebase.OnLinearLayoutItemScrolled +import com.ediposouza.teslesgendstracker.util.ConfigManager import com.ediposouza.teslesgendstracker.util.inflate import com.google.firebase.auth.FirebaseAuth import jp.wasabeef.recyclerview.animators.SlideInLeftAnimator @@ -35,6 +38,7 @@ import java.text.NumberFormat */ open class DecksPublicFragment : BaseFragment() { + val ASUS_CREATE_LAYER_ERROR = "Z00AD" val ADS_EACH_ITEMS = 10 //after 10 lines val DECK_PAGE_SIZE = 8 @@ -62,12 +66,18 @@ open class DecksPublicFragment : BaseFragment() { val favorite = it?.filter { it.uuid == deck.uuid }?.isNotEmpty() ?: false val userId = FirebaseAuth.getInstance().currentUser?.uid val like = deck.likes.contains(userId) - startActivity(DeckActivity.newIntent(context, deck, favorite, like, deck.owner == userId), - ActivityOptionsCompat.makeSceneTransitionAnimation(activity, - Pair(view.deck_name as View, nameTransitionName), - Pair(view.deck_cover as View, coverTransitionName), - Pair(view.deck_attr1 as View, attr1TransitionName), - Pair(view.deck_attr2 as View, attr2TransitionName)).toBundle()) + val deckIntent = DeckActivity.newIntent(context, deck, favorite, like, deck.owner == userId) + if (ConfigManager.isAsusZenPhoneSingleAnim() && Build.MODEL.contains(ASUS_CREATE_LAYER_ERROR)) { + ActivityCompat.startActivity(activity, deckIntent, ActivityOptionsCompat + .makeSceneTransitionAnimation(activity, view.deck_cover, coverTransitionName).toBundle()) + } else { + ActivityCompat.startActivity(activity, deckIntent, ActivityOptionsCompat + .makeSceneTransitionAnimation(activity, + Pair(view.deck_name as View, nameTransitionName), + Pair(view.deck_cover as View, coverTransitionName), + Pair(view.deck_attr1 as View, attr1TransitionName), + Pair(view.deck_attr2 as View, attr2TransitionName)).toBundle()) + } } } diff --git a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/decks/widget/DeckList.kt b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/decks/widget/DeckList.kt index 68153a1..341f936 100644 --- a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/decks/widget/DeckList.kt +++ b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/decks/widget/DeckList.kt @@ -41,11 +41,7 @@ class DeckList(ctx: Context?, attrs: AttributeSet?, defStyleAttr: Int) : } var editMode = false - private fun showExpandedCard(card: Card, view: View) { - val transitionName = context.getString(R.string.card_transition_name) - ActivityCompat.startActivity(context, CardActivity.newIntent(context, card), - ActivityOptionsCompat.makeSceneTransitionAnimation(context as Activity, view, transitionName).toBundle()) - } + val cardTransitionName by lazy { context.getString(R.string.card_transition_name) } val deckListAdapter by lazy { DeckListAdapter({ index -> decklist_recycle_view.scrollToPosition(index) }, @@ -53,7 +49,9 @@ class DeckList(ctx: Context?, attrs: AttributeSet?, defStyleAttr: Int) : if (editMode) { remCard(card) } else { - showExpandedCard(card, view) + ActivityCompat.startActivity(context, CardActivity.newIntent(context, card), + ActivityOptionsCompat.makeSceneTransitionAnimation(context as Activity, + view, cardTransitionName).toBundle()) } }, itemLongClick = { view, card -> @@ -63,7 +61,9 @@ class DeckList(ctx: Context?, attrs: AttributeSet?, defStyleAttr: Int) : negativeButton(android.R.string.no, {}) }.show() } else { - showExpandedCard(card, view) + ActivityCompat.startActivity(context, CardActivity.newIntent(context, card), + ActivityOptionsCompat.makeSceneTransitionAnimation(context as Activity, + view, cardTransitionName).toBundle()) } true }) diff --git a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/matches/tabs/MatchesStatisticsFragment.kt b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/matches/tabs/MatchesStatisticsFragment.kt index 541a49a..515ff49 100644 --- a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/matches/tabs/MatchesStatisticsFragment.kt +++ b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/ui/matches/tabs/MatchesStatisticsFragment.kt @@ -2,6 +2,7 @@ package com.ediposouza.teslesgendstracker.ui.matches.tabs import android.content.Context import android.os.Bundle +import android.support.v4.app.ActivityCompat import android.support.v4.app.ActivityOptionsCompat import android.support.v4.content.ContextCompat import android.support.v4.util.Pair @@ -93,7 +94,7 @@ class MatchesStatisticsFragment : BaseFragment() { it.getTag(com.inqbarna.tablefixheaders.R.id.tag_row) == row && it.getTag(com.inqbarna.tablefixheaders.R.id.tag_type_view) == 2 }.first() - startActivity(MatchesStatisticsClassActivity.newIntent(context, currentMatchMode, currentSeason, + ActivityCompat.startActivity(activity, MatchesStatisticsClassActivity.newIntent(context, currentMatchMode, currentSeason, selectedClass!!), ActivityOptionsCompat.makeSceneTransitionAnimation(activity, Pair(classView.cell_class_attr1 as View, attr1TransitionName), Pair(classView.cell_class_attr2 as View, attr2TransitionName)).toBundle()) diff --git a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/util/ConfigManager.kt b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/util/ConfigManager.kt index fff6f28..55b6c27 100644 --- a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/util/ConfigManager.kt +++ b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/util/ConfigManager.kt @@ -14,6 +14,7 @@ object ConfigManager { val DB_UPDATE_CONFIG = "db_update" val SHOW_DECK_ADS_CONFIG = "showDeckAds" val VERSION_UNSUPPORTED_CONFIG = "version_unsupported" + val ASUS_ZENPHONE_SINGLE_ANIM_CONFIG = "asusZenPhoneSingleAnim" val remoteConfig: FirebaseRemoteConfig by lazy { FirebaseRemoteConfig.getInstance() } @@ -24,7 +25,8 @@ object ConfigManager { .build()) setDefaults(mapOf(DB_UPDATE_CONFIG to false, SHOW_DECK_ADS_CONFIG to false, - VERSION_UNSUPPORTED_CONFIG to "")) + VERSION_UNSUPPORTED_CONFIG to "", + ASUS_ZENPHONE_SINGLE_ANIM_CONFIG to false)) } updateCaches {} } @@ -44,6 +46,8 @@ object ConfigManager { fun isShowDeckAds() = remoteConfig.getBoolean(SHOW_DECK_ADS_CONFIG) + fun isAsusZenPhoneSingleAnim() = remoteConfig.getBoolean(ASUS_ZENPHONE_SINGLE_ANIM_CONFIG) + fun isVersionUnsupported(): Boolean { val unsupportedVersions = remoteConfig.getString(VERSION_UNSUPPORTED_CONFIG) if (unsupportedVersions.isEmpty()) { diff --git a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/util/MetricsConstants.kt b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/util/MetricsConstants.kt index ed6ada4..41be1db 100644 --- a/app/src/main/kotlin/com/ediposouza/teslesgendstracker/util/MetricsConstants.kt +++ b/app/src/main/kotlin/com/ediposouza/teslesgendstracker/util/MetricsConstants.kt @@ -125,7 +125,7 @@ sealed class MetricAction(val name: String) { val PARAM_CLASS = "Class" } - class ACTION_NEW_MATCH_START_WITH(val deck: Deck?, val fromArena: Boolean = false) : MetricAction("NewMatch") { + class ACTION_NEW_MATCH_START_WITH(val deck: Deck?, val fromArena: Boolean = false) : MetricAction("MatchStart") { val PARAM_DECK = "Deck" val PARAM_DECK_VALUE_OTHER = "Other" val PARAM_FROM_ARENA = "FromArena" diff --git a/build.gradle b/build.gradle index d7dfcc6..19d4a90 100644 --- a/build.gradle +++ b/build.gradle @@ -2,11 +2,11 @@ buildscript { ext { - appVersionName = "0.4.0" - appVersionCode = 11 + appVersionName = "0.4.1" + appVersionCode = 12 kotlin_version = "1.1.0-beta-38" - prepareToRelease = true + prepareToRelease = false } repositories {