Dashboard list touch events actually start playing streams
Refined Home Fragment to clean up double definition of it for clarity Updated Gradle release
This commit is contained in:
parent
d69aeece54
commit
2e9b76ce3b
8 changed files with 38 additions and 16 deletions
3
.idea/codeStyles/Project.xml
generated
3
.idea/codeStyles/Project.xml
generated
|
@ -1,8 +1,5 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<AndroidXmlCodeStyleSettings>
|
||||
<option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
|
||||
</AndroidXmlCodeStyleSettings>
|
||||
<JetCodeStyleSettings>
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
|
|
3
.idea/gradle.xml
generated
3
.idea/gradle.xml
generated
|
@ -1,8 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
|
@ -12,7 +14,6 @@
|
|||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
|
5
.idea/misc.xml
generated
5
.idea/misc.xml
generated
|
@ -1,10 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeSettings">
|
||||
<configurations>
|
||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
|
|
2
.idea/vcs.xml
generated
2
.idea/vcs.xml
generated
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,5 +1,6 @@
|
|||
package net.theoks.customstreams.android.ui.dashboard
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Typeface
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
|
@ -7,6 +8,7 @@ import android.util.Log
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.Observer
|
||||
|
@ -16,13 +18,18 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.android.volley.Request
|
||||
import com.android.volley.Response
|
||||
import com.android.volley.toolbox.JsonArrayRequest
|
||||
import com.android.volley.toolbox.JsonObjectRequest
|
||||
import com.android.volley.toolbox.Volley
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.lists.SingleLineItemViewHolder
|
||||
import net.theoks.customstreams.android.R
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import com.google.android.material.lists.ThreeLineItemViewHolder
|
||||
import com.google.android.material.lists.TwoLineItemViewHolder
|
||||
import com.google.android.material.textview.MaterialTextView
|
||||
import kotlinx.android.synthetic.main.fragment_home.view.*
|
||||
import net.theoks.customstreams.android.PlayerActivity
|
||||
|
||||
class DashboardFragment : Fragment() {
|
||||
|
||||
|
@ -92,6 +99,28 @@ class DashboardFragment : Fragment() {
|
|||
vh.tertiary.text = split[2]
|
||||
vh.secondary.ellipsize = TextUtils.TruncateAt.END
|
||||
}
|
||||
vh.itemView.setOnClickListener { view ->
|
||||
val realIt = view as RelativeLayout
|
||||
val textView = realIt.getChildAt(1) as MaterialTextView
|
||||
val streamKey = textView.text.toString()
|
||||
|
||||
val queue = Volley.newRequestQueue(view.context)
|
||||
val url = "https://buyvm-cf.theoks.net/custom-streams-player/get_title.php?streamkey=$streamKey"
|
||||
val streamInfoJsonRequest = JsonObjectRequest(Request.Method.GET, url, null, Response.Listener<JSONObject> {
|
||||
if(it.getBoolean("stream_is_live")) {
|
||||
val intent = Intent(view.context, PlayerActivity::class.java).apply {
|
||||
putExtra("net.theoks.customstreams.streamkey", streamKey)
|
||||
}
|
||||
view.context.startActivity(intent)
|
||||
} else {
|
||||
val builder = MaterialAlertDialogBuilder(view.context ?: throw Exception("Couldn't get context while building alert"))
|
||||
builder.setTitle(R.string.stream_not_live).setMessage("Stream $streamKey is not live.").setPositiveButton(R.string.ok, null).show()
|
||||
Log.i("OKSCustom-StreamInfo", "Stream $streamKey is not live!")
|
||||
}
|
||||
},
|
||||
Response.ErrorListener {Log.e("OKSCustom-StreamInfo", "Error when requesting stream info ${it.message}")})
|
||||
queue.add(streamInfoJsonRequest)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
|
|
|
@ -36,11 +36,11 @@ class HomeFragment : Fragment() {
|
|||
val root = inflater.inflate(R.layout.fragment_home, container, false)
|
||||
|
||||
val button = root.findViewById(R.id.watchButton) as Button
|
||||
button.setOnClickListener {
|
||||
val streamKey = (it.rootView.findViewById(R.id.streamKeyEdit) as EditText).text.toString()
|
||||
button.setOnClickListener { view ->
|
||||
val streamKey = (view.rootView.findViewById(R.id.streamKeyEdit) as EditText).text.toString()
|
||||
Log.i("OKSCustomHome", "Button pressed, found stream key $streamKey")
|
||||
|
||||
val queue = Volley.newRequestQueue(it.context)
|
||||
val queue = Volley.newRequestQueue(view.context)
|
||||
val url = "https://buyvm-cf.theoks.net/custom-streams-player/get_title.php?streamkey=$streamKey"
|
||||
val streamInfoJsonRequest = JsonObjectRequest(Request.Method.GET, url, null, Response.Listener<JSONObject> {
|
||||
if(it.getBoolean("stream_is_live")) {
|
||||
|
|
|
@ -8,7 +8,7 @@ buildscript {
|
|||
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.3'
|
||||
classpath 'com.android.tools.build:gradle:3.6.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Sat Feb 08 20:51:27 PST 2020
|
||||
#Thu Feb 27 15:52:05 PST 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue