Skip to content

Commit

Permalink
Remove force portrait for tablets
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswoo-stripe committed Apr 12, 2022
1 parent 2d357d1 commit c4567a6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# CHANGELOG
## x.x.x - xxxx-xx-xx

### PaymentSheet
* [CHANGED] [4855](https://github.com/stripe/stripe-android/pull/4855) Remove force portrait mode for tablets.

## 20.0.1 - 2022-04-11
This release includes several PaymentSheet bug fixes.

Expand Down
4 changes: 4 additions & 0 deletions payments-core/res/values-sw600dp/attrs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="isTablet">true</bool>
</resources>
2 changes: 2 additions & 0 deletions payments-core/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@
</attr>
<attr name="backgroundColorStateList" format="reference" />
</declare-styleable>

<bool name="isTablet">false</bool>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.activity.viewModels
import androidx.annotation.VisibleForTesting
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModelProvider
import com.stripe.android.R
import com.stripe.android.view.AuthActivityStarterHost

/**
Expand All @@ -36,7 +37,9 @@ internal class PaymentLauncherConfirmationActivity : AppCompatActivity() {
@SuppressLint("SourceLockedOrientationActivity")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (Build.VERSION.SDK_INT != Build.VERSION_CODES.O) {
if (Build.VERSION.SDK_INT != Build.VERSION_CODES.O &&
!resources.getBoolean(R.bool.isTablet)
) {
// In Oreo, Activities where `android:windowIsTranslucent=true` can't request
// orientation. See https://stackoverflow.com/a/50832408/11103900
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
Expand Down

0 comments on commit c4567a6

Please sign in to comment.