Skip to content

Commit

Permalink
Merge pull request #661 from 100mslive/dev
Browse files Browse the repository at this point in the history
Release 1.1.95
  • Loading branch information
AniketSK authored Mar 4, 2024
2 parents ba1dc21 + 48a3967 commit 7b138d4
Show file tree
Hide file tree
Showing 31 changed files with 825 additions and 39 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ dependencies {

//100ms.live prebuilt lib
implementation "live.100ms:room-kit:$HMS_ROOM_KIT_VERSION"
// TODO update the version when it's ready
def hmsVersion = "2.9.5"
implementation "live.100ms:hms-noise-cancellation-android:$hmsVersion"

// Navigation
implementation "androidx.navigation:navigation-fragment-ktx:2.4.0"
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/java/live/hms/app2/ui/home/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AlertDialog
import androidx.core.content.ContextCompat
import androidx.core.content.edit
import androidx.core.os.bundleOf
import androidx.core.widget.doOnTextChanged
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
Expand All @@ -32,7 +31,6 @@ import live.hms.roomkit.ui.meeting.DeviceStatsBottomSheet
import live.hms.roomkit.ui.meeting.LEAVE_INFORMATION_PERSON
import live.hms.roomkit.ui.meeting.LEAVE_INFORMATION_REASON
import live.hms.roomkit.ui.meeting.LEAVE_INFROMATION_WAS_END_ROOM
import live.hms.roomkit.ui.settings.SettingsMode
import live.hms.roomkit.ui.settings.SettingsStore
import live.hms.roomkit.util.EmailUtils
import live.hms.roomkit.util.NameUtils.isValidUserName
Expand Down Expand Up @@ -171,7 +169,7 @@ class HomeFragment : Fragment() {
if (settings.environment.contains("prod").not()) {
put("token", "https://auth-nonprod.100ms.live")
put("init", "https://qa-init.100ms.live/init")
put("layout", if (settings.useMockAPi) "https://demo8271564.mockable.io" else "https://api-nonprod.100ms.live")
put("layout", "https://api-nonprod.100ms.live")
}
})
)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ kotlin.code.style=official
100MS_APP_VERSION_CODE=643
100MS_APP_VERSION_NAME=5.8.872
hmsRoomKitGroup=live.100ms
HMS_ROOM_KIT_VERSION=1.1.95
HMS_ROOM_KIT_VERSION=1.1.96
android.suppressUnsupportedCompileSdk=33
3 changes: 2 additions & 1 deletion room-kit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ dependencies {
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
def hmsVersion = "2.9.4"
def hmsVersion = "2.9.5"
implementation "com.otaliastudios:zoomlayout:1.9.0"
// To add dependencies of specific module
implementation "live.100ms:android-sdk:$hmsVersion"
implementation "live.100ms:video-view:$hmsVersion"
implementation "live.100ms:hls-player:$hmsVersion"
implementation "live.100ms:video-filters:$hmsVersion"

// Navigation
implementation "androidx.navigation:navigation-fragment-ktx:2.7.4"
Expand Down
7 changes: 7 additions & 0 deletions room-kit/src/main/java/live/hms/roomkit/ui/GridOptionItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class GridOptionItem(
var isSelected: Boolean = false,
var particpantCount: Int? = null,
var showProgress: Boolean = false,
val selectedTitle : String? = null,

) : BindableItem<ItemGridOptionBinding>() {

private val SELECTION_UPDATE = "SELECTION_UPDATE"
Expand Down Expand Up @@ -62,6 +64,11 @@ class GridOptionItem(
}

private fun setSelectedView(isSelected: Boolean, v: ItemGridOptionBinding) {
if(isSelected && selectedTitle != null )
v.subtitle.text = selectedTitle
else
v.subtitle.text = title

v.rootLayout.background = if (isSelected.not()) {
getShape().apply {
setTint(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
package live.hms.roomkit.ui.filters


import android.app.Dialog
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.PorterDuff
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.widget.FrameLayout
import android.widget.SeekBar
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.widget.SwitchCompat
import androidx.fragment.app.activityViewModels
import androidx.recyclerview.widget.LinearSnapHelper
import androidx.recyclerview.widget.SnapHelper
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.tabs.TabLayout
import live.hms.roomkit.R
import live.hms.roomkit.databinding.BottomSheetVideoFilterBinding
import live.hms.roomkit.drawableEnd
import live.hms.roomkit.drawableStart
import live.hms.roomkit.ui.meeting.MeetingViewModel
import live.hms.roomkit.ui.meeting.MeetingViewModelFactory
import live.hms.roomkit.ui.theme.HMSPrebuiltTheme
import live.hms.roomkit.ui.theme.getColorOrDefault
import live.hms.roomkit.util.viewLifecycle


class FilterBottomSheet(
) : BottomSheetDialogFragment() {

private var binding by viewLifecycle<BottomSheetVideoFilterBinding>()


private val meetingViewModel: MeetingViewModel by activityViewModels {
MeetingViewModelFactory(
requireActivity().application
)
}


var currentSelectedFilter: VideoFilter? = null

val padding = 8

override fun onStart() {
super.onStart()
dialog?.window?.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NORMAL, R.style.AppBottomSheetDialogTheme);

}


override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View {
binding = BottomSheetVideoFilterBinding.inflate(inflater, container, false)
return binding.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)


binding.root.background = resources.getDrawable(R.drawable.gray_shape_round_dialog).apply {
val color = getColorOrDefault(
HMSPrebuiltTheme.getColours()?.backgroundDefault,
HMSPrebuiltTheme.getDefaults().background_default
)
setColorFilter(color, PorterDuff.Mode.ADD);
}

var btnArray = arrayOf(
binding.audioOt
)

val borders = arrayOf(
binding.border5
)

borders.forEach {
it.setBackgroundColor(
getColorOrDefault(
HMSPrebuiltTheme.getColours()?.borderDefault,
HMSPrebuiltTheme.getDefaults().border_bright
)
)
}



binding.closeBtn.drawable.setTint(
getColorOrDefault(
HMSPrebuiltTheme.getColours()?.onSurfaceHigh,
HMSPrebuiltTheme.getDefaults().onsurface_high_emp
)
)

binding.closeBtn.setOnClickListener {
dismissAllowingStateLoss()
}




(binding.pluginSwitch as SwitchCompat).isChecked = true
meetingViewModel.setupFilterVideoPlugin()
(binding.pluginSwitch as SwitchCompat).setTextColor(
getColorOrDefault(
HMSPrebuiltTheme.getColours()?.onSurfaceHigh,
HMSPrebuiltTheme.getDefaults().onsurface_high_emp
)
)
(binding.pluginSwitch as SwitchCompat).setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) meetingViewModel.setupFilterVideoPlugin()
else meetingViewModel.removeVideoFilterPlugIn()
}

binding.seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
when (currentSelectedFilter) {
is VideoFilter.Brightness -> meetingViewModel.filterPlugin.setBrightness(
progress / 100f
)

is VideoFilter.Sharpness -> meetingViewModel.filterPlugin.setSharpness(progress / 100f)
is VideoFilter.Contrast -> meetingViewModel.filterPlugin.setContrast(progress / 100f)
is VideoFilter.Redness -> meetingViewModel.filterPlugin.setRedness(progress / 100f)
is VideoFilter.Smoothness -> meetingViewModel.filterPlugin.setSmoothness(progress / 100f)
null -> {}
else -> {}
}

}

override fun onStartTrackingTouch(seekBar: SeekBar?) {

}

override fun onStopTrackingTouch(seekBar: SeekBar?) {

}

})




binding.tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) {
when (tab?.tag) {
is VideoFilter.Brightness -> {
currentSelectedFilter = VideoFilter.Brightness
binding.seekBar.progress =
(meetingViewModel.filterPlugin.getBrightnessProgress() * 100f).toInt()
}

is VideoFilter.Sharpness -> {
currentSelectedFilter = VideoFilter.Sharpness
binding.seekBar.progress =
(meetingViewModel.filterPlugin.getSharpnessProgress() * 100f).toInt()
}


is VideoFilter.Contrast -> {
currentSelectedFilter = VideoFilter.Contrast
binding.seekBar.progress =
( meetingViewModel.filterPlugin.getContrastProgress() * 100f).toInt()
}

is VideoFilter.Redness -> {
currentSelectedFilter = VideoFilter.Redness
binding.seekBar.progress =
(meetingViewModel.filterPlugin.getRednessProgress() * 100f).toInt()
}

is VideoFilter.Smoothness -> {
currentSelectedFilter = VideoFilter.Smoothness
binding.seekBar.progress =
( meetingViewModel.filterPlugin.getSmoothnessProgress() * 100f).toInt()
}


else -> {

}
}
}

