Skip to content
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

Grid Video Component #453

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion app/src/main/java/live/hms/app2/ui/home/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.EditText
import android.widget.Toast
import androidx.activity.OnBackPressedCallback
import androidx.activity.result.contract.ActivityResultContracts
Expand All @@ -26,7 +27,6 @@ import live.hms.roomkit.ui.settings.SettingsMode
import live.hms.roomkit.ui.settings.SettingsStore
import live.hms.roomkit.util.EmailUtils
import live.hms.app2.util.*
import live.hms.roomkit.util.NameUtils.isValidUserName
import live.hms.roomkit.ui.HMSPrebuiltOptions
import live.hms.roomkit.ui.HMSRoomKit
import live.hms.roomkit.ui.meeting.*
Expand Down Expand Up @@ -249,6 +249,15 @@ class HomeFragment : Fragment() {
}
}

fun isValidUserName(editText: EditText): Boolean {
val username = editText.text.toString()
if (username.isEmpty()) {
return false
}
return true
}


private fun enableButton() {
binding.btnJoinNow.isEnabled = true
binding.btnJoinNow.background =
Expand Down
1 change: 1 addition & 0 deletions common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
121 changes: 121 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
id 'maven-publish'
id 'kotlin-parcelize'
id 'signing'
id "org.jetbrains.dokka" version "1.5.0"
}

def getVersionName = { ->
return "$HMS_ROOM_KIT_VERSION"
}

android {
namespace 'live.hms.common'
compileSdk 33

defaultConfig {
minSdk 21
targetSdk 33
versionCode 1
versionName getVersionName()

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

buildFeatures {
viewBinding true
dataBinding {
enabled true
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}

publishing {
singleVariant('release') {
withSourcesJar()
}
}

}

dependencies {
implementation 'androidx.core:core:1.10.1'
def hmsVersion = "2.7.7-de"
// To add dependencies of specific module
implementation "live.100ms:android-sdk:$hmsVersion"
implementation "live.100ms:video-view:$hmsVersion"
implementation 'com.google.code.gson:gson:2.8.6'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}


task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
archiveFileName = "javadoc.jar"
from "build/dokka/javadoc"
archiveClassifier.set("javadoc")
}

afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
from components.release
pom {
// Only sign the artefacts if this is a maven central build.
// This would only halt jitpack builds and/or make our signing keys public.
if(rootProject.properties["ossrhUsername"]) {
artifact javadocJar
signing {
sign publishing.publications
}
}
name = "100ms.live Android Room Kit"
description = "Room Kit that simplifies setting up videoconferencing in your own app. See more at https://www.100ms.live/docs/android/v2/guides/quickstart"
url = "100ms.live"
licenses {
license {
name = 'MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
}
}
developers {
developer {
id = '1'
name = '100ms'
email = '[email protected]'
}
}
scm {
connection = 'SCM is private'
developerConnection = 'SCM is private'
url = 'SCM is private'
}
}
groupId = "live.100ms"
artifactId = 'common'
version = getVersionName()
}
}
}
}
Empty file added common/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions common/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package live.hms.common

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("live.hms.common.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package live.hms.roomkit.util
package live.hms.common.util

import android.widget.EditText
import java.util.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package live.hms.roomkit.util
package live.hms.common.util

import android.app.Activity
import android.app.AlertDialog
Expand All @@ -12,8 +12,7 @@ import android.view.*
import android.view.accessibility.AccessibilityManager
import androidx.core.content.FileProvider
import androidx.core.view.GestureDetectorCompat
import live.hms.roomkit.R
import live.hms.roomkit.helpers.OnSingleClickListener
import live.hms.common.util.helpers.OnSingleClickListener
import live.hms.video.media.capturers.camera.CameraControl
import live.hms.video.media.settings.HMSSimulcastLayerDefinition
import live.hms.video.media.tracks.HMSLocalVideoTrack
Expand Down Expand Up @@ -80,7 +79,7 @@ fun Bitmap.saveCaptureToLocalCache(context: Context) : Uri? {

val imagePath = File(context.cacheDir, "images")
val newFile = File(imagePath, "image.png")
return FileProvider.getUriForFile(context, "live.hms.roomkit.provider", newFile)
return null

}

Expand All @@ -98,9 +97,6 @@ fun Activity.openShareIntent(uri: Uri) {
startActivity(Intent.createChooser(shareIntent, "Choose an app"))
}

fun HMSVideoTrack?.isValid(): Boolean {
return !(this == null || this.isMute || this.isDegraded)
}


fun Context.showTileListDialog(
Expand Down Expand Up @@ -139,6 +135,8 @@ fun SurfaceViewRenderer.onBitMap(onBitmap: (Bitmap?) -> Unit, scale : Float = 1.
}, scale)
}



fun Context.showSimulcastDialog(hmsVideoTrack: HMSRemoteVideoTrack?) {
if (hmsVideoTrack == null)
return
Expand Down Expand Up @@ -196,17 +194,7 @@ fun Context.showMirrorOptions(surfaceViewRenderer: SurfaceViewRenderer?) {
}


fun SurfaceViewRenderer.setInit() {
setTag(R.id.IS_INT,true)
}

fun SurfaceViewRenderer.setRelease() {
setTag(R.id.IS_INT,false)
}

fun SurfaceViewRenderer.isInit() : Boolean {
return (getTag(R.id.IS_INT) as? Boolean) == true
}

fun HMSVideoTrack?.switchCamera() {
(this as? HMSLocalVideoTrack)?.switchCamera()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package live.hms.roomkit.ui.meeting
package live.hms.common.util.helpers

import com.google.gson.Gson
import com.google.gson.JsonSyntaxException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package live.hms.roomkit.helpers
package live.hms.common.util.helpers

import android.content.Context
import android.graphics.drawable.Drawable
import androidx.core.content.ContextCompat
import live.hms.roomkit.R
import live.hms.common.R

class NetworkQualityHelper {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package live.hms.roomkit.helpers
package live.hms.common.util.helpers

import android.view.View

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:shape="ring"
android:thickness="4dp"
android:useLevel="false">
<solid android:color="@color/white" />
<solid android:color="@android:color/white" />
</shape>
</item>
</layer-list>
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="false"
tools:context=".ui.meeting.videogrid.VideoGridPageFragment" />
/>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<dimen name="inset_pill_height">186dp</dimen>
<dimen name="sizeteen_dp">16dp</dimen>
<dimen name="eight_dp">8dp</dimen>
<dimen name="one_dp">1dp</dimen>
<dimen name="two_dp">4dp</dimen>
<dimen name="four_dp">4dp</dimen>
<dimen name="thirty_two_dp">32dp</dimen>
</resources>
17 changes: 17 additions & 0 deletions common/src/test/java/live/hms/common/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package live.hms.common

import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
5 changes: 4 additions & 1 deletion room-kit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.percentlayout:percentlayout:1.0.0'

def hmsVersion = "2.7.2"
implementation "live.100ms:common:0.0.6"
implementation "live.100ms:videogrid:0.0.6"

def hmsVersion = "2.7.7-de"
// To add dependencies of specific module
implementation "live.100ms:android-sdk:$hmsVersion"
implementation "live.100ms:video-view:$hmsVersion"
Expand Down
Loading