forked from geode-sdk/android-launcher
initial files
This commit is contained in:
63 files changed
+2268
No files matched your search
@@ -0,0 +1,112 @@
|
||||
package com.customRobTop
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.net.ConnectivityManager
|
||||
import android.net.NetworkCapabilities
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
import java.util.*
|
||||
|
||||
|
||||
@Suppress("unused", "UNUSED_PARAMETER")
|
||||
open class BaseRobTopActivity : DefaultRobTopActivity() {
|
||||
companion object {
|
||||
private var isLoaded_ = false
|
||||
lateinit var me: Activity
|
||||
var blockBackButton_ = false
|
||||
private var keyboardActive_ = false
|
||||
|
||||
fun setCurrentActivity(currentActivity: Activity) {
|
||||
me = currentActivity
|
||||
}
|
||||
|
||||
@SuppressLint("HardwareIds")
|
||||
@JvmStatic
|
||||
fun getUserID(): String {
|
||||
// this is how RobTop does it in 2.2, based on the meltdown leaks
|
||||
val androidId = Settings.Secure.getString(me.contentResolver, Settings.Secure.ANDROID_ID)
|
||||
return if ("9774d56d682e549c" != androidId) {
|
||||
UUID.nameUUIDFromBytes(androidId.toByteArray()).toString()
|
||||
} else return UUID.randomUUID().toString()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isNetworkAvailable(): Boolean {
|
||||
val connectivityManager = me.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
|
||||
val activeNetwork = connectivityManager.activeNetwork
|
||||
val networkCapabilities = connectivityManager.getNetworkCapabilities(activeNetwork) ?: return false
|
||||
|
||||
if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setKeyboardState(value: Boolean) {
|
||||
keyboardActive_ = value
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setBlockBackButton(value: Boolean) {
|
||||
blockBackButton_ = value
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun loadingFinished() {
|
||||
isLoaded_ = true
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun gameServicesIsSignedIn(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
// everyplay doesn't even exist anymore lol
|
||||
@JvmStatic
|
||||
fun isEveryplaySupported(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isRecordingSupported(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun stopRecording() { }
|
||||
|
||||
@JvmStatic
|
||||
fun unlockAchievement(id: String) {}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
me = this
|
||||
|
||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
|
||||
|
||||
hideSystemUi()
|
||||
}
|
||||
|
||||
private fun hideSystemUi() {
|
||||
val windowInsetsController =
|
||||
ViewCompat.getWindowInsetsController(window.decorView) ?: return
|
||||
|
||||
windowInsetsController.systemBarsBehavior =
|
||||
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.customRobTop
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
|
||||
open class DefaultRobTopActivity : Activity() {
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.customRobTop
|
||||
|
||||
object JniToCpp {
|
||||
@JvmStatic
|
||||
external fun didCacheInterstitial(str: String?)
|
||||
|
||||
@JvmStatic
|
||||
external fun didClickInterstitial()
|
||||
|
||||
@JvmStatic
|
||||
external fun didCloseInterstitial()
|
||||
|
||||
@JvmStatic
|
||||
external fun didDismissInterstitial()
|
||||
|
||||
@JvmStatic
|
||||
external fun everyplayRecordingStopped()
|
||||
|
||||
@JvmStatic
|
||||
external fun googlePlaySignedIn()
|
||||
|
||||
@JvmStatic
|
||||
external fun hideLoadingCircle()
|
||||
|
||||
@JvmStatic
|
||||
external fun itemPurchased(str: String)
|
||||
|
||||
@JvmStatic
|
||||
external fun itemRefunded(str: String)
|
||||
|
||||
@JvmStatic
|
||||
external fun promoImageDownloaded()
|
||||
|
||||
@JvmStatic
|
||||
external fun resumeSound()
|
||||
|
||||
@JvmStatic
|
||||
external fun rewardedVideoAdFinished(i: Int)
|
||||
|
||||
@JvmStatic
|
||||
external fun rewardedVideoAdHidden()
|
||||
|
||||
@JvmStatic
|
||||
external fun setupHSSAssets(str: String?, str2: String?)
|
||||
|
||||
@JvmStatic
|
||||
external fun showInterstitialFailed()
|
||||
|
||||
@JvmStatic
|
||||
external fun userDidAttemptToRateApp()
|
||||
|
||||
@JvmStatic
|
||||
external fun videoAdHidden()
|
||||
|
||||
@JvmStatic
|
||||
external fun videoAdShowed()
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.robtopx.geometryjump
|
||||
|
||||
object GJConstants {
|
||||
const val PACKAGE_NAME = "com.robtopx.geometryjump"
|
||||
|
||||
const val COCOS_LIB_NAME = "cocos2dcpp"
|
||||
const val FMOD_LIB_NAME = "fmod"
|
||||
const val MOD_CORE_LIB_NAME = "geode"
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.robtopx.geometryjump
|
||||
|
||||
import dalvik.system.BaseDexClassLoader
|
||||
import java.io.File
|
||||
|
||||
object LaunchUtils {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun addDirectoryToClassPath(directory: String, classLoader: ClassLoader) {
|
||||
// uses code from zhuowei/MCPELauncher
|
||||
try {
|
||||
val clazz = classLoader.javaClass
|
||||
val plField = clazz.superclass.getDeclaredField("pathList")
|
||||
plField.isAccessible = true
|
||||
|
||||
val pathListInst = plField.get(classLoader)
|
||||
val pathListClazz = pathListInst.javaClass
|
||||
val nldField = pathListClazz.getDeclaredField("nativeLibraryDirectories")
|
||||
nldField.isAccessible = true
|
||||
|
||||
val pathList = nldField.get(pathListInst)
|
||||
|
||||
println(pathList)
|
||||
|
||||
if (pathList is ArrayList<*>) {
|
||||
// no safe way to check this type afaik, so casting is needed
|
||||
(pathList as ArrayList<File>).add(
|
||||
File(directory)
|
||||
)
|
||||
}
|
||||
|
||||
if (classLoader is BaseDexClassLoader && classLoader.findLibrary(GJConstants.COCOS_LIB_NAME) == null) {
|
||||
val anpMethod = pathListClazz.getDeclaredMethod("addNativePath", Collection::class.java)
|
||||
|
||||
anpMethod.invoke(
|
||||
pathListInst,
|
||||
listOf(directory)
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user