Merge branch 'main' into fix-multiupload

This commit is contained in:
Nicolas Raoul 2025-03-14 15:22:12 +09:00 committed by GitHub
commit 5916d00f85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 36 additions and 32 deletions

View file

@ -97,9 +97,9 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
} }
if (media == null) { if (media == null) {
if (callback != null) { if (callback != null) {
binding!!.tvTitle.text = getString(R.string.step_count, binding?.tvTitle?.text = getString(R.string.step_count,
callback!!.getIndexInViewFlipper(this) + 1, callback?.getIndexInViewFlipper(this)?.plus(1) ?: 1,
callback!!.totalNumberOfSteps, callback?.totalNumberOfSteps ?: 1,
getString(R.string.categories_activity_title)) getString(R.string.categories_activity_title))
} }
} else { } else {
@ -110,7 +110,7 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
} }
setTvSubTitle() setTvSubTitle()
binding!!.tooltip.setOnClickListener { binding?.let { it.tooltip.setOnClickListener {
showAlertDialog( showAlertDialog(
requireActivity(), requireActivity(),
getString(R.string.categories_activity_title), getString(R.string.categories_activity_title),
@ -119,10 +119,11 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
null null
) )
} }
}
if (media == null) { if (media == null) {
presenter!!.onAttachView(this) presenter?.onAttachView(this)
} else { } else {
presenter!!.onAttachViewWithMedia(this, media!!) presenter?.onAttachViewWithMedia(this, media!!)
} }
binding!!.btnNext.setOnClickListener { v: View? -> onNextButtonClicked() } binding!!.btnNext.setOnClickListener { v: View? -> onNextButtonClicked() }
binding!!.btnPrevious.setOnClickListener { v: View? -> onPreviousButtonClicked() } binding!!.btnPrevious.setOnClickListener { v: View? -> onPreviousButtonClicked() }
@ -137,7 +138,7 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
} }
subscribe = RxTextView.textChanges(binding!!.etSearch) subscribe = RxTextView.textChanges(binding!!.etSearch)
.doOnEach { v: Notification<CharSequence?>? -> .doOnEach { v: Notification<CharSequence?>? ->
binding!!.tilContainerSearch.error = binding?.tilContainerSearch?.error =
null null
} }
.takeUntil(RxView.detaches(binding!!.etSearch)) .takeUntil(RxView.detaches(binding!!.etSearch))
@ -163,25 +164,25 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
} }
private fun searchForCategory(query: String) { private fun searchForCategory(query: String) {
presenter!!.searchForCategories(query) presenter?.searchForCategories(query)
} }
private fun initRecyclerView() { private fun initRecyclerView() {
adapter = UploadCategoryAdapter({ categoryItem: CategoryItem? -> if (adapter == null) { adapter = UploadCategoryAdapter({ categoryItem: CategoryItem? ->
presenter!!.onCategoryItemClicked(categoryItem!!) presenter?.onCategoryItemClicked(categoryItem!!)
Unit Unit
}, nearbyPlaceCategory) }, nearbyPlaceCategory)
}
if (binding != null) { binding?.rvCategories?.apply {
binding!!.rvCategories.layoutManager = LinearLayoutManager(context) layoutManager = LinearLayoutManager(context)
binding!!.rvCategories.adapter = adapter adapter = this@UploadCategoriesFragment.adapter
} }
} }
override fun onDestroyView() { override fun onDestroyView() {
super.onDestroyView() super.onDestroyView()
presenter!!.onDetachView() presenter?.onDetachView()
subscribe!!.dispose() subscribe?.dispose()
} }
override fun showProgress(shouldShow: Boolean) { override fun showProgress(shouldShow: Boolean) {
@ -197,6 +198,11 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
} }
override fun setCategories(categories: List<CategoryItem>?) { override fun setCategories(categories: List<CategoryItem>?) {
if (adapter == null) {
Timber.e("Adapter is null in setCategories")
return
}
if (categories == null) { if (categories == null) {
adapter!!.clear() adapter!!.clear()
} else { } else {
@ -204,19 +210,16 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
} }
adapter!!.notifyDataSetChanged() adapter!!.notifyDataSetChanged()
if (binding == null) { binding?.let {
return it.rvCategories.post {
} it.rvCategories.smoothScrollToPosition(0)
// Nested waiting for search result data to load into the category it.rvCategories.post {
// list and smoothly scroll to the top of the search result list. it.rvCategories.smoothScrollToPosition(
binding!!.rvCategories.post {
binding!!.rvCategories.smoothScrollToPosition(0)
binding!!.rvCategories.post {
binding!!.rvCategories.smoothScrollToPosition(
0 0
) )
}
} }
} } ?: Timber.e("Binding is null in setCategories")
} }
override fun goToNextScreen() { override fun goToNextScreen() {
@ -308,7 +311,7 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
fun onNextButtonClicked() { fun onNextButtonClicked() {
if (media != null) { if (media != null) {
presenter!!.updateCategories(media!!, wikiText!!) presenter?.updateCategories(media!!, wikiText!!)
} else { } else {
presenter!!.verifyCategories() presenter!!.verifyCategories()
} }
@ -318,7 +321,7 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
if (media != null) { if (media != null) {
presenter!!.clearPreviousSelection() presenter!!.clearPreviousSelection()
adapter!!.items = null adapter!!.items = null
val mediaDetailFragment = checkNotNull(parentFragment as MediaDetailFragment?) val mediaDetailFragment = parentFragment as? MediaDetailFragment?: return
mediaDetailFragment.onResume() mediaDetailFragment.onResume()
goBackToPreviousScreen() goBackToPreviousScreen()
} else { } else {
@ -345,7 +348,7 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
super.onResume() super.onResume()
if (media != null) { if (media != null) {
binding!!.etSearch.setOnKeyListener { v: View?, keyCode: Int, event: KeyEvent? -> binding?.etSearch?.setOnKeyListener { v: View?, keyCode: Int, event: KeyEvent? ->
if (keyCode == KeyEvent.KEYCODE_BACK) { if (keyCode == KeyEvent.KEYCODE_BACK) {
binding!!.etSearch.clearFocus() binding!!.etSearch.clearFocus()
presenter!!.clearPreviousSelection() presenter!!.clearPreviousSelection()

View file

@ -60,7 +60,7 @@
<string name="login_success">ਦਾਖ਼ਲ ਹੋਣਾ ਸਫ਼ਲ!</string> <string name="login_success">ਦਾਖ਼ਲ ਹੋਣਾ ਸਫ਼ਲ!</string>
<string name="login_failed">ਦਾਖ਼ਲ ਹੋਣਾ ਅਸਫ਼ਲ!</string> <string name="login_failed">ਦਾਖ਼ਲ ਹੋਣਾ ਅਸਫ਼ਲ!</string>
<string name="upload_failed">ਫ਼ਾਇਲ ਦੀ ਖੋਜ ਨਹੀਂ ਹੋ ਸਕੀ। ਕਿਰਪਾ ਕਰਕੇ ਹੋਰ ਫ਼ਾਇਲ ਖੋਜੋ।</string> <string name="upload_failed">ਫ਼ਾਇਲ ਦੀ ਖੋਜ ਨਹੀਂ ਹੋ ਸਕੀ। ਕਿਰਪਾ ਕਰਕੇ ਹੋਰ ਫ਼ਾਇਲ ਖੋਜੋ।</string>
<string name="authentication_failed">ਪ੍ਰਮਾਣੀਕਰਨ ਅਸਫਲ ਰਿਹਾ। ਕਿਰਪਾ ਕਰਕੇ ਦੁਬਾਰਾ ਦਾਖਲ ਹੋਵੋ।</string> <string name="authentication_failed">ਤਸਦੀਕ ਨਾਕਾਮ ਰਹੀ। ਕਿਰਪਾ ਕਰਕੇ ਮੁੜ ਦਾਖਲ ਹੋਵੋ।</string>
<string name="uploading_started">ਅੱਪਲੋਡ ਸ਼ੁਰੂ ਹੋਇਆ!</string> <string name="uploading_started">ਅੱਪਲੋਡ ਸ਼ੁਰੂ ਹੋਇਆ!</string>
<string name="upload_completed_notification_title">%1$s ਅੱਪਲੋਡ ਹੋ ਗਏ!</string> <string name="upload_completed_notification_title">%1$s ਅੱਪਲੋਡ ਹੋ ਗਏ!</string>
<string name="upload_completed_notification_text">ਆਪਣਾ ਅੱਪਲੋਡ ਵੇਖਣ ਲਈ ਥਪੇੜੋ</string> <string name="upload_completed_notification_text">ਆਪਣਾ ਅੱਪਲੋਡ ਵੇਖਣ ਲਈ ਥਪੇੜੋ</string>
@ -91,10 +91,10 @@
<string name="login_failed_network">ਦਾਖ਼ਲ ਹੋਣ ਵਿੱਚ ਅਸਮਰੱਥ - ਨੈੱਟਵਰਕ ਫੇਲ੍ਹ ਹੋਇਆ ਹੈ</string> <string name="login_failed_network">ਦਾਖ਼ਲ ਹੋਣ ਵਿੱਚ ਅਸਮਰੱਥ - ਨੈੱਟਵਰਕ ਫੇਲ੍ਹ ਹੋਇਆ ਹੈ</string>
<string name="login_failed_throttled">ਬਹੁਤ ਸਾਰੀਆਂ ਅਸਫ਼ਲ ਕੋਸ਼ਿਸ਼ਾਂ। ਥੋੜ੍ਹੀ ਦੇਰ ਬਾਅਦ ਕੋਸ਼ਿਸ਼ ਕਰੋ ਜੀ।</string> <string name="login_failed_throttled">ਬਹੁਤ ਸਾਰੀਆਂ ਅਸਫ਼ਲ ਕੋਸ਼ਿਸ਼ਾਂ। ਥੋੜ੍ਹੀ ਦੇਰ ਬਾਅਦ ਕੋਸ਼ਿਸ਼ ਕਰੋ ਜੀ।</string>
<string name="login_failed_blocked">ਅਫ਼ਸੋਸ, ਇਹ ਵਰਤੋਂਕਾਰ ਨੂੰ ਕਾਮਨਜ਼ ਤੇ ਰੋਕ ਲਾਈ ਗਈ ਹੈ।</string> <string name="login_failed_blocked">ਅਫ਼ਸੋਸ, ਇਹ ਵਰਤੋਂਕਾਰ ਨੂੰ ਕਾਮਨਜ਼ ਤੇ ਰੋਕ ਲਾਈ ਗਈ ਹੈ।</string>
<string name="login_failed_2fa_needed">ਤੁਹਾਨੂੰ ਆਪਣਾ ਦੋ-ਕਾਰਕ ਪ੍ਰਮਾਣੀਕਰਨ ਕੋਡ ਦੇਣਾ ਪਵੇਗਾ।</string> <string name="login_failed_2fa_needed">ਤੁਹਾਨੂੰ ਆਪਣਾ ਦੋ-ਪੱਖੀ ਤਸਦੀਕ ਕੋਡ ਦੇਣਾ ਪਵੇਗਾ।</string>
<string name="login_failed_generic">ਦਾਖ਼ਲ ਹੋਣਾ ਅਸਫ਼ਲ!</string> <string name="login_failed_generic">ਦਾਖ਼ਲ ਹੋਣਾ ਅਸਫ਼ਲ!</string>
<string name="share_upload_button">ਚੜ੍ਹਾਉ</string> <string name="share_upload_button">ਚੜ੍ਹਾਉ</string>
<string name="multiple_share_base_title">ਇਸ ਸੈੱਟ ਨੂੰ ਨਾਂ ਦਿਓ</string> <string name="multiple_share_base_title">ਇਸ ਟੋਲੀ ਨੂੰ ਨਾਂ ਦਿਓ</string>
<string name="provider_modifications">ਸੋਧਾਂ</string> <string name="provider_modifications">ਸੋਧਾਂ</string>
<string name="menu_upload_single">ਚੜ੍ਹਾਉ</string> <string name="menu_upload_single">ਚੜ੍ਹਾਉ</string>
<string name="categories_search_text_hint">ਸ਼੍ਰੇਣੀਆਂ ਖੋਜੋ</string> <string name="categories_search_text_hint">ਸ਼੍ਰੇਣੀਆਂ ਖੋਜੋ</string>

View file

@ -9,6 +9,7 @@
* شاه زمان پټان * شاه زمان پټان
--> -->
<resources> <resources>
<string name="commons_facebook">د خونديځ فيسبوک پاڼه</string>
<string name="commons_github">خونديځ ګيټهوب سرچينه کوډ</string> <string name="commons_github">خونديځ ګيټهوب سرچينه کوډ</string>
<string name="commons_logo">خونديځ نښان</string> <string name="commons_logo">خونديځ نښان</string>
<string name="commons_website">خونديځ وېبپاڼه</string> <string name="commons_website">خونديځ وېبپاڼه</string>