-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #398 from lucasnlm/improve-theme
Update 17.0.0
- Loading branch information
Showing
312 changed files
with
6,579 additions
and
6,151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 8 additions & 45 deletions
53
about/src/main/java/dev/lucasnlm/antimine/about/AboutActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,19 @@ | ||
package dev.lucasnlm.antimine.about | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import androidx.fragment.app.FragmentTransaction | ||
import androidx.lifecycle.lifecycleScope | ||
import dev.lucasnlm.antimine.about.viewmodel.AboutEvent | ||
import dev.lucasnlm.antimine.about.viewmodel.AboutViewModel | ||
import dev.lucasnlm.antimine.about.views.info.AboutInfoFragment | ||
import dev.lucasnlm.antimine.about.views.licenses.LicensesFragment | ||
import dev.lucasnlm.antimine.ui.ext.ThematicActivity | ||
import kotlinx.android.synthetic.main.activity_about.* | ||
import org.koin.androidx.viewmodel.ext.android.viewModel | ||
|
||
class AboutActivity : ThematicActivity(R.layout.activity_about) { | ||
private val aboutViewModel: AboutViewModel by viewModel() | ||
import androidx.fragment.app.commit | ||
import dev.lucasnlm.antimine.about.views.AboutInfoFragment | ||
import dev.lucasnlm.antimine.ui.ext.ThemedActivity | ||
import kotlinx.android.synthetic.main.activity_container.* | ||
|
||
class AboutActivity : ThemedActivity(R.layout.activity_container) { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
section.bind( | ||
text = R.string.about, | ||
startButton = R.drawable.back_arrow, | ||
startDescription = R.string.back, | ||
startAction = { | ||
section.bindText(R.string.about) | ||
onBackPressed() | ||
}, | ||
) | ||
|
||
replaceFragment(AboutInfoFragment(), null) | ||
bindToolbar(toolbar) | ||
|
||
lifecycleScope.launchWhenCreated { | ||
aboutViewModel.observeEvent().collect { event -> | ||
when (event) { | ||
AboutEvent.ThirdPartyLicenses -> { | ||
section.bindText(R.string.licenses) | ||
replaceFragment(LicensesFragment(), LicensesFragment.TAG) | ||
} | ||
else -> { | ||
} | ||
} | ||
} | ||
supportFragmentManager.commit(allowStateLoss = true) { | ||
replace(R.id.content, AboutInfoFragment()) | ||
} | ||
} | ||
|
||
private fun replaceFragment(fragment: Fragment, stackName: String?) { | ||
supportFragmentManager.beginTransaction().apply { | ||
if (stackName != null) { | ||
setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) | ||
addToBackStack(stackName) | ||
} | ||
replace(R.id.content, fragment) | ||
}.commitAllowingStateLoss() | ||
} | ||
} |
12 changes: 0 additions & 12 deletions
12
about/src/main/java/dev/lucasnlm/antimine/about/viewmodel/AboutState.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
about/src/main/java/dev/lucasnlm/antimine/licenses/LicenseActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package dev.lucasnlm.antimine.licenses | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.commit | ||
import dev.lucasnlm.antimine.about.R | ||
import dev.lucasnlm.antimine.licenses.views.LicensesFragment | ||
import dev.lucasnlm.antimine.ui.ext.ThemedActivity | ||
import kotlinx.android.synthetic.main.activity_container.* | ||
|
||
class LicenseActivity : ThemedActivity(R.layout.activity_container) { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
bindToolbar(toolbar) | ||
toolbar.setTitle(R.string.licenses) | ||
|
||
supportFragmentManager.commit(allowStateLoss = true) { | ||
replace(R.id.content, LicensesFragment()) | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
about/src/main/java/dev/lucasnlm/antimine/licenses/viewmodel/LicenseState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package dev.lucasnlm.antimine.licenses.viewmodel | ||
|
||
data class License( | ||
val name: String, | ||
val url: String, | ||
) | ||
|
||
data class LicenseState( | ||
val licenses: List<License>, | ||
) |
26 changes: 26 additions & 0 deletions
26
about/src/main/java/dev/lucasnlm/antimine/licenses/viewmodel/LicenseViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package dev.lucasnlm.antimine.licenses.viewmodel | ||
|
||
import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel | ||
|
||
class LicenseViewModel : IntentViewModel<Void, LicenseState>() { | ||
private fun getLicensesList() = mapOf( | ||
"Antimine" to "https://github.com/lucasnlm/antimine-android/blob/main/LICENSE", | ||
"Android SDK License" to "https://developer.android.com/studio/terms", | ||
"Koin" to "https://github.com/InsertKoinIO/koin/blob/main/LICENSE", | ||
"LibGDX" to "https://github.com/libgdx/libgdx/blob/master/LICENSE", | ||
"Material Design" to "https://github.com/material-components/material-components-android/blob/master/LICENSE", | ||
"Moshi" to "https://github.com/square/moshi/blob/master/LICENSE.txt", | ||
"Mockk" to "https://github.com/mockk/mockk/blob/master/LICENSE", | ||
"Noto Emoji" to "https://github.com/googlefonts/noto-emoji/blob/main/fonts/LICENSE", | ||
"kotlin" to "https://github.com/JetBrains/kotlin/blob/master/license/LICENSE.txt", | ||
"kotlinx.coroutines" to "https://github.com/Kotlin/kotlinx.coroutines/blob/master/LICENSE.txt", | ||
).map { | ||
License(it.key, it.value) | ||
}.sortedBy { | ||
it.name | ||
}.toList() | ||
|
||
override fun initialState(): LicenseState { | ||
return LicenseState(licenses = getLicensesList()) | ||
} | ||
} |
Oops, something went wrong.