Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinTCoughlin committed Nov 24, 2024
1 parent 27283a7 commit 56e1258
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 161 deletions.
83 changes: 44 additions & 39 deletions .idea/caches/deviceStreaming.xml

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

8 changes: 8 additions & 0 deletions .idea/deploymentTargetSelector.xml

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

4 changes: 3 additions & 1 deletion Smodr/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
android:name="com.kevintcoughlin.smodr.SmodrApplication"
android:label="@string/app_name"
android:icon="@drawable/icon"
android:theme="@style/Theme.Smodr">
android:theme="@style/Theme.Smodr"
android:networkSecurityConfig="@xml/network_security_config"
android:usesCleartextTraffic="true">

<meta-data
android:name="firebase_performance_logcat_enabled"
Expand Down

This file was deleted.

12 changes: 0 additions & 12 deletions Smodr/src/main/java/com/kevintcoughlin/smodr/models/Item.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.kevintcoughlin.smodr.models
import android.net.Uri
import android.os.Bundle
import androidx.annotation.NonNull
import androidx.annotation.Nullable
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
Expand All @@ -17,48 +16,38 @@ class Item : IMediaPlayback {
@PrimaryKey
@ColumnInfo(name = "guid")
@field:Element
@NonNull
var guid: String = ""

@ColumnInfo(name = "title")
@field:Element
@NonNull
var title: String? = null

@ColumnInfo(name ="pubDate")
@field:Element
@NonNull
var pubDate: String? = null

@ColumnInfo(name ="description")
@field:Element
@NonNull
var description: String? = null

@ColumnInfo(name ="duration")
@field:Element
@NonNull
var duration: String? = null

@ColumnInfo(name ="summary")
@field:Element
@NonNull
var summary: String? = null

@ColumnInfo(name ="origEnclosureLink")
@field:Element
@NonNull
var origEnclosureLink: String? = null

@ColumnInfo(name ="completed")
@NonNull
var completed: Boolean = false

override val uri: Uri?
@Nullable
get() {
if (origEnclosureLink != null) {
// @todo
val uriString = origEnclosureLink!!.replace("http://", "https://")
return Uri.parse(uriString)
}
Expand Down Expand Up @@ -98,7 +87,6 @@ class Item : IMediaPlayback {

companion object {
@JvmStatic
@NonNull
fun create(item: Item, completed: Boolean): Item {
val newItem = Item()

Expand Down
25 changes: 0 additions & 25 deletions Smodr/src/main/java/com/kevintcoughlin/smodr/models/ItemDao.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import com.google.android.gms.ads.MobileAds
import com.google.android.gms.ads.RequestConfiguration
import com.google.firebase.analytics.FirebaseAnalytics
import com.kevintcoughlin.smodr.R
import com.kevintcoughlin.smodr.database.AppDatabase
import com.kevintcoughlin.smodr.databinding.ActivityMainLayoutBinding
import com.kevintcoughlin.smodr.models.Channel
import com.kevintcoughlin.smodr.models.Item
Expand Down Expand Up @@ -100,7 +99,6 @@ class MainActivity : AppCompatActivity(), OnItemSelected<Item?>,
)
)
mItem!!.completed = true
AppDatabase.updateData(applicationContext, mItem)
mBinderRecyclerFragment!!.markCompleted(mItem)
mItem = null

Expand All @@ -124,20 +122,14 @@ class MainActivity : AppCompatActivity(), OnItemSelected<Item?>,
val view: View = mBinding!!.root
setContentView(view)

mBinding!!.replay.setOnClickListener { view: View ->
this.onRewindClick(
view
)
mBinding!!.replay.setOnClickListener {
this.onRewindClick()
}
mBinding!!.play.setOnClickListener { view: View ->
this.onTogglePlaybackClick(
view
)
mBinding!!.play.setOnClickListener {
this.onTogglePlaybackClick()
}
mBinding!!.forward.setOnClickListener { view: View ->
this.onForwardClick(
view
)
mBinding!!.forward.setOnClickListener {
this.onForwardClick()
}
mBinding!!.seekbar.setOnSeekBarChangeListener(this)

Expand Down Expand Up @@ -197,23 +189,21 @@ class MainActivity : AppCompatActivity(), OnItemSelected<Item?>,
}
}

private fun onTogglePlaybackClick(view: View) {
private fun onTogglePlaybackClick() {
if (mBound) {
if (mService!!.isPlaying) {
mService!!.pausePlayback()

FirebaseAnalytics.getInstance(this)
.logEvent("pause_playback", safeGetEventBundle(mItem))
} else {
mService!!.resumePlayback()

FirebaseAnalytics.getInstance(this)
.logEvent("resume_playback", safeGetEventBundle(mItem))
}
}
}

private fun onForwardClick(view: View) {
private fun onForwardClick() {
if (mBound) {
mService!!.forward()
this.updateSeekProgress()
Expand All @@ -222,7 +212,7 @@ class MainActivity : AppCompatActivity(), OnItemSelected<Item?>,
FirebaseAnalytics.getInstance(this).logEvent("forward_playback", safeGetEventBundle(mItem))
}

fun onRewindClick(view: View) {
private fun onRewindClick() {
if (mBound) {
mService!!.rewind()
this.updateSeekProgress()
Expand Down Expand Up @@ -280,7 +270,7 @@ class MainActivity : AppCompatActivity(), OnItemSelected<Item?>,
private const val ONE_SECOND_IN_MS = 1000
private val mChannel = Channel(
"Tell 'Em Steve-Dave",
"https://feeds.feedburner.com/TellEmSteveDave"
"http://feeds.feedburner.com/TellEmSteveDave/"
)
private const val PRIVACY_POLICY_URL =
"https://kevintcoughlin.blob.core.windows.net/smodr/privacy_policy.html"
Expand Down
Loading

0 comments on commit 56e1258

Please sign in to comment.