Skip to content

Commit 70b950b

Browse files
authored
Merge pull request #63 from CodandoTV/feature/21-video-sharing
[ISSUE-21] - Compartilhamento de conteúdo
2 parents 1f0c969 + 1e97f92 commit 70b950b

File tree

15 files changed

+601
-5
lines changed

15 files changed

+601
-5
lines changed

core-shared-ui/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins {
55
}
66

77
dependencies {
8+
implementation(projects.coreShared)
89
implementation(libs.bundles.koin)
910
implementation(libs.bundles.kotlin)
1011
implementation(libs.bundles.androidSupport)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
33

4+
<queries>
5+
<package android:name="com.whatsapp" />
6+
<package android:name="com.whatsapp.w4b" />
7+
</queries>
48
</manifest>

core-shared-ui/src/main/java/com/codandotv/streamplayerapp/core_shared_ui/resources/Colors.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import androidx.compose.ui.graphics.Color
66

77
object Colors {
88
val Dark10 = Color(0x1A000000)
9+
val AlphaBlack = Color(0xEB000000)
910

1011
val LightColors = lightColorScheme(
1112
primary = Color(0xFFE50914),
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.codandotv.streamplayerapp.core_shared_ui.utils
2+
3+
import android.content.Context
4+
import android.content.pm.PackageInfo
5+
import android.content.pm.PackageManager
6+
import android.os.Build
7+
8+
object Sharing {
9+
10+
const val SHARING_DATA_TYPE_TEXT = "text/plain"
11+
const val SHARING_DATA_TYPE_IMAGE = "image/*"
12+
const val COPY_CONTENT_TYPE_TEXT = "text"
13+
const val WHATSAPP_PACKAGE_SHARING = "com.whatsapp"
14+
const val INSTAGRAM_PACKAGE_SHARING = "com.instagram.android"
15+
const val INSTAGRAM_STORY_DESTINATION = "com.instagram.share.ADD_TO_STORY"
16+
const val SMS_CONTENT_TYPE = "sms:"
17+
const val SMS_CONTENT_BODY = "sms_body"
18+
const val OPTIONS_TITLE_MESSAGE = "Compartilhar usando"
19+
const val ANIMATION_EXECUTION_DELAY = 100L
20+
const val ANIMATION_DURATION = 300
21+
}
22+
23+
fun isPackageInstalled(packageName: String, context: Context): Boolean {
24+
val pm = context.packageManager
25+
return try {
26+
pm.getPackageInfoCompat(packageName)
27+
true
28+
} catch (e: PackageManager.NameNotFoundException) {
29+
false
30+
}
31+
}
32+
33+
fun PackageManager.getPackageInfoCompat(packageName: String, flags: Int = 0): PackageInfo =
34+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
35+
getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(flags.toLong()))
36+
} else {
37+
@Suppress("DEPRECATION") getPackageInfo(packageName, flags)
38+
}

core-shared-ui/src/main/java/com/codandotv/streamplayerapp/core_shared_ui/widget/SharingStreamCustomView.kt

Lines changed: 401 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector android:height="24dp" android:tint="#000000"
2+
android:viewportHeight="24" android:viewportWidth="24"
3+
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
4+
<path android:fillColor="@android:color/white" android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
5+
</vector>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector android:height="16dp" android:tint="#FFFFFF"
2+
android:viewportHeight="24" android:viewportWidth="24"
3+
android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
4+
<path android:fillColor="@android:color/white" android:pathData="M16,1L4,1c-1.1,0 -2,0.9 -2,2v14h2L4,3h12L16,1zM19,5L8,5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h11c1.1,0 2,-0.9 2,-2L21,7c0,-1.1 -0.9,-2 -2,-2zM19,21L8,21L8,7h11v14z"/>
5+
</vector>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<vector android:height="24dp" android:viewportHeight="512"
2+
android:viewportWidth="512" android:width="24dp"
3+
xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android">
4+
<path android:fillColor="#FF000000" android:pathData="M76.8,0L435.2,0A76.8,76.8 0,0 1,512 76.8L512,435.2A76.8,76.8 0,0 1,435.2 512L76.8,512A76.8,76.8 0,0 1,0 435.2L0,76.8A76.8,76.8 0,0 1,76.8 0z"/>
5+
<path android:pathData="M76.8,0L435.2,0A76.8,76.8 0,0 1,512 76.8L512,435.2A76.8,76.8 0,0 1,435.2 512L76.8,512A76.8,76.8 0,0 1,0 435.2L0,76.8A76.8,76.8 0,0 1,76.8 0z">
6+
<aapt:attr name="android:fillColor">
7+
<gradient android:centerX="204.8" android:centerY="512"
8+
android:gradientRadius="512" android:type="radial">
9+
<item android:color="#FFFFDD55" android:offset="0.1"/>
10+
<item android:color="#FFFF543E" android:offset="0.5"/>
11+
<item android:color="#FFC837AB" android:offset="1"/>
12+
</gradient>
13+
</aapt:attr>
14+
</path>
15+
<path android:pathData="M76.8,0L435.2,0A76.8,76.8 0,0 1,512 76.8L512,435.2A76.8,76.8 0,0 1,435.2 512L76.8,512A76.8,76.8 0,0 1,0 435.2L0,76.8A76.8,76.8 0,0 1,76.8 0z">
16+
<aapt:attr name="android:fillColor">
17+
<gradient android:endX="102.4" android:endY="512"
18+
android:startX="-0" android:startY="0" android:type="linear">
19+
<item android:color="#FF3771C8" android:offset="0.1"/>
20+
<item android:color="#006600FF" android:offset="0.5"/>
21+
</gradient>
22+
</aapt:attr>
23+
</path>
24+
<path android:fillColor="#00000000"
25+
android:pathData="M183,102L329,102A81,81 0,0 1,410 183L410,329A81,81 0,0 1,329 410L183,410A81,81 0,0 1,102 329L102,183A81,81 0,0 1,183 102z"
26+
android:strokeColor="#fff" android:strokeWidth="30"/>
27+
<path android:fillColor="#00000000"
28+
android:pathData="M256,256m-72,0a72,72 0,1 1,144 0a72,72 0,1 1,-144 0"
29+
android:strokeColor="#fff" android:strokeWidth="30"/>
30+
<path android:fillColor="#00000000"
31+
android:pathData="M347,165m-6,0a6,6 0,1 1,12 0a6,6 0,1 1,-12 0"
32+
android:strokeColor="#fff" android:strokeWidth="30"/>
33+
</vector>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<vector android:height="24dp" android:viewportHeight="32"
2+
android:viewportWidth="32" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
3+
<path android:fillColor="#8c9eff" android:pathData="M26,7H6a3,3 0,0 0,-3 3v12a3,3 0,0 0,3 3h2.74l8.77,4.87A1,1 0,0 0,18 30a1,1 0,0 0,0.51 -0.14A1,1 0,0 0,19 29v-4h7a3,3 0,0 0,3 -3V10a3,3 0,0 0,-3 -3Z"/>
4+
<path android:fillColor="#FF000000" android:pathData="M21,17a1,1 0,0 1,-0.71 -0.29,1.15 1.15,0 0,1 -0.21,-0.33 0.94,0.94 0,0 1,0 -0.76,0.9 0.9,0 0,1 0.54,-0.54 1,1 0,0 1,0.76 0,1.15 1.15,0 0,1 0.33,0.21 1,1 0,0 1,0.21 0.33,1 1,0 0,1 -0.21,1.09 1.15,1.15 0,0 1,-0.33 0.21A1,1 0,0 1,21 17Z"/>
5+
<path android:fillColor="#5f7cf9" android:pathData="M26,7H16v22l1.51,0.84A1,1 0,0 0,18 30a1,1 0,0 0,0.51 -0.14A1,1 0,0 0,19 29v-4h7a3,3 0,0 0,3 -3V10a3,3 0,0 0,-3 -3Z"/>
6+
<path android:fillColor="#5f7cf9" android:pathData="M16,17a1,1 0,0 1,-0.38 -0.08,1.15 1.15,0 0,1 -0.33,-0.21 1,1 0,0 1,-0.21 -1.09,1 1,0 0,1 0.21,-0.33 1.15,1.15 0,0 1,0.33 -0.21,1 1,0 0,1 0.76,0 0.9,0.9 0,0 1,0.54 0.54,0.94 0.94,0 0,1 0,0.76 1.15,1.15 0,0 1,-0.21 0.33A1,1 0,0 1,16 17zM11,17a1,1 0,0 1,-0.38 -0.08,1.15 1.15,0 0,1 -0.33,-0.21 1,1 0,0 1,-0.21 -1.09,1 1,0 0,1 0.21,-0.33 1.15,1.15 0,0 1,0.33 -0.21,1 1,0 0,1 0.76,0 0.9,0.9 0,0 1,0.54 0.54,0.94 0.94,0 0,1 0,0.76 1.15,1.15 0,0 1,-0.21 0.33A1,1 0,0 1,11 17z"/>
7+
<path android:fillColor="#4062ed" android:pathData="M16.92,15.62a0.9,0.9 0,0 0,-0.54 -0.54A1,1 0,0 0,16 15v2a1,1 0,0 0,0.71 -0.29,1.15 1.15,0 0,0 0.21,-0.33 0.94,0.94 0,0 0,0 -0.76zM21,17a1,1 0,0 1,-0.71 -0.29,1.15 1.15,0 0,1 -0.21,-0.33 0.94,0.94 0,0 1,0 -0.76,0.9 0.9,0 0,1 0.54,-0.54 1,1 0,0 1,0.76 0,1.15 1.15,0 0,1 0.33,0.21 1,1 0,0 1,0.21 0.33,1 1,0 0,1 -0.21,1.09 1.15,1.15 0,0 1,-0.33 0.21A1,1 0,0 1,21 17z"/>
8+
</vector>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<vector android:height="24dp" android:viewportHeight="455.73"
2+
android:viewportWidth="455.73" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
3+
<path android:fillColor="#1BD741" android:pathData="M0,0h455.73v455.73h-455.73z"/>
4+
<path android:fillColor="#FFFFFF" android:pathData="M68.49,387.41l22.32,-79.28c-14.35,-24.39 -21.91,-52.13 -21.91,-80.64c0,-87.76 71.4,-159.17 159.17,-159.17s159.17,71.4 159.17,159.17c0,87.76 -71.4,159.17 -159.17,159.17c-27.35,0 -54.13,-7 -77.81,-20.29L68.49,387.41zM154.44,337.41l4.87,2.97c20.65,12.61 44.43,19.27 68.76,19.27c72.88,0 132.17,-59.29 132.17,-132.17S300.95,95.32 228.07,95.32S95.9,154.61 95.9,227.49c0,25.39 7.22,50.05 20.87,71.31l3.28,5.11l-12.85,45.66L154.44,337.41z"/>
5+
<path android:fillColor="#FFFFFF" android:pathData="M183.36,153.41l-10.33,-0.56c-3.24,-0.18 -6.43,0.91 -8.88,3.04c-5.01,4.35 -13.01,12.75 -15.47,23.71c-3.67,16.33 2,36.33 16.67,56.33c14.67,20 42,52 90.33,65.67c15.57,4.4 27.83,1.43 37.28,-4.61c7.49,-4.79 12.65,-12.48 14.51,-21.17l1.65,-7.7c0.52,-2.45 -0.72,-4.93 -2.99,-5.98l-34.9,-16.09c-2.27,-1.04 -4.95,-0.38 -6.48,1.59l-13.7,17.76c-1.03,1.34 -2.81,1.87 -4.41,1.31c-9.38,-3.3 -40.82,-16.46 -58.07,-49.69c-0.75,-1.44 -0.56,-3.19 0.5,-4.42l13.1,-15.15c1.34,-1.55 1.68,-3.72 0.87,-5.6l-15.05,-35.2C187.19,154.77 185.39,153.52 183.36,153.41z"/>
6+
</vector>

0 commit comments

Comments
 (0)