Goal, increase stylus performances on Android: mobile, tablet, Chromebooks...
Requirements: OpenGL architecture must let you draw "incrementally" (delta) or "fully"
import UIKit | |
import SwiftUI // <-- Add SwiftUI import | |
class HelloWorldView: UIView { | |
// UIView code here | |
struct HelloWorldView_Preview: PreviewProvider { // <-- Add the preview definition | |
static var previews: some View { | |
Preview() |
import UIKit | |
class HelloWorldView: UIView { | |
private lazy var title = createTitle() | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
addSubview(title) | |
} |
class MainActivity : AppCompatActivity() { | |
private val listener = Manager.Listener { | |
Log.d("memory_leak", "Use largeObject to avoid compiler opti $largeObject") | |
} | |
private var largeObject = (0..4_000).map { | |
Bitmap.createBitmap(1000, 1000, Bitmap.Config.ARGB_8888) | |
} | |
override fun onCreate(savedInstanceState: Bundle?) { |
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath(kotlin("gradle-plugin", version = "1.6.21")) | |
} | |
} | |
allprojects { |
package com.medium | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.fillMaxHeight | |
import androidx.compose.foundation.layout.fillMaxWidth | |
import androidx.compose.material.Text | |
import androidx.compose.ui.Alignment | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.unit.dp | |
import androidx.compose.ui.unit.sp |
Java and the JVM may leak objects.
Leaking an object on Java (or Kotlin) is done when a reference direct or indirect (via transitivity) is kept so that the Garbage Collector cannot release the memory.
What | Meaning in this snippet |
---|---|
live |
Means, cannot be garbage collected |
died |
Means, is garbage collected |
Hi 👋, I'm Jonathan, Android Lead at MWM. "You should write tests"
, that something we can hear on the mobile / tech industry. But the question is Why?. Let's find out if writing tests is something you should invest on.
"Be sure you test the tests written" 🙃. Romain Guy and Chet Haase.
Please, first, checkout Developer: Principles. These Android developer principles are the "implementation details" of developer principles on the Android world.
The following advices are very opinionated. Before saying "bullshit", please read the why below in the Details section. One of the main ability of developer is to understand the why. (This advice apply to myself of course. Every tool I'm criticising exist because of a why that I consider less important than the alternative. But for sure, you can disagree).
The goal of this document is more to start a reflection than make you think twice of your code.