Yuito-app-android/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt

1236 lines
51 KiB
Kotlin
Raw Normal View History

/* Copyright 2020 Tusky Contributors
*
* 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
import android.Manifest
import android.annotation.SuppressLint
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.content.pm.PackageManager
import android.content.res.ColorStateList
import android.graphics.Bitmap
import android.graphics.Color
import android.graphics.PorterDuff
import android.graphics.drawable.Animatable
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
2020-05-09 17:39:54 +02:00
import android.graphics.drawable.InsetDrawable
import android.net.Uri
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
2020-05-09 17:39:54 +02:00
import android.util.TypedValue
import android.view.KeyEvent
Add "Refresh" accessibility menu (#3121) * Add "Refresh" accessibility menu to TimelineFragment Per https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout the layout does not provide accessibility events, and a menu item should be provided as an alternative method for refreshing the content. In `TimelineFragment`: - Implement the `MenuProvider` interface so it can populate the action bar menu in activities that host the fragment - Create a "Refresh" menu item, and refresh the state when it is selected `MainActivity` has to change how the menu is created, so that fragments can add items to it. In `MainActivity`: - Call `setSupportActionBar` so `mainToolbar` participates in menus - Implement the `MenuProvider` interface, and move menu creation there - Set the title via supportActionBar * Never show the refresh item as a menubar action Per guidelines in https://developer.android.com/develop/ui/views/touch-and-input/swipe/add-swipe-interface#AddRefreshAction * Add "Refresh" menu item for AccountMediaFragment Also, fix the colour of the refresh progress indicator * Implement "Refresh" for AnnouncementsActivity * Add "Refresh" menu for ConversationsFragment * Keep the tabs adapter over the life of the viewpager Make `tabs` `var` instead of `val` in `MainPagerAdapter` so it can be updated when tabs change. Then detach the `tabLayoutMediator`, update the tabs, and call `notifyItemRangeChanged` in `setupTabs()`. This fixes a bug (not sure if it's this code, or in ViewPager2) where assigning a new adapter to the view pager seemed to result in a leak of one or more fragments. This wasn't user-visible, but it's a leak, and it becomes user-visible when fragments want to display menus. This also fixes two other bugs: 1. Be on the left-most tab. Scroll down a bit. Then modify the tabs at "Account preferences > tabs", but keep the left-most tab as-is. Then go back to MainActivity. Your reading position in the left-most tab has been jumped to the top. 2. Be on any non-left-most tab. Then modify the tab list by reordering tabs (adding/removing tabs is also OK). Then go back to MainActivity. Your tab selection has been overridden, and the left-most tab has been selected. Because the fragments are not destroyed unnecessarily your reading position is retained. And it remembers the tab you had selected, and as long as that tab is still present you will be returned to it, even if it's changed position in the list. Fixes https://github.com/tuskyapp/Tusky/issues/3251 * Add "Refresh" menu for ScheduledStatusActivity * Lint * Add "Refresh" menu for SearchFragment / SearchActivity * Explicitly set the searchview width Using "collapseActionView" requires the user to press "Back" twice to exit the activity, which is not acceptable. * Move toolbar handling in to ViewThreadActivity Previous code had the toolbar in the fragment's layout. Refactor to make consistent with other activities, and move the toolbar in to the activity layout. Implement MenuProvider in ViewThreadFragment to adjust the menu in the activity. * Add "Refresh" menu to ViewThreadFragment * Implement "Refresh" for ViewEditsFragment * Lint * Add "Refresh" menu to ReportStatusesFragment * Add "Refresh" menu to NotificationsFragment * Rename menu resource files Be consistent with the layout resource files, which have an activity/fragment prefix, then the lower_snake_case name of the activity or fragment it's for. * Only enable refresh menu if swiptorefresh is enabled Some timelines don't have swipetorefresh enabled (e.g., those shown on AccountActivity). In those cases don't add the refresh menu, rely on the hosting activity to provide it. Update AccountActivity to provide the refresh menu item.
2023-03-01 19:58:18 +01:00
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.view.WindowManager
import android.widget.ImageView
import androidx.activity.OnBackPressedCallback
2022-11-10 15:16:52 +01:00
import androidx.activity.viewModels
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.content.res.AppCompatResources
2020-05-09 17:39:54 +02:00
import androidx.appcompat.view.menu.MenuBuilder
import androidx.appcompat.widget.PopupMenu
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.core.content.pm.ShortcutManagerCompat
import androidx.core.view.GravityCompat
Add "Refresh" accessibility menu (#3121) * Add "Refresh" accessibility menu to TimelineFragment Per https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout the layout does not provide accessibility events, and a menu item should be provided as an alternative method for refreshing the content. In `TimelineFragment`: - Implement the `MenuProvider` interface so it can populate the action bar menu in activities that host the fragment - Create a "Refresh" menu item, and refresh the state when it is selected `MainActivity` has to change how the menu is created, so that fragments can add items to it. In `MainActivity`: - Call `setSupportActionBar` so `mainToolbar` participates in menus - Implement the `MenuProvider` interface, and move menu creation there - Set the title via supportActionBar * Never show the refresh item as a menubar action Per guidelines in https://developer.android.com/develop/ui/views/touch-and-input/swipe/add-swipe-interface#AddRefreshAction * Add "Refresh" menu item for AccountMediaFragment Also, fix the colour of the refresh progress indicator * Implement "Refresh" for AnnouncementsActivity * Add "Refresh" menu for ConversationsFragment * Keep the tabs adapter over the life of the viewpager Make `tabs` `var` instead of `val` in `MainPagerAdapter` so it can be updated when tabs change. Then detach the `tabLayoutMediator`, update the tabs, and call `notifyItemRangeChanged` in `setupTabs()`. This fixes a bug (not sure if it's this code, or in ViewPager2) where assigning a new adapter to the view pager seemed to result in a leak of one or more fragments. This wasn't user-visible, but it's a leak, and it becomes user-visible when fragments want to display menus. This also fixes two other bugs: 1. Be on the left-most tab. Scroll down a bit. Then modify the tabs at "Account preferences > tabs", but keep the left-most tab as-is. Then go back to MainActivity. Your reading position in the left-most tab has been jumped to the top. 2. Be on any non-left-most tab. Then modify the tab list by reordering tabs (adding/removing tabs is also OK). Then go back to MainActivity. Your tab selection has been overridden, and the left-most tab has been selected. Because the fragments are not destroyed unnecessarily your reading position is retained. And it remembers the tab you had selected, and as long as that tab is still present you will be returned to it, even if it's changed position in the list. Fixes https://github.com/tuskyapp/Tusky/issues/3251 * Add "Refresh" menu for ScheduledStatusActivity * Lint * Add "Refresh" menu for SearchFragment / SearchActivity * Explicitly set the searchview width Using "collapseActionView" requires the user to press "Back" twice to exit the activity, which is not acceptable. * Move toolbar handling in to ViewThreadActivity Previous code had the toolbar in the fragment's layout. Refactor to make consistent with other activities, and move the toolbar in to the activity layout. Implement MenuProvider in ViewThreadFragment to adjust the menu in the activity. * Add "Refresh" menu to ViewThreadFragment * Implement "Refresh" for ViewEditsFragment * Lint * Add "Refresh" menu to ReportStatusesFragment * Add "Refresh" menu to NotificationsFragment * Rename menu resource files Be consistent with the layout resource files, which have an activity/fragment prefix, then the lower_snake_case name of the activity or fragment it's for. * Only enable refresh menu if swiptorefresh is enabled Some timelines don't have swipetorefresh enabled (e.g., those shown on AccountActivity). In those cases don't add the refresh menu, rely on the hosting activity to provide it. Update AccountActivity to provide the refresh menu item.
2023-03-01 19:58:18 +01:00
import androidx.core.view.MenuProvider
import androidx.lifecycle.lifecycleScope
import androidx.preference.PreferenceManager
import androidx.viewpager2.widget.MarginPageTransformer
import at.connyduck.calladapter.networkresult.fold
import com.bumptech.glide.Glide
import com.bumptech.glide.RequestManager
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.target.CustomTarget
import com.bumptech.glide.request.target.FixedSizeDrawable
import com.bumptech.glide.request.transition.Transition
import com.google.android.material.color.MaterialColors
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayout.OnTabSelectedListener
import com.google.android.material.tabs.TabLayoutMediator
2021-06-28 22:04:34 +02:00
import com.keylesspalace.tusky.appstore.AnnouncementReadEvent
import com.keylesspalace.tusky.appstore.CacheUpdater
import com.keylesspalace.tusky.appstore.EventHub
import com.keylesspalace.tusky.appstore.MainTabsChangedEvent
import com.keylesspalace.tusky.appstore.PreferenceChangedEvent
2021-06-28 22:04:34 +02:00
import com.keylesspalace.tusky.appstore.ProfileEditedEvent
import com.keylesspalace.tusky.components.account.AccountActivity
import com.keylesspalace.tusky.components.accountlist.AccountListActivity
import com.keylesspalace.tusky.components.announcements.AnnouncementsActivity
import com.keylesspalace.tusky.components.compose.ComposeActivity
import com.keylesspalace.tusky.components.compose.ComposeActivity.Companion.canHandleMimeType
import com.keylesspalace.tusky.components.drafts.DraftsActivity
import com.keylesspalace.tusky.components.login.LoginActivity
import com.keylesspalace.tusky.components.notifications.NotificationHelper
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
import com.keylesspalace.tusky.components.notifications.NotificationsFragment
import com.keylesspalace.tusky.components.notifications.disableAllNotifications
import com.keylesspalace.tusky.components.notifications.enablePushNotificationsWithFallback
import com.keylesspalace.tusky.components.notifications.showMigrationNoticeIfNecessary
import com.keylesspalace.tusky.components.preference.PreferencesActivity
import com.keylesspalace.tusky.components.scheduled.ScheduledStatusActivity
import com.keylesspalace.tusky.components.search.SearchActivity
import com.keylesspalace.tusky.components.timeline.TimelineFragment
Add trending tags (#3149) * Add initial feature for viewing trending graphs. Currently only views hash tag trends. Contains API additions, tab additions and a set of trending components. * Add clickable system through a LinkListener. Duplicates a little code from SFragment. * Add accessibility description. * The background for the graph should match the background for black theme too. * Add error handling through a state flow system using existing code as an example. * Graphing: Use a primary and a secondary line. Remove under line fill. Apply line thickness. Dotted end of line. * Trending changes: New layout for trending: Cell. Use ViewBinding. Add padding to RecyclerView to stop the FAB from hiding content. Multiple bugs in GraphView resolved. Wide (landscape, for example) will show 4 columns, portrait will show 2. Remove unused base holder class. ViewModel invalidate scoping changed. Some renaming to variables made. For uses and accounts, use longs. These could be big numbers eventually. TagViewHolder renamed to TrendingTagViewHolder. * Trending changes: Remove old layout. Update cell textsizes and use proper string. Remove bad comment. * Trending changes: Refresh the main drawer when the tabs are edited. This will allow the trending item to toggle. * Trending changes: Add a trending activity to be able to view the trending data from the main drawer. * Trending changes: The title text should be changed to Trending Hashtags. * Trending changes: Add meta color to draw axis etc. Draw the date boundaries on the graph. Remove dates from each cell and place them in the list as a header. Graphs should be proportional to the highest historical value. Add a new interface to control whether the FAB should be visible (important when switching tabs, the state is lost). Add header to the adapter and viewdata structures. Add QOL extensions for getting the dates from history. * Trending changes: Refresh FAB through the main activity and FabFragment interface. Trending has no FAB. * Trending changes: Make graph proportional to the highest usage value. Fixes to the graph ratio calculations. * Trending changes: KtLintFix * Trending changes: Remove accidental build gradle change. Remove trending cases. Remove unused progress. Set drawer button addition explicitly to false, leaving the code there for future issue #3010. Remove unnecessary arguments for intent. Remove media preview preferences, there is nothing to preview. No padding between hashtag symbol and text. Do not ellipsize hashtags. * Trending changes: Use bottomsheet slide in animation helper for opening the hashtag intent. Remove explicit layout height from the XML and apply it to the view holder itself. The height was not being respected in XML. * Use some platform standards for styling - Align on an 8dp grid - Use android:attr for paddingStart and paddingEnd - Use textAppearanceListItem variants - Adjust constraints to handle different size containers * Correct lineWidth calculations Previous code didn't convert the value to pixels, so it was always displaying as a hairline stroke, irrespective of the value in the layout file. While I'm here, rename from lineThickness to lineWidth, to be consistent with parameters like strokeWidth. * Does not need to inherit from FabFragment * Rename to TrendingAdapter "Paging" in the adapter name is a misnomer here * Clean up comments, use full class name as tag * Simplify TrendingViewModel - Remove unncessary properties - Fetch tags and map in invalidate() - emptyList() instead of listOf() for clarity * Remove line dividers, use X-axis to separate content Experiment with UI -- instead of dividers between each item, draw an explicit x-axis for each chart, and add a little more vertical padding, to see if that provides a cleaner separation between the content * Adjust date format - Show day and year - Use platform attributes for size * Locale-aware format of numbers Format numbers < 100,000 by inserting locale-aware separators. Numbers larger are scaled and have K, M, G, ... etc suffix appended. * Prevent a crash if viewData is empty Don't access viewData without first checking if it's empty. This can be the case if the server returned an empty list for some reason, or the data has been filtered. * Filter out tags the user has filtered from their home timeline Invalidate the list if the user's preferences change, as that may indicate they've changed their filters. * Experiment with alternative layout * Set chart height to 160dp to align to an 8dp grid * Draw ticks that are 5% the height of the x-axis * Legend adjustments - Use tuskyblue for the ticks - Wrap legend components in a layout so they can have a dedicated background - Use a 60% transparent background for the legend to retain legibility if lines go under it * Bezier curves, shorter cell height * More tweaks - List tags in order of popularity, most popular first - Make it clear that uses/accounts in the legend are totals, not current - Show current values at end of the chart * Hide FAB * Fix crash, it's not always hosted in an ActionButtonActivity * Arrange totals vertically in landscape layout * Always add the Trending drawer menu if it's not a tab * Revert unrelated whitespace changes * One more whitespace revert --------- Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-02-14 19:52:11 +01:00
import com.keylesspalace.tusky.components.trending.TrendingActivity
import com.keylesspalace.tusky.databinding.ActivityMainBinding
import com.keylesspalace.tusky.db.AccountEntity
import com.keylesspalace.tusky.db.DraftsAlert
import com.keylesspalace.tusky.di.ViewModelFactory
import com.keylesspalace.tusky.entity.Account
import com.keylesspalace.tusky.entity.Notification
import com.keylesspalace.tusky.interfaces.AccountSelectionListener
import com.keylesspalace.tusky.interfaces.ActionButtonActivity
Add trending tags (#3149) * Add initial feature for viewing trending graphs. Currently only views hash tag trends. Contains API additions, tab additions and a set of trending components. * Add clickable system through a LinkListener. Duplicates a little code from SFragment. * Add accessibility description. * The background for the graph should match the background for black theme too. * Add error handling through a state flow system using existing code as an example. * Graphing: Use a primary and a secondary line. Remove under line fill. Apply line thickness. Dotted end of line. * Trending changes: New layout for trending: Cell. Use ViewBinding. Add padding to RecyclerView to stop the FAB from hiding content. Multiple bugs in GraphView resolved. Wide (landscape, for example) will show 4 columns, portrait will show 2. Remove unused base holder class. ViewModel invalidate scoping changed. Some renaming to variables made. For uses and accounts, use longs. These could be big numbers eventually. TagViewHolder renamed to TrendingTagViewHolder. * Trending changes: Remove old layout. Update cell textsizes and use proper string. Remove bad comment. * Trending changes: Refresh the main drawer when the tabs are edited. This will allow the trending item to toggle. * Trending changes: Add a trending activity to be able to view the trending data from the main drawer. * Trending changes: The title text should be changed to Trending Hashtags. * Trending changes: Add meta color to draw axis etc. Draw the date boundaries on the graph. Remove dates from each cell and place them in the list as a header. Graphs should be proportional to the highest historical value. Add a new interface to control whether the FAB should be visible (important when switching tabs, the state is lost). Add header to the adapter and viewdata structures. Add QOL extensions for getting the dates from history. * Trending changes: Refresh FAB through the main activity and FabFragment interface. Trending has no FAB. * Trending changes: Make graph proportional to the highest usage value. Fixes to the graph ratio calculations. * Trending changes: KtLintFix * Trending changes: Remove accidental build gradle change. Remove trending cases. Remove unused progress. Set drawer button addition explicitly to false, leaving the code there for future issue #3010. Remove unnecessary arguments for intent. Remove media preview preferences, there is nothing to preview. No padding between hashtag symbol and text. Do not ellipsize hashtags. * Trending changes: Use bottomsheet slide in animation helper for opening the hashtag intent. Remove explicit layout height from the XML and apply it to the view holder itself. The height was not being respected in XML. * Use some platform standards for styling - Align on an 8dp grid - Use android:attr for paddingStart and paddingEnd - Use textAppearanceListItem variants - Adjust constraints to handle different size containers * Correct lineWidth calculations Previous code didn't convert the value to pixels, so it was always displaying as a hairline stroke, irrespective of the value in the layout file. While I'm here, rename from lineThickness to lineWidth, to be consistent with parameters like strokeWidth. * Does not need to inherit from FabFragment * Rename to TrendingAdapter "Paging" in the adapter name is a misnomer here * Clean up comments, use full class name as tag * Simplify TrendingViewModel - Remove unncessary properties - Fetch tags and map in invalidate() - emptyList() instead of listOf() for clarity * Remove line dividers, use X-axis to separate content Experiment with UI -- instead of dividers between each item, draw an explicit x-axis for each chart, and add a little more vertical padding, to see if that provides a cleaner separation between the content * Adjust date format - Show day and year - Use platform attributes for size * Locale-aware format of numbers Format numbers < 100,000 by inserting locale-aware separators. Numbers larger are scaled and have K, M, G, ... etc suffix appended. * Prevent a crash if viewData is empty Don't access viewData without first checking if it's empty. This can be the case if the server returned an empty list for some reason, or the data has been filtered. * Filter out tags the user has filtered from their home timeline Invalidate the list if the user's preferences change, as that may indicate they've changed their filters. * Experiment with alternative layout * Set chart height to 160dp to align to an 8dp grid * Draw ticks that are 5% the height of the x-axis * Legend adjustments - Use tuskyblue for the ticks - Wrap legend components in a layout so they can have a dedicated background - Use a 60% transparent background for the legend to retain legibility if lines go under it * Bezier curves, shorter cell height * More tweaks - List tags in order of popularity, most popular first - Make it clear that uses/accounts in the legend are totals, not current - Show current values at end of the chart * Hide FAB * Fix crash, it's not always hosted in an ActionButtonActivity * Arrange totals vertically in landscape layout * Always add the Trending drawer menu if it's not a tab * Revert unrelated whitespace changes * One more whitespace revert --------- Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-02-14 19:52:11 +01:00
import com.keylesspalace.tusky.interfaces.FabFragment
import com.keylesspalace.tusky.interfaces.ReselectableFragment
2021-07-25 17:10:48 +02:00
import com.keylesspalace.tusky.interfaces.ResettableFragment
import com.keylesspalace.tusky.pager.MainPagerAdapter
2020-08-16 10:01:51 +02:00
import com.keylesspalace.tusky.settings.PrefKeys
Keep scroll position when loading missing statuses (#3000) * Change "Load more" to load oldest statuses first in home timeline Previous behaviour loaded missing statuses by using "since_id" and "max_id". This loads the most recent N statuses, looking backwards from "max_id". Change to load the oldest statuses first, assuming the user is scrolling up through the timeline and will want to load statuses in reverse chronological order. * Scroll to the bottom of new entries added by "Load more" - Remember the position of the "Load more" placeholder - Check the position of inserted entries - If they match, scroll to the bottom * Change "Load more" to load oldest statuses first in home timeline Previous behaviour loaded missing statuses by using "since_id" and "max_id". This loads the most recent N statuses, looking backwards from "max_id". Change to load the oldest statuses first, assuming the user is scrolling up through the timeline and will want to load statuses in reverse chronological order. * Scroll to the bottom of new entries added by "Load more" - Remember the position of the "Load more" placeholder - Check the position of inserted entries - If they match, scroll to the bottom * Ensure the user can't have two simultaneous "Load more" coroutines Having two simultanous coroutines would break the calculation used to figure out which item in the list to scroll to after a "Load more" in the timeline. Do this by: - Creating a TimelineUiState and associated flow that tracks the "Load more" state - Updating this in the (Cached|Network)TimelineViewModel - Listening for changes to it in TimelineFragment, and notifying the adapter - The adapter will disable any placeholder views while "Load more" is active * Revert changes that loaded the oldest statuses instead of the newest * Be more robust about locating the status to scroll to Weirdness with the PagingData library meant that positionStart could still be wrong after "Load more" was clicked. Instead, remember the position of the "Load more" item and the ID of the status immediately after it. When new items are added, search for the remembered status at the position of the "Load more" item. This is quick, testing at most LOAD_AT_ONCE items in the adapter. If the remembered status is not visible on screen then scroll to it. * Lint * Add a preference to specify the reading order Default behaviour (oldest first) is for "load more" to load statuses and stay at the oldest of the new statuses. Alternative behaviour (if the user is reading from top to bottom) is to stay at the newest of the new statuses. * Move ReadingOrder enum construction logic in to the enum * Jump to top if swipe/refresh while preferring newest-first order * Show a circular progress spinner during "Load more" operations Remove a dedicated view, and use an icon on the button instead. Adjust the placeholder attributes and styles accordingly. * Remove the "loadMoreActive" property Complicates the code and doesn't really achieve the desired effect. If the user wants to tap multiple "Load more" buttons they can. * Update comments in TimelineFragment * Respect the user's reading order preference if it changes * Add developer tools This is for functionality that makes it easier for developers to interact with the app, or get it in to a known-state. These features are for use by users, so are only visible in debug builds. * Adjust how content is loaded based on preferred reading order - Add the readingOrder to TimelineViewModel so derived classes can use it. - Update the homeTimeline API to support the `minId` parameter and update calls in NetworkTimelineViewModel In CachedTimelineViewModel: - Set the bounds of the load to be the status IDs on either side of the placeholder ID (update TimelineDao with a new query for this) - Load statuses using either minId or sinceId depending on the reading order - Is there was no overlap then insert the new placeholder at the start/end of the list depending on reading order * Lint * Rename unused dialog parameter to _ * Update API arguments in tests * Simplify ReadingOrder preference handling * Fix bug with Placeholder and the "expanded" property If a status is a Placeholder the "expanded" propery is used to indicate whether or not it is loading. replaceStatusRange() set this property based on the old value, and the user's alwaysOpenSpoiler preference setting. This shouldn't have been used if the status is a Placeholder, as it can lead to incorrect loading states. Fix this. While I'm here, introduce an explicit computed property for whether a TimelineStatusEntity is a placeholder, and use that for code clarity. * Set the "Load more" button background to transparent * Fix typo. * Inline spec, update comment * Revert 1480c6aa3ac5c0c2d362fb271f47ea2259ab14e2 Turns out the behaviour is not desired. * Remove unnecessary Log call * Extract function * Change default to newest first
2023-01-13 19:26:24 +01:00
import com.keylesspalace.tusky.usecase.DeveloperToolsUseCase
import com.keylesspalace.tusky.usecase.LogoutUsecase
2021-06-28 22:04:34 +02:00
import com.keylesspalace.tusky.util.deleteStaleCachedMedia
import com.keylesspalace.tusky.util.emojify
import com.keylesspalace.tusky.util.getDimension
2021-06-28 22:04:34 +02:00
import com.keylesspalace.tusky.util.hide
import com.keylesspalace.tusky.util.reduceSwipeSensitivity
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # app/build.gradle # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/MediaUploader.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/NetworkModule.kt # app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/util/ThemeUtils.java # app/src/main/res/layout/item_status_detailed.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/strings.xml # fastlane/metadata/android/sv/changelogs/74.txt # fastlane/metadata/android/tr/changelogs/58.txt # gradle/libs.versions.toml
2023-01-25 00:46:02 +01:00
import com.keylesspalace.tusky.util.setDrawableTint
import com.keylesspalace.tusky.util.show
import com.keylesspalace.tusky.util.unsafeLazy
2021-06-28 22:04:34 +02:00
import com.keylesspalace.tusky.util.updateShortcut
import com.keylesspalace.tusky.util.viewBinding
import com.keylesspalace.tusky.util.visible
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
import com.mikepenz.iconics.utils.colorInt
import com.mikepenz.iconics.utils.sizeDp
import com.mikepenz.materialdrawer.holder.BadgeStyle
import com.mikepenz.materialdrawer.holder.ColorHolder
import com.mikepenz.materialdrawer.holder.StringHolder
import com.mikepenz.materialdrawer.iconics.iconicsIcon
2021-06-28 22:04:34 +02:00
import com.mikepenz.materialdrawer.model.AbstractDrawerItem
import com.mikepenz.materialdrawer.model.DividerDrawerItem
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem
import com.mikepenz.materialdrawer.model.ProfileDrawerItem
import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.IProfile
import com.mikepenz.materialdrawer.model.interfaces.descriptionRes
import com.mikepenz.materialdrawer.model.interfaces.descriptionText
import com.mikepenz.materialdrawer.model.interfaces.iconRes
import com.mikepenz.materialdrawer.model.interfaces.iconUrl
import com.mikepenz.materialdrawer.model.interfaces.nameRes
import com.mikepenz.materialdrawer.model.interfaces.nameText
import com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader
import com.mikepenz.materialdrawer.util.DrawerImageLoader
import com.mikepenz.materialdrawer.util.addItems
import com.mikepenz.materialdrawer.util.addItemsAtPosition
import com.mikepenz.materialdrawer.util.addStickyDrawerItems
2021-06-28 22:04:34 +02:00
import com.mikepenz.materialdrawer.util.updateBadge
import com.mikepenz.materialdrawer.widget.AccountHeaderView
import dagger.android.DispatchingAndroidInjector
import dagger.android.HasAndroidInjector
import de.c1710.filemojicompat_ui.helpers.EMOJI_PREFERENCE
import io.reactivex.rxjava3.schedulers.Schedulers
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
import kotlinx.coroutines.job
import kotlinx.coroutines.launch
import net.accelf.yuito.FooterDrawerItem
import net.accelf.yuito.QuickTootViewModel
2022-01-24 19:32:57 +01:00
import net.accelf.yuito.streaming.StreamingManager
import javax.inject.Inject
Add "Refresh" accessibility menu (#3121) * Add "Refresh" accessibility menu to TimelineFragment Per https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout the layout does not provide accessibility events, and a menu item should be provided as an alternative method for refreshing the content. In `TimelineFragment`: - Implement the `MenuProvider` interface so it can populate the action bar menu in activities that host the fragment - Create a "Refresh" menu item, and refresh the state when it is selected `MainActivity` has to change how the menu is created, so that fragments can add items to it. In `MainActivity`: - Call `setSupportActionBar` so `mainToolbar` participates in menus - Implement the `MenuProvider` interface, and move menu creation there - Set the title via supportActionBar * Never show the refresh item as a menubar action Per guidelines in https://developer.android.com/develop/ui/views/touch-and-input/swipe/add-swipe-interface#AddRefreshAction * Add "Refresh" menu item for AccountMediaFragment Also, fix the colour of the refresh progress indicator * Implement "Refresh" for AnnouncementsActivity * Add "Refresh" menu for ConversationsFragment * Keep the tabs adapter over the life of the viewpager Make `tabs` `var` instead of `val` in `MainPagerAdapter` so it can be updated when tabs change. Then detach the `tabLayoutMediator`, update the tabs, and call `notifyItemRangeChanged` in `setupTabs()`. This fixes a bug (not sure if it's this code, or in ViewPager2) where assigning a new adapter to the view pager seemed to result in a leak of one or more fragments. This wasn't user-visible, but it's a leak, and it becomes user-visible when fragments want to display menus. This also fixes two other bugs: 1. Be on the left-most tab. Scroll down a bit. Then modify the tabs at "Account preferences > tabs", but keep the left-most tab as-is. Then go back to MainActivity. Your reading position in the left-most tab has been jumped to the top. 2. Be on any non-left-most tab. Then modify the tab list by reordering tabs (adding/removing tabs is also OK). Then go back to MainActivity. Your tab selection has been overridden, and the left-most tab has been selected. Because the fragments are not destroyed unnecessarily your reading position is retained. And it remembers the tab you had selected, and as long as that tab is still present you will be returned to it, even if it's changed position in the list. Fixes https://github.com/tuskyapp/Tusky/issues/3251 * Add "Refresh" menu for ScheduledStatusActivity * Lint * Add "Refresh" menu for SearchFragment / SearchActivity * Explicitly set the searchview width Using "collapseActionView" requires the user to press "Back" twice to exit the activity, which is not acceptable. * Move toolbar handling in to ViewThreadActivity Previous code had the toolbar in the fragment's layout. Refactor to make consistent with other activities, and move the toolbar in to the activity layout. Implement MenuProvider in ViewThreadFragment to adjust the menu in the activity. * Add "Refresh" menu to ViewThreadFragment * Implement "Refresh" for ViewEditsFragment * Lint * Add "Refresh" menu to ReportStatusesFragment * Add "Refresh" menu to NotificationsFragment * Rename menu resource files Be consistent with the layout resource files, which have an activity/fragment prefix, then the lower_snake_case name of the activity or fragment it's for. * Only enable refresh menu if swiptorefresh is enabled Some timelines don't have swipetorefresh enabled (e.g., those shown on AccountActivity). In those cases don't add the refresh menu, rely on the hosting activity to provide it. Update AccountActivity to provide the refresh menu item.
2023-03-01 19:58:18 +01:00
class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInjector, MenuProvider {
@Inject
lateinit var androidInjector: DispatchingAndroidInjector<Any>
@Inject
lateinit var eventHub: EventHub
@Inject
lateinit var cacheUpdater: CacheUpdater
@Inject
lateinit var logoutUsecase: LogoutUsecase
@Inject
lateinit var draftsAlert: DraftsAlert
Keep scroll position when loading missing statuses (#3000) * Change "Load more" to load oldest statuses first in home timeline Previous behaviour loaded missing statuses by using "since_id" and "max_id". This loads the most recent N statuses, looking backwards from "max_id". Change to load the oldest statuses first, assuming the user is scrolling up through the timeline and will want to load statuses in reverse chronological order. * Scroll to the bottom of new entries added by "Load more" - Remember the position of the "Load more" placeholder - Check the position of inserted entries - If they match, scroll to the bottom * Change "Load more" to load oldest statuses first in home timeline Previous behaviour loaded missing statuses by using "since_id" and "max_id". This loads the most recent N statuses, looking backwards from "max_id". Change to load the oldest statuses first, assuming the user is scrolling up through the timeline and will want to load statuses in reverse chronological order. * Scroll to the bottom of new entries added by "Load more" - Remember the position of the "Load more" placeholder - Check the position of inserted entries - If they match, scroll to the bottom * Ensure the user can't have two simultaneous "Load more" coroutines Having two simultanous coroutines would break the calculation used to figure out which item in the list to scroll to after a "Load more" in the timeline. Do this by: - Creating a TimelineUiState and associated flow that tracks the "Load more" state - Updating this in the (Cached|Network)TimelineViewModel - Listening for changes to it in TimelineFragment, and notifying the adapter - The adapter will disable any placeholder views while "Load more" is active * Revert changes that loaded the oldest statuses instead of the newest * Be more robust about locating the status to scroll to Weirdness with the PagingData library meant that positionStart could still be wrong after "Load more" was clicked. Instead, remember the position of the "Load more" item and the ID of the status immediately after it. When new items are added, search for the remembered status at the position of the "Load more" item. This is quick, testing at most LOAD_AT_ONCE items in the adapter. If the remembered status is not visible on screen then scroll to it. * Lint * Add a preference to specify the reading order Default behaviour (oldest first) is for "load more" to load statuses and stay at the oldest of the new statuses. Alternative behaviour (if the user is reading from top to bottom) is to stay at the newest of the new statuses. * Move ReadingOrder enum construction logic in to the enum * Jump to top if swipe/refresh while preferring newest-first order * Show a circular progress spinner during "Load more" operations Remove a dedicated view, and use an icon on the button instead. Adjust the placeholder attributes and styles accordingly. * Remove the "loadMoreActive" property Complicates the code and doesn't really achieve the desired effect. If the user wants to tap multiple "Load more" buttons they can. * Update comments in TimelineFragment * Respect the user's reading order preference if it changes * Add developer tools This is for functionality that makes it easier for developers to interact with the app, or get it in to a known-state. These features are for use by users, so are only visible in debug builds. * Adjust how content is loaded based on preferred reading order - Add the readingOrder to TimelineViewModel so derived classes can use it. - Update the homeTimeline API to support the `minId` parameter and update calls in NetworkTimelineViewModel In CachedTimelineViewModel: - Set the bounds of the load to be the status IDs on either side of the placeholder ID (update TimelineDao with a new query for this) - Load statuses using either minId or sinceId depending on the reading order - Is there was no overlap then insert the new placeholder at the start/end of the list depending on reading order * Lint * Rename unused dialog parameter to _ * Update API arguments in tests * Simplify ReadingOrder preference handling * Fix bug with Placeholder and the "expanded" property If a status is a Placeholder the "expanded" propery is used to indicate whether or not it is loading. replaceStatusRange() set this property based on the old value, and the user's alwaysOpenSpoiler preference setting. This shouldn't have been used if the status is a Placeholder, as it can lead to incorrect loading states. Fix this. While I'm here, introduce an explicit computed property for whether a TimelineStatusEntity is a placeholder, and use that for code clarity. * Set the "Load more" button background to transparent * Fix typo. * Inline spec, update comment * Revert 1480c6aa3ac5c0c2d362fb271f47ea2259ab14e2 Turns out the behaviour is not desired. * Remove unnecessary Log call * Extract function * Change default to newest first
2023-01-13 19:26:24 +01:00
@Inject
lateinit var developerToolsUseCase: DeveloperToolsUseCase
@Inject
lateinit var viewModelFactory: ViewModelFactory
2022-01-24 19:32:57 +01:00
@Inject
lateinit var streamingManager: StreamingManager
private val binding by viewBinding(ActivityMainBinding::inflate)
private val quickTootViewModel: QuickTootViewModel by viewModels { viewModelFactory }
private lateinit var header: AccountHeaderView
private var notificationTabPosition = 0
private var onTabSelectedListener: OnTabSelectedListener? = null
private var unreadAnnouncementsCount = 0
private val preferences by unsafeLazy { PreferenceManager.getDefaultSharedPreferences(this) }
2020-08-16 10:01:51 +02:00
private lateinit var glide: RequestManager
private var accountLocked: Boolean = false
// We need to know if the emoji pack has been changed
private var selectedEmojiPack: String? = null
/** Mediate between binding.viewPager and the chosen tab layout */
private var tabLayoutMediator: TabLayoutMediator? = null
/** Adapter for the different timeline tabs */
private lateinit var tabAdapter: MainPagerAdapter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val activeAccount = accountManager.activeAccount
?: return // will be redirected to LoginActivity by BaseActivity
var showNotificationTab = false
if (intent != null) {
/** there are two possibilities the accountId can be passed to MainActivity:
* - from our code as long 'account_id'
* - from share shortcuts as String 'android.intent.extra.shortcut.ID'
*/
var accountId = intent.getLongExtra(NotificationHelper.ACCOUNT_ID, -1)
if (accountId == -1L) {
val accountIdString = intent.getStringExtra(ShortcutManagerCompat.EXTRA_SHORTCUT_ID)
if (accountIdString != null) {
accountId = accountIdString.toLong()
}
}
val accountRequested = accountId != -1L
if (accountRequested && accountId != activeAccount.id) {
accountManager.setActiveAccount(accountId)
}
val openDrafts = intent.getBooleanExtra(OPEN_DRAFTS, false)
if (canHandleMimeType(intent.type)) {
// Sharing to Tusky from an external app
if (accountRequested) {
// The correct account is already active
forwardShare(intent)
} else {
// No account was provided, show the chooser
2021-06-28 22:04:34 +02:00
showAccountChooserDialog(
getString(R.string.action_share_as),
true,
2021-06-28 22:04:34 +02:00
object : AccountSelectionListener {
override fun onAccountSelected(account: AccountEntity) {
val requestedId = account.id
if (requestedId == activeAccount.id) {
// The correct account is already active
forwardShare(intent)
} else {
// A different account was requested, restart the activity
intent.putExtra(NotificationHelper.ACCOUNT_ID, requestedId)
changeAccount(requestedId, intent)
}
}
}
2021-06-28 22:04:34 +02:00
)
}
} else if (openDrafts) {
val intent = DraftsActivity.newIntent(this)
startActivity(intent)
} else if (accountRequested && savedInstanceState == null) {
// user clicked a notification, show follow requests for type FOLLOW_REQUEST,
// otherwise show notification tab
if (intent.getStringExtra(NotificationHelper.TYPE) == Notification.Type.FOLLOW_REQUEST.name) {
val intent = AccountListActivity.newIntent(this, AccountListActivity.Type.FOLLOW_REQUESTS, accountLocked = true)
startActivityWithSlideInAnimation(intent)
} else {
showNotificationTab = true
}
}
}
window.statusBarColor = Color.TRANSPARENT // don't draw a status bar, the DrawerLayout and the MaterialDrawerLayout have their own
setContentView(binding.root)
Add "Refresh" accessibility menu (#3121) * Add "Refresh" accessibility menu to TimelineFragment Per https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout the layout does not provide accessibility events, and a menu item should be provided as an alternative method for refreshing the content. In `TimelineFragment`: - Implement the `MenuProvider` interface so it can populate the action bar menu in activities that host the fragment - Create a "Refresh" menu item, and refresh the state when it is selected `MainActivity` has to change how the menu is created, so that fragments can add items to it. In `MainActivity`: - Call `setSupportActionBar` so `mainToolbar` participates in menus - Implement the `MenuProvider` interface, and move menu creation there - Set the title via supportActionBar * Never show the refresh item as a menubar action Per guidelines in https://developer.android.com/develop/ui/views/touch-and-input/swipe/add-swipe-interface#AddRefreshAction * Add "Refresh" menu item for AccountMediaFragment Also, fix the colour of the refresh progress indicator * Implement "Refresh" for AnnouncementsActivity * Add "Refresh" menu for ConversationsFragment * Keep the tabs adapter over the life of the viewpager Make `tabs` `var` instead of `val` in `MainPagerAdapter` so it can be updated when tabs change. Then detach the `tabLayoutMediator`, update the tabs, and call `notifyItemRangeChanged` in `setupTabs()`. This fixes a bug (not sure if it's this code, or in ViewPager2) where assigning a new adapter to the view pager seemed to result in a leak of one or more fragments. This wasn't user-visible, but it's a leak, and it becomes user-visible when fragments want to display menus. This also fixes two other bugs: 1. Be on the left-most tab. Scroll down a bit. Then modify the tabs at "Account preferences > tabs", but keep the left-most tab as-is. Then go back to MainActivity. Your reading position in the left-most tab has been jumped to the top. 2. Be on any non-left-most tab. Then modify the tab list by reordering tabs (adding/removing tabs is also OK). Then go back to MainActivity. Your tab selection has been overridden, and the left-most tab has been selected. Because the fragments are not destroyed unnecessarily your reading position is retained. And it remembers the tab you had selected, and as long as that tab is still present you will be returned to it, even if it's changed position in the list. Fixes https://github.com/tuskyapp/Tusky/issues/3251 * Add "Refresh" menu for ScheduledStatusActivity * Lint * Add "Refresh" menu for SearchFragment / SearchActivity * Explicitly set the searchview width Using "collapseActionView" requires the user to press "Back" twice to exit the activity, which is not acceptable. * Move toolbar handling in to ViewThreadActivity Previous code had the toolbar in the fragment's layout. Refactor to make consistent with other activities, and move the toolbar in to the activity layout. Implement MenuProvider in ViewThreadFragment to adjust the menu in the activity. * Add "Refresh" menu to ViewThreadFragment * Implement "Refresh" for ViewEditsFragment * Lint * Add "Refresh" menu to ReportStatusesFragment * Add "Refresh" menu to NotificationsFragment * Rename menu resource files Be consistent with the layout resource files, which have an activity/fragment prefix, then the lower_snake_case name of the activity or fragment it's for. * Only enable refresh menu if swiptorefresh is enabled Some timelines don't have swipetorefresh enabled (e.g., those shown on AccountActivity). In those cases don't add the refresh menu, rely on the hosting activity to provide it. Update AccountActivity to provide the refresh menu item.
2023-03-01 19:58:18 +01:00
setSupportActionBar(binding.mainToolbar)
glide = Glide.with(this)
binding.viewQuickToot.attachViewModel(quickTootViewModel, this)
binding.composeButton.setOnClickListener(binding.viewQuickToot::onFABClicked)
2020-08-16 10:01:51 +02:00
val hideTopToolbar = preferences.getBoolean(PrefKeys.HIDE_TOP_TOOLBAR, false)
binding.mainToolbar.visible(!hideTopToolbar)
2020-08-16 10:01:51 +02:00
loadDrawerAvatar(activeAccount.profilePictureUrl, true)
Add "Refresh" accessibility menu (#3121) * Add "Refresh" accessibility menu to TimelineFragment Per https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout the layout does not provide accessibility events, and a menu item should be provided as an alternative method for refreshing the content. In `TimelineFragment`: - Implement the `MenuProvider` interface so it can populate the action bar menu in activities that host the fragment - Create a "Refresh" menu item, and refresh the state when it is selected `MainActivity` has to change how the menu is created, so that fragments can add items to it. In `MainActivity`: - Call `setSupportActionBar` so `mainToolbar` participates in menus - Implement the `MenuProvider` interface, and move menu creation there - Set the title via supportActionBar * Never show the refresh item as a menubar action Per guidelines in https://developer.android.com/develop/ui/views/touch-and-input/swipe/add-swipe-interface#AddRefreshAction * Add "Refresh" menu item for AccountMediaFragment Also, fix the colour of the refresh progress indicator * Implement "Refresh" for AnnouncementsActivity * Add "Refresh" menu for ConversationsFragment * Keep the tabs adapter over the life of the viewpager Make `tabs` `var` instead of `val` in `MainPagerAdapter` so it can be updated when tabs change. Then detach the `tabLayoutMediator`, update the tabs, and call `notifyItemRangeChanged` in `setupTabs()`. This fixes a bug (not sure if it's this code, or in ViewPager2) where assigning a new adapter to the view pager seemed to result in a leak of one or more fragments. This wasn't user-visible, but it's a leak, and it becomes user-visible when fragments want to display menus. This also fixes two other bugs: 1. Be on the left-most tab. Scroll down a bit. Then modify the tabs at "Account preferences > tabs", but keep the left-most tab as-is. Then go back to MainActivity. Your reading position in the left-most tab has been jumped to the top. 2. Be on any non-left-most tab. Then modify the tab list by reordering tabs (adding/removing tabs is also OK). Then go back to MainActivity. Your tab selection has been overridden, and the left-most tab has been selected. Because the fragments are not destroyed unnecessarily your reading position is retained. And it remembers the tab you had selected, and as long as that tab is still present you will be returned to it, even if it's changed position in the list. Fixes https://github.com/tuskyapp/Tusky/issues/3251 * Add "Refresh" menu for ScheduledStatusActivity * Lint * Add "Refresh" menu for SearchFragment / SearchActivity * Explicitly set the searchview width Using "collapseActionView" requires the user to press "Back" twice to exit the activity, which is not acceptable. * Move toolbar handling in to ViewThreadActivity Previous code had the toolbar in the fragment's layout. Refactor to make consistent with other activities, and move the toolbar in to the activity layout. Implement MenuProvider in ViewThreadFragment to adjust the menu in the activity. * Add "Refresh" menu to ViewThreadFragment * Implement "Refresh" for ViewEditsFragment * Lint * Add "Refresh" menu to ReportStatusesFragment * Add "Refresh" menu to NotificationsFragment * Rename menu resource files Be consistent with the layout resource files, which have an activity/fragment prefix, then the lower_snake_case name of the activity or fragment it's for. * Only enable refresh menu if swiptorefresh is enabled Some timelines don't have swipetorefresh enabled (e.g., those shown on AccountActivity). In those cases don't add the refresh menu, rely on the hosting activity to provide it. Update AccountActivity to provide the refresh menu item.
2023-03-01 19:58:18 +01:00
addMenuProvider(this)
binding.viewPager.reduceSwipeSensitivity()
Add trending tags (#3149) * Add initial feature for viewing trending graphs. Currently only views hash tag trends. Contains API additions, tab additions and a set of trending components. * Add clickable system through a LinkListener. Duplicates a little code from SFragment. * Add accessibility description. * The background for the graph should match the background for black theme too. * Add error handling through a state flow system using existing code as an example. * Graphing: Use a primary and a secondary line. Remove under line fill. Apply line thickness. Dotted end of line. * Trending changes: New layout for trending: Cell. Use ViewBinding. Add padding to RecyclerView to stop the FAB from hiding content. Multiple bugs in GraphView resolved. Wide (landscape, for example) will show 4 columns, portrait will show 2. Remove unused base holder class. ViewModel invalidate scoping changed. Some renaming to variables made. For uses and accounts, use longs. These could be big numbers eventually. TagViewHolder renamed to TrendingTagViewHolder. * Trending changes: Remove old layout. Update cell textsizes and use proper string. Remove bad comment. * Trending changes: Refresh the main drawer when the tabs are edited. This will allow the trending item to toggle. * Trending changes: Add a trending activity to be able to view the trending data from the main drawer. * Trending changes: The title text should be changed to Trending Hashtags. * Trending changes: Add meta color to draw axis etc. Draw the date boundaries on the graph. Remove dates from each cell and place them in the list as a header. Graphs should be proportional to the highest historical value. Add a new interface to control whether the FAB should be visible (important when switching tabs, the state is lost). Add header to the adapter and viewdata structures. Add QOL extensions for getting the dates from history. * Trending changes: Refresh FAB through the main activity and FabFragment interface. Trending has no FAB. * Trending changes: Make graph proportional to the highest usage value. Fixes to the graph ratio calculations. * Trending changes: KtLintFix * Trending changes: Remove accidental build gradle change. Remove trending cases. Remove unused progress. Set drawer button addition explicitly to false, leaving the code there for future issue #3010. Remove unnecessary arguments for intent. Remove media preview preferences, there is nothing to preview. No padding between hashtag symbol and text. Do not ellipsize hashtags. * Trending changes: Use bottomsheet slide in animation helper for opening the hashtag intent. Remove explicit layout height from the XML and apply it to the view holder itself. The height was not being respected in XML. * Use some platform standards for styling - Align on an 8dp grid - Use android:attr for paddingStart and paddingEnd - Use textAppearanceListItem variants - Adjust constraints to handle different size containers * Correct lineWidth calculations Previous code didn't convert the value to pixels, so it was always displaying as a hairline stroke, irrespective of the value in the layout file. While I'm here, rename from lineThickness to lineWidth, to be consistent with parameters like strokeWidth. * Does not need to inherit from FabFragment * Rename to TrendingAdapter "Paging" in the adapter name is a misnomer here * Clean up comments, use full class name as tag * Simplify TrendingViewModel - Remove unncessary properties - Fetch tags and map in invalidate() - emptyList() instead of listOf() for clarity * Remove line dividers, use X-axis to separate content Experiment with UI -- instead of dividers between each item, draw an explicit x-axis for each chart, and add a little more vertical padding, to see if that provides a cleaner separation between the content * Adjust date format - Show day and year - Use platform attributes for size * Locale-aware format of numbers Format numbers < 100,000 by inserting locale-aware separators. Numbers larger are scaled and have K, M, G, ... etc suffix appended. * Prevent a crash if viewData is empty Don't access viewData without first checking if it's empty. This can be the case if the server returned an empty list for some reason, or the data has been filtered. * Filter out tags the user has filtered from their home timeline Invalidate the list if the user's preferences change, as that may indicate they've changed their filters. * Experiment with alternative layout * Set chart height to 160dp to align to an 8dp grid * Draw ticks that are 5% the height of the x-axis * Legend adjustments - Use tuskyblue for the ticks - Wrap legend components in a layout so they can have a dedicated background - Use a 60% transparent background for the legend to retain legibility if lines go under it * Bezier curves, shorter cell height * More tweaks - List tags in order of popularity, most popular first - Make it clear that uses/accounts in the legend are totals, not current - Show current values at end of the chart * Hide FAB * Fix crash, it's not always hosted in an ActionButtonActivity * Arrange totals vertically in landscape layout * Always add the Trending drawer menu if it's not a tab * Revert unrelated whitespace changes * One more whitespace revert --------- Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-02-14 19:52:11 +01:00
setupDrawer(
savedInstanceState,
addSearchButton = hideTopToolbar,
addTrendingButton = !accountManager.activeAccount!!.tabPreferences.hasTab(TRENDING)
)
/* Fetch user info while we're doing other things. This has to be done after setting up the
* drawer, though, because its callback touches the header in the drawer. */
fetchUserInfo()
fetchAnnouncements()
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
streamingManager.setup(lifecycleScope.coroutineContext.job) { active ->
if (active) {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
} else {
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
}
// Initialise the tab adapter and set to viewpager. Fragments appear to be leaked if the
// adapter changes over the life of the viewPager (the adapter, not its contents), so set
// the initial list of tabs to empty, and set the full list later in setupTabs(). See
// https://github.com/tuskyapp/Tusky/issues/3251 for details.
tabAdapter = MainPagerAdapter(emptyList(), this)
binding.viewPager.adapter = tabAdapter
setupTabs(showNotificationTab)
2021-01-03 06:42:50 +01:00
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PrefKeys.VIEW_PAGER_OFF_SCREEN_LIMIT, false)) {
binding.viewPager.offscreenPageLimit = 9
}
lifecycleScope.launch {
eventHub.events.collect { event ->
when (event) {
is ProfileEditedEvent -> onFetchUserInfoSuccess(event.newProfileData)
Add trending tags (#3149) * Add initial feature for viewing trending graphs. Currently only views hash tag trends. Contains API additions, tab additions and a set of trending components. * Add clickable system through a LinkListener. Duplicates a little code from SFragment. * Add accessibility description. * The background for the graph should match the background for black theme too. * Add error handling through a state flow system using existing code as an example. * Graphing: Use a primary and a secondary line. Remove under line fill. Apply line thickness. Dotted end of line. * Trending changes: New layout for trending: Cell. Use ViewBinding. Add padding to RecyclerView to stop the FAB from hiding content. Multiple bugs in GraphView resolved. Wide (landscape, for example) will show 4 columns, portrait will show 2. Remove unused base holder class. ViewModel invalidate scoping changed. Some renaming to variables made. For uses and accounts, use longs. These could be big numbers eventually. TagViewHolder renamed to TrendingTagViewHolder. * Trending changes: Remove old layout. Update cell textsizes and use proper string. Remove bad comment. * Trending changes: Refresh the main drawer when the tabs are edited. This will allow the trending item to toggle. * Trending changes: Add a trending activity to be able to view the trending data from the main drawer. * Trending changes: The title text should be changed to Trending Hashtags. * Trending changes: Add meta color to draw axis etc. Draw the date boundaries on the graph. Remove dates from each cell and place them in the list as a header. Graphs should be proportional to the highest historical value. Add a new interface to control whether the FAB should be visible (important when switching tabs, the state is lost). Add header to the adapter and viewdata structures. Add QOL extensions for getting the dates from history. * Trending changes: Refresh FAB through the main activity and FabFragment interface. Trending has no FAB. * Trending changes: Make graph proportional to the highest usage value. Fixes to the graph ratio calculations. * Trending changes: KtLintFix * Trending changes: Remove accidental build gradle change. Remove trending cases. Remove unused progress. Set drawer button addition explicitly to false, leaving the code there for future issue #3010. Remove unnecessary arguments for intent. Remove media preview preferences, there is nothing to preview. No padding between hashtag symbol and text. Do not ellipsize hashtags. * Trending changes: Use bottomsheet slide in animation helper for opening the hashtag intent. Remove explicit layout height from the XML and apply it to the view holder itself. The height was not being respected in XML. * Use some platform standards for styling - Align on an 8dp grid - Use android:attr for paddingStart and paddingEnd - Use textAppearanceListItem variants - Adjust constraints to handle different size containers * Correct lineWidth calculations Previous code didn't convert the value to pixels, so it was always displaying as a hairline stroke, irrespective of the value in the layout file. While I'm here, rename from lineThickness to lineWidth, to be consistent with parameters like strokeWidth. * Does not need to inherit from FabFragment * Rename to TrendingAdapter "Paging" in the adapter name is a misnomer here * Clean up comments, use full class name as tag * Simplify TrendingViewModel - Remove unncessary properties - Fetch tags and map in invalidate() - emptyList() instead of listOf() for clarity * Remove line dividers, use X-axis to separate content Experiment with UI -- instead of dividers between each item, draw an explicit x-axis for each chart, and add a little more vertical padding, to see if that provides a cleaner separation between the content * Adjust date format - Show day and year - Use platform attributes for size * Locale-aware format of numbers Format numbers < 100,000 by inserting locale-aware separators. Numbers larger are scaled and have K, M, G, ... etc suffix appended. * Prevent a crash if viewData is empty Don't access viewData without first checking if it's empty. This can be the case if the server returned an empty list for some reason, or the data has been filtered. * Filter out tags the user has filtered from their home timeline Invalidate the list if the user's preferences change, as that may indicate they've changed their filters. * Experiment with alternative layout * Set chart height to 160dp to align to an 8dp grid * Draw ticks that are 5% the height of the x-axis * Legend adjustments - Use tuskyblue for the ticks - Wrap legend components in a layout so they can have a dedicated background - Use a 60% transparent background for the legend to retain legibility if lines go under it * Bezier curves, shorter cell height * More tweaks - List tags in order of popularity, most popular first - Make it clear that uses/accounts in the legend are totals, not current - Show current values at end of the chart * Hide FAB * Fix crash, it's not always hosted in an ActionButtonActivity * Arrange totals vertically in landscape layout * Always add the Trending drawer menu if it's not a tab * Revert unrelated whitespace changes * One more whitespace revert --------- Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-02-14 19:52:11 +01:00
is MainTabsChangedEvent -> {
refreshMainDrawerItems(
addSearchButton = hideTopToolbar,
addTrendingButton = !event.newTabs.hasTab(TRENDING)
Add trending tags (#3149) * Add initial feature for viewing trending graphs. Currently only views hash tag trends. Contains API additions, tab additions and a set of trending components. * Add clickable system through a LinkListener. Duplicates a little code from SFragment. * Add accessibility description. * The background for the graph should match the background for black theme too. * Add error handling through a state flow system using existing code as an example. * Graphing: Use a primary and a secondary line. Remove under line fill. Apply line thickness. Dotted end of line. * Trending changes: New layout for trending: Cell. Use ViewBinding. Add padding to RecyclerView to stop the FAB from hiding content. Multiple bugs in GraphView resolved. Wide (landscape, for example) will show 4 columns, portrait will show 2. Remove unused base holder class. ViewModel invalidate scoping changed. Some renaming to variables made. For uses and accounts, use longs. These could be big numbers eventually. TagViewHolder renamed to TrendingTagViewHolder. * Trending changes: Remove old layout. Update cell textsizes and use proper string. Remove bad comment. * Trending changes: Refresh the main drawer when the tabs are edited. This will allow the trending item to toggle. * Trending changes: Add a trending activity to be able to view the trending data from the main drawer. * Trending changes: The title text should be changed to Trending Hashtags. * Trending changes: Add meta color to draw axis etc. Draw the date boundaries on the graph. Remove dates from each cell and place them in the list as a header. Graphs should be proportional to the highest historical value. Add a new interface to control whether the FAB should be visible (important when switching tabs, the state is lost). Add header to the adapter and viewdata structures. Add QOL extensions for getting the dates from history. * Trending changes: Refresh FAB through the main activity and FabFragment interface. Trending has no FAB. * Trending changes: Make graph proportional to the highest usage value. Fixes to the graph ratio calculations. * Trending changes: KtLintFix * Trending changes: Remove accidental build gradle change. Remove trending cases. Remove unused progress. Set drawer button addition explicitly to false, leaving the code there for future issue #3010. Remove unnecessary arguments for intent. Remove media preview preferences, there is nothing to preview. No padding between hashtag symbol and text. Do not ellipsize hashtags. * Trending changes: Use bottomsheet slide in animation helper for opening the hashtag intent. Remove explicit layout height from the XML and apply it to the view holder itself. The height was not being respected in XML. * Use some platform standards for styling - Align on an 8dp grid - Use android:attr for paddingStart and paddingEnd - Use textAppearanceListItem variants - Adjust constraints to handle different size containers * Correct lineWidth calculations Previous code didn't convert the value to pixels, so it was always displaying as a hairline stroke, irrespective of the value in the layout file. While I'm here, rename from lineThickness to lineWidth, to be consistent with parameters like strokeWidth. * Does not need to inherit from FabFragment * Rename to TrendingAdapter "Paging" in the adapter name is a misnomer here * Clean up comments, use full class name as tag * Simplify TrendingViewModel - Remove unncessary properties - Fetch tags and map in invalidate() - emptyList() instead of listOf() for clarity * Remove line dividers, use X-axis to separate content Experiment with UI -- instead of dividers between each item, draw an explicit x-axis for each chart, and add a little more vertical padding, to see if that provides a cleaner separation between the content * Adjust date format - Show day and year - Use platform attributes for size * Locale-aware format of numbers Format numbers < 100,000 by inserting locale-aware separators. Numbers larger are scaled and have K, M, G, ... etc suffix appended. * Prevent a crash if viewData is empty Don't access viewData without first checking if it's empty. This can be the case if the server returned an empty list for some reason, or the data has been filtered. * Filter out tags the user has filtered from their home timeline Invalidate the list if the user's preferences change, as that may indicate they've changed their filters. * Experiment with alternative layout * Set chart height to 160dp to align to an 8dp grid * Draw ticks that are 5% the height of the x-axis * Legend adjustments - Use tuskyblue for the ticks - Wrap legend components in a layout so they can have a dedicated background - Use a 60% transparent background for the legend to retain legibility if lines go under it * Bezier curves, shorter cell height * More tweaks - List tags in order of popularity, most popular first - Make it clear that uses/accounts in the legend are totals, not current - Show current values at end of the chart * Hide FAB * Fix crash, it's not always hosted in an ActionButtonActivity * Arrange totals vertically in landscape layout * Always add the Trending drawer menu if it's not a tab * Revert unrelated whitespace changes * One more whitespace revert --------- Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-02-14 19:52:11 +01:00
)
setupTabs(false)
}
is AnnouncementReadEvent -> {
unreadAnnouncementsCount--
updateAnnouncementsBadge()
}
}
binding.viewQuickToot.handleEvent(event)
}
}
Schedulers.io().scheduleDirect {
// Flush old media that was cached for sharing
deleteStaleCachedMedia(applicationContext.getExternalFilesDir("Tusky"))
}
selectedEmojiPack = preferences.getString(EMOJI_PREFERENCE, "")
onBackPressedDispatcher.addCallback(
this,
object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
when {
binding.mainDrawerLayout.isOpen -> {
binding.mainDrawerLayout.close()
}
binding.viewPager.currentItem != 0 -> {
binding.viewPager.currentItem = 0
}
else -> {
finish()
}
}
}
}
)
if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(
this,
arrayOf(Manifest.permission.POST_NOTIFICATIONS),
1
)
}
// "Post failed" dialog should display in this activity
draftsAlert.observeInContext(this, true)
}
Add "Refresh" accessibility menu (#3121) * Add "Refresh" accessibility menu to TimelineFragment Per https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout the layout does not provide accessibility events, and a menu item should be provided as an alternative method for refreshing the content. In `TimelineFragment`: - Implement the `MenuProvider` interface so it can populate the action bar menu in activities that host the fragment - Create a "Refresh" menu item, and refresh the state when it is selected `MainActivity` has to change how the menu is created, so that fragments can add items to it. In `MainActivity`: - Call `setSupportActionBar` so `mainToolbar` participates in menus - Implement the `MenuProvider` interface, and move menu creation there - Set the title via supportActionBar * Never show the refresh item as a menubar action Per guidelines in https://developer.android.com/develop/ui/views/touch-and-input/swipe/add-swipe-interface#AddRefreshAction * Add "Refresh" menu item for AccountMediaFragment Also, fix the colour of the refresh progress indicator * Implement "Refresh" for AnnouncementsActivity * Add "Refresh" menu for ConversationsFragment * Keep the tabs adapter over the life of the viewpager Make `tabs` `var` instead of `val` in `MainPagerAdapter` so it can be updated when tabs change. Then detach the `tabLayoutMediator`, update the tabs, and call `notifyItemRangeChanged` in `setupTabs()`. This fixes a bug (not sure if it's this code, or in ViewPager2) where assigning a new adapter to the view pager seemed to result in a leak of one or more fragments. This wasn't user-visible, but it's a leak, and it becomes user-visible when fragments want to display menus. This also fixes two other bugs: 1. Be on the left-most tab. Scroll down a bit. Then modify the tabs at "Account preferences > tabs", but keep the left-most tab as-is. Then go back to MainActivity. Your reading position in the left-most tab has been jumped to the top. 2. Be on any non-left-most tab. Then modify the tab list by reordering tabs (adding/removing tabs is also OK). Then go back to MainActivity. Your tab selection has been overridden, and the left-most tab has been selected. Because the fragments are not destroyed unnecessarily your reading position is retained. And it remembers the tab you had selected, and as long as that tab is still present you will be returned to it, even if it's changed position in the list. Fixes https://github.com/tuskyapp/Tusky/issues/3251 * Add "Refresh" menu for ScheduledStatusActivity * Lint * Add "Refresh" menu for SearchFragment / SearchActivity * Explicitly set the searchview width Using "collapseActionView" requires the user to press "Back" twice to exit the activity, which is not acceptable. * Move toolbar handling in to ViewThreadActivity Previous code had the toolbar in the fragment's layout. Refactor to make consistent with other activities, and move the toolbar in to the activity layout. Implement MenuProvider in ViewThreadFragment to adjust the menu in the activity. * Add "Refresh" menu to ViewThreadFragment * Implement "Refresh" for ViewEditsFragment * Lint * Add "Refresh" menu to ReportStatusesFragment * Add "Refresh" menu to NotificationsFragment * Rename menu resource files Be consistent with the layout resource files, which have an activity/fragment prefix, then the lower_snake_case name of the activity or fragment it's for. * Only enable refresh menu if swiptorefresh is enabled Some timelines don't have swipetorefresh enabled (e.g., those shown on AccountActivity). In those cases don't add the refresh menu, rely on the hosting activity to provide it. Update AccountActivity to provide the refresh menu item.
2023-03-01 19:58:18 +01:00
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
menuInflater.inflate(R.menu.activity_main, menu)
menu.findItem(R.id.action_search)?.apply {
icon = IconicsDrawable(this@MainActivity, GoogleMaterial.Icon.gmd_search).apply {
sizeDp = 20
colorInt = MaterialColors.getColor(binding.mainToolbar, android.R.attr.textColorPrimary)
}
}
}
override fun onMenuItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.action_search -> {
startActivity(SearchActivity.getIntent(this@MainActivity))
true
}
else -> super.onOptionsItemSelected(item)
}
2022-01-24 19:32:57 +01:00
}
override fun onResume() {
super.onResume()
val currentEmojiPack = preferences.getString(EMOJI_PREFERENCE, "")
if (currentEmojiPack != selectedEmojiPack) {
Log.d(
TAG,
"onResume: EmojiPack has been changed from %s to %s"
.format(selectedEmojiPack, currentEmojiPack)
)
selectedEmojiPack = currentEmojiPack
recreate()
}
}
override fun onStart() {
super.onStart()
// For some reason the navigation drawer is opened when the activity is recreated
if (binding.mainDrawerLayout.isOpen) {
binding.mainDrawerLayout.closeDrawer(GravityCompat.START, false)
}
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
when (keyCode) {
KeyEvent.KEYCODE_MENU -> {
if (binding.mainDrawerLayout.isOpen) {
binding.mainDrawerLayout.close()
} else {
binding.mainDrawerLayout.open()
}
return true
}
KeyEvent.KEYCODE_SEARCH -> {
startActivityWithSlideInAnimation(SearchActivity.getIntent(this))
return true
}
}
if (event.isCtrlPressed || event.isShiftPressed) {
// FIXME: blackberry keyONE raises SHIFT key event even CTRL IS PRESSED
when (keyCode) {
KeyEvent.KEYCODE_N -> {
// open compose activity by pressing SHIFT + N (or CTRL + N)
val composeIntent = Intent(applicationContext, ComposeActivity::class.java)
startActivity(composeIntent)
return true
}
}
}
return super.onKeyDown(keyCode, event)
}
public override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)
if (intent != null) {
val redirectUrl = intent.getStringExtra(REDIRECT_URL)
if (redirectUrl != null) {
viewUrl(redirectUrl, PostLookupFallbackBehavior.DISPLAY_ERROR)
}
}
}
private fun forwardShare(intent: Intent) {
val composeIntent = Intent(this, ComposeActivity::class.java)
composeIntent.action = intent.action
composeIntent.type = intent.type
composeIntent.putExtras(intent)
composeIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
startActivity(composeIntent)
finish()
}
Add trending tags (#3149) * Add initial feature for viewing trending graphs. Currently only views hash tag trends. Contains API additions, tab additions and a set of trending components. * Add clickable system through a LinkListener. Duplicates a little code from SFragment. * Add accessibility description. * The background for the graph should match the background for black theme too. * Add error handling through a state flow system using existing code as an example. * Graphing: Use a primary and a secondary line. Remove under line fill. Apply line thickness. Dotted end of line. * Trending changes: New layout for trending: Cell. Use ViewBinding. Add padding to RecyclerView to stop the FAB from hiding content. Multiple bugs in GraphView resolved. Wide (landscape, for example) will show 4 columns, portrait will show 2. Remove unused base holder class. ViewModel invalidate scoping changed. Some renaming to variables made. For uses and accounts, use longs. These could be big numbers eventually. TagViewHolder renamed to TrendingTagViewHolder. * Trending changes: Remove old layout. Update cell textsizes and use proper string. Remove bad comment. * Trending changes: Refresh the main drawer when the tabs are edited. This will allow the trending item to toggle. * Trending changes: Add a trending activity to be able to view the trending data from the main drawer. * Trending changes: The title text should be changed to Trending Hashtags. * Trending changes: Add meta color to draw axis etc. Draw the date boundaries on the graph. Remove dates from each cell and place them in the list as a header. Graphs should be proportional to the highest historical value. Add a new interface to control whether the FAB should be visible (important when switching tabs, the state is lost). Add header to the adapter and viewdata structures. Add QOL extensions for getting the dates from history. * Trending changes: Refresh FAB through the main activity and FabFragment interface. Trending has no FAB. * Trending changes: Make graph proportional to the highest usage value. Fixes to the graph ratio calculations. * Trending changes: KtLintFix * Trending changes: Remove accidental build gradle change. Remove trending cases. Remove unused progress. Set drawer button addition explicitly to false, leaving the code there for future issue #3010. Remove unnecessary arguments for intent. Remove media preview preferences, there is nothing to preview. No padding between hashtag symbol and text. Do not ellipsize hashtags. * Trending changes: Use bottomsheet slide in animation helper for opening the hashtag intent. Remove explicit layout height from the XML and apply it to the view holder itself. The height was not being respected in XML. * Use some platform standards for styling - Align on an 8dp grid - Use android:attr for paddingStart and paddingEnd - Use textAppearanceListItem variants - Adjust constraints to handle different size containers * Correct lineWidth calculations Previous code didn't convert the value to pixels, so it was always displaying as a hairline stroke, irrespective of the value in the layout file. While I'm here, rename from lineThickness to lineWidth, to be consistent with parameters like strokeWidth. * Does not need to inherit from FabFragment * Rename to TrendingAdapter "Paging" in the adapter name is a misnomer here * Clean up comments, use full class name as tag * Simplify TrendingViewModel - Remove unncessary properties - Fetch tags and map in invalidate() - emptyList() instead of listOf() for clarity * Remove line dividers, use X-axis to separate content Experiment with UI -- instead of dividers between each item, draw an explicit x-axis for each chart, and add a little more vertical padding, to see if that provides a cleaner separation between the content * Adjust date format - Show day and year - Use platform attributes for size * Locale-aware format of numbers Format numbers < 100,000 by inserting locale-aware separators. Numbers larger are scaled and have K, M, G, ... etc suffix appended. * Prevent a crash if viewData is empty Don't access viewData without first checking if it's empty. This can be the case if the server returned an empty list for some reason, or the data has been filtered. * Filter out tags the user has filtered from their home timeline Invalidate the list if the user's preferences change, as that may indicate they've changed their filters. * Experiment with alternative layout * Set chart height to 160dp to align to an 8dp grid * Draw ticks that are 5% the height of the x-axis * Legend adjustments - Use tuskyblue for the ticks - Wrap legend components in a layout so they can have a dedicated background - Use a 60% transparent background for the legend to retain legibility if lines go under it * Bezier curves, shorter cell height * More tweaks - List tags in order of popularity, most popular first - Make it clear that uses/accounts in the legend are totals, not current - Show current values at end of the chart * Hide FAB * Fix crash, it's not always hosted in an ActionButtonActivity * Arrange totals vertically in landscape layout * Always add the Trending drawer menu if it's not a tab * Revert unrelated whitespace changes * One more whitespace revert --------- Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-02-14 19:52:11 +01:00
private fun setupDrawer(
savedInstanceState: Bundle?,
addSearchButton: Boolean,
addTrendingButton: Boolean
) {
val drawerOpenClickListener = View.OnClickListener { binding.mainDrawerLayout.open() }
binding.mainToolbar.setNavigationOnClickListener(drawerOpenClickListener)
binding.topNavAvatar.setOnClickListener(drawerOpenClickListener)
binding.bottomNavAvatar.setOnClickListener(drawerOpenClickListener)
header = AccountHeaderView(this).apply {
headerBackgroundScaleType = ImageView.ScaleType.CENTER_CROP
currentHiddenInList = true
onAccountHeaderListener = { _: View?, profile: IProfile, current: Boolean -> handleProfileClick(profile, current) }
2021-06-28 22:04:34 +02:00
addProfile(
ProfileSettingDrawerItem().apply {
identifier = DRAWER_ITEM_ADD_ACCOUNT
nameRes = R.string.add_account_name
descriptionRes = R.string.add_account_description
iconicsIcon = GoogleMaterial.Icon.gmd_add
},
0
)
attachToSliderView(binding.mainDrawer)
dividerBelowHeader = false
closeDrawerOnProfileListClick = true
}
header.currentProfileName.maxLines = 1
header.currentProfileName.ellipsize = TextUtils.TruncateAt.END
header.accountHeaderBackground.setColorFilter(getColor(R.color.headerBackgroundFilter))
header.accountHeaderBackground.setBackgroundColor(MaterialColors.getColor(header, R.attr.colorBackgroundAccent))
2020-08-16 10:01:51 +02:00
val animateAvatars = preferences.getBoolean("animateGifAvatars", false)
DrawerImageLoader.init(object : AbstractDrawerImageLoader() {
override fun set(imageView: ImageView, uri: Uri, placeholder: Drawable, tag: String?) {
if (animateAvatars) {
glide.load(uri)
.placeholder(placeholder)
.into(imageView)
} else {
glide.asBitmap()
.load(uri)
.placeholder(placeholder)
.into(imageView)
}
}
override fun cancel(imageView: ImageView) {
glide.clear(imageView)
}
override fun placeholder(ctx: Context, tag: String?): Drawable {
if (tag == DrawerImageLoader.Tags.PROFILE.name || tag == DrawerImageLoader.Tags.PROFILE_DRAWER_ITEM.name) {
return ctx.getDrawable(R.drawable.avatar_default)!!
}
return super.placeholder(ctx, tag)
}
})
binding.mainDrawer.apply {
Add trending tags (#3149) * Add initial feature for viewing trending graphs. Currently only views hash tag trends. Contains API additions, tab additions and a set of trending components. * Add clickable system through a LinkListener. Duplicates a little code from SFragment. * Add accessibility description. * The background for the graph should match the background for black theme too. * Add error handling through a state flow system using existing code as an example. * Graphing: Use a primary and a secondary line. Remove under line fill. Apply line thickness. Dotted end of line. * Trending changes: New layout for trending: Cell. Use ViewBinding. Add padding to RecyclerView to stop the FAB from hiding content. Multiple bugs in GraphView resolved. Wide (landscape, for example) will show 4 columns, portrait will show 2. Remove unused base holder class. ViewModel invalidate scoping changed. Some renaming to variables made. For uses and accounts, use longs. These could be big numbers eventually. TagViewHolder renamed to TrendingTagViewHolder. * Trending changes: Remove old layout. Update cell textsizes and use proper string. Remove bad comment. * Trending changes: Refresh the main drawer when the tabs are edited. This will allow the trending item to toggle. * Trending changes: Add a trending activity to be able to view the trending data from the main drawer. * Trending changes: The title text should be changed to Trending Hashtags. * Trending changes: Add meta color to draw axis etc. Draw the date boundaries on the graph. Remove dates from each cell and place them in the list as a header. Graphs should be proportional to the highest historical value. Add a new interface to control whether the FAB should be visible (important when switching tabs, the state is lost). Add header to the adapter and viewdata structures. Add QOL extensions for getting the dates from history. * Trending changes: Refresh FAB through the main activity and FabFragment interface. Trending has no FAB. * Trending changes: Make graph proportional to the highest usage value. Fixes to the graph ratio calculations. * Trending changes: KtLintFix * Trending changes: Remove accidental build gradle change. Remove trending cases. Remove unused progress. Set drawer button addition explicitly to false, leaving the code there for future issue #3010. Remove unnecessary arguments for intent. Remove media preview preferences, there is nothing to preview. No padding between hashtag symbol and text. Do not ellipsize hashtags. * Trending changes: Use bottomsheet slide in animation helper for opening the hashtag intent. Remove explicit layout height from the XML and apply it to the view holder itself. The height was not being respected in XML. * Use some platform standards for styling - Align on an 8dp grid - Use android:attr for paddingStart and paddingEnd - Use textAppearanceListItem variants - Adjust constraints to handle different size containers * Correct lineWidth calculations Previous code didn't convert the value to pixels, so it was always displaying as a hairline stroke, irrespective of the value in the layout file. While I'm here, rename from lineThickness to lineWidth, to be consistent with parameters like strokeWidth. * Does not need to inherit from FabFragment * Rename to TrendingAdapter "Paging" in the adapter name is a misnomer here * Clean up comments, use full class name as tag * Simplify TrendingViewModel - Remove unncessary properties - Fetch tags and map in invalidate() - emptyList() instead of listOf() for clarity * Remove line dividers, use X-axis to separate content Experiment with UI -- instead of dividers between each item, draw an explicit x-axis for each chart, and add a little more vertical padding, to see if that provides a cleaner separation between the content * Adjust date format - Show day and year - Use platform attributes for size * Locale-aware format of numbers Format numbers < 100,000 by inserting locale-aware separators. Numbers larger are scaled and have K, M, G, ... etc suffix appended. * Prevent a crash if viewData is empty Don't access viewData without first checking if it's empty. This can be the case if the server returned an empty list for some reason, or the data has been filtered. * Filter out tags the user has filtered from their home timeline Invalidate the list if the user's preferences change, as that may indicate they've changed their filters. * Experiment with alternative layout * Set chart height to 160dp to align to an 8dp grid * Draw ticks that are 5% the height of the x-axis * Legend adjustments - Use tuskyblue for the ticks - Wrap legend components in a layout so they can have a dedicated background - Use a 60% transparent background for the legend to retain legibility if lines go under it * Bezier curves, shorter cell height * More tweaks - List tags in order of popularity, most popular first - Make it clear that uses/accounts in the legend are totals, not current - Show current values at end of the chart * Hide FAB * Fix crash, it's not always hosted in an ActionButtonActivity * Arrange totals vertically in landscape layout * Always add the Trending drawer menu if it's not a tab * Revert unrelated whitespace changes * One more whitespace revert --------- Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-02-14 19:52:11 +01:00
refreshMainDrawerItems(addSearchButton, addTrendingButton)
setSavedInstance(savedInstanceState)
}
}
private fun refreshMainDrawerItems(addSearchButton: Boolean, addTrendingButton: Boolean) {
binding.mainDrawer.apply {
itemAdapter.clear()
tintStatusBar = true
addItems(
primaryDrawerItem {
nameRes = R.string.action_edit_profile
iconicsIcon = GoogleMaterial.Icon.gmd_person
onClick = {
val intent = Intent(context, EditProfileActivity::class.java)
startActivityWithSlideInAnimation(intent)
}
},
primaryDrawerItem {
nameRes = R.string.action_view_favourites
isSelectable = false
iconicsIcon = GoogleMaterial.Icon.gmd_star
onClick = {
val intent = StatusListActivity.newFavouritesIntent(context)
startActivityWithSlideInAnimation(intent)
}
},
primaryDrawerItem {
nameRes = R.string.action_view_bookmarks
iconicsIcon = GoogleMaterial.Icon.gmd_bookmark
onClick = {
val intent = StatusListActivity.newBookmarksIntent(context)
startActivityWithSlideInAnimation(intent)
}
},
primaryDrawerItem {
nameRes = R.string.action_view_follow_requests
iconicsIcon = GoogleMaterial.Icon.gmd_person_add
onClick = {
val intent = AccountListActivity.newIntent(context, AccountListActivity.Type.FOLLOW_REQUESTS, accountLocked = accountLocked)
startActivityWithSlideInAnimation(intent)
}
},
primaryDrawerItem {
nameRes = R.string.action_lists
iconicsIcon = GoogleMaterial.Icon.gmd_list
onClick = {
startActivityWithSlideInAnimation(ListsActivity.newIntent(context))
}
},
primaryDrawerItem {
nameRes = R.string.action_access_drafts
iconRes = R.drawable.ic_notebook
onClick = {
val intent = DraftsActivity.newIntent(context)
startActivityWithSlideInAnimation(intent)
}
},
primaryDrawerItem {
nameRes = R.string.action_access_scheduled_posts
iconRes = R.drawable.ic_access_time
onClick = {
startActivityWithSlideInAnimation(ScheduledStatusActivity.newIntent(context))
}
},
primaryDrawerItem {
identifier = DRAWER_ITEM_ANNOUNCEMENTS
nameRes = R.string.title_announcements
iconRes = R.drawable.ic_bullhorn_24dp
onClick = {
startActivityWithSlideInAnimation(AnnouncementsActivity.newIntent(context))
}
badgeStyle = BadgeStyle().apply {
textColor = ColorHolder.fromColor(MaterialColors.getColor(binding.mainDrawer, com.google.android.material.R.attr.colorOnPrimary))
Add trending tags (#3149) * Add initial feature for viewing trending graphs. Currently only views hash tag trends. Contains API additions, tab additions and a set of trending components. * Add clickable system through a LinkListener. Duplicates a little code from SFragment. * Add accessibility description. * The background for the graph should match the background for black theme too. * Add error handling through a state flow system using existing code as an example. * Graphing: Use a primary and a secondary line. Remove under line fill. Apply line thickness. Dotted end of line. * Trending changes: New layout for trending: Cell. Use ViewBinding. Add padding to RecyclerView to stop the FAB from hiding content. Multiple bugs in GraphView resolved. Wide (landscape, for example) will show 4 columns, portrait will show 2. Remove unused base holder class. ViewModel invalidate scoping changed. Some renaming to variables made. For uses and accounts, use longs. These could be big numbers eventually. TagViewHolder renamed to TrendingTagViewHolder. * Trending changes: Remove old layout. Update cell textsizes and use proper string. Remove bad comment. * Trending changes: Refresh the main drawer when the tabs are edited. This will allow the trending item to toggle. * Trending changes: Add a trending activity to be able to view the trending data from the main drawer. * Trending changes: The title text should be changed to Trending Hashtags. * Trending changes: Add meta color to draw axis etc. Draw the date boundaries on the graph. Remove dates from each cell and place them in the list as a header. Graphs should be proportional to the highest historical value. Add a new interface to control whether the FAB should be visible (important when switching tabs, the state is lost). Add header to the adapter and viewdata structures. Add QOL extensions for getting the dates from history. * Trending changes: Refresh FAB through the main activity and FabFragment interface. Trending has no FAB. * Trending changes: Make graph proportional to the highest usage value. Fixes to the graph ratio calculations. * Trending changes: KtLintFix * Trending changes: Remove accidental build gradle change. Remove trending cases. Remove unused progress. Set drawer button addition explicitly to false, leaving the code there for future issue #3010. Remove unnecessary arguments for intent. Remove media preview preferences, there is nothing to preview. No padding between hashtag symbol and text. Do not ellipsize hashtags. * Trending changes: Use bottomsheet slide in animation helper for opening the hashtag intent. Remove explicit layout height from the XML and apply it to the view holder itself. The height was not being respected in XML. * Use some platform standards for styling - Align on an 8dp grid - Use android:attr for paddingStart and paddingEnd - Use textAppearanceListItem variants - Adjust constraints to handle different size containers * Correct lineWidth calculations Previous code didn't convert the value to pixels, so it was always displaying as a hairline stroke, irrespective of the value in the layout file. While I'm here, rename from lineThickness to lineWidth, to be consistent with parameters like strokeWidth. * Does not need to inherit from FabFragment * Rename to TrendingAdapter "Paging" in the adapter name is a misnomer here * Clean up comments, use full class name as tag * Simplify TrendingViewModel - Remove unncessary properties - Fetch tags and map in invalidate() - emptyList() instead of listOf() for clarity * Remove line dividers, use X-axis to separate content Experiment with UI -- instead of dividers between each item, draw an explicit x-axis for each chart, and add a little more vertical padding, to see if that provides a cleaner separation between the content * Adjust date format - Show day and year - Use platform attributes for size * Locale-aware format of numbers Format numbers < 100,000 by inserting locale-aware separators. Numbers larger are scaled and have K, M, G, ... etc suffix appended. * Prevent a crash if viewData is empty Don't access viewData without first checking if it's empty. This can be the case if the server returned an empty list for some reason, or the data has been filtered. * Filter out tags the user has filtered from their home timeline Invalidate the list if the user's preferences change, as that may indicate they've changed their filters. * Experiment with alternative layout * Set chart height to 160dp to align to an 8dp grid * Draw ticks that are 5% the height of the x-axis * Legend adjustments - Use tuskyblue for the ticks - Wrap legend components in a layout so they can have a dedicated background - Use a 60% transparent background for the legend to retain legibility if lines go under it * Bezier curves, shorter cell height * More tweaks - List tags in order of popularity, most popular first - Make it clear that uses/accounts in the legend are totals, not current - Show current values at end of the chart * Hide FAB * Fix crash, it's not always hosted in an ActionButtonActivity * Arrange totals vertically in landscape layout * Always add the Trending drawer menu if it's not a tab * Revert unrelated whitespace changes * One more whitespace revert --------- Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-02-14 19:52:11 +01:00
color = ColorHolder.fromColor(MaterialColors.getColor(binding.mainDrawer, com.google.android.material.R.attr.colorPrimary))
}
},
DividerDrawerItem(),
secondaryDrawerItem {
nameRes = R.string.action_view_account_preferences
iconRes = R.drawable.ic_account_settings
onClick = {
val intent = PreferencesActivity.newIntent(context, PreferencesActivity.ACCOUNT_PREFERENCES)
startActivityWithSlideInAnimation(intent)
}
},
secondaryDrawerItem {
nameRes = R.string.action_view_preferences
iconicsIcon = GoogleMaterial.Icon.gmd_settings
onClick = {
val intent = PreferencesActivity.newIntent(context, PreferencesActivity.GENERAL_PREFERENCES)
startActivityWithSlideInAnimation(intent)
}
},
secondaryDrawerItem {
nameRes = R.string.about_title_activity
iconicsIcon = GoogleMaterial.Icon.gmd_info
onClick = {
val intent = Intent(context, AboutActivity::class.java)
startActivityWithSlideInAnimation(intent)
}
},
secondaryDrawerItem {
nameRes = R.string.action_logout
iconRes = R.drawable.ic_logout
onClick = ::logout
}
)
val footer = FooterDrawerItem()
addStickyDrawerItems(footer)
lifecycleScope.launch {
footer.setInstance(mastodonApi.getInstance())
}
2020-08-16 10:01:51 +02:00
if (addSearchButton) {
2021-06-28 22:04:34 +02:00
binding.mainDrawer.addItemsAtPosition(
4,
primaryDrawerItem {
nameRes = R.string.action_search
iconicsIcon = GoogleMaterial.Icon.gmd_search
onClick = {
startActivityWithSlideInAnimation(SearchActivity.getIntent(context))
}
2021-06-28 22:04:34 +02:00
}
)
2020-08-16 10:01:51 +02:00
}
Add trending tags (#3149) * Add initial feature for viewing trending graphs. Currently only views hash tag trends. Contains API additions, tab additions and a set of trending components. * Add clickable system through a LinkListener. Duplicates a little code from SFragment. * Add accessibility description. * The background for the graph should match the background for black theme too. * Add error handling through a state flow system using existing code as an example. * Graphing: Use a primary and a secondary line. Remove under line fill. Apply line thickness. Dotted end of line. * Trending changes: New layout for trending: Cell. Use ViewBinding. Add padding to RecyclerView to stop the FAB from hiding content. Multiple bugs in GraphView resolved. Wide (landscape, for example) will show 4 columns, portrait will show 2. Remove unused base holder class. ViewModel invalidate scoping changed. Some renaming to variables made. For uses and accounts, use longs. These could be big numbers eventually. TagViewHolder renamed to TrendingTagViewHolder. * Trending changes: Remove old layout. Update cell textsizes and use proper string. Remove bad comment. * Trending changes: Refresh the main drawer when the tabs are edited. This will allow the trending item to toggle. * Trending changes: Add a trending activity to be able to view the trending data from the main drawer. * Trending changes: The title text should be changed to Trending Hashtags. * Trending changes: Add meta color to draw axis etc. Draw the date boundaries on the graph. Remove dates from each cell and place them in the list as a header. Graphs should be proportional to the highest historical value. Add a new interface to control whether the FAB should be visible (important when switching tabs, the state is lost). Add header to the adapter and viewdata structures. Add QOL extensions for getting the dates from history. * Trending changes: Refresh FAB through the main activity and FabFragment interface. Trending has no FAB. * Trending changes: Make graph proportional to the highest usage value. Fixes to the graph ratio calculations. * Trending changes: KtLintFix * Trending changes: Remove accidental build gradle change. Remove trending cases. Remove unused progress. Set drawer button addition explicitly to false, leaving the code there for future issue #3010. Remove unnecessary arguments for intent. Remove media preview preferences, there is nothing to preview. No padding between hashtag symbol and text. Do not ellipsize hashtags. * Trending changes: Use bottomsheet slide in animation helper for opening the hashtag intent. Remove explicit layout height from the XML and apply it to the view holder itself. The height was not being respected in XML. * Use some platform standards for styling - Align on an 8dp grid - Use android:attr for paddingStart and paddingEnd - Use textAppearanceListItem variants - Adjust constraints to handle different size containers * Correct lineWidth calculations Previous code didn't convert the value to pixels, so it was always displaying as a hairline stroke, irrespective of the value in the layout file. While I'm here, rename from lineThickness to lineWidth, to be consistent with parameters like strokeWidth. * Does not need to inherit from FabFragment * Rename to TrendingAdapter "Paging" in the adapter name is a misnomer here * Clean up comments, use full class name as tag * Simplify TrendingViewModel - Remove unncessary properties - Fetch tags and map in invalidate() - emptyList() instead of listOf() for clarity * Remove line dividers, use X-axis to separate content Experiment with UI -- instead of dividers between each item, draw an explicit x-axis for each chart, and add a little more vertical padding, to see if that provides a cleaner separation between the content * Adjust date format - Show day and year - Use platform attributes for size * Locale-aware format of numbers Format numbers < 100,000 by inserting locale-aware separators. Numbers larger are scaled and have K, M, G, ... etc suffix appended. * Prevent a crash if viewData is empty Don't access viewData without first checking if it's empty. This can be the case if the server returned an empty list for some reason, or the data has been filtered. * Filter out tags the user has filtered from their home timeline Invalidate the list if the user's preferences change, as that may indicate they've changed their filters. * Experiment with alternative layout * Set chart height to 160dp to align to an 8dp grid * Draw ticks that are 5% the height of the x-axis * Legend adjustments - Use tuskyblue for the ticks - Wrap legend components in a layout so they can have a dedicated background - Use a 60% transparent background for the legend to retain legibility if lines go under it * Bezier curves, shorter cell height * More tweaks - List tags in order of popularity, most popular first - Make it clear that uses/accounts in the legend are totals, not current - Show current values at end of the chart * Hide FAB * Fix crash, it's not always hosted in an ActionButtonActivity * Arrange totals vertically in landscape layout * Always add the Trending drawer menu if it's not a tab * Revert unrelated whitespace changes * One more whitespace revert --------- Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-02-14 19:52:11 +01:00
if (addTrendingButton) {
binding.mainDrawer.addItemsAtPosition(
5,
primaryDrawerItem {
nameRes = R.string.title_public_trending_hashtags
iconicsIcon = GoogleMaterial.Icon.gmd_trending_up
onClick = {
startActivityWithSlideInAnimation(TrendingActivity.getIntent(context))
}
}
)
}
}
if (BuildConfig.DEBUG) {
Keep scroll position when loading missing statuses (#3000) * Change "Load more" to load oldest statuses first in home timeline Previous behaviour loaded missing statuses by using "since_id" and "max_id". This loads the most recent N statuses, looking backwards from "max_id". Change to load the oldest statuses first, assuming the user is scrolling up through the timeline and will want to load statuses in reverse chronological order. * Scroll to the bottom of new entries added by "Load more" - Remember the position of the "Load more" placeholder - Check the position of inserted entries - If they match, scroll to the bottom * Change "Load more" to load oldest statuses first in home timeline Previous behaviour loaded missing statuses by using "since_id" and "max_id". This loads the most recent N statuses, looking backwards from "max_id". Change to load the oldest statuses first, assuming the user is scrolling up through the timeline and will want to load statuses in reverse chronological order. * Scroll to the bottom of new entries added by "Load more" - Remember the position of the "Load more" placeholder - Check the position of inserted entries - If they match, scroll to the bottom * Ensure the user can't have two simultaneous "Load more" coroutines Having two simultanous coroutines would break the calculation used to figure out which item in the list to scroll to after a "Load more" in the timeline. Do this by: - Creating a TimelineUiState and associated flow that tracks the "Load more" state - Updating this in the (Cached|Network)TimelineViewModel - Listening for changes to it in TimelineFragment, and notifying the adapter - The adapter will disable any placeholder views while "Load more" is active * Revert changes that loaded the oldest statuses instead of the newest * Be more robust about locating the status to scroll to Weirdness with the PagingData library meant that positionStart could still be wrong after "Load more" was clicked. Instead, remember the position of the "Load more" item and the ID of the status immediately after it. When new items are added, search for the remembered status at the position of the "Load more" item. This is quick, testing at most LOAD_AT_ONCE items in the adapter. If the remembered status is not visible on screen then scroll to it. * Lint * Add a preference to specify the reading order Default behaviour (oldest first) is for "load more" to load statuses and stay at the oldest of the new statuses. Alternative behaviour (if the user is reading from top to bottom) is to stay at the newest of the new statuses. * Move ReadingOrder enum construction logic in to the enum * Jump to top if swipe/refresh while preferring newest-first order * Show a circular progress spinner during "Load more" operations Remove a dedicated view, and use an icon on the button instead. Adjust the placeholder attributes and styles accordingly. * Remove the "loadMoreActive" property Complicates the code and doesn't really achieve the desired effect. If the user wants to tap multiple "Load more" buttons they can. * Update comments in TimelineFragment * Respect the user's reading order preference if it changes * Add developer tools This is for functionality that makes it easier for developers to interact with the app, or get it in to a known-state. These features are for use by users, so are only visible in debug builds. * Adjust how content is loaded based on preferred reading order - Add the readingOrder to TimelineViewModel so derived classes can use it. - Update the homeTimeline API to support the `minId` parameter and update calls in NetworkTimelineViewModel In CachedTimelineViewModel: - Set the bounds of the load to be the status IDs on either side of the placeholder ID (update TimelineDao with a new query for this) - Load statuses using either minId or sinceId depending on the reading order - Is there was no overlap then insert the new placeholder at the start/end of the list depending on reading order * Lint * Rename unused dialog parameter to _ * Update API arguments in tests * Simplify ReadingOrder preference handling * Fix bug with Placeholder and the "expanded" property If a status is a Placeholder the "expanded" propery is used to indicate whether or not it is loading. replaceStatusRange() set this property based on the old value, and the user's alwaysOpenSpoiler preference setting. This shouldn't have been used if the status is a Placeholder, as it can lead to incorrect loading states. Fix this. While I'm here, introduce an explicit computed property for whether a TimelineStatusEntity is a placeholder, and use that for code clarity. * Set the "Load more" button background to transparent * Fix typo. * Inline spec, update comment * Revert 1480c6aa3ac5c0c2d362fb271f47ea2259ab14e2 Turns out the behaviour is not desired. * Remove unnecessary Log call * Extract function * Change default to newest first
2023-01-13 19:26:24 +01:00
// Add a "Developer tools" entry. Code that makes it easier to
// set the app state at runtime belongs here, it will never
// be exposed to users.
binding.mainDrawer.addItems(
Keep scroll position when loading missing statuses (#3000) * Change "Load more" to load oldest statuses first in home timeline Previous behaviour loaded missing statuses by using "since_id" and "max_id". This loads the most recent N statuses, looking backwards from "max_id". Change to load the oldest statuses first, assuming the user is scrolling up through the timeline and will want to load statuses in reverse chronological order. * Scroll to the bottom of new entries added by "Load more" - Remember the position of the "Load more" placeholder - Check the position of inserted entries - If they match, scroll to the bottom * Change "Load more" to load oldest statuses first in home timeline Previous behaviour loaded missing statuses by using "since_id" and "max_id". This loads the most recent N statuses, looking backwards from "max_id". Change to load the oldest statuses first, assuming the user is scrolling up through the timeline and will want to load statuses in reverse chronological order. * Scroll to the bottom of new entries added by "Load more" - Remember the position of the "Load more" placeholder - Check the position of inserted entries - If they match, scroll to the bottom * Ensure the user can't have two simultaneous "Load more" coroutines Having two simultanous coroutines would break the calculation used to figure out which item in the list to scroll to after a "Load more" in the timeline. Do this by: - Creating a TimelineUiState and associated flow that tracks the "Load more" state - Updating this in the (Cached|Network)TimelineViewModel - Listening for changes to it in TimelineFragment, and notifying the adapter - The adapter will disable any placeholder views while "Load more" is active * Revert changes that loaded the oldest statuses instead of the newest * Be more robust about locating the status to scroll to Weirdness with the PagingData library meant that positionStart could still be wrong after "Load more" was clicked. Instead, remember the position of the "Load more" item and the ID of the status immediately after it. When new items are added, search for the remembered status at the position of the "Load more" item. This is quick, testing at most LOAD_AT_ONCE items in the adapter. If the remembered status is not visible on screen then scroll to it. * Lint * Add a preference to specify the reading order Default behaviour (oldest first) is for "load more" to load statuses and stay at the oldest of the new statuses. Alternative behaviour (if the user is reading from top to bottom) is to stay at the newest of the new statuses. * Move ReadingOrder enum construction logic in to the enum * Jump to top if swipe/refresh while preferring newest-first order * Show a circular progress spinner during "Load more" operations Remove a dedicated view, and use an icon on the button instead. Adjust the placeholder attributes and styles accordingly. * Remove the "loadMoreActive" property Complicates the code and doesn't really achieve the desired effect. If the user wants to tap multiple "Load more" buttons they can. * Update comments in TimelineFragment * Respect the user's reading order preference if it changes * Add developer tools This is for functionality that makes it easier for developers to interact with the app, or get it in to a known-state. These features are for use by users, so are only visible in debug builds. * Adjust how content is loaded based on preferred reading order - Add the readingOrder to TimelineViewModel so derived classes can use it. - Update the homeTimeline API to support the `minId` parameter and update calls in NetworkTimelineViewModel In CachedTimelineViewModel: - Set the bounds of the load to be the status IDs on either side of the placeholder ID (update TimelineDao with a new query for this) - Load statuses using either minId or sinceId depending on the reading order - Is there was no overlap then insert the new placeholder at the start/end of the list depending on reading order * Lint * Rename unused dialog parameter to _ * Update API arguments in tests * Simplify ReadingOrder preference handling * Fix bug with Placeholder and the "expanded" property If a status is a Placeholder the "expanded" propery is used to indicate whether or not it is loading. replaceStatusRange() set this property based on the old value, and the user's alwaysOpenSpoiler preference setting. This shouldn't have been used if the status is a Placeholder, as it can lead to incorrect loading states. Fix this. While I'm here, introduce an explicit computed property for whether a TimelineStatusEntity is a placeholder, and use that for code clarity. * Set the "Load more" button background to transparent * Fix typo. * Inline spec, update comment * Revert 1480c6aa3ac5c0c2d362fb271f47ea2259ab14e2 Turns out the behaviour is not desired. * Remove unnecessary Log call * Extract function * Change default to newest first
2023-01-13 19:26:24 +01:00
DividerDrawerItem(),
secondaryDrawerItem {
Keep scroll position when loading missing statuses (#3000) * Change "Load more" to load oldest statuses first in home timeline Previous behaviour loaded missing statuses by using "since_id" and "max_id". This loads the most recent N statuses, looking backwards from "max_id". Change to load the oldest statuses first, assuming the user is scrolling up through the timeline and will want to load statuses in reverse chronological order. * Scroll to the bottom of new entries added by "Load more" - Remember the position of the "Load more" placeholder - Check the position of inserted entries - If they match, scroll to the bottom * Change "Load more" to load oldest statuses first in home timeline Previous behaviour loaded missing statuses by using "since_id" and "max_id". This loads the most recent N statuses, looking backwards from "max_id". Change to load the oldest statuses first, assuming the user is scrolling up through the timeline and will want to load statuses in reverse chronological order. * Scroll to the bottom of new entries added by "Load more" - Remember the position of the "Load more" placeholder - Check the position of inserted entries - If they match, scroll to the bottom * Ensure the user can't have two simultaneous "Load more" coroutines Having two simultanous coroutines would break the calculation used to figure out which item in the list to scroll to after a "Load more" in the timeline. Do this by: - Creating a TimelineUiState and associated flow that tracks the "Load more" state - Updating this in the (Cached|Network)TimelineViewModel - Listening for changes to it in TimelineFragment, and notifying the adapter - The adapter will disable any placeholder views while "Load more" is active * Revert changes that loaded the oldest statuses instead of the newest * Be more robust about locating the status to scroll to Weirdness with the PagingData library meant that positionStart could still be wrong after "Load more" was clicked. Instead, remember the position of the "Load more" item and the ID of the status immediately after it. When new items are added, search for the remembered status at the position of the "Load more" item. This is quick, testing at most LOAD_AT_ONCE items in the adapter. If the remembered status is not visible on screen then scroll to it. * Lint * Add a preference to specify the reading order Default behaviour (oldest first) is for "load more" to load statuses and stay at the oldest of the new statuses. Alternative behaviour (if the user is reading from top to bottom) is to stay at the newest of the new statuses. * Move ReadingOrder enum construction logic in to the enum * Jump to top if swipe/refresh while preferring newest-first order * Show a circular progress spinner during "Load more" operations Remove a dedicated view, and use an icon on the button instead. Adjust the placeholder attributes and styles accordingly. * Remove the "loadMoreActive" property Complicates the code and doesn't really achieve the desired effect. If the user wants to tap multiple "Load more" buttons they can. * Update comments in TimelineFragment * Respect the user's reading order preference if it changes * Add developer tools This is for functionality that makes it easier for developers to interact with the app, or get it in to a known-state. These features are for use by users, so are only visible in debug builds. * Adjust how content is loaded based on preferred reading order - Add the readingOrder to TimelineViewModel so derived classes can use it. - Update the homeTimeline API to support the `minId` parameter and update calls in NetworkTimelineViewModel In CachedTimelineViewModel: - Set the bounds of the load to be the status IDs on either side of the placeholder ID (update TimelineDao with a new query for this) - Load statuses using either minId or sinceId depending on the reading order - Is there was no overlap then insert the new placeholder at the start/end of the list depending on reading order * Lint * Rename unused dialog parameter to _ * Update API arguments in tests * Simplify ReadingOrder preference handling * Fix bug with Placeholder and the "expanded" property If a status is a Placeholder the "expanded" propery is used to indicate whether or not it is loading. replaceStatusRange() set this property based on the old value, and the user's alwaysOpenSpoiler preference setting. This shouldn't have been used if the status is a Placeholder, as it can lead to incorrect loading states. Fix this. While I'm here, introduce an explicit computed property for whether a TimelineStatusEntity is a placeholder, and use that for code clarity. * Set the "Load more" button background to transparent * Fix typo. * Inline spec, update comment * Revert 1480c6aa3ac5c0c2d362fb271f47ea2259ab14e2 Turns out the behaviour is not desired. * Remove unnecessary Log call * Extract function * Change default to newest first
2023-01-13 19:26:24 +01:00
nameText = "Developer tools"
isEnabled = true
iconicsIcon = GoogleMaterial.Icon.gmd_developer_mode
onClick = {
buildDeveloperToolsDialog().show()
}
}
)
}
binding.mainDrawer.addItems(
2022-11-10 15:16:52 +01:00
secondaryDrawerItem {
nameText = "Yuito (by kyori19)"
isEnabled = false
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # app/build.gradle # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/MediaUploader.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/NetworkModule.kt # app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/util/ThemeUtils.java # app/src/main/res/layout/item_status_detailed.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/strings.xml # fastlane/metadata/android/sv/changelogs/74.txt # fastlane/metadata/android/tr/changelogs/58.txt # gradle/libs.versions.toml
2023-01-25 00:46:02 +01:00
textColor = ColorStateList.valueOf(MaterialColors.getColor(binding.mainDrawer, R.attr.colorInfo))
2022-11-10 15:16:52 +01:00
}
)
}
Keep scroll position when loading missing statuses (#3000) * Change "Load more" to load oldest statuses first in home timeline Previous behaviour loaded missing statuses by using "since_id" and "max_id". This loads the most recent N statuses, looking backwards from "max_id". Change to load the oldest statuses first, assuming the user is scrolling up through the timeline and will want to load statuses in reverse chronological order. * Scroll to the bottom of new entries added by "Load more" - Remember the position of the "Load more" placeholder - Check the position of inserted entries - If they match, scroll to the bottom * Change "Load more" to load oldest statuses first in home timeline Previous behaviour loaded missing statuses by using "since_id" and "max_id". This loads the most recent N statuses, looking backwards from "max_id". Change to load the oldest statuses first, assuming the user is scrolling up through the timeline and will want to load statuses in reverse chronological order. * Scroll to the bottom of new entries added by "Load more" - Remember the position of the "Load more" placeholder - Check the position of inserted entries - If they match, scroll to the bottom * Ensure the user can't have two simultaneous "Load more" coroutines Having two simultanous coroutines would break the calculation used to figure out which item in the list to scroll to after a "Load more" in the timeline. Do this by: - Creating a TimelineUiState and associated flow that tracks the "Load more" state - Updating this in the (Cached|Network)TimelineViewModel - Listening for changes to it in TimelineFragment, and notifying the adapter - The adapter will disable any placeholder views while "Load more" is active * Revert changes that loaded the oldest statuses instead of the newest * Be more robust about locating the status to scroll to Weirdness with the PagingData library meant that positionStart could still be wrong after "Load more" was clicked. Instead, remember the position of the "Load more" item and the ID of the status immediately after it. When new items are added, search for the remembered status at the position of the "Load more" item. This is quick, testing at most LOAD_AT_ONCE items in the adapter. If the remembered status is not visible on screen then scroll to it. * Lint * Add a preference to specify the reading order Default behaviour (oldest first) is for "load more" to load statuses and stay at the oldest of the new statuses. Alternative behaviour (if the user is reading from top to bottom) is to stay at the newest of the new statuses. * Move ReadingOrder enum construction logic in to the enum * Jump to top if swipe/refresh while preferring newest-first order * Show a circular progress spinner during "Load more" operations Remove a dedicated view, and use an icon on the button instead. Adjust the placeholder attributes and styles accordingly. * Remove the "loadMoreActive" property Complicates the code and doesn't really achieve the desired effect. If the user wants to tap multiple "Load more" buttons they can. * Update comments in TimelineFragment * Respect the user's reading order preference if it changes * Add developer tools This is for functionality that makes it easier for developers to interact with the app, or get it in to a known-state. These features are for use by users, so are only visible in debug builds. * Adjust how content is loaded based on preferred reading order - Add the readingOrder to TimelineViewModel so derived classes can use it. - Update the homeTimeline API to support the `minId` parameter and update calls in NetworkTimelineViewModel In CachedTimelineViewModel: - Set the bounds of the load to be the status IDs on either side of the placeholder ID (update TimelineDao with a new query for this) - Load statuses using either minId or sinceId depending on the reading order - Is there was no overlap then insert the new placeholder at the start/end of the list depending on reading order * Lint * Rename unused dialog parameter to _ * Update API arguments in tests * Simplify ReadingOrder preference handling * Fix bug with Placeholder and the "expanded" property If a status is a Placeholder the "expanded" propery is used to indicate whether or not it is loading. replaceStatusRange() set this property based on the old value, and the user's alwaysOpenSpoiler preference setting. This shouldn't have been used if the status is a Placeholder, as it can lead to incorrect loading states. Fix this. While I'm here, introduce an explicit computed property for whether a TimelineStatusEntity is a placeholder, and use that for code clarity. * Set the "Load more" button background to transparent * Fix typo. * Inline spec, update comment * Revert 1480c6aa3ac5c0c2d362fb271f47ea2259ab14e2 Turns out the behaviour is not desired. * Remove unnecessary Log call * Extract function * Change default to newest first
2023-01-13 19:26:24 +01:00
private fun buildDeveloperToolsDialog(): AlertDialog {
return AlertDialog.Builder(this)
.setTitle("Developer Tools")
.setItems(
arrayOf("Create \"Load more\" gap")
) { _, which ->
Log.d(TAG, "Developer tools: $which")
when (which) {
0 -> {
Log.d(TAG, "Creating \"Load more\" gap")
lifecycleScope.launch {
accountManager.activeAccount?.let {
developerToolsUseCase.createLoadMoreGap(
it.id
)
}
}
}
}
}
.create()
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(binding.mainDrawer.saveInstanceState(outState))
}
private fun tintCheckIcon(item: MenuItem) {
if (item.isChecked) {
@Suppress("DEPRECATION")
item.icon?.setColorFilter(ContextCompat.getColor(this, R.color.tusky_green_light), PorterDuff.Mode.SRC_IN)
} else {
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # app/build.gradle # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/MediaUploader.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/NetworkModule.kt # app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/util/ThemeUtils.java # app/src/main/res/layout/item_status_detailed.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/strings.xml # fastlane/metadata/android/sv/changelogs/74.txt # fastlane/metadata/android/tr/changelogs/58.txt # gradle/libs.versions.toml
2023-01-25 00:46:02 +01:00
setDrawableTint(this, item.icon!!, android.R.attr.textColorTertiary)
}
}
private fun setupTabs(selectNotificationTab: Boolean) {
val activeTabLayout = if (preferences.getString(PrefKeys.MAIN_NAV_POSITION, "top") == "bottom") {
val actionBarSize = getDimension(this, androidx.appcompat.R.attr.actionBarSize)
val fabMargin = resources.getDimensionPixelSize(R.dimen.fabMargin)
(binding.composeButton.layoutParams as CoordinatorLayout.LayoutParams).bottomMargin = actionBarSize + fabMargin
binding.topNav.hide()
binding.bottomTabLayout
} else {
binding.bottomNav.hide()
(binding.viewPager.layoutParams as CoordinatorLayout.LayoutParams).bottomMargin = 0
(binding.composeButton.layoutParams as CoordinatorLayout.LayoutParams).anchorId = R.id.viewPager
binding.tabLayout
}
// Save the previous tab so it can be restored later
val previousTab = tabAdapter.tabs.getOrNull(binding.viewPager.currentItem)
val tabs = accountManager.activeAccount!!.tabPreferences.toMutableList()
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
val popups = MutableList<PopupMenu?>(tabs.size) { null }
// Detach any existing mediator before changing tab contents and attaching a new mediator
tabLayoutMediator?.detach()
tabAdapter.tabs = tabs
tabAdapter.notifyItemRangeChanged(0, tabs.size)
tabLayoutMediator = TabLayoutMediator(activeTabLayout, binding.viewPager, true) {
tab: TabLayout.Tab, position: Int ->
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
val data = tabs[position]
tab.icon = AppCompatResources.getDrawable(this@MainActivity, data.icon)
tab.contentDescription = when (data.id) {
LIST -> data.arguments[1]
else -> getString(data.text)
}
if (popups[position] != null) {
return@TabLayoutMediator
}
val popup = PopupMenu(this, tab.view)
popup.menuInflater.inflate(R.menu.view_tab_action, popup.menu)
@SuppressLint("RestrictedApi")
if (popup.menu is MenuBuilder) {
val menuBuilder = popup.menu as MenuBuilder
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
if (data.id in arrayOf(HOME, LOCAL, FEDERATED, HASHTAG, LIST)) {
2021-07-25 17:10:48 +02:00
menuBuilder.findItem(R.id.tabReset).isVisible = true
}
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
if (data.id == LIST) {
2020-08-14 11:43:59 +02:00
menuBuilder.findItem(R.id.tabEditList).isVisible = true
}
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
if (data.id in arrayOf(HOME, LOCAL, FEDERATED, LIST)) {
menuBuilder.findItem(R.id.tabToggleStreaming).apply {
isVisible = true
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
isChecked = data.enableStreaming
}
}
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
if (data.id == NOTIFICATIONS) {
menuBuilder.findItem(R.id.tabToggleNotificationsFilter).isVisible = true
}
menuBuilder.setOptionalIconsVisible(true)
menuBuilder.visibleItems.forEach { item ->
val iconMarginPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8f, resources.displayMetrics).toInt()
if (item.icon != null) {
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
item.icon = InsetDrawable(item.icon, iconMarginPx, 0, iconMarginPx, 0)
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # app/build.gradle # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/MediaUploader.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/NetworkModule.kt # app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/util/ThemeUtils.java # app/src/main/res/layout/item_status_detailed.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/strings.xml # fastlane/metadata/android/sv/changelogs/74.txt # fastlane/metadata/android/tr/changelogs/58.txt # gradle/libs.versions.toml
2023-01-25 00:46:02 +01:00
setDrawableTint(this, item.icon!!, android.R.attr.textColorPrimary)
}
}
tintCheckIcon(menuBuilder.findItem(R.id.tabToggleStreaming))
}
popup.setOnMenuItemClickListener { item ->
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
val fragment = tabAdapter.getFragment(tab.position)
when (item.itemId) {
R.id.tabJumpToTop -> {
if (fragment is ReselectableFragment) {
(fragment as ReselectableFragment).onReselect()
}
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
refreshComposeButtonState(tabAdapter, tab.position)
}
2021-07-25 17:10:48 +02:00
R.id.tabReset -> {
if (fragment is ResettableFragment) {
fragment.onReset()
}
}
2020-08-14 11:43:59 +02:00
R.id.tabEditList -> {
AccountsInListFragment.newInstance(
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
data.arguments.getOrNull(0).orEmpty(),
data.arguments.getOrNull(1).orEmpty()
2020-08-14 11:43:59 +02:00
).show(supportFragmentManager, null)
}
R.id.tabToggleStreaming -> {
if (fragment is TimelineFragment) {
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
val to = !item.isChecked
fragment.setStreamingEnabled(to)
item.isChecked = to
tintCheckIcon(item)
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
tabs[position] = data.copy(enableStreaming = to)
accountManager.activeAccount?.let {
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
it.tabPreferences = tabs
accountManager.saveAccount(it)
}
}
}
R.id.tabToggleNotificationsFilter -> {
if (fragment is NotificationsFragment) {
val prefs = PreferenceManager.getDefaultSharedPreferences(this)
2022-11-10 15:16:52 +01:00
prefs.edit().putBoolean(
"showNotificationsFilter",
!prefs.getBoolean("showNotificationsFilter", true)
)
.apply()
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
lifecycleScope.launch {
eventHub.dispatch(PreferenceChangedEvent("showNotificationsFilter"))
}
}
}
}
false
}
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
popups[position] = popup
}.also { it.attach() }
// Selected tab is either
// - Notification tab (if appropriate)
// - The previously selected tab (if it hasn't been removed)
// - Left-most tab
val position = if (selectNotificationTab) {
tabs.indexOfFirst { it.id == NOTIFICATIONS }
} else {
previousTab?.let { tabs.indexOfFirst { it == previousTab } }
}.takeIf { it != -1 } ?: 0
binding.viewPager.setCurrentItem(position, false)
val pageMargin = resources.getDimensionPixelSize(R.dimen.tab_page_margin)
binding.viewPager.setPageTransformer(MarginPageTransformer(pageMargin))
val enableSwipeForTabs = preferences.getBoolean(PrefKeys.ENABLE_SWIPE_FOR_TABS, true)
binding.viewPager.isUserInputEnabled = enableSwipeForTabs
onTabSelectedListener?.let {
activeTabLayout.removeOnTabSelectedListener(it)
}
onTabSelectedListener = object : OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab) {
binding.mainToolbar.title = tab.contentDescription
refreshComposeButtonState(tabAdapter, tab.position)
}
override fun onTabUnselected(tab: TabLayout.Tab) {}
override fun onTabReselected(tab: TabLayout.Tab) {
Merge remote-tracking branch 'tuskyapp/develop' # Conflicts: # .gitignore # README.md # app/build.gradle # app/src/green/res/mipmap-hdpi/ic_launcher.png # app/src/green/res/mipmap-mdpi/ic_launcher.png # app/src/green/res/mipmap-xhdpi/ic_launcher.png # app/src/green/res/mipmap-xxhdpi/ic_launcher.png # app/src/green/res/mipmap-xxxhdpi/ic_launcher.png # app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt # app/src/main/java/com/keylesspalace/tusky/MainActivity.kt # app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt # app/src/main/java/com/keylesspalace/tusky/TabData.kt # app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java # app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java # app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt # app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt # app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesActivity.kt # app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/report/fragments/ReportStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt # app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt # app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt # app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt # app/src/main/java/com/keylesspalace/tusky/di/ActivitiesModule.kt # app/src/main/java/com/keylesspalace/tusky/di/FragmentBuildersModule.kt # app/src/main/java/com/keylesspalace/tusky/di/ViewModelFactory.kt # app/src/main/java/com/keylesspalace/tusky/entity/NewStatus.kt # app/src/main/java/com/keylesspalace/tusky/entity/Status.kt # app/src/main/java/com/keylesspalace/tusky/entity/TimelineAccount.kt # app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java # app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt # app/src/main/java/com/keylesspalace/tusky/settings/SettingsConstants.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusDisplayOptions.kt # app/src/main/java/com/keylesspalace/tusky/util/StatusParsingHelper.kt # app/src/main/res/layout/activity_about.xml # app/src/main/res/layout/activity_main.xml # app/src/main/res/layout/item_status.xml # app/src/main/res/layout/item_status_notification.xml # app/src/main/res/values-ar/strings.xml # app/src/main/res/values-be/strings.xml # app/src/main/res/values-bn-rBD/strings.xml # app/src/main/res/values-ca/strings.xml # app/src/main/res/values-cy/strings.xml # app/src/main/res/values-de/strings.xml # app/src/main/res/values-es/strings.xml # app/src/main/res/values-eu/strings.xml # app/src/main/res/values-fa/strings.xml # app/src/main/res/values-fr/strings.xml # app/src/main/res/values-gd/strings.xml # app/src/main/res/values-gl/strings.xml # app/src/main/res/values-hu/strings.xml # app/src/main/res/values-in/strings.xml # app/src/main/res/values-is/strings.xml # app/src/main/res/values-it/strings.xml # app/src/main/res/values-ja/strings.xml # app/src/main/res/values-lv/strings.xml # app/src/main/res/values-nb-rNO/strings.xml # app/src/main/res/values-night/theme_colors.xml # app/src/main/res/values-oc/strings.xml # app/src/main/res/values-pl/strings.xml # app/src/main/res/values-pt-rBR/strings.xml # app/src/main/res/values-ru/strings.xml # app/src/main/res/values-sa/strings.xml # app/src/main/res/values-sv/strings.xml # app/src/main/res/values-tr/strings.xml # app/src/main/res/values-uk/strings.xml # app/src/main/res/values-vi/strings.xml # app/src/main/res/values-zh-rCN/strings.xml # app/src/main/res/values/attrs.xml # app/src/main/res/values/styles.xml # app/src/main/res/values/theme_colors.xml # app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt # app/src/test/java/com/keylesspalace/tusky/FilterV1Test.kt # app/src/test/java/com/keylesspalace/tusky/components/timeline/StatusMocker.kt # app/src/test/java/com/keylesspalace/tusky/db/TimelineDaoTest.kt # app/src/test/java/com/keylesspalace/tusky/usecase/TimelineCasesTest.kt # app/src/test/java/com/keylesspalace/tusky/util/RickRollTest.kt # assets/tusky_banner.xcf # fastlane/metadata/android/ca/changelogs/58.txt # fastlane/metadata/android/ca/full_description.txt # fastlane/metadata/android/de/changelogs/58.txt # fastlane/metadata/android/de/changelogs/61.txt # fastlane/metadata/android/de/changelogs/67.txt # fastlane/metadata/android/de/changelogs/68.txt # fastlane/metadata/android/de/changelogs/70.txt # fastlane/metadata/android/de/changelogs/72.txt # fastlane/metadata/android/de/changelogs/74.txt # fastlane/metadata/android/de/changelogs/77.txt # fastlane/metadata/android/de/changelogs/80.txt # fastlane/metadata/android/de/changelogs/82.txt # fastlane/metadata/android/de/changelogs/83.txt # fastlane/metadata/android/de/changelogs/87.txt # fastlane/metadata/android/de/changelogs/89.txt # fastlane/metadata/android/de/changelogs/94.txt # fastlane/metadata/android/de/full_description.txt # fastlane/metadata/android/de/short_description.txt # fastlane/metadata/android/fa/changelogs/58.txt # fastlane/metadata/android/it/changelogs/58.txt # gradle.properties # gradle/libs.versions.toml # instance-build.gradle
2023-05-26 17:42:56 +02:00
popups[tab.position]?.show()
}
}.also {
activeTabLayout.addOnTabSelectedListener(it)
}
val activeTabPosition = if (selectNotificationTab) notificationTabPosition else 0
Add "Refresh" accessibility menu (#3121) * Add "Refresh" accessibility menu to TimelineFragment Per https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout the layout does not provide accessibility events, and a menu item should be provided as an alternative method for refreshing the content. In `TimelineFragment`: - Implement the `MenuProvider` interface so it can populate the action bar menu in activities that host the fragment - Create a "Refresh" menu item, and refresh the state when it is selected `MainActivity` has to change how the menu is created, so that fragments can add items to it. In `MainActivity`: - Call `setSupportActionBar` so `mainToolbar` participates in menus - Implement the `MenuProvider` interface, and move menu creation there - Set the title via supportActionBar * Never show the refresh item as a menubar action Per guidelines in https://developer.android.com/develop/ui/views/touch-and-input/swipe/add-swipe-interface#AddRefreshAction * Add "Refresh" menu item for AccountMediaFragment Also, fix the colour of the refresh progress indicator * Implement "Refresh" for AnnouncementsActivity * Add "Refresh" menu for ConversationsFragment * Keep the tabs adapter over the life of the viewpager Make `tabs` `var` instead of `val` in `MainPagerAdapter` so it can be updated when tabs change. Then detach the `tabLayoutMediator`, update the tabs, and call `notifyItemRangeChanged` in `setupTabs()`. This fixes a bug (not sure if it's this code, or in ViewPager2) where assigning a new adapter to the view pager seemed to result in a leak of one or more fragments. This wasn't user-visible, but it's a leak, and it becomes user-visible when fragments want to display menus. This also fixes two other bugs: 1. Be on the left-most tab. Scroll down a bit. Then modify the tabs at "Account preferences > tabs", but keep the left-most tab as-is. Then go back to MainActivity. Your reading position in the left-most tab has been jumped to the top. 2. Be on any non-left-most tab. Then modify the tab list by reordering tabs (adding/removing tabs is also OK). Then go back to MainActivity. Your tab selection has been overridden, and the left-most tab has been selected. Because the fragments are not destroyed unnecessarily your reading position is retained. And it remembers the tab you had selected, and as long as that tab is still present you will be returned to it, even if it's changed position in the list. Fixes https://github.com/tuskyapp/Tusky/issues/3251 * Add "Refresh" menu for ScheduledStatusActivity * Lint * Add "Refresh" menu for SearchFragment / SearchActivity * Explicitly set the searchview width Using "collapseActionView" requires the user to press "Back" twice to exit the activity, which is not acceptable. * Move toolbar handling in to ViewThreadActivity Previous code had the toolbar in the fragment's layout. Refactor to make consistent with other activities, and move the toolbar in to the activity layout. Implement MenuProvider in ViewThreadFragment to adjust the menu in the activity. * Add "Refresh" menu to ViewThreadFragment * Implement "Refresh" for ViewEditsFragment * Lint * Add "Refresh" menu to ReportStatusesFragment * Add "Refresh" menu to NotificationsFragment * Rename menu resource files Be consistent with the layout resource files, which have an activity/fragment prefix, then the lower_snake_case name of the activity or fragment it's for. * Only enable refresh menu if swiptorefresh is enabled Some timelines don't have swipetorefresh enabled (e.g., those shown on AccountActivity). In those cases don't add the refresh menu, rely on the hosting activity to provide it. Update AccountActivity to provide the refresh menu item.
2023-03-01 19:58:18 +01:00
supportActionBar?.title = tabs[activeTabPosition].title(this@MainActivity)
binding.mainToolbar.setOnClickListener {
(tabAdapter.getFragment(activeTabLayout.selectedTabPosition) as? ReselectableFragment)?.onReselect()
}
updateProfiles()
}
Add trending tags (#3149) * Add initial feature for viewing trending graphs. Currently only views hash tag trends. Contains API additions, tab additions and a set of trending components. * Add clickable system through a LinkListener. Duplicates a little code from SFragment. * Add accessibility description. * The background for the graph should match the background for black theme too. * Add error handling through a state flow system using existing code as an example. * Graphing: Use a primary and a secondary line. Remove under line fill. Apply line thickness. Dotted end of line. * Trending changes: New layout for trending: Cell. Use ViewBinding. Add padding to RecyclerView to stop the FAB from hiding content. Multiple bugs in GraphView resolved. Wide (landscape, for example) will show 4 columns, portrait will show 2. Remove unused base holder class. ViewModel invalidate scoping changed. Some renaming to variables made. For uses and accounts, use longs. These could be big numbers eventually. TagViewHolder renamed to TrendingTagViewHolder. * Trending changes: Remove old layout. Update cell textsizes and use proper string. Remove bad comment. * Trending changes: Refresh the main drawer when the tabs are edited. This will allow the trending item to toggle. * Trending changes: Add a trending activity to be able to view the trending data from the main drawer. * Trending changes: The title text should be changed to Trending Hashtags. * Trending changes: Add meta color to draw axis etc. Draw the date boundaries on the graph. Remove dates from each cell and place them in the list as a header. Graphs should be proportional to the highest historical value. Add a new interface to control whether the FAB should be visible (important when switching tabs, the state is lost). Add header to the adapter and viewdata structures. Add QOL extensions for getting the dates from history. * Trending changes: Refresh FAB through the main activity and FabFragment interface. Trending has no FAB. * Trending changes: Make graph proportional to the highest usage value. Fixes to the graph ratio calculations. * Trending changes: KtLintFix * Trending changes: Remove accidental build gradle change. Remove trending cases. Remove unused progress. Set drawer button addition explicitly to false, leaving the code there for future issue #3010. Remove unnecessary arguments for intent. Remove media preview preferences, there is nothing to preview. No padding between hashtag symbol and text. Do not ellipsize hashtags. * Trending changes: Use bottomsheet slide in animation helper for opening the hashtag intent. Remove explicit layout height from the XML and apply it to the view holder itself. The height was not being respected in XML. * Use some platform standards for styling - Align on an 8dp grid - Use android:attr for paddingStart and paddingEnd - Use textAppearanceListItem variants - Adjust constraints to handle different size containers * Correct lineWidth calculations Previous code didn't convert the value to pixels, so it was always displaying as a hairline stroke, irrespective of the value in the layout file. While I'm here, rename from lineThickness to lineWidth, to be consistent with parameters like strokeWidth. * Does not need to inherit from FabFragment * Rename to TrendingAdapter "Paging" in the adapter name is a misnomer here * Clean up comments, use full class name as tag * Simplify TrendingViewModel - Remove unncessary properties - Fetch tags and map in invalidate() - emptyList() instead of listOf() for clarity * Remove line dividers, use X-axis to separate content Experiment with UI -- instead of dividers between each item, draw an explicit x-axis for each chart, and add a little more vertical padding, to see if that provides a cleaner separation between the content * Adjust date format - Show day and year - Use platform attributes for size * Locale-aware format of numbers Format numbers < 100,000 by inserting locale-aware separators. Numbers larger are scaled and have K, M, G, ... etc suffix appended. * Prevent a crash if viewData is empty Don't access viewData without first checking if it's empty. This can be the case if the server returned an empty list for some reason, or the data has been filtered. * Filter out tags the user has filtered from their home timeline Invalidate the list if the user's preferences change, as that may indicate they've changed their filters. * Experiment with alternative layout * Set chart height to 160dp to align to an 8dp grid * Draw ticks that are 5% the height of the x-axis * Legend adjustments - Use tuskyblue for the ticks - Wrap legend components in a layout so they can have a dedicated background - Use a 60% transparent background for the legend to retain legibility if lines go under it * Bezier curves, shorter cell height * More tweaks - List tags in order of popularity, most popular first - Make it clear that uses/accounts in the legend are totals, not current - Show current values at end of the chart * Hide FAB * Fix crash, it's not always hosted in an ActionButtonActivity * Arrange totals vertically in landscape layout * Always add the Trending drawer menu if it's not a tab * Revert unrelated whitespace changes * One more whitespace revert --------- Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-02-14 19:52:11 +01:00
private fun refreshComposeButtonState(adapter: MainPagerAdapter, tabPosition: Int) {
adapter.getFragment(tabPosition)?.also { fragment ->
if (fragment is FabFragment) {
if (fragment.isFabVisible()) {
binding.composeButton.show()
} else {
binding.composeButton.hide()
}
} else {
binding.composeButton.show()
}
}
}
private fun handleProfileClick(profile: IProfile, current: Boolean): Boolean {
val activeAccount = accountManager.activeAccount
2021-06-28 22:04:34 +02:00
// open profile when active image was clicked
if (current && activeAccount != null) {
val intent = AccountActivity.getIntent(this, activeAccount.accountId)
startActivityWithSlideInAnimation(intent)
return false
}
2021-06-28 22:04:34 +02:00
// open LoginActivity to add new account
if (profile.identifier == DRAWER_ITEM_ADD_ACCOUNT) {
startActivityWithSlideInAnimation(LoginActivity.getIntent(this, LoginActivity.MODE_ADDITIONAL_LOGIN))
return false
}
2021-06-28 22:04:34 +02:00
// change Account
changeAccount(profile.identifier, null)
return false
}
private fun changeAccount(newSelectedId: Long, forward: Intent?) {
cacheUpdater.stop()
accountManager.setActiveAccount(newSelectedId)
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
val intent = Intent(this, MainActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
if (forward != null) {
intent.type = forward.type
intent.action = forward.action
intent.putExtras(forward)
}
startActivity(intent)
finishWithoutSlideOutAnimation()
overridePendingTransition(R.anim.explode, R.anim.explode)
}
private fun logout() {
accountManager.activeAccount?.let { activeAccount ->
AlertDialog.Builder(this)
.setTitle(R.string.action_logout)
.setMessage(getString(R.string.action_logout_confirm, activeAccount.fullName))
.setPositiveButton(android.R.string.ok) { _: DialogInterface?, _: Int ->
binding.appBar.hide()
binding.viewPager.hide()
binding.progressBar.show()
binding.bottomNav.hide()
binding.composeButton.hide()
lifecycleScope.launch {
val otherAccountAvailable = logoutUsecase.logout()
val intent = if (otherAccountAvailable) {
Intent(this@MainActivity, MainActivity::class.java)
} else {
LoginActivity.getIntent(this@MainActivity, LoginActivity.MODE_DEFAULT)
}
startActivity(intent)
finishWithoutSlideOutAnimation()
}
}
2021-06-28 22:04:34 +02:00
.setNegativeButton(android.R.string.cancel, null)
.show()
}
}
private fun fetchUserInfo() = lifecycleScope.launch {
mastodonApi.accountVerifyCredentials().fold(
{ userInfo ->
onFetchUserInfoSuccess(userInfo)
},
{ throwable ->
Log.e(TAG, "Failed to fetch user info. " + throwable.message)
}
)
}
private fun onFetchUserInfoSuccess(me: Account) {
glide.asBitmap()
2021-06-28 22:04:34 +02:00
.load(me.header)
.into(header.accountHeaderBackground)
loadDrawerAvatar(me.avatar, false)
accountManager.updateActiveAccount(me)
NotificationHelper.createNotificationChannelsForAccount(accountManager.activeAccount!!, this)
// Setup push notifications
showMigrationNoticeIfNecessary(this, binding.mainCoordinatorLayout, binding.composeButton, accountManager)
if (NotificationHelper.areNotificationsEnabled(this, accountManager)) {
lifecycleScope.launch {
enablePushNotificationsWithFallback(this@MainActivity, mastodonApi, accountManager)
}
} else {
disableAllNotifications(this, accountManager)
}
accountLocked = me.locked
updateProfiles()
updateShortcut(this, accountManager.activeAccount!!)
}
private fun loadDrawerAvatar(avatarUrl: String, showPlaceholder: Boolean) {
val hideTopToolbar = preferences.getBoolean(PrefKeys.HIDE_TOP_TOOLBAR, false)
val animateAvatars = preferences.getBoolean("animateGifAvatars", false)
if (hideTopToolbar) {
val navOnBottom = preferences.getString("mainNavPosition", "top") == "bottom"
val avatarView = if (navOnBottom) {
binding.bottomNavAvatar.show()
binding.bottomNavAvatar
} else {
binding.topNavAvatar.show()
binding.topNavAvatar
}
if (animateAvatars) {
Glide.with(this)
.load(avatarUrl)
.placeholder(R.drawable.avatar_default)
.into(avatarView)
} else {
Glide.with(this)
.asBitmap()
.load(avatarUrl)
.placeholder(R.drawable.avatar_default)
.into(avatarView)
}
} else {
binding.bottomNavAvatar.hide()
binding.topNavAvatar.hide()
val navIconSize = resources.getDimensionPixelSize(R.dimen.avatar_toolbar_nav_icon_size)
if (animateAvatars) {
glide.asDrawable()
.load(avatarUrl)
.transform(
RoundedCorners(resources.getDimensionPixelSize(R.dimen.avatar_radius_36dp))
)
.apply {
if (showPlaceholder) {
placeholder(R.drawable.avatar_default)
}
}
.into(object : CustomTarget<Drawable>(navIconSize, navIconSize) {
override fun onLoadStarted(placeholder: Drawable?) {
if (placeholder != null) {
binding.mainToolbar.navigationIcon =
FixedSizeDrawable(placeholder, navIconSize, navIconSize)
}
}
override fun onResourceReady(
resource: Drawable,
transition: Transition<in Drawable>?
) {
if (resource is Animatable) {
resource.start()
}
binding.mainToolbar.navigationIcon =
FixedSizeDrawable(resource, navIconSize, navIconSize)
}
override fun onLoadCleared(placeholder: Drawable?) {
if (placeholder != null) {
binding.mainToolbar.navigationIcon =
FixedSizeDrawable(placeholder, navIconSize, navIconSize)
}
}
})
} else {
glide.asBitmap()
.load(avatarUrl)
.transform(
RoundedCorners(resources.getDimensionPixelSize(R.dimen.avatar_radius_36dp))
)
.apply {
if (showPlaceholder) {
placeholder(R.drawable.avatar_default)
}
}
.into(object : CustomTarget<Bitmap>(navIconSize, navIconSize) {
override fun onLoadStarted(placeholder: Drawable?) {
if (placeholder != null) {
binding.mainToolbar.navigationIcon =
FixedSizeDrawable(placeholder, navIconSize, navIconSize)
}
}
override fun onResourceReady(
resource: Bitmap,
transition: Transition<in Bitmap>?
) {
binding.mainToolbar.navigationIcon = FixedSizeDrawable(
BitmapDrawable(resources, resource),
navIconSize,
navIconSize
)
}
override fun onLoadCleared(placeholder: Drawable?) {
if (placeholder != null) {
binding.mainToolbar.navigationIcon =
FixedSizeDrawable(placeholder, navIconSize, navIconSize)
}
}
})
}
}
}
private fun fetchAnnouncements() {
lifecycleScope.launch {
mastodonApi.listAnnouncements(false)
.fold(
{ announcements ->
unreadAnnouncementsCount = announcements.count { !it.read }
updateAnnouncementsBadge()
},
{ throwable ->
Log.w(TAG, "Failed to fetch announcements.", throwable)
}
)
}
}
private fun updateAnnouncementsBadge() {
binding.mainDrawer.updateBadge(DRAWER_ITEM_ANNOUNCEMENTS, StringHolder(if (unreadAnnouncementsCount <= 0) null else unreadAnnouncementsCount.toString()))
}
private fun updateProfiles() {
val animateEmojis = preferences.getBoolean(PrefKeys.ANIMATE_CUSTOM_EMOJIS, false)
Add trending tags (#3149) * Add initial feature for viewing trending graphs. Currently only views hash tag trends. Contains API additions, tab additions and a set of trending components. * Add clickable system through a LinkListener. Duplicates a little code from SFragment. * Add accessibility description. * The background for the graph should match the background for black theme too. * Add error handling through a state flow system using existing code as an example. * Graphing: Use a primary and a secondary line. Remove under line fill. Apply line thickness. Dotted end of line. * Trending changes: New layout for trending: Cell. Use ViewBinding. Add padding to RecyclerView to stop the FAB from hiding content. Multiple bugs in GraphView resolved. Wide (landscape, for example) will show 4 columns, portrait will show 2. Remove unused base holder class. ViewModel invalidate scoping changed. Some renaming to variables made. For uses and accounts, use longs. These could be big numbers eventually. TagViewHolder renamed to TrendingTagViewHolder. * Trending changes: Remove old layout. Update cell textsizes and use proper string. Remove bad comment. * Trending changes: Refresh the main drawer when the tabs are edited. This will allow the trending item to toggle. * Trending changes: Add a trending activity to be able to view the trending data from the main drawer. * Trending changes: The title text should be changed to Trending Hashtags. * Trending changes: Add meta color to draw axis etc. Draw the date boundaries on the graph. Remove dates from each cell and place them in the list as a header. Graphs should be proportional to the highest historical value. Add a new interface to control whether the FAB should be visible (important when switching tabs, the state is lost). Add header to the adapter and viewdata structures. Add QOL extensions for getting the dates from history. * Trending changes: Refresh FAB through the main activity and FabFragment interface. Trending has no FAB. * Trending changes: Make graph proportional to the highest usage value. Fixes to the graph ratio calculations. * Trending changes: KtLintFix * Trending changes: Remove accidental build gradle change. Remove trending cases. Remove unused progress. Set drawer button addition explicitly to false, leaving the code there for future issue #3010. Remove unnecessary arguments for intent. Remove media preview preferences, there is nothing to preview. No padding between hashtag symbol and text. Do not ellipsize hashtags. * Trending changes: Use bottomsheet slide in animation helper for opening the hashtag intent. Remove explicit layout height from the XML and apply it to the view holder itself. The height was not being respected in XML. * Use some platform standards for styling - Align on an 8dp grid - Use android:attr for paddingStart and paddingEnd - Use textAppearanceListItem variants - Adjust constraints to handle different size containers * Correct lineWidth calculations Previous code didn't convert the value to pixels, so it was always displaying as a hairline stroke, irrespective of the value in the layout file. While I'm here, rename from lineThickness to lineWidth, to be consistent with parameters like strokeWidth. * Does not need to inherit from FabFragment * Rename to TrendingAdapter "Paging" in the adapter name is a misnomer here * Clean up comments, use full class name as tag * Simplify TrendingViewModel - Remove unncessary properties - Fetch tags and map in invalidate() - emptyList() instead of listOf() for clarity * Remove line dividers, use X-axis to separate content Experiment with UI -- instead of dividers between each item, draw an explicit x-axis for each chart, and add a little more vertical padding, to see if that provides a cleaner separation between the content * Adjust date format - Show day and year - Use platform attributes for size * Locale-aware format of numbers Format numbers < 100,000 by inserting locale-aware separators. Numbers larger are scaled and have K, M, G, ... etc suffix appended. * Prevent a crash if viewData is empty Don't access viewData without first checking if it's empty. This can be the case if the server returned an empty list for some reason, or the data has been filtered. * Filter out tags the user has filtered from their home timeline Invalidate the list if the user's preferences change, as that may indicate they've changed their filters. * Experiment with alternative layout * Set chart height to 160dp to align to an 8dp grid * Draw ticks that are 5% the height of the x-axis * Legend adjustments - Use tuskyblue for the ticks - Wrap legend components in a layout so they can have a dedicated background - Use a 60% transparent background for the legend to retain legibility if lines go under it * Bezier curves, shorter cell height * More tweaks - List tags in order of popularity, most popular first - Make it clear that uses/accounts in the legend are totals, not current - Show current values at end of the chart * Hide FAB * Fix crash, it's not always hosted in an ActionButtonActivity * Arrange totals vertically in landscape layout * Always add the Trending drawer menu if it's not a tab * Revert unrelated whitespace changes * One more whitespace revert --------- Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-02-14 19:52:11 +01:00
val profiles: MutableList<IProfile> =
accountManager.getAllAccountsOrderedByActive().map { acc ->
ProfileDrawerItem().apply {
isSelected = acc.isActive
nameText = acc.displayName.emojify(acc.emojis, header, animateEmojis)
iconUrl = acc.profilePictureUrl
isNameShown = true
identifier = acc.id
descriptionText = acc.fullName
}
}.toMutableList()
// reuse the already existing "add account" item
for (profile in header.profiles.orEmpty()) {
if (profile.identifier == DRAWER_ITEM_ADD_ACCOUNT) {
profiles.add(profile)
break
}
}
header.clear()
header.profiles = profiles
header.setActiveProfile(accountManager.activeAccount!!.id)
binding.mainToolbar.subtitle = if (accountManager.shouldDisplaySelfUsername(this)) {
accountManager.activeAccount!!.fullName
} else {
null
}
}
2021-06-28 22:04:34 +02:00
override fun getActionButton() = binding.composeButton
override fun androidInjector() = androidInjector
companion object {
private const val TAG = "MainActivity" // logging tag
private const val DRAWER_ITEM_ADD_ACCOUNT: Long = -13
private const val DRAWER_ITEM_ANNOUNCEMENTS: Long = 14
const val REDIRECT_URL = "redirectUrl"
const val OPEN_DRAFTS = "draft"
}
}
private inline fun primaryDrawerItem(block: PrimaryDrawerItem.() -> Unit): PrimaryDrawerItem {
return PrimaryDrawerItem()
.apply {
isSelectable = false
isIconTinted = true
}
.apply(block)
}
private inline fun secondaryDrawerItem(block: SecondaryDrawerItem.() -> Unit): SecondaryDrawerItem {
return SecondaryDrawerItem()
.apply {
isSelectable = false
isIconTinted = true
}
.apply(block)
}
private var AbstractDrawerItem<*, *>.onClick: () -> Unit
get() = throw UnsupportedOperationException()
set(value) {
onDrawerItemClickListener = { _, _, _ ->
value()
2020-04-28 21:56:02 +02:00
false
}
}