override fun onTabUnselected(tab: TabLayout.Tab?) {

}

override fun onTabReselected(tab: TabLayout.Tab?) {

}

})



binding.tabLayout.apply {
setTabTextColors(
getColorOrDefault(
HMSPrebuiltTheme.getColours()?.onSurfaceLow,
HMSPrebuiltTheme.getDefaults().onsurface_high_emp
), getColorOrDefault(
HMSPrebuiltTheme.getColours()?.onSurfaceHigh,
HMSPrebuiltTheme.getDefaults().onsurface_high_emp
)

)
addTab(
this.newTab().setText("Brightness").setTag(VideoFilter.Brightness), true
)
addTab(
this.newTab().setText("Contrast").setTag(VideoFilter.Contrast)
)
addTab(
this.newTab().setText("Sharpness").setTag(VideoFilter.Sharpness)
)
addTab(
this.newTab().setText("Redness").setTag(VideoFilter.Redness)
)
addTab(
this.newTab().setText("Smoothness").setTag(VideoFilter.Smoothness)
)
setSelectedTabIndicatorColor(Color.TRANSPARENT)
}







btnArray.forEach {
it.setTextColor(
getColorOrDefault(
HMSPrebuiltTheme.getColours()?.onSurfaceHigh,
HMSPrebuiltTheme.getDefaults().onsurface_high_emp
)
)

it.drawableEnd?.setTint(
getColorOrDefault(
HMSPrebuiltTheme.getColours()?.onSurfaceHigh,
HMSPrebuiltTheme.getDefaults().onsurface_high_emp
)
)

it.drawableStart?.setTint(
getColorOrDefault(
HMSPrebuiltTheme.getColours()?.onSurfaceHigh,
HMSPrebuiltTheme.getDefaults().onsurface_high_emp
)
)
}

}

private fun getData(from: Int, to: Int): List<String> {
val data: MutableList<String> = ArrayList()


for (i in 0 until padding) {
data.add("")
}
for (i in from until to) {
data.add(i.toString())
}

for (i in 0 until padding) {
data.add("")
}
return data
}

override fun getTheme(): Int {
return R.style.AppBottomSheetDialogTheme
}

}
Loading

0 comments on commit 7b138d4

Please sign in to comment.