Skip to content

Commit

Permalink
feat: Allow the user to specify an arbitrary number of tabs
Browse files Browse the repository at this point in the history
- Remove the existing restriction on the number of tabs
- Allow the tabs to scroll to display more
- Update UI and text resources to remove obsolete content
  • Loading branch information
nikclayton committed Sep 4, 2023
1 parent b1fd20e commit 369979a
Show file tree
Hide file tree
Showing 49 changed files with 146 additions and 528 deletions.
450 changes: 137 additions & 313 deletions app/lint-baseline.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,12 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene
toggleFab(false)
}

binding.maxTabsInfo.text = resources.getQuantityString(R.plurals.max_tab_number_reached, MAX_TAB_COUNT, MAX_TAB_COUNT)

updateAvailableTabs()

onBackPressedDispatcher.addCallback(onFabDismissedCallback)
}

override fun onTabAdded(tab: TabData) {
if (currentTabs.size >= MAX_TAB_COUNT) {
return
}

toggleFab(false)

if (tab.id == HASHTAG) {
Expand Down Expand Up @@ -399,7 +393,6 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene

addTabAdapter.updateData(addableTabs)

binding.maxTabsInfo.visible(addableTabs.size == 0 || currentTabs.size >= MAX_TAB_COUNT)
currentTabsAdapter.setRemoveButtonVisible(currentTabs.size > MIN_TAB_COUNT)
}

Expand Down Expand Up @@ -432,6 +425,5 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene

companion object {
private const val MIN_TAB_COUNT = 2
private const val MAX_TAB_COUNT = 5
}
}
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabMaxWidth="0dp"
app:tabMode="fixed" />
app:tabMode="scrollable" />
</androidx.appcompat.widget.Toolbar>

</com.google.android.material.appbar.AppBarLayout>
Expand Down Expand Up @@ -73,7 +73,7 @@
android:layout_height="?attr/actionBarSize"
app:tabGravity="fill"
app:tabIndicatorGravity="top"
app:tabMode="fixed" />
app:tabMode="scrollable" />

</com.google.android.material.bottomappbar.BottomAppBar>

Expand Down
11 changes: 1 addition & 10 deletions app/src/main/res/layout/activity_tab_preference.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down Expand Up @@ -53,14 +52,6 @@
android:layout_height="wrap_content"
android:overScrollMode="never" />

<TextView
android:id="@+id/maxTabsInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingMultiplier="1.1"
android:padding="8dp"
tools:text="@string/max_tab_number_reached" />

<TextView
android:layout_width="match_parent"
android:layout_height="48dp"
Expand All @@ -80,4 +71,4 @@

