Various bug fixes and code cleanup.

This commit is contained in:
NerdNumber9 2017-01-04 23:34:47 -05:00
parent f5c4535cb0
commit 8fb4093dc6
2 changed files with 9 additions and 4 deletions

View File

@ -232,4 +232,4 @@ repositories {
} }
//Firebase (EH) //Firebase (EH)
//apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'

View File

@ -26,7 +26,7 @@ class BatchAddFragment : BaseFragment() {
= inflater.inflate(R.layout.eh_fragment_batch_add, container, false)!! = inflater.inflate(R.layout.eh_fragment_batch_add, container, false)!!
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
setToolbarTitle("Batch Add") setToolbarTitle("Batch add")
setup() setup()
} }
@ -35,8 +35,10 @@ class BatchAddFragment : BaseFragment() {
btn_add_galleries.setOnClickListener { btn_add_galleries.setOnClickListener {
val galleries = galleries_box.text.toString() val galleries = galleries_box.text.toString()
//Check text box has content //Check text box has content
if(galleries.isNullOrBlank()) if(galleries.isNullOrBlank()) {
noGalleriesSpecified() noGalleriesSpecified()
return@setOnClickListener
}
//Too lazy to actually deal with orientation changes //Too lazy to actually deal with orientation changes
activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR
@ -71,12 +73,15 @@ class BatchAddFragment : BaseFragment() {
} }
//Show report //Show report
val succeededCount = succeeded.size
val failedCount = failed.size
if(succeeded.isEmpty()) succeeded += "None" if(succeeded.isEmpty()) succeeded += "None"
if(failed.isEmpty()) failed += "None" if(failed.isEmpty()) failed += "None"
val succeededReport = succeeded.joinToString(separator = "\n", prefix = "Added:\n") val succeededReport = succeeded.joinToString(separator = "\n", prefix = "Added:\n")
val failedReport = failed.joinToString(separator = "\n", prefix = "Failed:\n") val failedReport = failed.joinToString(separator = "\n", prefix = "Failed:\n")
val summary = "Summary:\nAdded: ${succeeded.size} gallerie(s)\nFailed: ${failed.size} gallerie(s)" val summary = "Summary:\nAdded: $succeededCount gallerie(s)\nFailed: $failedCount gallerie(s)"
val report = listOf(succeededReport, failedReport, summary).joinToString(separator = "\n\n") val report = listOf(succeededReport, failedReport, summary).joinToString(separator = "\n\n")