diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragment.kt index c3f7f9b74aecaf19a6be5147e2bb277da5376d4f..8098f974bcc8b52db73ff714d713b92d381c5ad2 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragment.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragment.kt @@ -61,6 +61,9 @@ class AboutFragment : DaggerFragment() { @BindView(R.id.contributors) lateinit var contributors: RecyclerView + @BindView(R.id.translators) + lateinit var translators: RecyclerView + @BindView(R.id.libraries) lateinit var libraries: RecyclerView @@ -351,6 +354,25 @@ class AboutFragment : DaggerFragment() { contributors.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL)) ViewCompat.setNestedScrollingEnabled(contributors, false) + translators.layoutManager = LinearLayoutManager(context) + translators.itemAnimator = null + translators.adapter = TranslatorAdapter(listOf( + Translator( + name = "TDa_", + language = R.string.preference_language_entry_lt + ), + Translator( + name = "Exterminador", + language = R.string.preference_language_entry_pt + ), + Translator( + name = "Luka Ilić", + language = R.string.preference_language_entry_sr + ) + )) + translators.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL)) + ViewCompat.setNestedScrollingEnabled(translators, false) + return view } } diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/Translator.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/Translator.kt new file mode 100644 index 0000000000000000000000000000000000000000..b29f423051c7e6994dda37e765fe0d0afb86f6d0 --- /dev/null +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/Translator.kt @@ -0,0 +1,27 @@ +/* + * Quasseldroid - Quassel client for Android + * + * Copyright (c) 2018 Janne Koschinski + * Copyright (c) 2018 The Quassel Project + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package de.kuschku.quasseldroid.ui.clientsettings.about + +import android.support.annotation.StringRes + +data class Translator( + val name: String, + @StringRes val language: Int +) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/TranslatorAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/TranslatorAdapter.kt new file mode 100644 index 0000000000000000000000000000000000000000..b751d65ea754708e61a992b1dfaef25b4bfbe720 --- /dev/null +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/TranslatorAdapter.kt @@ -0,0 +1,59 @@ +/* + * Quasseldroid - Quassel client for Android + * + * Copyright (c) 2018 Janne Koschinski + * Copyright (c) 2018 The Quassel Project + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package de.kuschku.quasseldroid.ui.clientsettings.about + +import android.support.v7.widget.RecyclerView +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.TextView +import butterknife.BindView +import butterknife.ButterKnife +import de.kuschku.quasseldroid.R + +class TranslatorAdapter(private val translators: List<Translator>) : + RecyclerView.Adapter<TranslatorAdapter.TranslatorViewHolder>() { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = TranslatorViewHolder( + LayoutInflater.from(parent.context).inflate(R.layout.widget_translator, parent, false) + ) + + override fun getItemCount() = translators.size + + override fun onBindViewHolder(holder: TranslatorViewHolder, position: Int) { + holder.bind(translators[position]) + } + + class TranslatorViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + @BindView(R.id.name) + lateinit var name: TextView + + @BindView(R.id.language) + lateinit var language: TextView + + init { + ButterKnife.bind(this, itemView) + } + + fun bind(item: Translator) { + this.name.text = item.name + this.language.text = itemView.resources.getString(item.language) + } + } +} diff --git a/app/src/main/res/layout/preferences_about.xml b/app/src/main/res/layout/preferences_about.xml index 47e761bc2c5a8f7f101149b0aeff780a899833e3..530fefa518aa88470b44ce5fb7f3e063c1728155 100644 --- a/app/src/main/res/layout/preferences_about.xml +++ b/app/src/main/res/layout/preferences_about.xml @@ -49,6 +49,25 @@ </LinearLayout> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="?listPreferredItemHeight" + android:orientation="vertical"> + + <TextView + style="@style/Widget.Subhead" + android:text="@string/label_translators" /> + + <android.support.v7.widget.RecyclerView + android:id="@+id/translators" + android:layout_width="match_parent" + android:layout_height="wrap_content" + tools:itemCount="5" + tools:listitem="@layout/widget_translator" /> + + </LinearLayout> + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/widget_translator.xml b/app/src/main/res/layout/widget_translator.xml new file mode 100644 index 0000000000000000000000000000000000000000..1a345a5ac80222abdfec6d2c7cfa3a45fdd0e007 --- /dev/null +++ b/app/src/main/res/layout/widget_translator.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + Quasseldroid - Quassel client for Android + + Copyright (c) 2018 Janne Koschinski + Copyright (c) 2018 The Quassel Project + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License version 3 as published + by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see <http://www.gnu.org/licenses/>. + --> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?android:attr/selectableItemBackground" + android:focusable="true" + android:gravity="center_vertical" + android:minHeight="?android:attr/listPreferredItemHeightSmall" + android:paddingEnd="?android:attr/listPreferredItemPaddingRight" + android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" + android:paddingRight="?android:attr/listPreferredItemPaddingRight" + android:paddingStart="?android:attr/listPreferredItemPaddingLeft" + tools:showIn="@layout/preferences_about"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom="16dp" + android:paddingTop="16dp"> + + <TextView + android:id="@+id/name" + style="@style/Widget.RtlConformTextView" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="?colorTextPrimary" + android:textSize="16sp" + tools:text="@sample/contributors.json/data/name" /> + + <TextView + android:id="@+id/language" + style="@style/Widget.RtlConformTextView" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="?colorTextSecondary" + tools:text="@sample/contributors.json/data/description" /> + </LinearLayout> +</LinearLayout> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e3019f061e572b951ffeb9cff062097d315225d8..f4736bc615f064beda7fc97184b110cee8c58bcc 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -96,6 +96,7 @@ <string name="label_share_crashreport">Share Crash Report</string> <string name="label_show_hidden">Show Hidden</string> <string name="label_topic">Channel Topic</string> + <string name="label_translators">Translators</string> <string name="label_unhide">Make Visible</string> <string name="label_website">Website</string> <string name="label_whitelist">Ignore</string> diff --git a/app/src/main/res/values/strings_preferences.xml b/app/src/main/res/values/strings_preferences.xml index a4f188f130eea188028bc17dffc50851b92712f4..56a6e5edd348afd8ac3072f6a2ed283324fc6b22 100644 --- a/app/src/main/res/values/strings_preferences.xml +++ b/app/src/main/res/values/strings_preferences.xml @@ -85,12 +85,14 @@ <string name="preference_language_entry_de" translatable="false">Deutsch</string> <string name="preference_language_entry_lt" translatable="false">Lietuvių</string> <string name="preference_language_entry_pt" translatable="false">Português</string> + <string name="preference_language_entry_sr" translatable="false">Srpski (latinica)</string> <string-array name="preference_language_entries" translatable="false"> <item>@string/preference_language_entry_auto</item> <item>@string/preference_language_entry_en</item> <item>@string/preference_language_entry_de</item> <item>@string/preference_language_entry_lt</item> <item>@string/preference_language_entry_pt</item> + <!--<item>@string/preference_language_entry_sr</item>--> </string-array> <string-array name="preference_language_entryvalues" translatable="false"> <item /> @@ -98,6 +100,7 @@ <item>de</item> <item>lt</item> <item>pt</item> + <!--<item>sr</item>--> </string-array>