List tabs (#1570)
* List tabs * Add comment * Move decoder part to TabData.createTabDataFromId * Fix drawable tint * Use dedicated view for list picker * Error log * Fix logging Co-Authored-By: Konrad Pozniak <connyduck@users.noreply.github.com> * Fix tint color Co-Authored-By: Konrad Pozniak <connyduck@users.noreply.github.com> * Fix missing import * Move encoding part too * Fix comment * Fix decoder * Revert "Fix decoder" This reverts commit fdc45aac9c113348f8740e6692d2d8e9ace14f7f. * Revert "Fix comment" This reverts commit 704b4e6d2e5545d5f2d20c9bc6bc276d6257d119. * Revert "Move encoding part too" This reverts commit 32e77346ff98ae1133e76ab6dfd880b26171005e. * Revert "Move decoder part to TabData.createTabDataFromId" This reverts commit d1cd2070ab564d2e33874225272a71f0904d681e.main
parent
997fa4b8f7
commit
d137e6c63c
@ -0,0 +1,48 @@ |
||||
/* Copyright 2019 kyori19 |
||||
* |
||||
* This file is a part of Tusky. |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the |
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the |
||||
* License, or (at your option) any later version. |
||||
* |
||||
* Tusky 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 Tusky; if not, |
||||
* see <http://www.gnu.org/licenses>. */ |
||||
|
||||
package com.keylesspalace.tusky.adapter |
||||
|
||||
import android.content.Context |
||||
import android.view.LayoutInflater |
||||
import android.view.View |
||||
import android.view.ViewGroup |
||||
import android.widget.ArrayAdapter |
||||
import com.keylesspalace.tusky.R |
||||
import com.keylesspalace.tusky.entity.MastoList |
||||
import com.keylesspalace.tusky.util.ThemeUtils |
||||
import kotlinx.android.synthetic.main.item_picker_list.view.* |
||||
|
||||
class ListSelectionAdapter(context: Context) : ArrayAdapter<MastoList>(context, R.layout.item_autocomplete_hashtag) { |
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View { |
||||
var view = convertView |
||||
|
||||
if (convertView == null) { |
||||
val layoutInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater |
||||
view = layoutInflater.inflate(R.layout.item_picker_list, parent, false) |
||||
} |
||||
view!! |
||||
|
||||
val list = getItem(position) |
||||
if (list != null) { |
||||
val title = view.title |
||||
title.text = list.title |
||||
val icon = ThemeUtils.getTintedDrawable(context, R.drawable.ic_list, android.R.attr.textColorTertiary) |
||||
title.setCompoundDrawablesRelativeWithIntrinsicBounds(icon, null, null, null) |
||||
} |
||||
|
||||
return view |
||||
} |
||||
} |
@ -0,0 +1,9 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="24dp" |
||||
android:height="24dp" |
||||
android:viewportWidth="24.0" |
||||
android:viewportHeight="24.0"> |
||||
<path |
||||
android:fillColor="#FF000000" |
||||
android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z"/> |
||||
</vector> |
@ -0,0 +1,8 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:id="@+id/title" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:padding="16dp" |
||||
android:drawablePadding="8dp" |
||||
android:textSize="?attr/status_text_medium" /> |
Loading…
Reference in new issue