Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
Working on Android Apps

Jonathan Mercandalli Mercandj

😀
Working on Android Apps
View GitHub Profile
View android_screen_recorder.md

Screen recorder - Android

  • Basic code to record screen on Android.
  • Record your app and other apps
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
    intent ?: return super.onStartCommand(intent, flags, startId)
    val extras = intent.extras
        ?: return super.onStartCommand(intent, flags, startId)
View manager_tech_principles.md

Manager: Principles

Imagine you are a tech manager, as a tech manager here some principles:

Principles

# 5 Principles
1 Promote your CTO principles about code
2 Lead by example
@Mercandj
Mercandj / android_image_folders.sh
Last active Nov 2, 2020
Derivation of images into Android drawable folders
View android_image_folders.sh
#!/bin/sh
# GOAL
# Convert images png or jpg into Android drawable folder and convert into webp
# HOW TO USE IT
# · Setup: "brew install imagemagick" // https://formulae.brew.sh/formula/imagemagick
# · Place your images in the same folder of this script
# · Run the script
View setup_gitlab_ci_on_mac.md

Gitlab runner setup (CI)

  • Install brew
  • Install gitlab runner with brew install gitlab-runner
  • Install gitlab as a start server brew services start gitlab-runner
  • Be sure to have unregister previous runner sudo gitlab-runner unregister --all-runners
  • Configure the runner sudo gitlab-runner register
    • Typer the URL of gitlab (cf in the WebApp, YourProject > Settings > CI/CD)
    • Typer the Token of gitlab (cf in the WebApp, YourProject > Settings > CI/CD)
    • Tag (for example "android")
@Mercandj
Mercandj / setup_mac_os.md
Last active Jan 9, 2021
"Minimal" setup to work on MacOS as an Android Developer
View setup_mac_os.md

Mac OS Setup

Here my "minimal" setup to work on a Mac as an Android Developer

@Mercandj
Mercandj / developer_principles.md
Last active Apr 11, 2021
I'm your CTO! As a developer, here the rules I expect you to follow:
View developer_principles.md

Developer: Principles

Description

Like Robert C. Martin would say on this video,

Imagine I'm your CTO, as your CTO I expect you to follow this principles:

Untitled-collage-10-min-9 (1)

@Mercandj
Mercandj / android_livedata.md
Last active Aug 30, 2020
LiveData: Pros, Cons, Conclusion.
View android_livedata.md

Android: LiveData

Pros, Cons, Conclusion. TLDR; More Cons than Pros.

class Timer {

   private val timeLeftMillis = MutableLiveData(5_000L)
   
   fun getTimeLeftMillis(): LiveData<Long> {
View android_view_layout_id_creation.md

Android view: Layout IDs creation

Issue:

Here a ConstraintLayout in a layout containing 2 views:

<androidx.constraintlayout.widget.ConstraintLayout>

    <View
@Mercandj
Mercandj / android_upload_aab.md
Last active Aug 10, 2020
Android: Upload AppBundle on the PlayStore via CLI
View android_upload_aab.md

Android: Upload AppBundle on PlayStore

Goal:

Upload AppBundle on the PlayStore via the termial. Based on the Google API Publisher v3.

Process:

  • Be sure to have Java installed
  • Be sure to have your AppBundle file .aab
View android_activity_restore.md

Android: Activity restoration

When you user click Home on any of your activity, the system will save the state of the activity stack and the state of your top-activity.

Then, when your user go back to your application, this activity and the activities stack will be restored on a new JVM.

How to test it?

  • Open your app
  • Go to the activity you want to test