moved the database button to hidden settings
This commit is contained in:
@ -7,8 +7,8 @@ import android.view.View
|
|||||||
import android.widget.*
|
import android.widget.*
|
||||||
import com.dano.test1.data.ExcelExportService
|
import com.dano.test1.data.ExcelExportService
|
||||||
import com.dano.test1.utils.ViewUtils
|
import com.dano.test1.utils.ViewUtils
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.dano.test1.LanguageManager
|
import com.dano.test1.LanguageManager
|
||||||
import com.dano.test1.MainActivity
|
|
||||||
import com.dano.test1.MyApp
|
import com.dano.test1.MyApp
|
||||||
import com.dano.test1.R
|
import com.dano.test1.R
|
||||||
import com.dano.test1.data.Client
|
import com.dano.test1.data.Client
|
||||||
@ -19,7 +19,7 @@ import kotlinx.coroutines.*
|
|||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
|
|
||||||
class DatabaseButtonHandler(
|
class DatabaseButtonHandler(
|
||||||
private val activity: MainActivity,
|
private val activity: AppCompatActivity,
|
||||||
private val databaseButton: Button,
|
private val databaseButton: Button,
|
||||||
private val onClose: () -> Unit,
|
private val onClose: () -> Unit,
|
||||||
private val languageIDProvider: () -> String = { "GERMAN" }
|
private val languageIDProvider: () -> String = { "GERMAN" }
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.dano.test1.ui
|
package com.dano.test1.ui
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.widget.Button
|
||||||
import android.widget.RadioButton
|
import android.widget.RadioButton
|
||||||
import android.widget.RadioGroup
|
import android.widget.RadioGroup
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
@ -43,6 +44,13 @@ class DevSettingsActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
AbTestSettingsStore.setVariant(this, variant)
|
AbTestSettingsStore.setVariant(this, variant)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val databaseButton = findViewById<Button>(R.id.databaseButton)
|
||||||
|
DatabaseButtonHandler(
|
||||||
|
activity = this,
|
||||||
|
databaseButton = databaseButton,
|
||||||
|
onClose = { recreate() }
|
||||||
|
).setup()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun applyPrefsToUi() {
|
private fun applyPrefsToUi() {
|
||||||
|
|||||||
@ -45,7 +45,6 @@ class HandlerOpeningScreen(private val activity: MainActivity) {
|
|||||||
private lateinit var editButton: Button
|
private lateinit var editButton: Button
|
||||||
private lateinit var uploadButton: Button
|
private lateinit var uploadButton: Button
|
||||||
private lateinit var downloadButton: Button
|
private lateinit var downloadButton: Button
|
||||||
private lateinit var databaseButton: Button
|
|
||||||
private lateinit var statusSession: TextView
|
private lateinit var statusSession: TextView
|
||||||
private lateinit var statusOnline: TextView
|
private lateinit var statusOnline: TextView
|
||||||
private val SESSION_WARN_AFTER_MS = 12 * 60 * 60 * 1000L // 12h
|
private val SESSION_WARN_AFTER_MS = 12 * 60 * 60 * 1000L // 12h
|
||||||
@ -97,7 +96,6 @@ class HandlerOpeningScreen(private val activity: MainActivity) {
|
|||||||
setupEditButtonHandler()
|
setupEditButtonHandler()
|
||||||
setupUploadButton()
|
setupUploadButton()
|
||||||
setupDownloadButton()
|
setupDownloadButton()
|
||||||
setupDatabaseButtonHandler()
|
|
||||||
|
|
||||||
uiHandler.removeCallbacks(statusTicker)
|
uiHandler.removeCallbacks(statusTicker)
|
||||||
updateStatusStrip()
|
updateStatusStrip()
|
||||||
@ -129,7 +127,6 @@ class HandlerOpeningScreen(private val activity: MainActivity) {
|
|||||||
downloadButton = activity.findViewById(R.id.downloadButton)
|
downloadButton = activity.findViewById(R.id.downloadButton)
|
||||||
downloadButton.visibility = View.GONE
|
downloadButton.visibility = View.GONE
|
||||||
|
|
||||||
databaseButton = activity.findViewById(R.id.databaseButton)
|
|
||||||
statusSession = activity.findViewById(R.id.statusSession)
|
statusSession = activity.findViewById(R.id.statusSession)
|
||||||
statusOnline = activity.findViewById(R.id.statusOnline)
|
statusOnline = activity.findViewById(R.id.statusOnline)
|
||||||
val tag = editText.tag as? String ?: ""
|
val tag = editText.tag as? String ?: ""
|
||||||
@ -390,7 +387,6 @@ class HandlerOpeningScreen(private val activity: MainActivity) {
|
|||||||
editButton.text = t("edit")
|
editButton.text = t("edit")
|
||||||
uploadButton.text = t("upload")
|
uploadButton.text = t("upload")
|
||||||
downloadButton.text = t("download")
|
downloadButton.text = t("download")
|
||||||
databaseButton.text = t("database")
|
|
||||||
val hintTag = editText.tag as? String ?: ""
|
val hintTag = editText.tag as? String ?: ""
|
||||||
editText.hint = t(hintTag)
|
editText.hint = t(hintTag)
|
||||||
val coachTag = coachEditText.tag as? String ?: ""
|
val coachTag = coachEditText.tag as? String ?: ""
|
||||||
@ -533,17 +529,8 @@ class HandlerOpeningScreen(private val activity: MainActivity) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupDatabaseButtonHandler() {
|
|
||||||
DatabaseButtonHandler(
|
|
||||||
activity = activity,
|
|
||||||
databaseButton = databaseButton,
|
|
||||||
onClose = { init() },
|
|
||||||
languageIDProvider = { languageID }
|
|
||||||
).setup()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateMainButtonsState(isDatabaseAvailable: Boolean) {
|
private fun updateMainButtonsState(isDatabaseAvailable: Boolean) {
|
||||||
listOf(buttonLoad, saveButton, editButton, databaseButton).forEach { b ->
|
listOf(buttonLoad, saveButton, editButton).forEach { b ->
|
||||||
b.isEnabled = isDatabaseAvailable
|
b.isEnabled = isDatabaseAvailable
|
||||||
b.alpha = if (isDatabaseAvailable) 1.0f else 0.5f
|
b.alpha = if (isDatabaseAvailable) 1.0f else 0.5f
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,6 +70,27 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Variant B" />
|
android:text="Variant B" />
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:background="#DDDDDD" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:text="Database"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/databaseButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Datenbank" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@ -253,19 +253,6 @@
|
|||||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/pill_height"
|
android:layout_height="@dimen/pill_height"
|
||||||
android:layout_marginBottom="12dp"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:textColor="@color/brand_purple"
|
|
||||||
app:cornerRadius="@dimen/pill_radius"
|
|
||||||
app:strokeColor="@color/brand_purple"
|
|
||||||
app:strokeWidth="@dimen/pill_stroke"
|
|
||||||
app:backgroundTint="@android:color/transparent"/>
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/databaseButton"
|
|
||||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/pill_height"
|
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textColor="@color/brand_purple"
|
android:textColor="@color/brand_purple"
|
||||||
app:cornerRadius="@dimen/pill_radius"
|
app:cornerRadius="@dimen/pill_radius"
|
||||||
|
|||||||
Reference in New Issue
Block a user