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 19339ea + 8105c02 commit 9577f94
Show file tree
Hide file tree
Showing 58 changed files with 1,321 additions and 223 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

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

8 changes: 5 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id("com.google.android.gms.oss-licenses-plugin")
}

android {
Expand All @@ -12,7 +13,7 @@ android {
minSdk 29
targetSdk 33
versionCode 1
versionName "1.0.2"
versionName "1.1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -21,6 +22,7 @@ android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
}
compileOptions {
Expand All @@ -33,17 +35,17 @@ android {
}

dependencies {

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation("com.google.android.gms:play-services-oss-licenses:17.0.1")
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

// 5GMAG
implementation 'com.fivegmag:a5gmscommonlibrary:1.0.2'
implementation 'com.fivegmag:a5gmscommonlibrary:1.1.0'

// Retrofit
def retrofit_version = "2.9.0"
Expand Down
14 changes: 12 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
android:theme="@style/Theme.5GMSMediaSessionHandler"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
android:name=".AboutActivity"
android:exported="false" />
<activity
android:name=".LicenseActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="true">
Expand All @@ -29,13 +35,17 @@
android:name="android.app.lib_name"
android:value="" />
</activity>

<service
android:name="com.fivegmag.a5gmsmediasessionhandler.MediaSessionHandlerMessengerService"
android:name=".MediaSessionHandlerMessengerService"
android:exported="true">
<intent-filter>
<action android:name="com.fivegmag.a5gmsmediasessionhandler.Service" />
</intent-filter>
</service>
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>

</manifest>
121 changes: 121 additions & 0 deletions app/src/main/java/com/fivegmag/BaseActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
package com.fivegmag

import android.app.AlertDialog
import android.content.Intent
import android.net.Uri
import android.text.Html
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity;
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.fivegmag.a5gmsmediasessionhandler.R


open class BaseActivity : AppCompatActivity() {

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)
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.fivegmag.a5gmsmediasessionhandler

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.a5gmsmediasessionhandler

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 @@ -13,31 +13,25 @@ import android.content.pm.PackageManager
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.widget.TextView
import com.fivegmag.BaseActivity

const val TAG_MEDIA_SESSION_HANDLER = "5GMS Aware Application"
const val TAG_MEDIA_SESSION_HANDLER = "5GMS Media Session Handler"

class MainActivity : AppCompatActivity() {
class MainActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setApplicationVersionNumber()
setSupportActionBar(findViewById(R.id.toolbar))
printDependenciesVersionNumbers()
}

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_MEDIA_SESSION_HANDLER, "5GMS Common Library Version: ${BuildConfig.LIB_VERSION_a5gmscommonlibrary}")
Log.d(
TAG_MEDIA_SESSION_HANDLER,
"5GMS Common Library Version: ${BuildConfig.LIB_VERSION_a5gmscommonlibrary}"
)
}
}

0 comments on commit 9577f94

Please sign in to comment.