Skip to content

Instantly share code, notes, and snippets.

View juancoob's full-sized avatar
😄
Learning

Juan Antonio Cobos Obrero juancoob

😄
Learning
View GitHub Profile
@dominicthomas
dominicthomas / Android - Launch another app
Created November 28, 2013 16:16
Launch another app using an intent with package name if app has a launcher activity or using package name and class name of main activity.
// only works if app has a launcher activity
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.example.yourapp");
startActivity(launchIntent);
// works if we know the name of the main activity, even if not a launcher
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("com.example.yourapp", "com.example.yourapp.MainActivity");
startActivity(intent);
@staltz
staltz / introrx.md
Last active July 19, 2024 22:21
The introduction to Reactive Programming you've been missing
@nanusdad
nanusdad / git_new_local_branch.md
Last active June 16, 2024 06:56
Git - create new local branch push to GitHub
@Oleur
Oleur / ComposeCanvasText.kt
Last active May 13, 2024 17:27
Draw text on Jetpack Compose Canvas
val textPaint = Paint().asFrameworkPaint().apply {
isAntiAlias = true
textSize = 24.sp.toPx()
color = android.graphics.Color.BLUE
typeface = Typeface.create(Typeface.MONOSPACE, Typeface.BOLD)
}
Canvas(
modifier = modifier.fillMaxSize(),
onDraw = {
drawIntoCanvas {
@alexzaitsev
alexzaitsev / DefaultLinkMovementMethod.java
Last active January 17, 2024 08:45
How to display HTML using Android Compose
/**
* Set this on a textview and then you can potentially open links locally if applicable
*/
public class DefaultLinkMovementMethod extends LinkMovementMethod {
private OnLinkClickedListener mOnLinkClickedListener;
public DefaultLinkMovementMethod(OnLinkClickedListener onLinkClickedListener) {
mOnLinkClickedListener = onLinkClickedListener;
}
private const val SCROLL_DX = 24f
private const val REQUIRED_CARD_COUNT = 8
private class AutoScrollItem<T>(
val id: String = UUID.randomUUID().toString(),
val data: T
)
@Composable
fun <T : Any> AutoScrollingLazyRow(
@SylpheM
SylpheM / TooltipShape.kt
Last active March 30, 2024 06:15
A tooltip shape (a rounded rectangle with an arrow or a tick), that can be used with a shadow. Preview included
enum class TickOrientation {
TOP, START, END, BOTTOM
}
class TooltipShape(
private val cornerRadiusDp: Dp,
private val tickHeight: Dp,
private val tickOrientation: TickOrientation
) : Shape {