mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fix: enable H/W acceleration for UploadActivity to resolve keyboard not showing on Upload Screen (#6418)
Some checks are pending
Android CI / Run tests and generate APK (push) Waiting to run
Some checks are pending
Android CI / Run tests and generate APK (push) Waiting to run
* fix: enable h/w acceleration for UploadActivity to resolve ime issue * fix(upload): handle keyboard insets for bottom buttons at Depicts step * fix(upload): handle keyboard insets for buttons at select category step * fix(upload): hide keyboard before navigating to Media License screen This solves keyboard opened at the License screen issue, if we proceed by pressing next at the Upload Categories screen when the keyboard is opened
This commit is contained in:
parent
730f314200
commit
2811b181b7
7 changed files with 51 additions and 33 deletions
|
|
@ -101,7 +101,6 @@
|
|||
android:name=".upload.UploadActivity"
|
||||
android:configChanges="orientation|screenSize|keyboard"
|
||||
android:exported="true"
|
||||
android:hardwareAccelerated="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter android:label="@string/intent_share_upload_label">
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import android.os.Build.VERSION_CODES
|
|||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.view.View
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.CheckBox
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
|
|
@ -805,6 +806,19 @@ class UploadActivity : BaseActivity(), UploadContract.View, UploadBaseFragment.C
|
|||
|
||||
override fun onNextButtonClicked(index: Int) {
|
||||
if (index < fragments!!.size - 1) {
|
||||
// Hide the keyboard before navigating to Media License screen
|
||||
val isUploadCategoriesFragment = fragments!!.getOrNull(index)?.let {
|
||||
it is UploadCategoriesFragment
|
||||
} ?: false
|
||||
if (isUploadCategoriesFragment) {
|
||||
val inputMethodManager = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
currentFocus?.let { focusedView ->
|
||||
inputMethodManager.hideSoftInputFromWindow(
|
||||
focusedView.windowToken,
|
||||
InputMethodManager.HIDE_NOT_ALWAYS
|
||||
)
|
||||
}
|
||||
}
|
||||
binding.vpUpload.setCurrentItem(index + 1, false)
|
||||
fragments!![index + 1].onBecameVisible()
|
||||
(binding.rvThumbnails.layoutManager as LinearLayoutManager)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import fr.free.nrw.commons.media.MediaDetailFragment
|
|||
import fr.free.nrw.commons.upload.UploadActivity
|
||||
import fr.free.nrw.commons.upload.UploadBaseFragment
|
||||
import fr.free.nrw.commons.utils.DialogUtil.showAlertDialog
|
||||
import fr.free.nrw.commons.utils.handleKeyboardInsets
|
||||
import fr.free.nrw.commons.wikidata.WikidataConstants.SELECTED_NEARBY_PLACE_CATEGORY
|
||||
import io.reactivex.Notification
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
|
|
@ -69,6 +70,7 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
|
|||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
binding = UploadCategoriesFragmentBinding.inflate(inflater, container, false)
|
||||
binding!!.llContainerButtons.handleKeyboardInsets()
|
||||
return binding!!.root
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import fr.free.nrw.commons.upload.UploadActivity
|
|||
import fr.free.nrw.commons.upload.UploadBaseFragment
|
||||
import fr.free.nrw.commons.upload.structure.depictions.DepictedItem
|
||||
import fr.free.nrw.commons.utils.DialogUtil.showAlertDialog
|
||||
import fr.free.nrw.commons.utils.handleKeyboardInsets
|
||||
import fr.free.nrw.commons.wikidata.WikidataConstants.SELECTED_NEARBY_PLACE
|
||||
import io.reactivex.Notification
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
|
|
@ -69,6 +70,7 @@ class DepictsFragment : UploadBaseFragment(), DepictsContract.View {
|
|||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = UploadDepictsFragmentBinding.inflate(inflater, container, false)
|
||||
_binding!!.navigationButtonsContainer.handleKeyboardInsets()
|
||||
return binding.root
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
android:id="@+id/rl_container_categories"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/standard_gap"
|
||||
android:background="?attr/mainBackground"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/button_divider"
|
||||
android:padding="@dimen/medium_padding"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -110,7 +110,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:padding="@dimen/standard_gap"
|
||||
android:paddingVertical="@dimen/small_padding"
|
||||
android:paddingHorizontal="@dimen/large_padding"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
|
||||
|
|
|
|||
|
|
@ -124,38 +124,35 @@
|
|||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/button_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_above="@+id/depicts_next"
|
||||
android:background="@color/divider_grey" />
|
||||
android:id="@+id/button_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_above="@+id/navigation_buttons_container"
|
||||
android:background="@color/divider_grey" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/depicts_next"
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:id="@+id/navigation_buttons_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:paddingHorizontal="@dimen/medium_padding"
|
||||
android:paddingVertical="@dimen/small_padding"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginRight="24dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:contentDescription="@string/next"
|
||||
android:text="@string/next"
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/depicts_previous"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="@dimen/standard_gap"
|
||||
android:layout_marginRight="@dimen/standard_gap"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_toStartOf="@id/depicts_next"
|
||||
android:layout_toLeftOf="@id/depicts_next"
|
||||
android:contentDescription="@string/previous"
|
||||
android:text="@string/previous" />
|
||||
android:gravity="end">
|
||||
<Button
|
||||
android:id="@+id/depicts_previous"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/standard_gap"
|
||||
android:contentDescription="@string/previous"
|
||||
android:text="@string/previous" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/depicts_next"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/next"
|
||||
android:text="@string/next"
|
||||
android:textColor="@android:color/white" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@
|
|||
<dimen name="achievements_activity_margin_vertical">8dp</dimen>
|
||||
<dimen name="medium_height">12dp</dimen>
|
||||
<dimen name="medium_width">12dp</dimen>
|
||||
<dimen name="small_padding">8dp</dimen>
|
||||
<dimen name="medium_padding">16dp</dimen>
|
||||
<dimen name="large_padding">24dp</dimen>
|
||||
|
||||
<!-- Standard margins / padding -->
|
||||
<dimen name="login_padding">30dp</dimen>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue