Skip to content

Commit

Permalink
adapt DiSender for YouTube Music urls
Browse files Browse the repository at this point in the history
  • Loading branch information
kylichist committed Dec 27, 2020
1 parent 3ec7f04 commit f1251a7
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 35 deletions.
6 changes: 6 additions & 0 deletions .idea/compiler.xml

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

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.

2 changes: 1 addition & 1 deletion .idea/misc.xml

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

11 changes: 4 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
compileSdkVersion 30
buildToolsVersion "29.0.3"

defaultConfig {
applicationId "com.github.kylichist.disender"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
targetSdkVersion 30
versionCode 2
versionName "1.1"
}

buildTypes {
Expand All @@ -23,7 +22,5 @@ android {
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
}
Binary file modified app/release/app-release.apk
Binary file not shown.
10 changes: 4 additions & 6 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
{
"version": 1,
"version": 2,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.github.kylichist.disender",
"variantName": "release",
"variantName": "processReleaseResources",
"elements": [
{
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 1,
"versionName": "1.0",
"enabled": true,
"versionCode": 2,
"versionName": "1.1",
"outputFile": "app-release.apk"
}
]
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
android:theme="@style/NoUiAppTheme">
<intent-filter
android:icon="@drawable/p_min"
android:label="Send with prefix '-'"
android:label="-play"
android:priority="100000000">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
Expand All @@ -28,7 +28,7 @@
android:theme="@style/NoUiAppTheme">
<intent-filter
android:icon="@drawable/p_eq"
android:label="Send with prefix '='"
android:label="=play"
android:priority="99999999">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
Expand All @@ -40,7 +40,7 @@
android:theme="@style/NoUiAppTheme">
<intent-filter
android:icon="@drawable/p_exc"
android:label="Send with prefix '!'"
android:label="!play"
android:priority="99999998">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/com/github/kylichist/disender/EqActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

class EqActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) = super.onCreate(savedInstanceState)
.send("=", this)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
sendString("=")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

class ExcActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) = super.onCreate(savedInstanceState)
.send("!", this)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
sendString("!")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

class MinActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) = super.onCreate(savedInstanceState)
.send("-", this)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
sendString("-")
}
}
14 changes: 6 additions & 8 deletions app/src/main/java/com/github/kylichist/disender/operator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package com.github.kylichist.disender
import android.app.Activity
import android.content.Intent

@Suppress("unused")
fun Unit.send(prefix: String, activity: Activity) =
fun Activity.sendString(prefix: String) {
Intent().apply {
setClassName(
"com.discord",
Expand All @@ -13,10 +12,9 @@ fun Unit.send(prefix: String, activity: Activity) =
action = Intent.ACTION_SEND
putExtra(
Intent.EXTRA_TEXT,
"${prefix}play ${activity.intent.extras?.getString("android.intent.extra.TEXT")}"
"${prefix}play ${intent.extras?.getString("android.intent.extra.TEXT")?.substringAfterLast(" ")}"
)
with(activity) {
startActivity(this@apply)
finish()
}
}.run { }
startActivity(this@apply)
finish()
}
}
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
buildscript {
ext.kotlin_version = "1.4.0"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21"
}
}

Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Sun Dec 27 15:53:30 MSK 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

1 comment on commit f1251a7

@alperen1884r637
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use
rtyejhe
music
youtube ,

Please sign in to comment.