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

Feature/versions #24

Merged
merged 2 commits into from
Aug 25, 2023
Merged
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
2 changes: 1 addition & 1 deletion fivegmag_5GMSdAwareApplication/.idea/compiler.xml

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

2 changes: 1 addition & 1 deletion fivegmag_5GMSdAwareApplication/.idea/misc.xml

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

13 changes: 13 additions & 0 deletions fivegmag_5GMSdAwareApplication/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,17 @@ dependencies {
def retrofit_version = "2.9.0"
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
}

task CaptureLibraryVersion {
def libDef = project.configurations.getByName('implementation').allDependencies.matching {
it.group.equals("com.fivegmag")
}
if (libDef.size() > 0) {
android.buildTypes.each {
libDef.forEach { item ->
it.buildConfigField 'String', "LIB_VERSION_" + item.name, "\"${item.version}\""
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<!--<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.178.78:3003/m8/</entry>
<entry key="m8LocalDummyHost">http://192.168.2.1: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
Expand Up @@ -9,7 +9,9 @@ https://drive.google.com/file/d/1cinCiA778IErENZ3JN52VFW-1ffHpx7Z/view

package com.fivegmag.a5gmsdawareapplication

import android.content.pm.PackageManager
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.AdapterView
import android.widget.ArrayAdapter
Expand Down Expand Up @@ -38,7 +40,7 @@ import java.net.URI
import java.util.*


const val TAG = "5GMS Aware Application"
const val TAG_AWARE_APPLICATION = "5GMS Aware Application"

@UnstableApi
class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener {
Expand All @@ -61,6 +63,8 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener {
loadConfiguration()
populateM8SelectionSpinner()
exoPlayerView = findViewById(R.id.idExoPlayerVIew)
setApplicationVersionNumber()
printDependenciesVersionNumbers()
registerButtonListener()
mediaSessionHandlerAdapter.initialize(
this,
Expand All @@ -75,15 +79,32 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener {
}

override fun onStop() {
EventBus.getDefault().unregister(mediaStreamHandlerEventHandler);
EventBus.getDefault().unregister(mediaStreamHandlerEventHandler)
super.onStop()
// Unbind from the service
mediaSessionHandlerAdapter.reset(this)
}

override fun onStart() {
super.onStart()
EventBus.getDefault().register(mediaStreamHandlerEventHandler);
EventBus.getDefault().register(mediaStreamHandlerEventHandler)
}

private fun setApplicationVersionNumber() {
try {
val packageInfo = packageManager.getPackageInfo(packageName, 0)
val versionName = packageInfo.versionName
val versionTextView = findViewById<TextView>(R.id.versionNumber)
val versionText = getString(R.string.versionTextField, 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}")
}

private fun loadConfiguration() {
Expand Down Expand Up @@ -171,7 +192,7 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener {
}

private fun replaceDoubleTicks(value: String): String {
return value.replace("\"", "");
return value.replace("\"", "")
}

override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
Expand Down Expand Up @@ -248,9 +269,9 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener {

for (serviceListEntry in jsonServiceList) {
val itemAsJsonObject = Json.parseToJsonElement(serviceListEntry.toString()).jsonObject
var name: String =
val name: String =
replaceDoubleTicks(itemAsJsonObject["name"].toString())
var provisioningSessionId =
val provisioningSessionId =
replaceDoubleTicks(itemAsJsonObject["provisioningSessionId"].toString())

val entryPoints = ArrayList<EntryPoint>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,15 @@
app:layout_constraintStart_toStartOf="@+id/idExoPlayerVIew"
app:layout_constraintTop_toTopOf="@+id/idExoPlayerVIew" />

<TextView
android:id="@+id/versionNumber"
android:layout_width="146dp"
android:layout_height="20dp"
android:layout_marginBottom="16dp"
android:text="@string/versionTextField"
android:textAlignment="textEnd"
app:layout_constraintBottom_toTopOf="@+id/idExoPlayerVIew"
app:layout_constraintEnd_toEndOf="@+id/idExoPlayerVIew" />


</androidx.constraintlayout.widget.ConstraintLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,15 @@
app:layout_constraintStart_toStartOf="@+id/idExoPlayerVIew"
app:layout_constraintTop_toTopOf="@+id/idExoPlayerVIew" />

<TextView
android:id="@+id/versionNumber"
android:layout_width="162dp"
android:layout_height="23dp"
android:layout_marginBottom="20dp"
android:text="@string/versionTextField"
android:textAlignment="textEnd"
app:layout_constraintBottom_toTopOf="@+id/representationInfo"
app:layout_constraintEnd_toEndOf="@+id/idExoPlayerVIew" />


</androidx.constraintlayout.widget.ConstraintLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<string name="labelStreamSelection">Select a Stream</string>
<string name="startPlaybackButton">Start Playback</string>
<string name="representationInfo">%1$s kbit/s - Rep ID: %2$s</string>
<string name="versionTextField">Version: %s</string>
</resources>
Loading