Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development'
Browse files Browse the repository at this point in the history
  • Loading branch information
dsilhavy committed Jan 25, 2024
2 parents c985de4 + 5752736 commit 90656c3
Show file tree
Hide file tree
Showing 57 changed files with 884 additions and 77 deletions.
1 change: 0 additions & 1 deletion fivegmag_5GMSdAwareApplication/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions fivegmag_5GMSdAwareApplication/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
minSdk 29
targetSdk 32
versionCode 1
versionName "1.0.2"
versionName "1.1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -41,8 +41,9 @@ dependencies {
implementation 'com.google.android.material:material:1.8.0'
implementation 'org.greenrobot:eventbus:3.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.fivegmag:a5gmscommonlibrary:1.0.2'
implementation 'com.fivegmag:a5gmsmediastreamhandler:1.0.2'
implementation 'com.google.android.gms:play-services-oss-licenses:17.0.1'
implementation 'com.fivegmag:a5gmscommonlibrary:1.1.0'
implementation 'com.fivegmag:a5gmsmediastreamhandler:1.1.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
android:supportsRtl="true"
android:theme="@style/Theme.5GMSdAwareApplication"
tools:targetApi="31">
<activity
android:name=".AboutActivity"
android:exported="false" />
<activity
android:name=".LicenseActivity"
android:exported="false" />
<activity
android:name="com.fivegmag.a5gmsdawareapplication.MainActivity"
android:exported="true">
Expand All @@ -28,6 +34,9 @@
android:name="android.app.lib_name"
android:value="" />
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>

<queries>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!-- <entry key="m8LocalMultiMedia">m8/config_multi_media.json</entry> -->
<!--<entry key="m8LocalAfAndAs">m8/config_local_af.json</entry>-->
<entry key="m85GMAGHost">https://rt.5g-mag.com/</entry>
<!-- <entry key="m8LocalDummyHost">http://10.147.67.179:3003/m8/</entry>-->
<entry key="m8LocalDummyHost">http://192.168.2.1:3003/m8/</entry>
<!-- <entry key="m8LocalDummyHost">http://10.147.67.10:3003/m8/</entry> -->
<entry key="m8LocalDummyHost">http://192.168.178.78:3003/m8/</entry>
<!-- <entry key="m8LocalDummyHost">http://194.95.175.90:3003/m8/</entry> -->
</properties>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.fivegmag.a5gmsdawareapplication

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class AboutActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_about)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.fivegmag.a5gmsdawareapplication

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class LicenseActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_license)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,27 @@ https://drive.google.com/file/d/1cinCiA778IErENZ3JN52VFW-1ffHpx7Z/view

package com.fivegmag.a5gmsdawareapplication

import android.Manifest
import android.app.AlertDialog
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle
import android.text.Html
import android.util.Log
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.Button
import android.widget.Spinner
import android.widget.TextView
import androidx.activity.result.contract.ActivityResultContracts
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.media3.common.util.UnstableApi
import com.fivegmag.a5gmscommonlibrary.models.EntryPoint
import com.fivegmag.a5gmscommonlibrary.models.M8Model
Expand All @@ -45,7 +56,7 @@ const val TAG_AWARE_APPLICATION = "5GMS Aware Application"
@UnstableApi
class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener {

private val mediaSessionHandlerAdapter = MediaSessionHandlerAdapter()
private val mediaSessionHandlerAdapter = MediaSessionHandlerAdapter()
private val exoPlayerAdapter = ExoPlayerAdapter()
private val mediaStreamHandlerEventHandler = MediaStreamHandlerEventHandler()
private var currentSelectedStreamIndex: Int = 0
Expand All @@ -58,7 +69,149 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
requestUserPermissions()
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_main, menu)
return true
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.actionLicense -> {
val dialogView = LayoutInflater.from(this).inflate(R.layout.activity_license, null)
val textView = dialogView.findViewById<TextView>(R.id.licenseTextView)
val formattedText = getString(R.string.license_text)
textView.text = Html.fromHtml(formattedText, Html.FROM_HTML_MODE_LEGACY)
val builder = AlertDialog.Builder(this)
.setView(dialogView)
.setPositiveButton("OK") { dialog, _ ->
dialog.dismiss()
}
val dialog = builder.create()
dialog.show()
return true
}

R.id.actionAbout -> {
val dialogView = LayoutInflater.from(this).inflate(R.layout.activity_about, null)
addVersionNumber(dialogView)
setClickListeners(dialogView)
formatAboutText(dialogView)
val builder = AlertDialog.Builder(this)
.setView(dialogView)
.setPositiveButton("OK") { dialog, _ ->
dialog.dismiss()
}
val dialog = builder.create()
dialog.show()
return true
}

R.id.actionAttribution -> {
OssLicensesMenuActivity.setActivityTitle(getString(R.string.action_attribution_notice))
val licensesIntent = Intent(this, OssLicensesMenuActivity::class.java)
startActivity(licensesIntent)
return true
}
}
return super.onOptionsItemSelected(item)
}

