Skip to content

Commit

Permalink
Edge to Edge support
Browse files Browse the repository at this point in the history
- All screens now edge to edge enforced
- Remove the status bar color setting, since it replaced by padding
- Minor UI fixes

MOB 3554
  • Loading branch information
DavDo committed Sep 12, 2024
1 parent 727cccf commit 0a8101c
Show file tree
Hide file tree
Showing 40 changed files with 207 additions and 290 deletions.
9 changes: 4 additions & 5 deletions app/src/main/java/com/glia/exampleapp/MainFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ class MainFragment : Fragment() {
GliaWidgets.init(
createDefaultConfig(
context = requireActivity().applicationContext,
// uiJsonRemoteConfig = UnifiedUiConfigurationLoader.fetchLocalGlobalColors(requireContext()),
// uiJsonRemoteConfig = UnifiedUiConfigurationLoader.fetchRemoteConfiguration(),
// runtimeConfig = createSampleRuntimeConfig(),
// region = "us"
)
Expand All @@ -526,14 +526,13 @@ class MainFragment : Fragment() {
setupAuthButtonsVisibility()
listenForCallVisualizerEngagements()

view?.post {
initMenu()
}
view?.post { initMenu() }
}

private fun createSampleRuntimeConfig(): UiTheme = UiTheme(
gvaQuickReplyTextColor = android.R.color.holo_green_dark,
gvaQuickReplyStrokeColor = android.R.color.holo_green_dark
gvaQuickReplyStrokeColor = android.R.color.holo_green_dark,
brandPrimaryColor = android.R.color.holo_green_dark
)

private fun prepareAuthentication() {
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/res/layout/main_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,20 @@

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/tool_bar_layout"
style="@style/Widget.MaterialComponents.AppBarLayout.Primary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:layout_constraintTop_toTopOf="parent">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/top_app_bar"
android:layout_height="wrap_content"
android:elevation="0dp"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
app:elevation="0dp"
app:menu="@menu/menu_main_fragment"
app:title="@string/app_name" />

Expand Down
45 changes: 27 additions & 18 deletions app/src/main/res/raw/sample_unified_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1134,9 +1134,10 @@
},
"borderWidth": 2,
"color": {
"type": "fill",
"type": "gradient",
"value": [
"#000000"
"#fdd42b",
"#ff0000"
]
},
"cornerRadius": 8
Expand Down Expand Up @@ -1187,9 +1188,10 @@
},
"borderWidth": 2,
"color": {
"type": "fill",
"type": "gradient",
"value": [
"#f9d12b"
"#fdd42b",
"#ff0000"
]
},
"cornerRadius": 8
Expand Down Expand Up @@ -1962,9 +1964,10 @@
},
"borderWidth": 2,
"color": {
"type": "fill",
"type": "gradient",
"value": [
"#fdd42b"
"#fdd42b",
"#ff0000"
]
},
"cornerRadius": 8
Expand Down Expand Up @@ -3990,9 +3993,10 @@
},
"borderWidth": 2,
"color": {
"type": "fill",
"type": "gradient",
"value": [
"#fdd42b"
"#fdd42b",
"#ff0000"
]
},
"cornerRadius": 8
Expand Down Expand Up @@ -4413,9 +4417,10 @@
},
"borderWidth": 2,
"color": {
"type": "fill",
"type": "gradient",
"value": [
"#000000"
"#fdd42b",
"#ff0000"
]
},
"cornerRadius": 8
Expand Down Expand Up @@ -4466,9 +4471,10 @@
},
"borderWidth": 2,
"color": {
"type": "fill",
"type": "gradient",
"value": [
"#f9d12b"
"#fdd42b",
"#ff0000"
]
},
"cornerRadius": 8
Expand Down Expand Up @@ -4790,9 +4796,10 @@
},
"borderWidth": 2,
"color": {
"type": "fill",
"type": "gradient",
"value": [
"#000000"
"#fdd42b",
"#ff0000"
]
},
"cornerRadius": 8
Expand Down Expand Up @@ -4843,9 +4850,10 @@
},
"borderWidth": 2,
"color": {
"type": "fill",
"type": "gradient",
"value": [
"#f9d12b"
"#fdd42b",
"#ff0000"
]
},
"cornerRadius": 8
Expand Down Expand Up @@ -5212,9 +5220,10 @@
},
"borderWidth": 2,
"color": {
"type": "fill",
"type": "gradient",
"value": [
"#fdd42b"
"#fdd42b",
"#ff0000"
]
},
"cornerRadius": 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.glia.widgets.base

