-
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.
Video player integration should now fixed
App uninstall dialog would appear
- Loading branch information
1 parent
ee99844
commit 170b87f
Showing
5 changed files
with
52 additions
and
29 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 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
36 changes: 31 additions & 5 deletions
36
app/src/main/java/id/psw/vshlauncher/VshActivityExtension.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 |
---|---|---|
@@ -1,16 +1,42 @@ | ||
package id.psw.vshlauncher | ||
|
||
import android.graphics.PointF | ||
import android.content.Intent | ||
import android.content.pm.PackageManager | ||
import android.net.Uri | ||
import android.widget.Toast | ||
|
||
/** | ||
* A file that contains extensions for the main VSH Activity | ||
* Due to the main class is too bloated for my PC to load | ||
*/ | ||
val NOPE = 0 | ||
|
||
fun VSH.loadExtension(){ | ||
/** Does nothing */ | ||
val UNINSTALL_REQ_CODE : Int get() = 29734 | ||
|
||
fun VSH.uninstallApp(packageName:String){ | ||
try{ | ||
val intent = Intent(Intent.ACTION_DELETE) | ||
intent.data = Uri.fromParts("package", packageName, null) | ||
intent.putExtra(Intent.EXTRA_RETURN_RESULT, true) | ||
startActivityForResult(intent, UNINSTALL_REQ_CODE) | ||
}catch(e:Exception){ | ||
Toast.makeText(this, "Failed to uninstall app: ${e.message}", Toast.LENGTH_LONG).show() | ||
} | ||
} | ||
|
||
fun VSH.isPointInsideOption(touchPoint: PointF){ | ||
fun VSH.runOnOtherThread(what : () -> Unit) : Thread { | ||
val thr = Thread { | ||
what.invoke() | ||
} | ||
|
||
thr.start() | ||
return thr | ||
} | ||
|
||
} | ||
fun VSH.launchURL(url:String){ | ||
try{ | ||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url))) | ||
}catch(e: PackageManager.NameNotFoundException){ | ||
Toast.makeText(this, "No default browser found in device.", Toast.LENGTH_SHORT).show() | ||
} | ||
} |
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