Skip to content
Snippets Groups Projects
Verified Commit 085be69e authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Added translator menu

parent 8d1b3d02
Branches
Tags
No related merge requests found
...@@ -61,6 +61,9 @@ class AboutFragment : DaggerFragment() { ...@@ -61,6 +61,9 @@ class AboutFragment : DaggerFragment() {
@BindView(R.id.contributors) @BindView(R.id.contributors)
lateinit var contributors: RecyclerView lateinit var contributors: RecyclerView
@BindView(R.id.translators)
lateinit var translators: RecyclerView
@BindView(R.id.libraries) @BindView(R.id.libraries)
lateinit var libraries: RecyclerView lateinit var libraries: RecyclerView
...@@ -351,6 +354,25 @@ class AboutFragment : DaggerFragment() { ...@@ -351,6 +354,25 @@ class AboutFragment : DaggerFragment() {
contributors.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL)) contributors.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL))
ViewCompat.setNestedScrollingEnabled(contributors, false) 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 return view
} }
} }
/*
* 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
)
/*
* 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)
}
}
}
...@@ -49,6 +49,25 @@ ...@@ -49,6 +49,25 @@
</LinearLayout> </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 <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
<?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>
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
<string name="label_share_crashreport">Share Crash Report</string> <string name="label_share_crashreport">Share Crash Report</string>
<string name="label_show_hidden">Show Hidden</string> <string name="label_show_hidden">Show Hidden</string>
<string name="label_topic">Channel Topic</string> <string name="label_topic">Channel Topic</string>
<string name="label_translators">Translators</string>
<string name="label_unhide">Make Visible</string> <string name="label_unhide">Make Visible</string>
<string name="label_website">Website</string> <string name="label_website">Website</string>
<string name="label_whitelist">Ignore</string> <string name="label_whitelist">Ignore</string>
......
...@@ -85,12 +85,14 @@ ...@@ -85,12 +85,14 @@
<string name="preference_language_entry_de" translatable="false">Deutsch</string> <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_lt" translatable="false">Lietuvių</string>
<string name="preference_language_entry_pt" translatable="false">Português</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"> <string-array name="preference_language_entries" translatable="false">
<item>@string/preference_language_entry_auto</item> <item>@string/preference_language_entry_auto</item>
<item>@string/preference_language_entry_en</item> <item>@string/preference_language_entry_en</item>
<item>@string/preference_language_entry_de</item> <item>@string/preference_language_entry_de</item>
<item>@string/preference_language_entry_lt</item> <item>@string/preference_language_entry_lt</item>
<item>@string/preference_language_entry_pt</item> <item>@string/preference_language_entry_pt</item>
<!--<item>@string/preference_language_entry_sr</item>-->
</string-array> </string-array>
<string-array name="preference_language_entryvalues" translatable="false"> <string-array name="preference_language_entryvalues" translatable="false">
<item /> <item />
...@@ -98,6 +100,7 @@ ...@@ -98,6 +100,7 @@
<item>de</item> <item>de</item>
<item>lt</item> <item>lt</item>
<item>pt</item> <item>pt</item>
<!--<item>sr</item>-->
</string-array> </string-array>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment