-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
16 changed files
with
151 additions
and
58 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
3 changes: 0 additions & 3 deletions
3
app/src/main/java/com/rajit/memeology/data/local/MemeDatabase.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
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,73 @@ | ||
package com.rajit.memeology.utils | ||
|
||
import android.content.Context | ||
import android.net.Uri | ||
import androidx.appcompat.content.res.AppCompatResources | ||
import androidx.browser.customtabs.CustomTabColorSchemeParams | ||
import androidx.browser.customtabs.CustomTabsIntent | ||
import androidx.core.content.ContextCompat | ||
import androidx.core.graphics.drawable.toBitmap | ||
import com.rajit.memeology.R | ||
|
||
object CustomTab { | ||
|
||
/** | ||
* Load @param [url] in the Custom Tav | ||
* [CustomTabsIntent.Builder] is used to build the custom tab along with the specified customizations | ||
**/ | ||
fun loadURL(context: Context, url: String) { | ||
|
||
val customCloseIcon = AppCompatResources.getDrawable(context, R.drawable.ic_custom_tab_back) | ||
|
||
// Light Mode Toolbar Color | ||
val lightModeColor = ContextCompat.getColor( | ||
context, | ||
R.color.actionBarColor | ||
) | ||
|
||
// Dark Mode Toolbar Color | ||
val darkModeColor = ContextCompat.getColor( | ||
context, | ||
R.color.actionBarColor | ||
) | ||
|
||
// Setting the Custom Tab Toolbar Configuration for Light Mode | ||
val customTabToolbarColorLight = CustomTabColorSchemeParams | ||
.Builder() | ||
.setToolbarColor(lightModeColor) | ||
.build() | ||
|
||
// Setting the Custom Tab Toolbar Configuration for Dark Mode | ||
val customTabToolbarColorDark = CustomTabColorSchemeParams | ||
.Builder() | ||
.setToolbarColor(darkModeColor) | ||
.build() | ||
|
||
CustomTabsIntent.Builder().apply { | ||
|
||
// Show Title of the Website in Custom Tab ToolBar | ||
setShowTitle(true) | ||
|
||
// Set Custom Close Button for Custom Tab | ||
setCloseButtonIcon(customCloseIcon!!.toBitmap()) | ||
|
||
// applying light mode color | ||
setDefaultColorSchemeParams(customTabToolbarColorLight) | ||
|
||
// applying dark mode color | ||
setColorSchemeParams( | ||
CustomTabsIntent.COLOR_SCHEME_DARK, | ||
customTabToolbarColorDark | ||
) | ||
|
||
// Build & Launch URL in Custom Tab | ||
build().launchUrl( | ||
context, | ||
Uri.parse(url) | ||
) | ||
|
||
} | ||
|
||
} | ||
|
||
} |
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,11 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:autoMirrored="true" | ||
android:tint="#000000" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z" /> | ||
</vector> |
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
Oops, something went wrong.