-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/development'
- Loading branch information
Showing
58 changed files
with
1,321 additions
and
223 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
|
||
|
||
|
||
} |
11 changes: 11 additions & 0 deletions
11
app/src/main/java/com/fivegmag/a5gmsmediasessionhandler/AboutActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
app/src/main/java/com/fivegmag/a5gmsmediasessionhandler/LicenseActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.