diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index da15edc6..6a1bfc4d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -122,12 +122,12 @@
+ 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"
}
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/TextActivity.kt b/app/src/main/java/dev/lucasnlm/antimine/about/TextActivity.kt
index 11bf0a7e..6b2005ef 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/about/TextActivity.kt
+++ b/app/src/main/java/dev/lucasnlm/antimine/about/TextActivity.kt
@@ -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"
- }
}
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/models/AboutEvent.kt b/app/src/main/java/dev/lucasnlm/antimine/about/models/AboutEvent.kt
new file mode 100644
index 00000000..5a5c5a93
--- /dev/null
+++ b/app/src/main/java/dev/lucasnlm/antimine/about/models/AboutEvent.kt
@@ -0,0 +1,7 @@
+package dev.lucasnlm.antimine.about.models
+
+enum class AboutEvent {
+ ThirdPartyLicenses,
+ SourceCode,
+ Translators
+}
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/thirds/data/ThirdParty.kt b/app/src/main/java/dev/lucasnlm/antimine/about/models/ThirdParty.kt
similarity index 52%
rename from app/src/main/java/dev/lucasnlm/antimine/about/thirds/data/ThirdParty.kt
rename to app/src/main/java/dev/lucasnlm/antimine/about/models/ThirdParty.kt
index 9cd03818..b056afec 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/about/thirds/data/ThirdParty.kt
+++ b/app/src/main/java/dev/lucasnlm/antimine/about/models/ThirdParty.kt
@@ -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
)
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/translators/model/TranslationInfo.kt b/app/src/main/java/dev/lucasnlm/antimine/about/models/TranslationInfo.kt
similarity index 63%
rename from app/src/main/java/dev/lucasnlm/antimine/about/translators/model/TranslationInfo.kt
rename to app/src/main/java/dev/lucasnlm/antimine/about/models/TranslationInfo.kt
index 49c03a34..d15a6620 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/about/translators/model/TranslationInfo.kt
+++ b/app/src/main/java/dev/lucasnlm/antimine/about/models/TranslationInfo.kt
@@ -1,4 +1,4 @@
-package dev.lucasnlm.antimine.about.translators.model
+package dev.lucasnlm.antimine.about.models
data class TranslationInfo(
val language: String,
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/thirds/ThirdPartiesActivity.kt b/app/src/main/java/dev/lucasnlm/antimine/about/thirds/ThirdPartiesActivity.kt
deleted file mode 100644
index e58b0639..00000000
--- a/app/src/main/java/dev/lucasnlm/antimine/about/thirds/ThirdPartiesActivity.kt
+++ /dev/null
@@ -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)
- }
- }
-}
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/translators/TranslatorsActivity.kt b/app/src/main/java/dev/lucasnlm/antimine/about/translators/TranslatorsActivity.kt
deleted file mode 100644
index 5cd7fa04..00000000
--- a/app/src/main/java/dev/lucasnlm/antimine/about/translators/TranslatorsActivity.kt
+++ /dev/null
@@ -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)
- }
- }
-}
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/viewmodel/AboutViewModel.kt b/app/src/main/java/dev/lucasnlm/antimine/about/viewmodel/AboutViewModel.kt
new file mode 100644
index 00000000..9fa0a995
--- /dev/null
+++ b/app/src/main/java/dev/lucasnlm/antimine/about/viewmodel/AboutViewModel.kt
@@ -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()
+
+ 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
+ )
+ )
+ )
+}
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/views/AboutInfoFragment.kt b/app/src/main/java/dev/lucasnlm/antimine/about/views/AboutInfoFragment.kt
new file mode 100644
index 00000000..643f3640
--- /dev/null
+++ b/app/src/main/java/dev/lucasnlm/antimine/about/views/AboutInfoFragment.kt
@@ -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)
+ }
+ }
+}
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/views/thirds/ThirdPartiesFragment.kt b/app/src/main/java/dev/lucasnlm/antimine/about/views/thirds/ThirdPartiesFragment.kt
new file mode 100644
index 00000000..43179583
--- /dev/null
+++ b/app/src/main/java/dev/lucasnlm/antimine/about/views/thirds/ThirdPartiesFragment.kt
@@ -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()
+ }
+}
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/thirds/view/ThirdPartyAdapter.kt b/app/src/main/java/dev/lucasnlm/antimine/about/views/thirds/ThirdPartyAdapter.kt
similarity index 61%
rename from app/src/main/java/dev/lucasnlm/antimine/about/thirds/view/ThirdPartyAdapter.kt
rename to app/src/main/java/dev/lucasnlm/antimine/about/views/thirds/ThirdPartyAdapter.kt
index d044fff2..5a04a52a 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/about/thirds/view/ThirdPartyAdapter.kt
+++ b/app/src/main/java/dev/lucasnlm/antimine/about/views/thirds/ThirdPartyAdapter.kt
@@ -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
) : RecyclerView.Adapter() {
@@ -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)
+ }
}
}
}
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/thirds/view/ThirdPartyViewHolder.kt b/app/src/main/java/dev/lucasnlm/antimine/about/views/thirds/ThirdPartyViewHolder.kt
similarity index 60%
rename from app/src/main/java/dev/lucasnlm/antimine/about/thirds/view/ThirdPartyViewHolder.kt
rename to app/src/main/java/dev/lucasnlm/antimine/about/views/thirds/ThirdPartyViewHolder.kt
index 91d36de2..f29fc7d2 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/about/thirds/view/ThirdPartyViewHolder.kt
+++ b/app/src/main/java/dev/lucasnlm/antimine/about/views/thirds/ThirdPartyViewHolder.kt
@@ -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)
}
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/translators/view/TranslatorsAdapter.kt b/app/src/main/java/dev/lucasnlm/antimine/about/views/translators/TranslatorsAdapter.kt
similarity index 84%
rename from app/src/main/java/dev/lucasnlm/antimine/about/translators/view/TranslatorsAdapter.kt
rename to app/src/main/java/dev/lucasnlm/antimine/about/views/translators/TranslatorsAdapter.kt
index 8a7090c8..d83ba424 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/about/translators/view/TranslatorsAdapter.kt
+++ b/app/src/main/java/dev/lucasnlm/antimine/about/views/translators/TranslatorsAdapter.kt
@@ -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
) : RecyclerView.Adapter() {
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/views/translators/TranslatorsFragment.kt b/app/src/main/java/dev/lucasnlm/antimine/about/views/translators/TranslatorsFragment.kt
new file mode 100644
index 00000000..c4d161d8
--- /dev/null
+++ b/app/src/main/java/dev/lucasnlm/antimine/about/views/translators/TranslatorsFragment.kt
@@ -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()
+ }
+}
diff --git a/app/src/main/java/dev/lucasnlm/antimine/about/translators/view/TranslatorsViewHolder.kt b/app/src/main/java/dev/lucasnlm/antimine/about/views/translators/TranslatorsViewHolder.kt
similarity index 66%
rename from app/src/main/java/dev/lucasnlm/antimine/about/translators/view/TranslatorsViewHolder.kt
rename to app/src/main/java/dev/lucasnlm/antimine/about/views/translators/TranslatorsViewHolder.kt
index 096fc964..3c76076d 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/about/translators/view/TranslatorsViewHolder.kt
+++ b/app/src/main/java/dev/lucasnlm/antimine/about/views/translators/TranslatorsViewHolder.kt
@@ -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)
}
diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml
index a3e46369..cca75460 100644
--- a/app/src/main/res/layout/activity_about.xml
+++ b/app/src/main/res/layout/activity_about.xml
@@ -1,79 +1,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ tools:context="dev.lucasnlm.antimine.about.AboutActivity"
+ android:fitsSystemWindows="true" />
diff --git a/app/src/main/res/layout/activity_text.xml b/app/src/main/res/layout/activity_text.xml
index fc15d49c..b3d52d19 100644
--- a/app/src/main/res/layout/activity_text.xml
+++ b/app/src/main/res/layout/activity_text.xml
@@ -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">
+
diff --git a/app/src/main/res/layout/activity_translators.xml b/app/src/main/res/layout/activity_translators.xml
index 0087b63d..81e49c39 100644
--- a/app/src/main/res/layout/activity_translators.xml
+++ b/app/src/main/res/layout/activity_translators.xml
@@ -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">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_third_party.xml b/app/src/main/res/layout/fragment_third_party.xml
similarity index 90%
rename from app/src/main/res/layout/activity_third_party.xml
rename to app/src/main/res/layout/fragment_third_party.xml
index 72702b11..27ea35e2 100644
--- a/app/src/main/res/layout/activity_third_party.xml
+++ b/app/src/main/res/layout/fragment_third_party.xml
@@ -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">
diff --git a/common/src/main/res/layout/fragment_level.xml b/common/src/main/res/layout/fragment_level.xml
index df391cfc..68d66f25 100644
--- a/common/src/main/res/layout/fragment_level.xml
+++ b/common/src/main/res/layout/fragment_level.xml
@@ -2,7 +2,6 @@
diff --git a/common/src/main/res/values-es/strings.xml b/common/src/main/res/values-es/strings.xml
index e584ed8e..32d639f6 100644
--- a/common/src/main/res/values-es/strings.xml
+++ b/common/src/main/res/values-es/strings.xml
@@ -62,7 +62,7 @@
Hice %1$d/%2$d en %3$d segundos.
Estoy jugando %1$s
No se pudo compartir el juego
- %1$s - %2$s
+ Versión %2$s
Efectos de Sonido
Dejar
¿Estás seguro?
diff --git a/common/src/main/res/values-pt/strings.xml b/common/src/main/res/values-pt/strings.xml
index 95574786..066bfcc3 100644
--- a/common/src/main/res/values-pt/strings.xml
+++ b/common/src/main/res/values-pt/strings.xml
@@ -62,7 +62,7 @@
Eu fiz %1$d/%2$d em %3$d segundos.
Estou jogando %1$s
Falha ao compartilhar jogo
- %1$s - %2$s
+ Versão %1$s
Efeitos Sonoros
Sair
Você tem certeza?
diff --git a/common/src/main/res/values-v21/themes.xml b/common/src/main/res/values-v21/themes.xml
index b4443c1c..ab83d501 100644
--- a/common/src/main/res/values-v21/themes.xml
+++ b/common/src/main/res/values-v21/themes.xml
@@ -1,5 +1,12 @@
+
+
-