Update About screen and its related areas, change theme
This commit is contained in:
parent
eabf6f40dc
commit
b53fe4112a
30 changed files with 389 additions and 325 deletions
|
@ -122,12 +122,12 @@
|
|||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="dev.lucasnlm.antimine.about.thirds.ThirdPartiesActivity"
|
||||
android:name="dev.lucasnlm.antimine.about.views.thirds.ThirdPartiesFragment"
|
||||
android:label="@string/licenses"
|
||||
android:theme="@style/AppTheme" />
|
||||
|
||||
<activity
|
||||
android:name="dev.lucasnlm.antimine.about.translators.TranslatorsActivity"
|
||||
android:name="dev.lucasnlm.antimine.about.views.translators.TranslatorsFragment"
|
||||
android:theme="@style/AppTheme" />
|
||||
|
||||
<activity
|
||||
|
|
|
@ -14,7 +14,6 @@ import android.view.MenuItem
|
|||
import android.view.View
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.os.HandlerCompat.postDelayed
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.drawerlayout.widget.DrawerLayout
|
||||
|
@ -37,7 +36,6 @@ import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModelFactory
|
|||
import dev.lucasnlm.antimine.core.analytics.AnalyticsManager
|
||||
import dev.lucasnlm.antimine.core.analytics.models.Analytics
|
||||
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository
|
||||
import dev.lucasnlm.antimine.core.utils.isDarkModeEnabled
|
||||
import dev.lucasnlm.antimine.instant.InstantAppManager
|
||||
import dev.lucasnlm.antimine.level.view.CustomLevelDialogFragment
|
||||
import dev.lucasnlm.antimine.level.view.EndGameDialogFragment
|
||||
|
@ -216,11 +214,6 @@ class GameActivity : DaggerAppCompatActivity() {
|
|||
R.string.open_menu,
|
||||
R.string.close_menu
|
||||
).apply {
|
||||
if (!isDarkModeEnabled(applicationContext)) {
|
||||
drawerArrowDrawable.color =
|
||||
ContextCompat.getColor(applicationContext, R.color.primary)
|
||||
}
|
||||
|
||||
syncState()
|
||||
}
|
||||
)
|
||||
|
|
|
@ -5,27 +5,57 @@ import android.net.Uri
|
|||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.view.MenuItem
|
||||
import dev.lucasnlm.antimine.BuildConfig
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import dev.lucasnlm.antimine.R
|
||||
|
||||
import dev.lucasnlm.antimine.about.thirds.ThirdPartiesActivity
|
||||
import dev.lucasnlm.antimine.about.translators.TranslatorsActivity
|
||||
import kotlinx.android.synthetic.main.activity_about.*
|
||||
import dev.lucasnlm.antimine.about.views.AboutInfoFragment
|
||||
import dev.lucasnlm.antimine.about.models.AboutEvent
|
||||
import dev.lucasnlm.antimine.about.views.translators.TranslatorsFragment
|
||||
import dev.lucasnlm.antimine.about.views.thirds.ThirdPartiesFragment
|
||||
import dev.lucasnlm.antimine.about.viewmodel.AboutViewModel
|
||||
|
||||
class AboutActivity : AppCompatActivity() {
|
||||
private lateinit var aboutViewModel: AboutViewModel
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_about)
|
||||
bindToolbar()
|
||||
|
||||
version.text = getString(
|
||||
R.string.version_s,
|
||||
getString(R.string.app_name), BuildConfig.VERSION_NAME
|
||||
)
|
||||
aboutViewModel = ViewModelProviders.of(this).get(AboutViewModel::class.java)
|
||||
|
||||
thirdsParties.setOnClickListener { openThirdParties() }
|
||||
sourceCode.setOnClickListener { openSourceCode() }
|
||||
translation.setOnClickListener { openTranslation() }
|
||||
aboutViewModel.eventObserver.observe(this, Observer { event ->
|
||||
when (event) {
|
||||
AboutEvent.ThirdPartyLicenses -> {
|
||||
replaceFragment(ThirdPartiesFragment(), ThirdPartiesFragment::class.simpleName)
|
||||
}
|
||||
AboutEvent.SourceCode -> {
|
||||
openSourceCode()
|
||||
}
|
||||
AboutEvent.Translators -> {
|
||||
replaceFragment(TranslatorsFragment(), TranslatorsFragment::class.simpleName)
|
||||
}
|
||||
else -> {
|
||||
replaceFragment(AboutInfoFragment(), null)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
replaceFragment(AboutInfoFragment(), null)
|
||||
}
|
||||
|
||||
private fun replaceFragment(fragment: Fragment, stackName: String?) {
|
||||
supportFragmentManager.beginTransaction().apply {
|
||||
replace(R.id.content, fragment)
|
||||
if (stackName != null) {
|
||||
addToBackStack(stackName)
|
||||
}
|
||||
}.commitAllowingStateLoss()
|
||||
}
|
||||
|
||||
private fun openSourceCode() {
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(SOURCE_CODE)))
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean =
|
||||
|
@ -45,18 +75,6 @@ class AboutActivity : AppCompatActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun openThirdParties() {
|
||||
startActivity(Intent(this, ThirdPartiesActivity::class.java))
|
||||
}
|
||||
|
||||
private fun openTranslation() {
|
||||
startActivity(Intent(this, TranslatorsActivity::class.java))
|
||||
}
|
||||
|
||||
private fun openSourceCode() {
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(SOURCE_CODE)))
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val SOURCE_CODE = "https://github.com/lucasnlm/antimine-android"
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package dev.lucasnlm.antimine.about
|
|||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import dev.lucasnlm.antimine.R
|
||||
|
@ -13,10 +12,6 @@ import kotlinx.coroutines.GlobalScope
|
|||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
|
||||
class TextActivity : AppCompatActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
@ -24,8 +19,6 @@ class TextActivity : AppCompatActivity() {
|
|||
setContentView(R.layout.activity_text)
|
||||
bindToolbar()
|
||||
|
||||
progressBar.isIndeterminate = true
|
||||
|
||||
GlobalScope.launch {
|
||||
withContext(Dispatchers.Main) {
|
||||
progressBar.visibility = View.VISIBLE
|
||||
|
@ -33,45 +26,22 @@ class TextActivity : AppCompatActivity() {
|
|||
|
||||
withContext(Dispatchers.IO) {
|
||||
val rawPath = intent.getIntExtra(Constants.TEXT_PATH, -1)
|
||||
var result: String? = null
|
||||
|
||||
if (rawPath > 0) {
|
||||
resources.openRawResource(rawPath).use { inputStream ->
|
||||
val result = resources.openRawResource(rawPath)
|
||||
.bufferedReader()
|
||||
.readLines()
|
||||
.joinToString("\n")
|
||||
|
||||
result = readTextFile(inputStream)
|
||||
withContext(Dispatchers.Main) {
|
||||
textView.text = result
|
||||
progressBar.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
withContext(Dispatchers.Main) {
|
||||
textView.text = result
|
||||
progressBar.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun readTextFile(inputStream: InputStream): String {
|
||||
var result = ""
|
||||
ByteArrayOutputStream().use { outputStream ->
|
||||
val buf = ByteArray(4096)
|
||||
var len: Int
|
||||
try {
|
||||
while (true) {
|
||||
len = inputStream.read(buf)
|
||||
if (len != -1) {
|
||||
outputStream.write(buf, 0, len)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
Log.e(TAG, "Fail to read file.", e)
|
||||
}
|
||||
result = outputStream.toString()
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
var handled = false
|
||||
|
||||
|
@ -90,8 +60,4 @@ class TextActivity : AppCompatActivity() {
|
|||
setHomeButtonEnabled(true)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "TextActivity"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package dev.lucasnlm.antimine.about.models
|
||||
|
||||
enum class AboutEvent {
|
||||
ThirdPartyLicenses,
|
||||
SourceCode,
|
||||
Translators
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package dev.lucasnlm.antimine.about.thirds.data
|
||||
package dev.lucasnlm.antimine.about.models
|
||||
|
||||
import androidx.annotation.RawRes
|
||||
|
||||
internal data class ThirdParty(
|
||||
data class ThirdParty(
|
||||
val name: String,
|
||||
@RawRes val license: Int
|
||||
)
|
|
@ -1,4 +1,4 @@
|
|||
package dev.lucasnlm.antimine.about.translators.model
|
||||
package dev.lucasnlm.antimine.about.models
|
||||
|
||||
data class TranslationInfo(
|
||||
val language: String,
|
|
@ -1,78 +0,0 @@
|
|||
package dev.lucasnlm.antimine.about.thirds
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.view.MenuItem
|
||||
import androidx.recyclerview.widget.DividerItemDecoration
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
|
||||
import dev.lucasnlm.antimine.R
|
||||
import dev.lucasnlm.antimine.about.thirds.data.ThirdParty
|
||||
import dev.lucasnlm.antimine.about.thirds.view.ThirdPartyAdapter
|
||||
import kotlinx.android.synthetic.main.activity_third_party.*
|
||||
|
||||
class ThirdPartiesActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_third_party)
|
||||
bindToolbar()
|
||||
|
||||
licenses.apply {
|
||||
setHasFixedSize(true)
|
||||
addItemDecoration(
|
||||
DividerItemDecoration(context, DividerItemDecoration.VERTICAL)
|
||||
)
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
bindLicenses()
|
||||
}
|
||||
|
||||
private fun bindLicenses() {
|
||||
licenses.adapter = ThirdPartyAdapter(
|
||||
listOf(
|
||||
ThirdParty(
|
||||
"Android SDK License",
|
||||
R.raw.android_sdk
|
||||
),
|
||||
ThirdParty(
|
||||
"Material Design Icons",
|
||||
R.raw.apache2
|
||||
),
|
||||
ThirdParty(
|
||||
"Dagger",
|
||||
R.raw.apache2
|
||||
),
|
||||
ThirdParty(
|
||||
"Moshi",
|
||||
R.raw.apache2
|
||||
),
|
||||
ThirdParty(
|
||||
"Mockito",
|
||||
R.raw.mockito
|
||||
),
|
||||
ThirdParty(
|
||||
"Sounds",
|
||||
R.raw.sounds
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean =
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> {
|
||||
onBackPressed()
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
private fun bindToolbar() {
|
||||
supportActionBar?.apply {
|
||||
setTitle(R.string.licenses)
|
||||
setDisplayHomeAsUpEnabled(true)
|
||||
setHomeButtonEnabled(true)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package dev.lucasnlm.antimine.about.translators
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.DividerItemDecoration
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dev.lucasnlm.antimine.R
|
||||
import dev.lucasnlm.antimine.about.translators.model.TranslationInfo
|
||||
import dev.lucasnlm.antimine.about.translators.view.TranslatorsAdapter
|
||||
import kotlinx.android.synthetic.main.activity_translators.*
|
||||
|
||||
class TranslatorsActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_translators)
|
||||
bindToolbar()
|
||||
|
||||
translators.apply {
|
||||
addItemDecoration(
|
||||
DividerItemDecoration(context, DividerItemDecoration.VERTICAL)
|
||||
)
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
bindTranslationInfo()
|
||||
}
|
||||
|
||||
private fun bindTranslationInfo() {
|
||||
translators.adapter = TranslatorsAdapter(
|
||||
listOf(
|
||||
TranslationInfo(
|
||||
"Brazilian Portuguese",
|
||||
sequenceOf("Lucas Lima")
|
||||
),
|
||||
TranslationInfo(
|
||||
"Czech",
|
||||
sequenceOf("Lukas Novotny")
|
||||
),
|
||||
TranslationInfo(
|
||||
"Turkish",
|
||||
sequenceOf("Fatih Fırıncı")
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean =
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> {
|
||||
onBackPressed()
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
private fun bindToolbar() {
|
||||
supportActionBar?.apply {
|
||||
setTitle(R.string.licenses)
|
||||
setDisplayHomeAsUpEnabled(true)
|
||||
setHomeButtonEnabled(true)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package dev.lucasnlm.antimine.about.viewmodel
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import dev.lucasnlm.antimine.R
|
||||
import dev.lucasnlm.antimine.about.models.AboutEvent
|
||||
import dev.lucasnlm.antimine.about.models.ThirdParty
|
||||
import dev.lucasnlm.antimine.about.models.TranslationInfo
|
||||
import dev.lucasnlm.antimine.about.views.thirds.ThirdPartyAdapter
|
||||
import dev.lucasnlm.antimine.about.views.translators.TranslatorsAdapter
|
||||
|
||||
class AboutViewModel : ViewModel() {
|
||||
val eventObserver = MutableLiveData<AboutEvent>()
|
||||
|
||||
fun getTranslators() = TranslatorsAdapter(
|
||||
listOf(
|
||||
TranslationInfo(
|
||||
"Brazilian Portuguese",
|
||||
sequenceOf("Lucas Lima")
|
||||
),
|
||||
TranslationInfo(
|
||||
"Czech",
|
||||
sequenceOf("novas78@xda")
|
||||
),
|
||||
TranslationInfo(
|
||||
"French",
|
||||
sequenceOf("Just Humeau")
|
||||
),
|
||||
TranslationInfo(
|
||||
"Turkish",
|
||||
sequenceOf("Fatih Fırıncı")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
fun getLicenses() = ThirdPartyAdapter(
|
||||
listOf(
|
||||
ThirdParty(
|
||||
"Android SDK License",
|
||||
R.raw.android_sdk
|
||||
),
|
||||
ThirdParty(
|
||||
"Material Design Icons",
|
||||
R.raw.apache2
|
||||
),
|
||||
ThirdParty(
|
||||
"Dagger",
|
||||
R.raw.apache2
|
||||
),
|
||||
ThirdParty(
|
||||
"Moshi",
|
||||
R.raw.apache2
|
||||
),
|
||||
ThirdParty(
|
||||
"Mockito",
|
||||
R.raw.mockito
|
||||
),
|
||||
ThirdParty(
|
||||
"Sounds",
|
||||
R.raw.sounds
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package dev.lucasnlm.antimine.about.views
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import dev.lucasnlm.antimine.BuildConfig
|
||||
import dev.lucasnlm.antimine.R
|
||||
import dev.lucasnlm.antimine.about.models.AboutEvent
|
||||
import dev.lucasnlm.antimine.about.viewmodel.AboutViewModel
|
||||
import kotlinx.android.synthetic.main.fragment_about_info.*
|
||||
|
||||
class AboutInfoFragment : Fragment() {
|
||||
private var aboutViewModel: AboutViewModel? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
activity?.run {
|
||||
aboutViewModel = ViewModelProviders.of(this).get(AboutViewModel::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? =
|
||||
inflater.inflate(R.layout.fragment_about_info, container, false)
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
version.text = getString(R.string.version_s, BuildConfig.VERSION_NAME)
|
||||
|
||||
thirdsParties.setOnClickListener {
|
||||
aboutViewModel?.eventObserver?.postValue(AboutEvent.ThirdPartyLicenses)
|
||||
}
|
||||
|
||||
sourceCode.setOnClickListener {
|
||||
aboutViewModel?.eventObserver?.postValue(AboutEvent.SourceCode)
|
||||
}
|
||||
|
||||
translation.setOnClickListener {
|
||||
aboutViewModel?.eventObserver?.postValue(AboutEvent.Translators)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package dev.lucasnlm.antimine.about.views.thirds
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import androidx.recyclerview.widget.DividerItemDecoration
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
|
||||
import dev.lucasnlm.antimine.R
|
||||
import dev.lucasnlm.antimine.about.viewmodel.AboutViewModel
|
||||
import kotlinx.android.synthetic.main.fragment_third_party.*
|
||||
|
||||
class ThirdPartiesFragment : Fragment() {
|
||||
private var aboutViewModel: AboutViewModel? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
activity?.run {
|
||||
aboutViewModel = ViewModelProviders.of(this).get(AboutViewModel::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? =
|
||||
inflater.inflate(R.layout.fragment_third_party, container, false)
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
licenses.apply {
|
||||
setHasFixedSize(true)
|
||||
addItemDecoration(
|
||||
DividerItemDecoration(context, DividerItemDecoration.VERTICAL)
|
||||
)
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
licenses.adapter = aboutViewModel?.getLicenses()
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package dev.lucasnlm.antimine.about.thirds.view
|
||||
package dev.lucasnlm.antimine.about.views.thirds
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
@ -8,9 +8,9 @@ import dev.lucasnlm.antimine.R
|
|||
|
||||
import dev.lucasnlm.antimine.about.Constants
|
||||
import dev.lucasnlm.antimine.about.TextActivity
|
||||
import dev.lucasnlm.antimine.about.thirds.data.ThirdParty
|
||||
import dev.lucasnlm.antimine.about.models.ThirdParty
|
||||
|
||||
internal class ThirdPartyAdapter(
|
||||
class ThirdPartyAdapter(
|
||||
private val thirdParties: List<ThirdParty>
|
||||
) : RecyclerView.Adapter<ThirdPartyViewHolder>() {
|
||||
|
||||
|
@ -25,14 +25,16 @@ internal class ThirdPartyAdapter(
|
|||
|
||||
override fun onBindViewHolder(holder: ThirdPartyViewHolder, position: Int) {
|
||||
val thirdParty = thirdParties[position]
|
||||
holder.title.text = thirdParty.name
|
||||
holder.itemView.setOnClickListener { view ->
|
||||
val intent = Intent(view.context, TextActivity::class.java).apply {
|
||||
putExtra(Constants.TEXT_TITLE, thirdParty.name)
|
||||
putExtra(Constants.TEXT_PATH, thirdParty.license)
|
||||
}
|
||||
holder.apply {
|
||||
title.text = thirdParty.name
|
||||
itemView.setOnClickListener { view ->
|
||||
val intent = Intent(view.context, TextActivity::class.java).apply {
|
||||
putExtra(Constants.TEXT_TITLE, thirdParty.name)
|
||||
putExtra(Constants.TEXT_PATH, thirdParty.license)
|
||||
}
|
||||
|
||||
view.context.startActivity(intent)
|
||||
view.context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package dev.lucasnlm.antimine.about.thirds.view
|
||||
package dev.lucasnlm.antimine.about.views.thirds
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import android.view.View
|
||||
|
@ -6,6 +6,6 @@ import android.widget.TextView
|
|||
|
||||
import dev.lucasnlm.antimine.R
|
||||
|
||||
internal class ThirdPartyViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
class ThirdPartyViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val title: TextView = view.findViewById(R.id.third_name)
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
package dev.lucasnlm.antimine.about.translators.view
|
||||
package dev.lucasnlm.antimine.about.views.translators
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import dev.lucasnlm.antimine.R
|
||||
import dev.lucasnlm.antimine.about.translators.model.TranslationInfo
|
||||
import dev.lucasnlm.antimine.about.models.TranslationInfo
|
||||
|
||||
internal class TranslatorsAdapter(
|
||||
class TranslatorsAdapter(
|
||||
private val translators: List<TranslationInfo>
|
||||
) : RecyclerView.Adapter<TranslatorsViewHolder>() {
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package dev.lucasnlm.antimine.about.views.translators
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import androidx.recyclerview.widget.DividerItemDecoration
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dev.lucasnlm.antimine.R
|
||||
import dev.lucasnlm.antimine.about.viewmodel.AboutViewModel
|
||||
import kotlinx.android.synthetic.main.activity_translators.*
|
||||
|
||||
class TranslatorsFragment : Fragment() {
|
||||
private var aboutViewModel: AboutViewModel? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
activity?.run {
|
||||
aboutViewModel = ViewModelProviders.of(this).get(AboutViewModel::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? =
|
||||
inflater.inflate(R.layout.activity_translators, container, false)
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
translators.apply {
|
||||
addItemDecoration(
|
||||
DividerItemDecoration(view.context, DividerItemDecoration.VERTICAL)
|
||||
)
|
||||
layoutManager = LinearLayoutManager(view.context)
|
||||
}
|
||||
|
||||
translators.adapter = aboutViewModel?.getTranslators()
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
package dev.lucasnlm.antimine.about.translators.view
|
||||
package dev.lucasnlm.antimine.about.views.translators
|
||||
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import dev.lucasnlm.antimine.R
|
||||
|
||||
internal class TranslatorsViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
class TranslatorsViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val language: TextView = view.findViewById(R.id.language)
|
||||
val translators: TextView = view.findViewById(R.id.translators)
|
||||
}
|
|
@ -1,79 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="dev.lucasnlm.antimine.about.AboutActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logo"
|
||||
android:layout_width="115dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/app_name"
|
||||
app:srcCompat="@drawable/title"
|
||||
app:layout_constraintBottom_toTopOf="@+id/version"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="16dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toTopOf="@+id/buttons"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/logo"
|
||||
tools:text="Anti-mine - Version 1.0" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/buttons"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/version">
|
||||
|
||||
<Button
|
||||
android:id="@+id/thirdsParties"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/show_licenses" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/sourceCode"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/source_code" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/translation"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/translation" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
tools:context="dev.lucasnlm.antimine.about.AboutActivity"
|
||||
android:fitsSystemWindows="true" />
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView"
|
||||
|
@ -36,4 +37,5 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="false"
|
||||
tools:context="dev.lucasnlm.antimine.about.translators.TranslatorsActivity">
|
||||
tools:context="dev.lucasnlm.antimine.about.views.translators.TranslatorsFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
|
|
80
app/src/main/res/layout/fragment_about_info.xml
Normal file
80
app/src/main/res/layout/fragment_about_info.xml
Normal file
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="dev.lucasnlm.antimine.about.AboutActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logo"
|
||||
android:layout_width="115dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/app_name"
|
||||
app:layout_constraintBottom_toTopOf="@+id/version"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="16dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toTopOf="@+id/buttons"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/logo"
|
||||
tools:text="Anti-mine - Version 1.0" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/buttons"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/version">
|
||||
|
||||
<Button
|
||||
android:id="@+id/thirdsParties"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/show_licenses" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/sourceCode"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/source_code" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/translation"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/translation" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -6,7 +6,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="false"
|
||||
tools:context="dev.lucasnlm.antimine.about.thirds.ThirdPartiesActivity">
|
||||
tools:context="dev.lucasnlm.antimine.about.views.thirds.ThirdPartiesFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
|
@ -16,7 +16,7 @@
|
|||
android:paddingTop="24dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingBottom="24dp"
|
||||
android:text="@string/translators_text"
|
||||
android:text="@string/used_software_text"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
|
@ -2,7 +2,6 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/frameLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<string name="share_body_text">Hice %1$d/%2$d en %3$d segundos.</string>
|
||||
<string name="share_body_text_generic">Estoy jugando %1$s</string>
|
||||
<string name="fail_to_share">No se pudo compartir el juego</string>
|
||||
<string name="version_s">%1$s - %2$s</string>
|
||||
<string name="version_s">Versión %2$s</string>
|
||||
<string name="sound_effects">Efectos de Sonido</string>
|
||||
<string name="quit">Dejar</string>
|
||||
<string name="are_you_sure">¿Estás seguro?</string>
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<string name="share_body_text">Eu fiz %1$d/%2$d em %3$d segundos.</string>
|
||||
<string name="share_body_text_generic">Estou jogando %1$s</string>
|
||||
<string name="fail_to_share">Falha ao compartilhar jogo</string>
|
||||
<string name="version_s">%1$s - %2$s</string>
|
||||
<string name="version_s">Versão %1$s</string>
|
||||
<string name="sound_effects">Efeitos Sonoros</string>
|
||||
<string name="quit">Sair</string>
|
||||
<string name="are_you_sure">Você tem certeza?</string>
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="AppTheme" parent="Theme.AppCompat.DayNight">
|
||||
<item name="colorPrimary">@color/primary</item>
|
||||
<item name="colorPrimaryDark">@color/primary_dark</item>
|
||||
<item name="colorAccent">@color/accent</item>
|
||||
<item name="android:windowTranslucentNavigation">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.DayNight">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
|
|
|
@ -58,11 +58,11 @@
|
|||
<string name="game_over_desc_1">在下次游戏中祝您好运。</string>
|
||||
<string name="game_over_desc_2">您在%1$d秒内完成了%2$d/%3$d。</string>
|
||||
<string name="game_over_desc_3">您几乎做到了!</string>
|
||||
<string name="game_over_desc_4">你在 %1$d 秒内完成了雷场.</string>
|
||||
<string name="share_body_text">我在 %1$d秒内完成了%2$d / %3$d。</string>
|
||||
<string name="game_over_desc_4">你在%1$d秒内完成了雷场.</string>
|
||||
<string name="share_body_text">我在%1$d秒内完成了%2$d/%3$d。</string>
|
||||
<string name="share_body_text_generic">我正在播放 %1$s</string>
|
||||
<string name="fail_to_share">分享游戏失败</string>
|
||||
<string name="version_s">%1$s - %2$s</string>
|
||||
<string name="version_s">版本%1$s</string>
|
||||
<string name="sound_effects">声音特效</string>
|
||||
<string name="quit">退出</string>
|
||||
<string name="are_you_sure">确定吗?</string>
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<color name="black">#000000</color>
|
||||
<color name="white">#FFFFFF</color>
|
||||
|
||||
<color name="primary">#212121</color>
|
||||
<color name="primary_dark">#212121</color>
|
||||
<color name="primary">#FFFFFF</color>
|
||||
<color name="primary_dark">#9E9E9E</color>
|
||||
|
||||
<color name="mines_around_1">#527F8D</color>
|
||||
<color name="mines_around_2">#2B8D43</color>
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<string name="share_body_text">I did %1$d/%2$d in %3$d seconds.</string>
|
||||
<string name="share_body_text_generic">I\'m playing %1$s</string>
|
||||
<string name="fail_to_share">Failed to share game</string>
|
||||
<string name="version_s">%1$s - %2$s</string>
|
||||
<string name="version_s">Version %1$s</string>
|
||||
<string name="sound_effects">Sound Effects</string>
|
||||
<string name="quit">Quit</string>
|
||||
<string name="are_you_sure">Are you sure?</string>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<item name="colorAccent">@color/accent</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.DayNight">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
|
Loading…
Reference in a new issue