</com.google.android.material.card.MaterialCardView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
8 changes: 0 additions & 8 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,6 @@
<string name="conversation_1_recipients">%1$s</string>
<string name="conversation_2_recipients">%1$s و %2$s</string>
<string name="conversation_more_recipients">%1$s و %2$s و %3$d آخَرون</string>
<plurals name="max_tab_number_reached">
<item quantity="zero">لقد بلغت الحد الأقصى مِن الألسنة %1$d</item>
<item quantity="one">لقد بلغت الحد الأقصى مِن الألسنة %1$d</item>
<item quantity="two">لقد بلغت الحد الأقصى مِن الألسنة %1$d</item>
<item quantity="few">لقد بلغت الحد الأقصى مِن الألسنة %1$d</item>
<item quantity="many">لقد بلغت الحد الأقصى مِن الألسنة %1$d</item>
<item quantity="other">لقد بلغت الحد الأقصى مِن الألسنة %1$d</item>
</plurals>
<string name="description_post_media">الوسائط: %s </string>
<string name="description_post_cw">تحذير عن المحتوى: %s </string>
<string name="description_post_media_no_description_placeholder">مِن دون وصف </string>
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/res/values-be/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,6 @@
<string name="notifications_apply_filter">Фільтр</string>
<string name="duration_365_days">365 дзён</string>
<string name="duration_no_change">(Без змен)</string>
<plurals name="max_tab_number_reached">
<item quantity="one">абмежаванне ў %1$d ўкладку дасягнута</item>
<item quantity="few">абмежаванне ў %1$d ўкладкі дасягнута</item>
<item quantity="many">абмежаванне ў %1$d ўкладак дасягнута</item>
<item quantity="other">абмежаванне ў %1$d ўкладак дасягнута</item>
</plurals>
<string name="compose_shortcut_long_label">Стварыць допіс</string>
<string name="compose_shortcut_short_label">Стварыць</string>
<string name="notification_clear_text">Вы ўпэўнены, што жадаеце выдаліць усе апавяшчэнні\?</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@
<string name="description_post_media_no_description_placeholder">Без описание</string>
<string name="description_post_cw">Предупреждение за съдържание: %s</string>
<string name="description_post_media">Мултимедия: %s</string>
<plurals name="max_tab_number_reached">
<item quantity="other">достигнати са максималните %1$d раздела</item>
</plurals>
<string name="conversation_more_recipients">%1$s, %2$s и %3$d други</string>
<string name="conversation_1_recipients">%1$s</string>
<string name="conversation_2_recipients">%1$s и %2$s</string>
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/values-bn-rBD/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
<string name="description_post_media_no_description_placeholder">বর্ণনা নাই</string>
<string name="description_post_cw">সতর্কবার্তা: %s</string>
<string name="description_post_media">মিডিয়া: %s</string>
<plurals name="max_tab_number_reached">
<item quantity="one">সর্বোচ্চ %1$dটি ট্যাব পৌঁছেছে</item>
<item quantity="other">সর্বোচ্চ %1$dটি ট্যাব পৌঁছেছে</item>
</plurals>
<string name="title_favourited_by">দ্বারা পছন্দ</string>
<string name="title_reblogged_by">দ্বারা সর্মথন</string>
<string name="pin_action">পিন</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-bn-rIN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,6 @@
<string name="conversation_1_recipients">%1$s</string>
<string name="conversation_2_recipients">%1$s এবং %2$s</string>
<string name="conversation_more_recipients">%1$s, %2$s এবং %3$d আরো অন্য জন</string>
<plurals name="max_tab_number_reached">
<item quantity="other">সর্বাধিক %1$d টি ট্যাব পৌঁছেছে</item>
</plurals>
<string name="description_post_media">মিডিয়া: %s</string>
<string name="description_post_cw">সতর্কবার্তা: %s</string>
<string name="description_post_media_no_description_placeholder">বর্ণনা নাই</string>
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/values-ca/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,6 @@
<string name="conversation_1_recipients">%1$s</string>
<string name="conversation_2_recipients">%1$s i %2$s</string>
<string name="conversation_more_recipients">%1$s, %2$s i %3$d més</string>
<plurals name="max_tab_number_reached">
<item quantity="one">S\'ha arribat al màxim de %1$d pestanya</item>
<item quantity="other">S\'han arribat al màxim de %1$d pestanyes</item>
</plurals>
<string name="description_post_media">Mèdia : %s</string>
<string name="description_post_media_no_description_placeholder">Sense descripció</string>
<string name="description_post_favourited">Favorits</string>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values-ckb/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,6 @@
<string name="description_post_media_no_description_placeholder">هیچ وەسفێک</string>
<string name="description_post_cw">ئاگاداری ناوەڕۆک: %s</string>
<string name="description_post_media">میدیا: %s</string>
<plurals name="max_tab_number_reached">
<item quantity="other">بەرزترین رێژەی خشتەبەندەکانی %1$d گەیشت</item>
</plurals>
<string name="conversation_more_recipients">%1$s, %2$s و %3$d زیاتر</string>
<string name="conversation_2_recipients">%1$s و %2$s</string>
<string name="conversation_1_recipients">%1$s</string>
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,6 @@
<string name="conversation_1_recipients">%1$s</string>
<string name="conversation_2_recipients">%1$s a %2$s</string>
<string name="conversation_more_recipients">%1$s, %2$s a %3$d další</string>
<plurals name="max_tab_number_reached">
<item quantity="one">bylo dosaženo maxima %1$d panelu</item>
<item quantity="few">bylo dosaženo maxima %1$d panelů</item>
<item quantity="other"/>
</plurals>
<string name="description_post_media">Média %s</string>
<string name="description_post_cw">Varování o obsahu: %s</string>
<string name="description_post_media_no_description_placeholder">Žádný popis</string>
Expand Down
8 changes: 0 additions & 8 deletions app/src/main/res/values-cy/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -519,14 +519,6 @@
</plurals>
<string name="conversation_1_recipients">%1$s</string>
<string name="description_post_edited">Golygwyd</string>
<plurals name="max_tab_number_reached">
<item quantity="zero">uchafswm o %1$d tab wedi eu cyrraedd</item>
<item quantity="one">uchafswm o %1$d tab wedi ei gyrraedd</item>
<item quantity="two">uchafswm o %1$d dab wedi eu cyrraedd</item>
<item quantity="few">uchafswm o %1$d tab wedi eu cyrraedd</item>
<item quantity="many">uchafswm o %1$d tab wedi eu cyrraedd</item>
<item quantity="other">uchafswm o %1$d tab wedi eu cyrraedd</item>
</plurals>
<string name="pref_show_self_username_disambiguate">Pan fydd cyfrifon lluosog wedi\'u mewngofnodi</string>
<string name="drafts_failed_loading_reply">Wedi methu llwytho gwybodaeth Ateb</string>
<string name="pref_title_alway_open_spoiler">Agor negeseuon wedi\'u marcio â rhybudd cynnwys bob tro</string>
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,6 @@
<string name="conversation_1_recipients">%1$s</string>
<string name="conversation_2_recipients">%1$s und %2$s</string>
<string name="conversation_more_recipients">%1$s, %2$s und %3$d mehr</string>
<plurals name="max_tab_number_reached">
<item quantity="one">Maximum von %1$d Tab erreicht</item>
<item quantity="other">Maximum von %1$d Tabs erreicht</item>
</plurals>
<string name="description_post_media_no_description_placeholder"> Keine Beschreibung </string>
<string name="description_post_favourited">Favorisiert </string>
<string name="description_visibility_public">Öffentlich </string>
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/values-eo/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,6 @@
<string name="conversation_1_recipients">%1$s</string>
<string name="conversation_2_recipients">%1$s kaj %2$s</string>
<string name="conversation_more_recipients">%1$s, %2$s kaj %3$d aliaj</string>
<plurals name="max_tab_number_reached">
<item quantity="one">maksimumo da %1$d langeto atingita</item>
<item quantity="other">maksimumo da %1$d langetoj atingita</item>
</plurals>
<string name="description_post_media"> Aŭdovidaĵo: %s
</string>
<string name="description_post_cw"> Enhava averto: %s
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,6 @@
<string name="conversation_1_recipients">%1$s</string>
<string name="conversation_2_recipients">%1$s y %2$s</string>
<string name="conversation_more_recipients">%1$s, %2$s y %3$d más</string>
<plurals name="max_tab_number_reached">
<item quantity="one">máximo de %1$d pestaña alcanzada</item>
<item quantity="many">máximo de %1$d pestañas alcanzadas</item>
<item quantity="other">máximo de %1$d pestañas alcanzadas</item>
</plurals>
<string name="action_mentions">Menciones</string>
<string name="action_open_faved_by">Mostrar favoritos</string>
<string name="title_mentions_dialog">Menciones</string>
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/values-eu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,6 @@
<string name="conversation_1_recipients">%1$s</string>
<string name="conversation_2_recipients">%1$s eta %2$s</string>
<string name="conversation_more_recipients">%1$s, %2$s eta %3$d gehiago</string>
<plurals name="max_tab_number_reached">
<item quantity="one">gehienezko %1$d fitxa iritsita</item>
<item quantity="other">gehienezko %1$d fitxa iritsita</item>
</plurals>
<string name="description_post_media">Media: %s</string>
<string name="description_post_cw">Edukiarekiko abisua: %s</string>
<string name="description_post_media_no_description_placeholder">Deskribapenik ez</string>
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,6 @@
<string name="conversation_1_recipients">%1$s</string>
<string name="conversation_2_recipients">%1$s و %2$s</string>
<string name="conversation_more_recipients">%1$s، %2$s و %3$d بیش‌تر</string>
<plurals name="max_tab_number_reached">
<item quantity="one">رسیده به بیشینهٔ %1$d زبانه</item>
<item quantity="other">رسیده به بیشینهٔ %1$d زبانه</item>
</plurals>
<string name="description_post_media">رسانه: %s</string>
<string name="description_post_cw">هشدار محتوا: %s</string>
<string name="description_post_media_no_description_placeholder">بدون شرح</string>
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,6 @@
<string name="conversation_1_recipients">%1$s</string>
<string name="conversation_2_recipients">%1$s et %2$s</string>
<string name="conversation_more_recipients">%1$s, %2$s et %3$d autres</string>
<plurals name="max_tab_number_reached">
<item quantity="one">maximum de %1$d onglet atteint</item>
<item quantity="many">maximum de %1$d onglets atteint</item>
<item quantity="other">maximum de %1$d onglets atteint</item>
</plurals>
<string name="description_post_media">Média : %s</string>
<string name="description_post_cw"> Avertissement : %s
</string>
Expand Down Expand Up @@ -682,4 +677,4 @@
<string name="filter_keyword_addition_title">Ajouter un mot-clé</string>
<string name="filter_edit_keyword_title">Modifier mot-clé</string>
<string name="filter_description_format">%s : %s</string>
</resources>
</resources>
3 changes: 0 additions & 3 deletions app/src/main/res/values-ga/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,6 @@
<string name="caption_notoemoji">Sraith emoji reatha Google</string>
<string name="license_description">Tá cód agus sócmhainní ó na tionscadail foinse oscailte seo a leanas i Tusky:</string>
<string name="label_remote_account">Féadfaidh an fhaisnéis thíos próifíl an úsáideora a léiriú go neamhiomlán. Brúigh chun próifíl iomlán a oscailt sa bhrabhsálaí.</string>
<plurals name="max_tab_number_reached">
<item quantity="other">uasmhéid de chluaisíní %1$d sroichte</item>
</plurals>
<string name="description_poll">Vótaíocht le roghanna: %1$s, %2$s, %3$s, %4$s; %5$s</string>
<string name="list">Liosta</string>
<string name="compose_shortcut_long_label">Scríobh postáil</string>
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/res/values-gd/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,6 @@
<string name="description_post_media_no_description_placeholder">Gun tuairisgeul</string>
<string name="description_post_cw">Rabhadh susbainte: %s</string>
<string name="description_post_media">Meadhan: %s</string>
<plurals name="max_tab_number_reached">
<item quantity="one">ràinig thu na tha ceadaichte dhe %1$d taba</item>
<item quantity="two">ràinig thu na tha ceadaichte dhe %1$d thaba</item>
<item quantity="few">ràinig thu na tha ceadaichte dhe %1$d tabaichean</item>
<item quantity="other">ràinig thu na tha ceadaichte dhe %1$d taba</item>
</plurals>
<string name="conversation_more_recipients">%1$s, %2$s ’s %3$d eile</string>
<string name="conversation_1_recipients">%1$s</string>
<string name="title_favourited_by">’Na annsachd aig</string>
Expand Down
8 changes: 2 additions & 6 deletions app/src/main/res/values-gl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,6 @@
<string name="description_post_media_no_description_placeholder">Sen descrición</string>
<string name="description_post_cw">Aviso sobre o contido: %s</string>
<string name="description_post_media">Multimedia: %s</string>
<plurals name="max_tab_number_reached">
<item quantity="one">acadouse o máximo de %1$d lapela</item>
<item quantity="other">acadouse o máximo de %1$d lapelas</item>
</plurals>
<string name="conversation_more_recipients">%1$s, %2$s e %3$d máis</string>
<string name="conversation_2_recipients">%1$s e %2$s</string>
<string name="title_favourited_by">Favorecido por</string>
Expand Down Expand Up @@ -304,7 +300,7 @@
<string name="post_share_link">Compartir ligazón ao toot</string>
<string name="post_share_content">Compartir contido do toot</string>
<string name="about_tusky_account">Perfil de Tusky</string>
<string name="about_bug_feature_request_site">Informar de fallos e solicitar funcións:
<string name="about_bug_feature_request_site">Informar de fallos e solicitar funcións:
\nhttps://github.com/tuskyapp/Tusky/issues</string>
<string name="about_project_site">Web do proxecto: https://tusky.app</string>
<string name="about_tusky_license">Tusky é software libre e de código aberto. Está baixo a licenza GNU General Public License Version 3. Podes ver a licenza aquí: https://www.gnu.org/licenses/gpl-3.0.en.html</string>
Expand Down Expand Up @@ -677,4 +673,4 @@
<string name="dialog_delete_filter_positive_action">Eliminar</string>
<string name="list_exclusive_label">Agochar na cronoloxía de inicio</string>
<string name="dialog_delete_filter_text">Eliminar o filtro \'%1$s\'\?</string>
</resources>
</resources>
3 changes: 0 additions & 3 deletions app/src/main/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,6 @@
<string name="description_visibility_unlisted">असूचीबद्ध</string>
<string name="description_visibility_public">सार्वजनिक</string>
<string name="description_post_cw">विषय वस्तु चेतावनी: %s</string>
<plurals name="max_tab_number_reached">
<item quantity="other">अधिकतम %1$d टैब तक पहुंच गऐ</item>
</plurals>
<string name="conversation_more_recipients">%1$s, %2$s तथा %3$d अन्य लोग</string>
<string name="conversation_2_recipients">%1$s तथा %2$s</string>
<string name="conversation_1_recipients">%1$s</string>
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,6 @@
<string name="title_reblogged_by">Megtolta</string>
<string name="title_favourited_by">Kedvencnek jelölte</string>
<string name="conversation_2_recipients">%1$s és %2$s</string>
<plurals name="max_tab_number_reached">
<item quantity="one">elérted a fülek maximális számát (%1$d)</item>
<item quantity="other">elérted a fülek maximális számát (%1$d)</item>
</plurals>
<string name="description_post_media_no_description_placeholder">Nincs leírás</string>
<string name="description_visibility_public">Nyilvános</string>
<string name="description_visibility_private">Követők</string>
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/values-is/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,6 @@
<string name="conversation_1_recipients">%1$s</string>
<string name="conversation_2_recipients">%1$s og %2$s</string>
<string name="conversation_more_recipients">%1$s, %2$s og %3$d til viðbótar</string>
<plurals name="max_tab_number_reached">
<item quantity="one">hámarksfjölda %1$d flipa náð</item>
<item quantity="other">hámarksfjölda %1$d flipa náð</item>
</plurals>
<string name="description_post_media">Myndefni: %s</string>
<string name="description_post_cw">Aðvörun vegna efnis: %s</string>
<string name="description_post_media_no_description_placeholder">Engin lýsing</string>
Expand Down
Loading

0 comments on commit 369979a

Please sign in to comment.