started adding header
This commit is contained in:
106
app/src/main/assets/header_order.json
Normal file
106
app/src/main/assets/header_order.json
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
[
|
||||||
|
"client_code",
|
||||||
|
"questionnaire_1_demographic_information",
|
||||||
|
"questionnaire_1_demographic_information-coach_code",
|
||||||
|
"questionnaire_1_demographic_information-consent_instruction",
|
||||||
|
"questionnaire_1_demographic_information-no_consent_entered",
|
||||||
|
"questionnaire_1_demographic_information-accommodation",
|
||||||
|
"questionnaire_1_demographic_information-other_accommodation",
|
||||||
|
"questionnaire_1_demographic_information-client_code_entry_question",
|
||||||
|
"questionnaire_1_demographic_information-age",
|
||||||
|
"questionnaire_1_demographic_information-gender",
|
||||||
|
"questionnaire_1_demographic_information-country_of_origin",
|
||||||
|
"questionnaire_1_demographic_information-departure_country",
|
||||||
|
"questionnaire_1_demographic_information-since_in_germany",
|
||||||
|
"questionnaire_1_demographic_information-living_situation",
|
||||||
|
"questionnaire_1_demographic_information-number_family_members",
|
||||||
|
"questionnaire_1_demographic_information-languages_spoken",
|
||||||
|
"questionnaire_1_demographic_information-german_skills",
|
||||||
|
"questionnaire_1_demographic_information-school_years_total",
|
||||||
|
"questionnaire_1_demographic_information-school_years_origin",
|
||||||
|
"questionnaire_1_demographic_information-school_years_transit",
|
||||||
|
"questionnaire_1_demographic_information-school_years_germany",
|
||||||
|
"questionnaire_1_demographic_information-vocational_training",
|
||||||
|
"questionnaire_1_demographic_information-provisional_accommodation_since",
|
||||||
|
"questionnaire_2_rhs",
|
||||||
|
"questionnaire_2_rhs-coach_code",
|
||||||
|
"questionnaire_2_rhs-glass_explanation",
|
||||||
|
"questionnaire_2_rhs-q1_symptom",
|
||||||
|
"questionnaire_2_rhs-q2_symptom",
|
||||||
|
"questionnaire_2_rhs-q3_symptom",
|
||||||
|
"questionnaire_2_rhs-q4_symptom",
|
||||||
|
"questionnaire_2_rhs-q5_symptom",
|
||||||
|
"questionnaire_2_rhs-q6_symptom",
|
||||||
|
"questionnaire_2_rhs-q7_symptom",
|
||||||
|
"questionnaire_2_rhs-q8_symptom",
|
||||||
|
"questionnaire_2_rhs-q9_symptom",
|
||||||
|
"questionnaire_2_rhs-q10_reexperience_trauma",
|
||||||
|
"questionnaire_2_rhs-q11_physical_reaction",
|
||||||
|
"questionnaire_2_rhs-q12_emotional_numbness",
|
||||||
|
"questionnaire_2_rhs-q13_easily_startled",
|
||||||
|
"questionnaire_2_rhs-q14_intro",
|
||||||
|
"questionnaire_2_rhs-pain_rating_instruction",
|
||||||
|
"questionnaire_2_rhs-violence_question_1",
|
||||||
|
"questionnaire_2_rhs-times_happend",
|
||||||
|
"questionnaire_2_rhs-age_at_incident",
|
||||||
|
"questionnaire_2_rhs-conflict_since_arrival",
|
||||||
|
"questionnaire_2_rhs-times_happend2",
|
||||||
|
"questionnaire_2_rhs-age_at_incident2",
|
||||||
|
"questionnaire_2_rhs-asylum_procedure_since",
|
||||||
|
"questionnaire_3_integration_index",
|
||||||
|
"questionnaire_3_integration_index-coach_code",
|
||||||
|
"questionnaire_3_integration_index-feeling_connected_to_germany_question",
|
||||||
|
"questionnaire_3_integration_index-understanding_political_issues",
|
||||||
|
"questionnaire_3_integration_index-unexpected_expense_question",
|
||||||
|
"questionnaire_3_integration_index-dining_with_germans_question",
|
||||||
|
"questionnaire_3_integration_index-reading_german_articles_question",
|
||||||
|
"questionnaire_3_integration_index-visiting_doctor_question",
|
||||||
|
"questionnaire_3_integration_index-feeling_as_outsider_question",
|
||||||
|
"questionnaire_3_integration_index-recent_occupation_question",
|
||||||
|
"questionnaire_3_integration_index-discussing_politics_question",
|
||||||
|
"questionnaire_3_integration_index-contact_with_germans_question",
|
||||||
|
"questionnaire_3_integration_index-speaking_german_opinion_question",
|
||||||
|
"questionnaire_3_integration_index-job_search_question",
|
||||||
|
"questionnaire_4_consultation_results",
|
||||||
|
"questionnaire_4_consultation_results-coach_code",
|
||||||
|
"questionnaire_4_consultation_results-date_consultation_health_interview_result",
|
||||||
|
"questionnaire_4_consultation_results-consultation_decision",
|
||||||
|
"questionnaire_4_consultation_results-consent_conversation_in_6_months",
|
||||||
|
"questionnaire_4_consultation_results-participation_in_coaching",
|
||||||
|
"questionnaire_4_consultation_results-consent_coaching_given",
|
||||||
|
"questionnaire_4_consultation_results-consent_conversation_in_6_months",
|
||||||
|
"questionnaire_4_consultation_results-decision_after_reflection_period",
|
||||||
|
"questionnaire_4_consultation_results-professional_referral",
|
||||||
|
"questionnaire_4_consultation_results-confidentiality_agreement",
|
||||||
|
"questionnaire_4_consultation_results-health_insurance_card",
|
||||||
|
"questionnaire_4_consultation_results-consent_conversation_in_6_months",
|
||||||
|
"questionnaire_5_final_interview",
|
||||||
|
"questionnaire_5_final_interview-coach_code",
|
||||||
|
"questionnaire_5_final_interview-consent_followup_6_months",
|
||||||
|
"questionnaire_5_final_interview-date_final_interview",
|
||||||
|
"questionnaire_5_final_interview-amount_nat_appointments",
|
||||||
|
"questionnaire_5_final_interview-amount_session_flowers",
|
||||||
|
"questionnaire_5_final_interview-amount_session_stones",
|
||||||
|
"questionnaire_5_final_interview-termination_nat_coaching",
|
||||||
|
"questionnaire_5_final_interview-client_canceled_NAT",
|
||||||
|
"questionnaire_6_follow_up_survey",
|
||||||
|
"questionnaire_6_follow_up_survey-coach_code",
|
||||||
|
"questionnaire_6_follow_up_survey-follow_up",
|
||||||
|
"questionnaire_6_follow_up_survey-special_burden_question",
|
||||||
|
"questionnaire_6_follow_up_survey-glass_explanation",
|
||||||
|
"questionnaire_6_follow_up_survey-how_strong_past_month",
|
||||||
|
"questionnaire_6_follow_up_survey-q14_intro",
|
||||||
|
"questionnaire_6_follow_up_survey-pain_rating_instruction",
|
||||||
|
"questionnaire_6_follow_up_survey-feeling_connected_to_germany_question",
|
||||||
|
"questionnaire_6_follow_up_survey-understanding_political_issues",
|
||||||
|
"questionnaire_6_follow_up_survey-unexpected_expense_question",
|
||||||
|
"questionnaire_6_follow_up_survey-dining_with_germans_question",
|
||||||
|
"questionnaire_6_follow_up_survey-reading_german_articles_question",
|
||||||
|
"questionnaire_6_follow_up_survey-visiting_doctor_question",
|
||||||
|
"questionnaire_6_follow_up_survey-feeling_as_outsider_question",
|
||||||
|
"questionnaire_6_follow_up_survey-recent_occupation_question",
|
||||||
|
"questionnaire_6_follow_up_survey-discussing_politics_question",
|
||||||
|
"questionnaire_6_follow_up_survey-contact_with_germans_question",
|
||||||
|
"questionnaire_6_follow_up_survey-speaking_german_opinion_question",
|
||||||
|
"questionnaire_6_follow_up_survey-job_search_question"
|
||||||
|
]
|
||||||
@ -107,7 +107,7 @@
|
|||||||
{
|
{
|
||||||
"id": "q11",
|
"id": "q11",
|
||||||
"layout": "radio_question",
|
"layout": "radio_question",
|
||||||
"question": "times_happend",
|
"question": "times_happend2",
|
||||||
"options": [
|
"options": [
|
||||||
{ "key": "once" },
|
{ "key": "once" },
|
||||||
{ "key": "multiple_times" }
|
{ "key": "multiple_times" }
|
||||||
@ -116,7 +116,7 @@
|
|||||||
{
|
{
|
||||||
"id": "q12",
|
"id": "q12",
|
||||||
"layout": "value_spinner",
|
"layout": "value_spinner",
|
||||||
"question": "age_at_incident",
|
"question": "age_at_incident2",
|
||||||
"range": {
|
"range": {
|
||||||
"min": 1,
|
"min": 1,
|
||||||
"max": 122
|
"max": 122
|
||||||
|
|||||||
@ -4,12 +4,12 @@ import android.util.Log
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.*
|
import android.widget.*
|
||||||
import com.dano.test1.data.Client
|
import com.dano.test1.data.Client
|
||||||
import com.dano.test1.data.CompletedQuestionnaire
|
|
||||||
import com.dano.test1.data.Question
|
import com.dano.test1.data.Question
|
||||||
import com.dano.test1.data.Questionnaire
|
import com.dano.test1.data.Questionnaire
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
import org.json.JSONArray
|
||||||
|
import java.nio.charset.Charset
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
import com.dano.test1.R
|
|
||||||
|
|
||||||
class DatabaseButtonHandler(
|
class DatabaseButtonHandler(
|
||||||
private val activity: MainActivity,
|
private val activity: MainActivity,
|
||||||
@ -19,6 +19,9 @@ class DatabaseButtonHandler(
|
|||||||
private val uiScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
|
private val uiScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
|
||||||
private val tag = "DatabaseButtonHandler"
|
private val tag = "DatabaseButtonHandler"
|
||||||
|
|
||||||
|
// Cache für geladene IDs aus assets/header_order.json
|
||||||
|
private var orderedIdsCache: List<String>? = null
|
||||||
|
|
||||||
fun setup() {
|
fun setup() {
|
||||||
databaseButton.text = "Datenbank"
|
databaseButton.text = "Datenbank"
|
||||||
databaseButton.setOnClickListener { openDatabaseScreen() }
|
databaseButton.setOnClickListener { openDatabaseScreen() }
|
||||||
@ -66,65 +69,124 @@ class DatabaseButtonHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------
|
// ---------------------------
|
||||||
// SCREEN 2: Fragebogen-Übersicht für einen Client
|
// SCREEN 2: Fragebogen-Übersicht + "header"-Liste für einen Client
|
||||||
// ---------------------------
|
// ---------------------------
|
||||||
private fun openClientOverviewScreen(clientCode: String) {
|
private fun openClientOverviewScreen(clientCode: String) {
|
||||||
activity.setContentView(R.layout.client_overview_screen)
|
activity.setContentView(R.layout.client_overview_screen)
|
||||||
|
|
||||||
val title: TextView = requireView(R.id.titleClientOverview, "titleClientOverview")
|
val title: TextView = requireView(R.id.titleClientOverview, "titleClientOverview")
|
||||||
val table: TableLayout = requireView(R.id.tableQuestionnaires, "tableQuestionnaires")
|
val tableQ: TableLayout = requireView(R.id.tableQuestionnaires, "tableQuestionnaires")
|
||||||
val progress: ProgressBar = requireView(R.id.progressBarClient, "progressBarClient")
|
val progress: ProgressBar = requireView(R.id.progressBarClient, "progressBarClient")
|
||||||
val emptyView: TextView = requireView(R.id.emptyViewClient, "emptyViewClient")
|
val emptyView: TextView = requireView(R.id.emptyViewClient, "emptyViewClient")
|
||||||
val backButton: Button = requireView(R.id.backButtonClient, "backButtonClient")
|
val backButton: Button = requireView(R.id.backButtonClient, "backButtonClient")
|
||||||
|
|
||||||
|
// "header" Sektion
|
||||||
|
val headerLabel: TextView = requireView(R.id.headerLabel, "headerLabel")
|
||||||
|
val tableOrdered: TableLayout = requireView(R.id.tableOrdered, "tableOrdered")
|
||||||
|
|
||||||
title.text = "Client: $clientCode – Fragebögen"
|
title.text = "Client: $clientCode – Fragebögen"
|
||||||
|
headerLabel.text = "header"
|
||||||
backButton.setOnClickListener { openDatabaseScreen() }
|
backButton.setOnClickListener { openDatabaseScreen() }
|
||||||
|
|
||||||
progress.visibility = View.VISIBLE
|
progress.visibility = View.VISIBLE
|
||||||
emptyView.visibility = View.GONE
|
emptyView.visibility = View.GONE
|
||||||
table.removeAllViews()
|
tableQ.removeAllViews()
|
||||||
|
tableOrdered.removeAllViews()
|
||||||
|
|
||||||
addHeaderRow(table, listOf("#", "Fragebogen-ID", "Status"))
|
addHeaderRow(tableQ, listOf("#", "Fragebogen-ID", "Status"))
|
||||||
|
addHeaderRow(tableOrdered, listOf("#", "ID", "Wert"))
|
||||||
|
|
||||||
uiScope.launch {
|
uiScope.launch {
|
||||||
val (allQuestionnaires, completedForClient) = withContext(Dispatchers.IO) {
|
val result = withContext(Dispatchers.IO) {
|
||||||
val qs = MyApp.database.questionnaireDao().getAll()
|
val allQuestionnaires = MyApp.database.questionnaireDao().getAll()
|
||||||
val done = MyApp.database.completedQuestionnaireDao().getAllForClient(clientCode)
|
val completedForClient = MyApp.database.completedQuestionnaireDao().getAllForClient(clientCode)
|
||||||
qs to done
|
val allAnswersForClient = MyApp.database.answerDao().getAnswersForClient(clientCode)
|
||||||
|
Triple(allQuestionnaires, completedForClient, allAnswersForClient)
|
||||||
}
|
}
|
||||||
|
|
||||||
progress.visibility = View.GONE
|
progress.visibility = View.GONE
|
||||||
|
|
||||||
|
val allQuestionnaires: List<Questionnaire> = result.first
|
||||||
|
val completedForClient = result.second
|
||||||
|
val allAnswersForClient = result.third
|
||||||
|
|
||||||
if (allQuestionnaires.isEmpty()) {
|
if (allQuestionnaires.isEmpty()) {
|
||||||
emptyView.text = "Keine Fragebögen vorhanden."
|
emptyView.text = "Keine Fragebögen vorhanden."
|
||||||
emptyView.visibility = View.VISIBLE
|
emptyView.visibility = View.VISIBLE
|
||||||
return@launch
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val statusMap = completedForClient.associate { it.questionnaireId to it.isDone }
|
val statusMap = completedForClient.associate { it.questionnaireId to it.isDone }
|
||||||
|
val questionnaireIdSet = allQuestionnaires.map { it.id }.toSet()
|
||||||
|
val answerMap = allAnswersForClient.associate { it.questionId to it.answerValue }
|
||||||
|
|
||||||
allQuestionnaires.forEachIndexed { idx, q ->
|
// *** Sortierung der FRAGEBÖGEN nach questionnaire_1..., _2..., _3..., _4..., _5..., _6... ***
|
||||||
|
val sortedQuestionnaires = allQuestionnaires.sortedWith(
|
||||||
|
compareBy(
|
||||||
|
{ extractQuestionnaireNumber(it.id) ?: Int.MAX_VALUE },
|
||||||
|
{ it.id }
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
// Tabelle 1: Fragebögen (nur ✓ klickbar) – HIER KEINE Hintergrundfarben, nur Textfarbe
|
||||||
|
sortedQuestionnaires.forEachIndexed { idx, q ->
|
||||||
val isDone = statusMap[q.id] ?: false
|
val isDone = statusMap[q.id] ?: false
|
||||||
val statusText = if (isDone) "✓" else "✗"
|
val statusText = if (isDone) "✓" else "✗"
|
||||||
val statusColor = if (isDone) 0xFF4CAF50.toInt() else 0xFFF44336.toInt()
|
val statusTextColor = if (isDone) 0xFF4CAF50.toInt() else 0xFFF44336.toInt()
|
||||||
|
|
||||||
if (isDone) {
|
if (isDone) {
|
||||||
// NUR diese sind klickbar
|
|
||||||
addClickableRow(
|
addClickableRow(
|
||||||
table = table,
|
table = tableQ,
|
||||||
cells = listOf((idx + 1).toString(), q.id, statusText),
|
cells = listOf((idx + 1).toString(), q.id, statusText),
|
||||||
onClick = { openQuestionnaireDetailScreen(clientCode, q.id) },
|
onClick = { openQuestionnaireDetailScreen(clientCode, q.id) },
|
||||||
colorOverrides = mapOf(2 to statusColor)
|
colorOverrides = mapOf(2 to statusTextColor), // nur Text einfärben
|
||||||
|
cellBgOverrides = emptyMap()
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// Nicht klickbar, leicht ausgegraut
|
|
||||||
addDisabledRow(
|
addDisabledRow(
|
||||||
table = table,
|
table = tableQ,
|
||||||
cells = listOf((idx + 1).toString(), q.id, statusText),
|
cells = listOf((idx + 1).toString(), q.id, statusText),
|
||||||
colorOverrides = mapOf(2 to statusColor)
|
colorOverrides = mapOf(2 to statusTextColor), // nur Text einfärben
|
||||||
|
cellBgOverrides = emptyMap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tabelle 2: "header"-Liste in der Reihenfolge aus assets/header_order.json
|
||||||
|
// HIER: GRÜN/ROT als HINTERGRUND für Fragebögen + GELB für "None"-Zeilen
|
||||||
|
val orderedIds = loadOrderedIds()
|
||||||
|
orderedIds.forEachIndexed { idx, id ->
|
||||||
|
var rowBgColor: Int? = null
|
||||||
|
|
||||||
|
val (value, bgColorForCells) = when {
|
||||||
|
id == "client_code" -> clientCode to null
|
||||||
|
id in questionnaireIdSet -> {
|
||||||
|
if (statusMap[id] == true) {
|
||||||
|
"Done" to 0xFF4CAF50.toInt() // GRÜN als Hintergrund
|
||||||
|
} else {
|
||||||
|
"Not Done" to 0xFFF44336.toInt() // ROT als Hintergrund
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
val v = answerMap[id]
|
||||||
|
val out = if (!v.isNullOrBlank()) v else "None"
|
||||||
|
if (out == "None") {
|
||||||
|
rowBgColor = 0xFFFFF59D.toInt() // GELB ganze Zeile bei None
|
||||||
|
}
|
||||||
|
out to null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Für Fragebögen im Header: ID (Spalte 2) und Wert (Spalte 3) farbig HINTERLEGEN
|
||||||
|
val cellBg = if (bgColorForCells != null) mapOf(1 to bgColorForCells, 2 to bgColorForCells) else emptyMap()
|
||||||
|
|
||||||
|
addRow(
|
||||||
|
table = tableOrdered,
|
||||||
|
cells = listOf((idx + 1).toString(), id, value),
|
||||||
|
colorOverrides = emptyMap(), // keine Textfarben im Header
|
||||||
|
rowBgColor = rowBgColor, // GELB für "None"
|
||||||
|
cellBgOverrides = cellBg // GRÜN/ROT für Done/Not Done
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,8 +238,33 @@ class DatabaseButtonHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------
|
// ---------------------------
|
||||||
// UI-Helfer
|
// assets/header_order.json laden (mit Cache)
|
||||||
// ---------------------------
|
// ---------------------------
|
||||||
|
private fun loadOrderedIds(): List<String> {
|
||||||
|
orderedIdsCache?.let { return it }
|
||||||
|
return try {
|
||||||
|
val stream = activity.assets.open("header_order.json")
|
||||||
|
val json = stream.readBytes().toString(Charset.forName("UTF-8"))
|
||||||
|
val arr = JSONArray(json)
|
||||||
|
val list = MutableList(arr.length()) { i -> arr.getString(i) }
|
||||||
|
orderedIdsCache = list
|
||||||
|
list
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(tag, "header_order.json konnte nicht geladen werden: ${e.message}")
|
||||||
|
Toast.makeText(activity, "header_order.json fehlt oder ist ungültig", Toast.LENGTH_LONG).show()
|
||||||
|
emptyList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------
|
||||||
|
// Hilfsfunktionen
|
||||||
|
// ---------------------------
|
||||||
|
private fun extractQuestionnaireNumber(id: String): Int? {
|
||||||
|
// Erwartet Präfix "questionnaire_<zahl>"
|
||||||
|
val m = Regex("^questionnaire_(\\d+)").find(id.lowercase())
|
||||||
|
return m?.groupValues?.get(1)?.toIntOrNull()
|
||||||
|
}
|
||||||
|
|
||||||
private fun addHeaderRow(table: TableLayout, labels: List<String>) {
|
private fun addHeaderRow(table: TableLayout, labels: List<String>) {
|
||||||
val row = TableRow(activity)
|
val row = TableRow(activity)
|
||||||
labels.forEach { label -> row.addView(makeHeaderCell(label)) }
|
labels.forEach { label -> row.addView(makeHeaderCell(label)) }
|
||||||
@ -188,11 +275,16 @@ class DatabaseButtonHandler(
|
|||||||
private fun addRow(
|
private fun addRow(
|
||||||
table: TableLayout,
|
table: TableLayout,
|
||||||
cells: List<String>,
|
cells: List<String>,
|
||||||
colorOverrides: Map<Int, Int> = emptyMap()
|
colorOverrides: Map<Int, Int> = emptyMap(), // optional: Textfarben je Spalte
|
||||||
|
rowBgColor: Int? = null, // optional: ganze Zeile hinterlegen
|
||||||
|
cellBgOverrides: Map<Int, Int> = emptyMap() // optional: einzelne Zellen hinterlegen
|
||||||
) {
|
) {
|
||||||
val row = TableRow(activity)
|
val row = TableRow(activity)
|
||||||
|
rowBgColor?.let { row.setBackgroundColor(it) }
|
||||||
|
|
||||||
cells.forEachIndexed { index, text ->
|
cells.forEachIndexed { index, text ->
|
||||||
row.addView(makeBodyCell(text, colorOverrides[index]))
|
val tv = makeBodyCell(text, colorOverrides[index], cellBgOverrides[index])
|
||||||
|
row.addView(tv)
|
||||||
}
|
}
|
||||||
table.addView(row)
|
table.addView(row)
|
||||||
addDivider(table)
|
addDivider(table)
|
||||||
@ -202,7 +294,8 @@ class DatabaseButtonHandler(
|
|||||||
table: TableLayout,
|
table: TableLayout,
|
||||||
cells: List<String>,
|
cells: List<String>,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
colorOverrides: Map<Int, Int> = emptyMap()
|
colorOverrides: Map<Int, Int> = emptyMap(),
|
||||||
|
cellBgOverrides: Map<Int, Int> = emptyMap()
|
||||||
) {
|
) {
|
||||||
val row = TableRow(activity).apply {
|
val row = TableRow(activity).apply {
|
||||||
isClickable = true
|
isClickable = true
|
||||||
@ -211,7 +304,8 @@ class DatabaseButtonHandler(
|
|||||||
setOnClickListener { onClick() }
|
setOnClickListener { onClick() }
|
||||||
}
|
}
|
||||||
cells.forEachIndexed { index, text ->
|
cells.forEachIndexed { index, text ->
|
||||||
row.addView(makeBodyCell(text, colorOverrides[index]))
|
val tv = makeBodyCell(text, colorOverrides[index], cellBgOverrides[index])
|
||||||
|
row.addView(tv)
|
||||||
}
|
}
|
||||||
table.addView(row)
|
table.addView(row)
|
||||||
addDivider(table)
|
addDivider(table)
|
||||||
@ -220,15 +314,17 @@ class DatabaseButtonHandler(
|
|||||||
private fun addDisabledRow(
|
private fun addDisabledRow(
|
||||||
table: TableLayout,
|
table: TableLayout,
|
||||||
cells: List<String>,
|
cells: List<String>,
|
||||||
colorOverrides: Map<Int, Int> = emptyMap()
|
colorOverrides: Map<Int, Int> = emptyMap(),
|
||||||
|
cellBgOverrides: Map<Int, Int> = emptyMap()
|
||||||
) {
|
) {
|
||||||
val row = TableRow(activity).apply {
|
val row = TableRow(activity).apply {
|
||||||
isClickable = false
|
isClickable = false
|
||||||
isEnabled = false
|
isEnabled = false
|
||||||
alpha = 0.6f // leicht ausgegraut
|
alpha = 0.6f
|
||||||
}
|
}
|
||||||
cells.forEachIndexed { index, text ->
|
cells.forEachIndexed { index, text ->
|
||||||
row.addView(makeBodyCell(text, colorOverrides[index]))
|
val tv = makeBodyCell(text, colorOverrides[index], cellBgOverrides[index])
|
||||||
|
row.addView(tv)
|
||||||
}
|
}
|
||||||
table.addView(row)
|
table.addView(row)
|
||||||
addDivider(table)
|
addDivider(table)
|
||||||
@ -253,12 +349,17 @@ class DatabaseButtonHandler(
|
|||||||
setTypeface(typeface, android.graphics.Typeface.BOLD)
|
setTypeface(typeface, android.graphics.Typeface.BOLD)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun makeBodyCell(text: String, color: Int? = null): TextView =
|
private fun makeBodyCell(
|
||||||
|
text: String,
|
||||||
|
textColor: Int? = null,
|
||||||
|
bgColor: Int? = null
|
||||||
|
): TextView =
|
||||||
TextView(activity).apply {
|
TextView(activity).apply {
|
||||||
this.text = text
|
this.text = text
|
||||||
setPadding(dp(12), dp(10), dp(12), dp(10))
|
setPadding(dp(12), dp(10), dp(12), dp(10))
|
||||||
textSize = 15f
|
textSize = 15f
|
||||||
color?.let { setTextColor(it) }
|
textColor?.let { setTextColor(it) }
|
||||||
|
bgColor?.let { setBackgroundColor(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun dp(value: Int): Int {
|
private fun dp(value: Int): Int {
|
||||||
|
|||||||
@ -188,6 +188,8 @@ object LanguageManager {
|
|||||||
"violence_question_1" to "Sind Sie jemals so schwer von anderen verletzt worden, dass Sie ärztliche Unterstützung benötigt haben? (Arzt, Krankenhaus)",
|
"violence_question_1" to "Sind Sie jemals so schwer von anderen verletzt worden, dass Sie ärztliche Unterstützung benötigt haben? (Arzt, Krankenhaus)",
|
||||||
"times_happend" to "Ist das ... passiert?",
|
"times_happend" to "Ist das ... passiert?",
|
||||||
"age_at_incident" to "In welchem Alter: mit ... Jahren?",
|
"age_at_incident" to "In welchem Alter: mit ... Jahren?",
|
||||||
|
"times_happend2" to "Ist das ... passiert?",
|
||||||
|
"age_at_incident2" to "In welchem Alter: mit ... Jahren?",
|
||||||
"conflict_since_arrival" to "Seitdem Sie in Deutschland sind, sind Sie jemals in gewalttätige Konflikte (Prügelei, körperlich, und psychische Konflikte) geraten?",
|
"conflict_since_arrival" to "Seitdem Sie in Deutschland sind, sind Sie jemals in gewalttätige Konflikte (Prügelei, körperlich, und psychische Konflikte) geraten?",
|
||||||
"finish_data_entry" to "Wenn Sie nun mit der Dateneingabe fertig sind, klicken Sie auf \"Speichern\".",
|
"finish_data_entry" to "Wenn Sie nun mit der Dateneingabe fertig sind, klicken Sie auf \"Speichern\".",
|
||||||
"feeling_connected_to_germany_question" to "Wie stark fühlen Sie sich Deutschland verbunden (in Deutschland angekommen)?",
|
"feeling_connected_to_germany_question" to "Wie stark fühlen Sie sich Deutschland verbunden (in Deutschland angekommen)?",
|
||||||
@ -487,6 +489,8 @@ object LanguageManager {
|
|||||||
"violence_question_1" to "Have you ever been injured by others so seriously that you needed medical attention? (doctor, hospital)",
|
"violence_question_1" to "Have you ever been injured by others so seriously that you needed medical attention? (doctor, hospital)",
|
||||||
"times_happend" to "Has this ... happened?",
|
"times_happend" to "Has this ... happened?",
|
||||||
"age_at_incident" to "At what age: at ... years?",
|
"age_at_incident" to "At what age: at ... years?",
|
||||||
|
"times_happend2" to "Has this ... happened?",
|
||||||
|
"age_at_incident2" to "At what age: at ... years?",
|
||||||
"conflict_since_arrival" to "Since arriving in Germany, have you ever been involved in violent conflicts (physical fights, physical or psychological conflicts)?",
|
"conflict_since_arrival" to "Since arriving in Germany, have you ever been involved in violent conflicts (physical fights, physical or psychological conflicts)?",
|
||||||
"finish_data_entry" to "When you have finished entering the data, click \"Save\".",
|
"finish_data_entry" to "When you have finished entering the data, click \"Save\".",
|
||||||
"feeling_connected_to_germany_question" to "How connected do you feel to Germany (how well have you settled in Germany)?",
|
"feeling_connected_to_germany_question" to "How connected do you feel to Germany (how well have you settled in Germany)?",
|
||||||
@ -781,6 +785,8 @@ object LanguageManager {
|
|||||||
"violence_question_1" to "Avez-vous déjà été blessé(e) si gravement par d’autres que vous avez dû consulter un médecin ou aller à l’hôpital ?",
|
"violence_question_1" to "Avez-vous déjà été blessé(e) si gravement par d’autres que vous avez dû consulter un médecin ou aller à l’hôpital ?",
|
||||||
"times_happend" to "Cela est-il arrivé ... ?",
|
"times_happend" to "Cela est-il arrivé ... ?",
|
||||||
"age_at_incident" to "À quel âge : à ... ans ?",
|
"age_at_incident" to "À quel âge : à ... ans ?",
|
||||||
|
"times_happend2" to "Cela est-il arrivé ... ?",
|
||||||
|
"age_at_incident2" to "À quel âge : à ... ans ?",
|
||||||
"conflict_since_arrival" to "Depuis votre arrivée en Allemagne, avez-vous été impliqué dans des conflits violents (bagarres, conflits physiques ou psychiques) ?",
|
"conflict_since_arrival" to "Depuis votre arrivée en Allemagne, avez-vous été impliqué dans des conflits violents (bagarres, conflits physiques ou psychiques) ?",
|
||||||
"finish_data_entry" to "Lorsque vous avez terminé la saisie des données, cliquez sur \"Enregistrer\".",
|
"finish_data_entry" to "Lorsque vous avez terminé la saisie des données, cliquez sur \"Enregistrer\".",
|
||||||
"feeling_connected_to_germany_question" to "Dans quelle mesure vous sentez-vous lié(e) à l’Allemagne (vous êtes arrivé(e) en Allemagne) ?",
|
"feeling_connected_to_germany_question" to "Dans quelle mesure vous sentez-vous lié(e) à l’Allemagne (vous êtes arrivé(e) en Allemagne) ?",
|
||||||
@ -1079,6 +1085,8 @@ object LanguageManager {
|
|||||||
"violence_question_1" to "Бывали ли случаи, когда вас так сильно ранили другие, что вам понадобилась медицинская помощь? (врач, больница)",
|
"violence_question_1" to "Бывали ли случаи, когда вас так сильно ранили другие, что вам понадобилась медицинская помощь? (врач, больница)",
|
||||||
"times_happend" to "Сколько раз это происходило?",
|
"times_happend" to "Сколько раз это происходило?",
|
||||||
"age_at_incident" to "В каком возрасте?",
|
"age_at_incident" to "В каком возрасте?",
|
||||||
|
"times_happend2" to "Сколько раз это происходило?",
|
||||||
|
"age_at_incident2" to "В каком возрасте?",
|
||||||
"conflict_since_arrival" to "Бывали ли у вас с тех пор, как вы в Германии, случаи насильственных конфликтов (драки, физические или психологические конфликты)?",
|
"conflict_since_arrival" to "Бывали ли у вас с тех пор, как вы в Германии, случаи насильственных конфликтов (драки, физические или психологические конфликты)?",
|
||||||
"finish_data_entry" to "Когда вы завершите ввод данных, нажмите \"Сохранить\".",
|
"finish_data_entry" to "Когда вы завершите ввод данных, нажмите \"Сохранить\".",
|
||||||
"feeling_connected_to_germany_question" to "Насколько вы чувствуете себя связанным с Германией (адаптировались в Германии)?",
|
"feeling_connected_to_germany_question" to "Насколько вы чувствуете себя связанным с Германией (адаптировались в Германии)?",
|
||||||
@ -1373,6 +1381,8 @@ object LanguageManager {
|
|||||||
"violence_question_1" to "Чи коли-небудь вас так сильно поранили інші, що вам потрібна була медична допомога? (лікар, лікарня)",
|
"violence_question_1" to "Чи коли-небудь вас так сильно поранили інші, що вам потрібна була медична допомога? (лікар, лікарня)",
|
||||||
"times_happend" to "Це сталося ... разів?",
|
"times_happend" to "Це сталося ... разів?",
|
||||||
"age_at_incident" to "У якому віці: у ... років?",
|
"age_at_incident" to "У якому віці: у ... років?",
|
||||||
|
"times_happend2" to "Це сталося ... разів?",
|
||||||
|
"age_at_incident2" to "У якому віці: у ... років?",
|
||||||
"conflict_since_arrival" to "Відтоді, як ви в Німеччині, чи потрапляли ви в насильницькі конфлікти (бійки, фізичні та психологічні конфлікти)?",
|
"conflict_since_arrival" to "Відтоді, як ви в Німеччині, чи потрапляли ви в насильницькі конфлікти (бійки, фізичні та психологічні конфлікти)?",
|
||||||
"finish_data_entry" to "Коли завершите введення даних, натисніть \"Зберегти\".",
|
"finish_data_entry" to "Коли завершите введення даних, натисніть \"Зберегти\".",
|
||||||
"feeling_connected_to_germany_question" to "Наскільки ви відчуваєте себе пов’язаним з Німеччиною (після прибуття в Німеччину)?",
|
"feeling_connected_to_germany_question" to "Наскільки ви відчуваєте себе пов’язаним з Німеччиною (після прибуття в Німеччину)?",
|
||||||
@ -1671,6 +1681,8 @@ object LanguageManager {
|
|||||||
"violence_question_1" to "Hiç başka biri tarafından öyle bir şekilde yaralandınız mı ki tıbbi yardım almak zorunda kaldınız? (doktor, hastane)",
|
"violence_question_1" to "Hiç başka biri tarafından öyle bir şekilde yaralandınız mı ki tıbbi yardım almak zorunda kaldınız? (doktor, hastane)",
|
||||||
"times_happend" to "Bu ... kez oldu mu?",
|
"times_happend" to "Bu ... kez oldu mu?",
|
||||||
"age_at_incident" to "Olay yaşandığında kaç yaşındaydınız?",
|
"age_at_incident" to "Olay yaşandığında kaç yaşındaydınız?",
|
||||||
|
"times_happend2" to "Bu ... kez oldu mu?",
|
||||||
|
"age_at_incident2" to "Olay yaşandığında kaç yaşındaydınız?",
|
||||||
"conflict_since_arrival" to "Almanya’ya geldikten sonra hiç şiddet içeren çatışmalara (kavga, fiziksel veya psikolojik) girdiniz mi?",
|
"conflict_since_arrival" to "Almanya’ya geldikten sonra hiç şiddet içeren çatışmalara (kavga, fiziksel veya psikolojik) girdiniz mi?",
|
||||||
"finish_data_entry" to "Veri girişini tamamladığınızda \"Kaydet\"e tıklayın.",
|
"finish_data_entry" to "Veri girişini tamamladığınızda \"Kaydet\"e tıklayın.",
|
||||||
"feeling_connected_to_germany_question" to "Kendinizi Almanya’ya ne kadar bağlı hissediyorsunuz (Almanya’ya geldikten sonra)?",
|
"feeling_connected_to_germany_question" to "Kendinizi Almanya’ya ne kadar bağlı hissediyorsunuz (Almanya’ya geldikten sonra)?",
|
||||||
@ -1969,6 +1981,8 @@ object LanguageManager {
|
|||||||
"violence_question_1" to "Czy został(a) Pan/Pani kiedykolwiek tak poważnie zraniony(a) przez inne osoby, że potrzebował(a) Pan/Pani pomocy medycznej? (lekarz, szpital)",
|
"violence_question_1" to "Czy został(a) Pan/Pani kiedykolwiek tak poważnie zraniony(a) przez inne osoby, że potrzebował(a) Pan/Pani pomocy medycznej? (lekarz, szpital)",
|
||||||
"times_happend" to "Czy to się wydarzyło ...?",
|
"times_happend" to "Czy to się wydarzyło ...?",
|
||||||
"age_at_incident" to "W jakim wieku: w wieku ... lat?",
|
"age_at_incident" to "W jakim wieku: w wieku ... lat?",
|
||||||
|
"times_happend2" to "Czy to się wydarzyło ...?",
|
||||||
|
"age_at_incident2" to "W jakim wieku: w wieku ... lat?",
|
||||||
"conflict_since_arrival" to "Czy od czasu przybycia do Niemiec zdarzyło się Panu/Pani uczestniczyć w aktach przemocy (bójki, konflikty fizyczne i psychiczne)?",
|
"conflict_since_arrival" to "Czy od czasu przybycia do Niemiec zdarzyło się Panu/Pani uczestniczyć w aktach przemocy (bójki, konflikty fizyczne i psychiczne)?",
|
||||||
"finish_data_entry" to "Gdy zakończysz wprowadzanie danych, kliknij \"Zapisz\".",
|
"finish_data_entry" to "Gdy zakończysz wprowadzanie danych, kliknij \"Zapisz\".",
|
||||||
"feeling_connected_to_germany_question" to "Jak bardzo czuje się Pan/Pani związany(a) z Niemcami (czy czuje się Pan/Pani osiedlony(a) w Niemczech)?",
|
"feeling_connected_to_germany_question" to "Jak bardzo czuje się Pan/Pani związany(a) z Niemcami (czy czuje się Pan/Pani osiedlony(a) w Niemczech)?",
|
||||||
@ -2267,6 +2281,8 @@ object LanguageManager {
|
|||||||
"violence_question_1" to "هل سبق أن تعرضت لإصابة خطيرة من قبل الآخرين لدرجة أنك احتجت إلى رعاية طبية؟ (طبيب، مستشفى)",
|
"violence_question_1" to "هل سبق أن تعرضت لإصابة خطيرة من قبل الآخرين لدرجة أنك احتجت إلى رعاية طبية؟ (طبيب، مستشفى)",
|
||||||
"times_happend" to "هل حدث هذا ...؟",
|
"times_happend" to "هل حدث هذا ...؟",
|
||||||
"age_at_incident" to "في أي عمر: عندما كنت بعمر ... سنة؟",
|
"age_at_incident" to "في أي عمر: عندما كنت بعمر ... سنة؟",
|
||||||
|
"times_happend2" to "هل حدث هذا ...؟",
|
||||||
|
"age_at_incident2" to "في أي عمر: عندما كنت بعمر ... سنة؟",
|
||||||
"conflict_since_arrival" to "منذ وصولك إلى ألمانيا، هل دخلت في صراعات عنيفة (عراك، صراعات جسدية أو نفسية)؟",
|
"conflict_since_arrival" to "منذ وصولك إلى ألمانيا، هل دخلت في صراعات عنيفة (عراك، صراعات جسدية أو نفسية)؟",
|
||||||
"finish_data_entry" to "عند الانتهاء من إدخال البيانات، انقر على \"حفظ\".",
|
"finish_data_entry" to "عند الانتهاء من إدخال البيانات، انقر على \"حفظ\".",
|
||||||
"feeling_connected_to_germany_question" to "ما مدى شعورك بالارتباط بألمانيا (هل تشعر أنك أصبحت جزءاً منها)؟",
|
"feeling_connected_to_germany_question" to "ما مدى شعورك بالارتباط بألمانيا (هل تشعر أنك أصبحت جزءاً منها)؟",
|
||||||
@ -2565,6 +2581,8 @@ object LanguageManager {
|
|||||||
"violence_question_1" to "Ați fost vreodată rănit(ă) atât de grav de alte persoane încât ați avut nevoie de ajutor medical? (medic, spital)",
|
"violence_question_1" to "Ați fost vreodată rănit(ă) atât de grav de alte persoane încât ați avut nevoie de ajutor medical? (medic, spital)",
|
||||||
"times_happend" to "Acest lucru s-a întâmplat ...?",
|
"times_happend" to "Acest lucru s-a întâmplat ...?",
|
||||||
"age_at_incident" to "La ce vârstă: la ... ani?",
|
"age_at_incident" to "La ce vârstă: la ... ani?",
|
||||||
|
"times_happend2" to "Acest lucru s-a întâmplat ...?",
|
||||||
|
"age_at_incident2" to "La ce vârstă: la ... ani?",
|
||||||
"conflict_since_arrival" to "De când sunteți în Germania, ați fost implicat(ă) în conflicte violente (bătaie, conflicte fizice sau psihice)?",
|
"conflict_since_arrival" to "De când sunteți în Germania, ați fost implicat(ă) în conflicte violente (bătaie, conflicte fizice sau psihice)?",
|
||||||
"finish_data_entry" to "Când ați terminat introducerea datelor, faceți clic pe \"Salvează\".",
|
"finish_data_entry" to "Când ați terminat introducerea datelor, faceți clic pe \"Salvează\".",
|
||||||
"feeling_connected_to_germany_question" to "Cât de mult simțiți că sunteți legat(ă) de Germania (că v-ați integrat)?",
|
"feeling_connected_to_germany_question" to "Cât de mult simțiți că sunteți legat(ă) de Germania (că v-ați integrat)?",
|
||||||
@ -2863,6 +2881,8 @@ object LanguageManager {
|
|||||||
"violence_question_1" to "¿Alguna vez resultó tan gravemente herido por otros que necesitó asistencia médica? (Médico, hospital)",
|
"violence_question_1" to "¿Alguna vez resultó tan gravemente herido por otros que necesitó asistencia médica? (Médico, hospital)",
|
||||||
"times_happend" to "¿Ha ocurrido esto...?",
|
"times_happend" to "¿Ha ocurrido esto...?",
|
||||||
"age_at_incident" to "¿A qué edad ocurrió? A los ... años",
|
"age_at_incident" to "¿A qué edad ocurrió? A los ... años",
|
||||||
|
"times_happend2" to "¿Ha ocurrido esto...?",
|
||||||
|
"age_at_incident2" to "¿A qué edad ocurrió? A los ... años",
|
||||||
"conflict_since_arrival" to "¿Desde que llegó a Alemania, ha estado involucrado en conflictos violentos (peleas físicas o conflictos psicológicos)?",
|
"conflict_since_arrival" to "¿Desde que llegó a Alemania, ha estado involucrado en conflictos violentos (peleas físicas o conflictos psicológicos)?",
|
||||||
"finish_data_entry" to "Cuando haya terminado de introducir los datos, haga clic en \"Guardar\".",
|
"finish_data_entry" to "Cuando haya terminado de introducir los datos, haga clic en \"Guardar\".",
|
||||||
"feeling_connected_to_germany_question" to "¿Qué tan conectado se siente con Alemania (llegado a Alemania)?",
|
"feeling_connected_to_germany_question" to "¿Qué tan conectado se siente con Alemania (llegado a Alemania)?",
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:paddingBottom="8dp" />
|
android:paddingBottom="8dp" />
|
||||||
|
|
||||||
|
<!-- Tabelle 1: Fragebögen (✓/✗) -->
|
||||||
<HorizontalScrollView
|
<HorizontalScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
@ -53,6 +54,38 @@
|
|||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:paddingBottom="8dp" />
|
android:paddingBottom="8dp" />
|
||||||
|
|
||||||
|
<!-- HEADER + Tabelle 2: geordnete IDs/Werte -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/headerLabel"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="header"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:paddingTop="12dp"
|
||||||
|
android:paddingBottom="6dp" />
|
||||||
|
|
||||||
|
<HorizontalScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:fillViewport="true"
|
||||||
|
android:scrollbars="horizontal">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fillViewport="true"
|
||||||
|
android:scrollbars="vertical">
|
||||||
|
|
||||||
|
<TableLayout
|
||||||
|
android:id="@+id/tableOrdered"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:stretchColumns="1,2" />
|
||||||
|
</ScrollView>
|
||||||
|
</HorizontalScrollView>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/backButtonClient"
|
android:id="@+id/backButtonClient"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
Reference in New Issue
Block a user