private fun addVersionNumber(dialogView: View) {
val packageInfo = packageManager.getPackageInfo(packageName, 0)
val versionName = packageInfo.versionName
val versionTextView = dialogView.findViewById<TextView>(R.id.versionNumberView)
val versionText = getString(R.string.version_text_field, versionName)
versionTextView.text = versionText
}

private fun setClickListeners(dialogView: View) {

val githubTextView = dialogView.findViewById<TextView>(R.id.githubLink)
githubTextView.setOnClickListener {
val url = getString(R.string.github_url)
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
}

val twitterTextView = dialogView.findViewById<TextView>(R.id.twitterLink)
twitterTextView.setOnClickListener {
val url = getString(R.string.twitter_url)
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
}

val linkedInView = dialogView.findViewById<TextView>(R.id.linkedInLink)
linkedInView.setOnClickListener {
val url = getString(R.string.linked_in_url)
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
}

val slackView = dialogView.findViewById<TextView>(R.id.slackLink)
slackView.setOnClickListener {
val url = getString(R.string.slack_url)
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
}

val websiteView = dialogView.findViewById<TextView>(R.id.websiteLink)
websiteView.setOnClickListener {
val url = getString(R.string.website_url)
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
}
}

private fun formatAboutText(dialogView: View) {
val textView = dialogView.findViewById<TextView>(R.id.descriptionText)
val formattedText = getString(R.string.description_text)
textView.text = Html.fromHtml(formattedText, Html.FROM_HTML_MODE_LEGACY)
}

private fun requestUserPermissions() {
val permissionLst = arrayListOf<String>()

val requestPermissionLauncher =
registerForActivityResult(
ActivityResultContracts.RequestMultiplePermissions()
) {
initialize()
}

// Register the cell info callback
if (ActivityCompat.checkSelfPermission(
this,
Manifest.permission.ACCESS_FINE_LOCATION
) != PackageManager.PERMISSION_GRANTED
) {
permissionLst.add(Manifest.permission.ACCESS_FINE_LOCATION)
}

if (ActivityCompat.checkSelfPermission(
this,
Manifest.permission.READ_PHONE_NUMBERS
) != PackageManager.PERMISSION_GRANTED
) {
permissionLst.add(Manifest.permission.READ_PHONE_NUMBERS)
}

if (permissionLst.size > 0)
{
requestPermissionLauncher.launch(permissionLst.toTypedArray())
}
else
{
initialize()
}
}

/**
* Initialization is performed after the user permissions have been requested.
*
*/
private fun initialize() {
try {
loadConfiguration()
populateM8SelectionSpinner()
Expand All @@ -71,13 +224,12 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener {
exoPlayerAdapter,
::onConnectionToMediaSessionHandlerEstablished
)
val representationInfoTextView = findViewById<TextView>(R.id.representationInfo)
val representationInfoTextView = findViewById<TextView>(R.id.representation_info)
mediaStreamHandlerEventHandler.initialize(representationInfoTextView, this)
} catch (e: Exception) {
e.printStackTrace()
}
}

override fun onStop() {
EventBus.getDefault().unregister(mediaStreamHandlerEventHandler)
super.onStop()
Expand All @@ -95,16 +247,22 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener {
val packageInfo = packageManager.getPackageInfo(packageName, 0)
val versionName = packageInfo.versionName
val versionTextView = findViewById<TextView>(R.id.versionNumber)
val versionText = getString(R.string.versionTextField, versionName)
val versionText = getString(R.string.version_text_field, versionName)
versionTextView.text = versionText
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
}
}

private fun printDependenciesVersionNumbers() {
Log.d(TAG_AWARE_APPLICATION, "5GMS Common Library Version: ${BuildConfig.LIB_VERSION_a5gmscommonlibrary}")
Log.d(TAG_AWARE_APPLICATION, "5GMS Media Stream Handler Version: ${BuildConfig.LIB_VERSION_a5gmsmediastreamhandler}")
Log.d(
TAG_AWARE_APPLICATION,
"5GMS Common Library Version: ${BuildConfig.LIB_VERSION_a5gmscommonlibrary}"
)
Log.d(
TAG_AWARE_APPLICATION,
"5GMS Media Stream Handler Version: ${BuildConfig.LIB_VERSION_a5gmsmediastreamhandler}"
)
}

private fun loadConfiguration() {
Expand All @@ -114,7 +272,10 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener {
configProperties.loadFromXML(inputStream)
inputStream.close()
} catch (e: Exception) {

Log.d(
TAG_AWARE_APPLICATION,
"loadConfiguration Exception: $e"
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MediaStreamHandlerEventHandler {
val kbitsPerSecond =
event.mediaLoadData.trackFormat?.peakBitrate?.div(1000).toString()
val id = event.mediaLoadData.trackFormat?.id.toString()
val text = context.getString(R.string.representationInfo, kbitsPerSecond, id)
val text = context.getString(R.string.representation_info, kbitsPerSecond, id)
representationInfoTextView.text = text
}
}
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="Poppins"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="name=Poppins&amp;weight=600"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 90656c3

Please sign in to comment.