-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android 15 Support - Part 2 of 2 #2624
Merged
brandonpage
merged 3 commits into
forcedotcom:dev
from
brandonpage:Android-15-Edge-To-Edge
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:id="@+id/sf__status_bar_background" android:height="100dp" > | ||
<shape android:shape="rectangle"> | ||
<size android:height="100dp" android:width="100dp"/> | ||
<solid android:color="@color/sf__primary_color"/> | ||
</shape> | ||
</item> | ||
|
||
<item android:id="@+id/sf__nav_bar_background" android:height="100dp"> | ||
<shape android:shape="rectangle"> | ||
<size android:height="100dp" android:width="100dp"/> | ||
<solid android:color="@android:color/transparent"/> | ||
</shape> | ||
</item> | ||
</layer-list> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,6 @@ internal class IDPManager( | |
spConfig, | ||
codeChallenge | ||
) { result -> | ||
authCodeActivity.finish() | ||
onResult(result) | ||
} | ||
} | ||
|
@@ -214,6 +213,7 @@ internal class IDPManager( | |
addCategory(Intent.CATEGORY_DEFAULT) | ||
} | ||
startActivity(activeFlow.context, launchIntent) | ||
activeFlow.authCodeActivity?.finish() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The IDP fix. |
||
} else { | ||
activeFlow.onStatusUpdate(Status.ERROR_RECEIVED_FROM_SP) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/EdgeToEdgeUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.salesforce.androidsdk.ui | ||
|
||
import android.os.Build.VERSION.SDK_INT | ||
import android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE | ||
import android.view.View | ||
import androidx.activity.enableEdgeToEdge | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.core.content.res.ResourcesCompat | ||
import androidx.core.view.ViewCompat | ||
import androidx.core.view.WindowInsetsCompat | ||
import androidx.core.view.updatePadding | ||
import com.salesforce.androidsdk.R.drawable.sf__fix_status_bar | ||
|
||
// TODO: Remove this in 13.0 after rewriting screens in compose. | ||
internal fun AppCompatActivity.fixEdgeToEdge(view: View) { | ||
if (application.applicationInfo.targetSdkVersion > UPSIDE_DOWN_CAKE && SDK_INT > UPSIDE_DOWN_CAKE) { | ||
enableEdgeToEdge() | ||
ViewCompat.setOnApplyWindowInsetsListener(view) { listenerView, windowInsets -> | ||
val insets = windowInsets.getInsets( | ||
WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout() | ||
) | ||
|
||
// Fix screens being drawn behind status and navigation bars | ||
listenerView.updatePadding(insets.left, insets.top, insets.right, insets.bottom) | ||
|
||
// Fix transparent status bar not matching action bar | ||
view.background = ResourcesCompat.getDrawable(resources, sf__fix_status_bar, null) | ||
|
||
WindowInsetsCompat.CONSUMED | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is sort of a hack to fill in the status and navigation bars with the appropriate color since they are now forced transparent and completely unsettable in Edge to Edge. Note that I am changing the height of the top rectangle to match the device status bar height in code!