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
/** | |
* Usage : gsonBuilder.registerTypeAdapterFactory(JsonPreProcessingAdapterFactory()) | |
**/ | |
class JsonPreProcessingAdapterFactory : TypeAdapterFactory { | |
override fun <T> create(gson: Gson, type: TypeToken<T>): TypeAdapter<T>? { | |
if (!Object::class.java.isAssignableFrom(type.rawType) || | |
Iterable::class.java.isAssignableFrom(type.rawType) |
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
Just remove the 'shorts' from the URL and replace it with: 'watch?v=' | |
E.g.: youtube.com/shorts/XXXXXXX into: youtube.com/watch?v=XXXXX | |
https://www.reddit.com/r/youtube/comments/um9p9u/comment/j7j7im2/ |
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
<receiver | |
android:name=".MySecretReceiver" | |
android:enabled="true" | |
android:exported="true"> | |
<intent-filter> | |
<action android:name="android.provider.Telephony.SECRET_CODE" /> | |
<data android:scheme="android_secret_code" android:host="123123"/> | |
</intent-filter> | |
</receiver> | |
http://simonmarquis.github.io/Android-SecretCodes/ |
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
findViewById<TextView>(R.id.running_text).isSelected=true |
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
#!/usr/bin/perl | |
use POSIX qw(strftime); | |
use IO::Socket::INET; | |
### binmode(STDIN); | |
$serverip = $ARGV[0]; | |
if(not defined $serverip){ | |
$serverip = '192.168.46.114'; |
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
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).format(Date()) |
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
view.getViewTreeObserver().addOnGlobalLayoutListener( | |
new ViewTreeObserver.OnGlobalLayoutListener() { | |
@Override | |
public void onGlobalLayout() { | |
// Layout has happened here. | |
// Don't forget to remove your listener when you are done with it. | |
view.getViewTreeObserver().removeOnGlobalLayoutListener(this); | |
} | |
}); |
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
class CustDialogFragment(contentLayoutId: Int) : DialogFragment(contentLayoutId) { | |
lateinit var tv: TextView | |
lateinit var pb: ProgressBar | |
/** | |
* Override to build your own custom Dialog container. This is typically | |
* used to show an AlertDialog instead of a generic Dialog; when doing so, | |
* [.onCreateView] does not need | |
* to be implemented since the AlertDialog takes care of its own content. |
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
private fun isMyServiceRunning(serv: String): Boolean { | |
val manager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager | |
return manager.getRunningServices(Integer.MAX_VALUE) | |
.any { | |
Log.e(TAG, "isMyServiceRunning: ${it.service.shortClassName}") | |
it.service.shortClassName == serv | |
} | |
} |
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
-- val navController = findNavController(R.id.nav_host_fragment_activity_main) | |
++ val navController = (supportFragmentManager.findFragmentById(R.id.nav_host_fragment_activity_main) as NavHostFragment).navController |
NewerOlder