forked from mpv-android/mpv-android
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
66 changed files
with
1,109 additions
and
576 deletions.
There are no files selected for viewing
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 was deleted.
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,9 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<application> | ||
<activity | ||
android:name=".IntentTestActivity" | ||
android:exported="false" | ||
android:configChanges="orientation|screenSize" | ||
android:theme="@style/FilePickerTheme" /> | ||
</application> | ||
</manifest> |
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,71 @@ | ||
package `is`.xyz.mpv | ||
|
||
import android.content.Intent | ||
import android.net.Uri | ||
import android.os.Bundle | ||
import android.util.Base64 | ||
import androidx.activity.result.ActivityResult | ||
import androidx.activity.result.contract.ActivityResultContracts | ||
import androidx.appcompat.app.AppCompatActivity | ||
import `is`.xyz.mpv.databinding.ActivityIntentTestBinding | ||
|
||
class IntentTestActivity : AppCompatActivity() { | ||
private lateinit var binding: ActivityIntentTestBinding | ||
|
||
private val callback = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { | ||
updateText("resultCode: ${ActivityResult.resultCodeToString(it.resultCode)}\n") | ||
val intent = it.data | ||
if (intent != null) { | ||
updateText("action: ${intent.action}\ndata: ${intent.data?.toString()}\n") | ||
val extras = intent.extras | ||
if (extras != null) { | ||
for (key in extras.keySet()) { | ||
val v = extras.get(key) | ||
updateText("extras[$key] = $v\n") | ||
} | ||
} | ||
} | ||
} | ||
|
||
private var text = "" | ||
|
||
private fun updateText(append: String) { | ||
text += append | ||
runOnUiThread { | ||
binding.info.text = this.text | ||
} | ||
} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityIntentTestBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
binding.button.setOnClickListener { | ||
val uri = Uri.parse(binding.editText1.text.toString()) | ||
if (uri.scheme.isNullOrEmpty()) | ||
return@setOnClickListener | ||
|
||
val intent = Intent(Intent.ACTION_VIEW) | ||
intent.setDataAndType(uri, "video/any") | ||
intent.setPackage(packageName) | ||
if (binding.switch1.isChecked) { | ||
val subMime = "application/x-subrip" | ||
val subData = "1\n00:00:00,000 --> 00:00:10,000\nHello World\n\n" | ||
val subUri = Uri.parse("data:${subMime};base64," + Base64.encodeToString(subData.toByteArray(), Base64.NO_WRAP)) | ||
intent.putExtra("subs", arrayOf(subUri)) | ||
intent.putExtra("subs.enable", arrayOf(subUri)) | ||
} | ||
if (binding.switch2.isChecked) | ||
intent.putExtra("decode_mode", 2.toByte()) | ||
if (binding.switch3.isChecked) | ||
intent.putExtra("title", "example text") | ||
if (binding.seekBar2.progress > 0) | ||
intent.putExtra("position", binding.seekBar2.progress * 1000) | ||
callback.launch(intent) | ||
|
||
text = "" | ||
updateText("launched!\n") | ||
} | ||
} | ||
} |
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,90 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
tools:ignore="HardcodedText" | ||
android:id="@+id/main" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:padding="24dp"> | ||
|
||
<androidx.appcompat.widget.SwitchCompat | ||
android:id="@+id/switch1" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/row1" | ||
android:text="subs data uri" /> | ||
|
||
<androidx.appcompat.widget.SwitchCompat | ||
android:id="@+id/switch2" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/switch1" | ||
android:text="no hwdec" /> | ||
|
||
<androidx.appcompat.widget.SwitchCompat | ||
android:id="@+id/switch3" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/switch2" | ||
android:text="force title" /> | ||
|
||
<Button | ||
android:id="@+id/button" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/row2" | ||
android:text="Launch" /> | ||
|
||
<TextView | ||
android:id="@+id/info" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/button" | ||
android:fontFamily="monospace" | ||
android:scrollbars="vertical" | ||
android:scrollHorizontally="true" /> | ||
|
||
<LinearLayout | ||
android:id="@+id/row2" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/switch3" | ||
android:orientation="horizontal"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:labelFor="@id/editText1" | ||
android:text="offset:" /> | ||
|
||
<SeekBar | ||
android:id="@+id/seekBar2" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:max="30" | ||
android:progress="0" /> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout | ||
android:id="@+id/row1" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="horizontal"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:labelFor="@id/editText1" | ||
android:text="URL:" /> | ||
|
||
<EditText | ||
android:id="@+id/editText1" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:autofillHints="" | ||
android:inputType="textUri" /> | ||
|
||
</LinearLayout> | ||
|
||
</RelativeLayout> |
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 @@ | ||
<resources></resources> |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:versionCode="33" | ||
android:versionName="1.15.n" > | ||
android:versionCode="40" | ||
android:versionName="1.16.n" > | ||
<application/> | ||
</manifest> |
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
Binary file not shown.
Oops, something went wrong.