Skip to content

Commit

Permalink
Merge branch 'develop' into nikclayton-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Nik Clayton authored Jul 20, 2023
2 parents 96721c3 + e4c2476 commit 472287a
Show file tree
Hide file tree
Showing 18 changed files with 140 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import dagger.android.DispatchingAndroidInjector
import dagger.android.HasAndroidInjector
import javax.inject.Inject

class SearchActivity : BottomSheetActivity(), HasAndroidInjector, MenuProvider {
class SearchActivity : BottomSheetActivity(), HasAndroidInjector, MenuProvider, SearchView.OnQueryTextListener {
@Inject
lateinit var androidInjector: DispatchingAndroidInjector<Any>

Expand Down Expand Up @@ -91,8 +91,6 @@ class SearchActivity : BottomSheetActivity(), HasAndroidInjector, MenuProvider {
searchViewMenuItem.expandActionView()
val searchView = searchViewMenuItem.actionView as SearchView
setupSearchView(searchView)

searchView.setQuery(viewModel.currentQuery, false)
}

override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
Expand Down Expand Up @@ -150,9 +148,23 @@ class SearchActivity : BottomSheetActivity(), HasAndroidInjector, MenuProvider {
val pxBuffer = ((48 * 2) * resources.displayMetrics.density).toInt()
searchView.maxWidth = pxScreenWidth - pxBuffer

// Keep text that was entered also when switching to a different tab (before the search is executed)
searchView.setOnQueryTextListener(this)
searchView.setQuery(viewModel.currentSearchFieldContent ?: "", false)

searchView.requestFocus()
}

override fun onQueryTextSubmit(query: String?): Boolean {
return false
}

override fun onQueryTextChange(newText: String?): Boolean {
viewModel.currentSearchFieldContent = newText

return false
}

override fun androidInjector() = androidInjector

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class SearchViewModel @Inject constructor(
) : ViewModel() {

var currentQuery: String = ""
var currentSearchFieldContent: String? = null

val activeAccount: AccountEntity?
get() = accountManager.activeAccount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,26 @@ class TrendingViewModel @Inject constructor(

mastodonApi.trendingTags().fold(
{ tagResponse ->
val homeFilters = deferredFilters.await().getOrNull()?.filter { filter ->
filter.context.contains(Filter.Kind.HOME.kind)
}
val tags = tagResponse
.filter { tag ->
homeFilters?.none { filter ->
filter.keywords.any { keyword -> keyword.keyword.equals(tag.name, ignoreCase = true) }
} ?: false
}
.sortedByDescending { tag -> tag.history.sumOf { it.uses.toLongOrNull() ?: 0 } }
.toViewData()

val firstTag = tagResponse.first()
val header = TrendingViewData.Header(firstTag.start(), firstTag.end())
val firstTag = tagResponse.firstOrNull()
_uiState.value = if (firstTag == null) {
TrendingUiState(emptyList(), LoadingState.LOADED)
} else {
val homeFilters = deferredFilters.await().getOrNull()?.filter { filter ->
filter.context.contains(Filter.Kind.HOME.kind)
}
val tags = tagResponse
.filter { tag ->
homeFilters?.none { filter ->
filter.keywords.any { keyword -> keyword.keyword.equals(tag.name, ignoreCase = true) }
} ?: false
}
.sortedByDescending { tag -> tag.history.sumOf { it.uses.toLongOrNull() ?: 0 } }
.toViewData()

_uiState.value = TrendingUiState(listOf(header) + tags, LoadingState.LOADED)
val header = TrendingViewData.Header(firstTag.start(), firstTag.end())
TrendingUiState(listOf(header) + tags, LoadingState.LOADED)
}
},
{ error ->
Log.w(TAG, "failed loading trending tags", error)
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_view_thread.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

<com.keylesspalace.tusky.view.BackgroundMessageView
android:id="@+id/statusView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:visibility="gone" />
</FrameLayout>
Expand Down
14 changes: 12 additions & 2 deletions app/src/main/res/values-cy/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<string name="action_compose">Creu</string>
<string name="action_login">Mewngofnodi â Tusky</string>
<string name="action_logout">Allgofnodi</string>
<string name="action_logout_confirm">Ydych chi\'n siŵr eich bod am allgofnodi o\'r cyfrif %1$s?</string>
<string name="action_logout_confirm">Ydych chi\'n siŵr eich bod am allgofnodi o\'r cyfrif %1$s\? Bydd hyn yn dileu\'r holl ddata lleol, gan gynnwys drafftiau a chyfeiriadau.</string>
<string name="action_follow">Dilyn</string>
<string name="action_unfollow">Dad-ddilyn</string>
<string name="action_block">Rhwystro</string>
Expand Down Expand Up @@ -712,4 +712,14 @@
\n
\nI archwilio cyfrifon gallwch un ai eu darganfod o fewn un o\'r llinellau amser eraill. Er enghraifft, mae llinell amser eich enghraifft chi [iconics gmd_group]. Neu gallwch eu chwilio yn ôl eu henw [iconics gmd_search]; er enghraifft, chwilio am Tusky i ganfod ein cyfrif Mastodon.</string>
<string name="pref_title_show_stat_inline">Dangos ystadegau postiadau mewn llinell amser</string>
</resources>
<string name="pref_ui_text_size">Maint testun rhyngwyneb</string>
<string name="notification_listenable_worker_name">Gweithgaredd cefndirol</string>
<string name="notification_listenable_worker_description">Hysbysiadau pan fydd Tusky\'n gweithio\'n y cefndir</string>
<string name="notification_notification_worker">Yn estyn hysbysiadau…</string>
<string name="notification_prune_cache">Cynnal a chadw\'r storfan…</string>
<string name="error_missing_edits">Mae\'r gweinydd yn gwybod fod y postiad wedi ei olygu, ond nid oes ganddo gopi o\'r golygiadau, felly nid oes modd eu dangos i chi.
\n
\nHwn yw <a href="https://github.com/mastodon/mastodon/issues/25398">mater Mastodon #25398</a>.</string>
<string name="load_newest_notifications">Llwytho\'r hysbys diweddaraf</string>
<string name="compose_delete_draft">Dileu\'r drafft\?</string>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values-gd/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@
<string name="action_view_mutes">Cleachdaichean mùchte</string>
<string name="action_view_bookmarks">Comharran-lìn</string>
<string name="action_view_profile">Pròifil</string>
<string name="action_logout_confirm">A bheil thu cinnteach gu bheil thu airson clàradh a-mach às a’ chunntas %1$s\?</string>
<string name="action_logout_confirm">A bheil thu cinnteach gu bheil thu airson clàradh a-mach à %1$s\? Thèid gach dàta ionadail a’ chunntais a sguabadh às, a’ gabhail a-staigh nan dreachdan is roghainnean.</string>
<string name="action_unfavourite">Thoir air falbh o na h-annsachdan</string>
<string name="action_bookmark">Cuir ris na comharran-lìn</string>
<string name="action_favourite">Cuir ris na h-annsachdan</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-gl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<string name="action_block">Bloquear</string>
<string name="action_unfollow">Deixar de seguir</string>
<string name="action_follow">Seguir</string>
<string name="action_logout_confirm">Tes a certeza de que queres pechar sesión da conta %1$s\?</string>
<string name="action_logout_confirm">Tes a certeza de querer pechar a sesión %1$s\? Isto eliminará todos os datos locais da conta, incluíndo borradores e preferencias.</string>
<string name="action_logout">Pechar sesión</string>
<string name="action_login">Acceder con Tusky</string>
<string name="action_compose">Redactar</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<string name="action_compose">Oluştur</string>
<string name="action_login">Tusky ile giriş yap</string>
<string name="action_logout">Oturumu kapat</string>
<string name="action_logout_confirm">Bu %1$s oturumu sonlandırmak istediğinizden emin misiniz\?</string>
<string name="action_logout_confirm">Bu %1$s\? oturumu sonlandırmak istediğinizden emin misiniz\?</string>
<string name="action_follow">Takip et</string>
<string name="action_unfollow">Takibi bırak</string>
<string name="action_block">Engelle</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/donottranslate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
<item>gab.com</item>
<item>gab.ai</item>
<item>spinster.xyz</item>
<item>truthsocial.com</item>
</string-array>

<string name="rick_roll_url">https://www.youtube.com/watch?v=dQw4w9WgXcQ</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
package com.keylesspalace.tusky.util

import org.junit.AfterClass
import org.junit.Assert.assertEquals
import org.junit.BeforeClass
import org.junit.Test
import java.time.Instant
import java.util.Date
import java.util.TimeZone
import java.util.*

class AbsoluteTimeFormatterTest {
companion object {
/** Default locale before this test started */
private lateinit var locale: Locale

/**
* Ensure the Locale is ENGLISH so that tests against literal strings like
* "Apr" later, even if the test host's locale is e.g. FRENCH which would
* normally report "avr.".
*/
@BeforeClass
@JvmStatic
fun beforeClass() {
locale = Locale.getDefault()
Locale.setDefault(Locale.ENGLISH)
}

@AfterClass
@JvmStatic
fun afterClass() {
Locale.setDefault(locale)
}
}

private val formatter = AbsoluteTimeFormatter(TimeZone.getTimeZone("UTC"))
private val now = Date.from(Instant.parse("2022-04-11T00:00:00.00Z"))
Expand Down
6 changes: 6 additions & 0 deletions fastlane/metadata/android/fa/changelogs/112.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
تاسکی ۲۳٫۰ بتا ۲

رفع اشکال‌ها:

- فروپاشی بالقوه هنگام ویرایش زمینه‌های نمایه
- فهرست بافتار بزرگ هنگام ویرایش شرح تصاویر
15 changes: 15 additions & 0 deletions fastlane/metadata/android/fa/changelogs/113.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
تاسکی ۲۳٫۰

ویژگی‌های جدید:

- ترجیح جدید برای مقیاس متن میانای کاربری

رفع اشکال‌ها:

- ذخیرهٔ درست اطّلاعات حساب
- «گرفتن» آگاهی‌ها روی افزاره‌های با نگارش اندروید کم‌تر از ۱۱
- مشکل امکان فراموشی توانایی رونوشت و جای‌گذاری در زمینه‌های متنی اندروید
- تجاوز نکردن از لیهٔ صفحه هنگام دیدن «تفاوت‌ها» در تاریخچهٔ ویرایش
- فرونپاشیدن در صورت نبودن تاریخچهٔ ویرایش فرسته روی کارساز
- نمایش درست اموجی‌های نامربّعی
- فروپاشی احتمالی هنگام ویرایش زمینه‌های نمایه
2 changes: 1 addition & 1 deletion fastlane/metadata/android/gl/changelogs/103.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Tusky 22.0
Tusky 22.0 beta 1

Características incluídas:

Expand Down
6 changes: 6 additions & 0 deletions fastlane/metadata/android/sv/changelogs/112.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Tusky 23.0 beta 2

Fixar:

- Potentiell krasch vid redigering av profilfält
- Överdimensionerad snabbmeny när du redigerar bildbeskrivningar
15 changes: 15 additions & 0 deletions fastlane/metadata/android/vi/changelogs/111.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Tusky 23.0 beta 1

Mới:

- Tăng cỡ chữ

Sửa:

- Lưu đúng thông tin tài khoản
- "đẩy" thông báo trên Android 11 trở xuống
- Sửa lỗi Android quên copy/paste
- Hiện "diffs" trong lịch sử sửa tút
- Sửa lỗi crash
- Thêm nút "Xóa" khi sửa bộ lọc
- Hiện đúng emoji không vuông
6 changes: 6 additions & 0 deletions fastlane/metadata/android/vi/changelogs/112.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Tusky 23.0 beta 2

Sửa:

- Sửa crash khi sửa hồ sơ
- Mở rộng menu khi sửa mô tả hình ảnh
13 changes: 13 additions & 0 deletions fastlane/metadata/android/vi/changelogs/113.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Tusky 23.0

Mới:
- Thu phóng chữ trên giao diện

Sửa:
- Lưu thông tin tài khoản chính xác
- "đẩy" thông báo trên Android 11
- Lỗi copy/paste không được
- Xem lịch sử sửa tút
- Không crash khi máy chủ của bạn không có lịch sử sửa
- Hiện emoji không vuông chính xác
- Lỗi crash khi sửa hồ sơ
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ autodispose = "2.1.1"
bouncycastle = "1.70"
conscrypt = "2.5.2"
coroutines = "1.7.2"
dagger = "2.46.1"
dagger = "2.47"
diffx = "1.1.1"
emoji2 = "1.3.0"
espresso = "3.5.1"
Expand Down

0 comments on commit 472287a

Please sign in to comment.