import android.content.Intent
import android.os.Build
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import com.glia.androidsdk.Glia
import com.glia.widgets.di.Dependencies
import com.glia.widgets.helper.insetsControllerCompat
import com.glia.widgets.locale.LocaleString
import io.reactivex.rxjava3.disposables.Disposable

Expand All @@ -16,30 +19,50 @@ open class FadeTransitionActivity : AppCompatActivity() {
private var disposable: Disposable? = null
private val localeProvider = Dependencies.localeProvider

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)

@RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
private fun overrideAnimation() {
overrideActivityTransition(OVERRIDE_TRANSITION_OPEN, android.R.anim.fade_in, android.R.anim.fade_out)
overrideActivityTransition(OVERRIDE_TRANSITION_CLOSE, android.R.anim.fade_in, android.R.anim.fade_out)
}

override fun finish() {
super.finish()
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
private fun overrideAnimationCompat() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
overrideAnimation()
return
}

overrideAnimationApi33()
}

@Suppress("DEPRECATION")
private fun overrideAnimationApi33() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
}
}

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
window.insetsControllerCompat.isAppearanceLightStatusBars = false
overrideAnimationCompat()
super.onCreate(savedInstanceState)
}

override fun finishAndRemoveTask() {
super.finishAndRemoveTask()
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
overrideAnimationApi33()
disposable?.dispose()
}

override fun startActivity(intent: Intent?) {
super.startActivity(intent)
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
overrideAnimationApi33()
}

override fun startActivity(intent: Intent?, options: Bundle?) {
super.startActivity(intent, options)
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
overrideAnimationApi33()
}

fun setTitle(locale: LocaleString?) {
Expand All @@ -56,7 +79,7 @@ open class FadeTransitionActivity : AppCompatActivity() {
.subscribe(
{ super.setTitle(it) },
{ /* no-op */ }
)
)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import androidx.annotation.Nullable;

import com.glia.widgets.GliaWidgets;
import com.glia.widgets.locale.LocaleString;
import com.glia.widgets.R;
import com.glia.widgets.base.FadeTransitionActivity;
import com.glia.widgets.chat.ChatActivity;
import com.glia.widgets.core.configuration.EngagementConfiguration;
import com.glia.widgets.di.Dependencies;
import com.glia.widgets.helper.Logger;
import com.glia.widgets.helper.Utils;
import com.glia.widgets.locale.LocaleString;
import com.glia.widgets.webbrowser.WebBrowserActivity;

import java.util.ArrayList;
Expand Down Expand Up @@ -161,9 +161,9 @@ private void navigateToWebBrowser(LocaleString title, String url) {

/**
* Creates and fills out Intent for starting CallActivity
* @deprecated use {@link #getIntent(Context, EngagementConfiguration)} since 1.8.2
* @deprecated use {@link #getIntent(Context, CallConfiguration)} since 1.8.2
* @param applicationContext - application context
* @param sdkConfiguration - widgets sdk configuration
* @param engagementConfiguration - widgets sdk configuration
* @param mediaType - media type that should be started (in case media engagement not ongoing)
* @return Intent for starting CallActivity
*/
Expand Down
Loading

0 comments on commit 0a8101c

Please sign in to comment.