Populating a list with a custom format is quite tiring when we do it the usual way in Android.

Note: This is just a quick comparison and discussion on how Jetpack Compose made our lives easier.

For example, we need to create a custom list like this in a usual way.

PS: The actual app is not laggy. I just converted the video to gif and reduce frames and size.

Image for post
Image for post

Step 1: We need to create an XML file for the card design item_character :

Step 2: Add the Recycler View to the main XML file:

Step 3…


Let’s talk about a class first.

In Kotlin, all classes are final and public in nature.

Error in Line 5 because you cannot extend the class Shape because it is final by default.

What you can do is add open before the class keyword to make it inheritable. You can also add the open keyword before the fun in declaring a method to override it in the subclass.

But what if you want a single class that can have both optional and required method to override in a class, you can use Abstract.

What does it mean? For…


Image for post
Image for post

An application can have multiple threads, but the most important thread is the UI Thread / the main thread which is created when an application launched.

To simplify, the main thread will be the one who’s responsible for rendering what you see, the user interface, and the possible interaction between the user and the application (onClick, onKeyDown, etc).

But the main thread has its own limit just like your patience.


An interface is like an abstract class, the difference is that an interface cannot store state.

Interface Declaration

interface Cats{
fun doMeow()
}

How to use Interface

interface Cat {
val sound: Sound
fun doMeow() = sound.meow()
}

class Siamese: Cat{
override val sound: Sound = Sound()
}
class Persian: Cat{
override val sound: Sound = Sound()
}

class Sound{
fun meow(){
print("Meow meow")
}
}

Note:

  • An interface can’t have a constructor and cannot inherit from a class.

Multiple Interfaces in a Class

interface Cat { val sound: Sound var color: String var weight: Double fun doMeow() = sound.meow()…

In Kotlin, classes cannot be inherited, because they are marked as final in default. To make a class inheritable, add the reserved word open before the word class.

open class Keyboard{}

Inheritance Declaration

fun main() {
Mechanical()
}

class Mechanical: Keyboard("Mechanical")

open class Keyboard (type: String){
init {
print("Its a $type Keyboard")
}
}
---------
OUTPUT:
Its a Mechanical Keyboard

Here we declared an inheritable class Keyboard with a primary constructor type then we extend this open class using the : symbol to the Mechanical class header so that it can inherit whatever inside theKeyboard open class.

Overriding Methods and…


Classes can be declared in Kotlin using the word class followed by its name and body inside curly braces.

class Moominvalley{
//class body
}

A class can have one or more Constructors, it can be declared as a Primary or a Secondary Constructor.

Primary Constructor Declaration

The primary constructor is part of the class header.

class Moominvalley(resident: String){//class body}

Secondary Constructor Declaration

class Moominvalley{

constructor(resident: String, kind: String){
print("Resident Name: $resident Kind: $kind")
}
}

Initializer Block

init{} will be always initialized

fun main() {
Moominvalley("Moominmama","Moomin")
}
class Moominvalley(resident: String){ constructor(resident: String, kind: String ): this(resident){ println("Resident Name: $resident Kind…


How to setup Discord to Bitrise to send a custom build message in your server’s channel using webhook.

What is Bitrise?

Bitrise is a Continuous Integration and Delivery (CI/CD) Platform as a Service (PaaS) with a main focus on mobile app development (iOS, Android, React Native, Flutter, and so on). It is a collection of tools and services to help you with the development and automation of your software projects.
https://www.bitrise.io/

Why CI/CD is important?

CICD practicies of continuous integration and continuous delivery helps DevOps teams ship higher quality software, faster, for improved software deployment.
https://about.gitlab.com/blog/2019/06/27/positive-outcomes-ci-cd/

But first, you must set up your project in…


Why CI/CD is important?

Basahin nyo na lang to: https://medium.com/@james.richardson.987123/why-is-ci-cd-important-in-software-development-lifecycle-c75f52cbed83

Note: Kung pagod ka na mag manual build at magsend ng APK sa QA nyong magaling manipat ng mali, ito na ang sagot para sayo.

Rekta na agad!

Prerequisite

  • You already set up the environments/flavors in your android project (buid.gradle :app)
  • You already pushed your android project to your Github/Gitlab/Bitbucket repository and is up to date.
  • (Optional) You already have different branches (develop, test,staging,master/prod)
  • You, of course, already registered on Bitrise haha

What’s in here? (jump if you want)

  1. Adding new app on Bitrise
  2. Workflows
  3. Code Signing
  4. Secrets
  5. Env Vars
  6. Triggers
  7. Build Manually

Adding new app on Bitrise

Step 1. Click ➕ button to add a new app

Image for post
Image for post

Step 2. Choose account & privacy


If you want your utility/helper method to be like one of a property/method of the built-in classes, you can use this hax called extension function.

The typical way of creating a helper:

  • We’ve created a new object DateTimeHelper, added a public method that converts your date and time to duration.
  • Then you’ll have to call this like DateTimeHelper.dateDuration(myStringDate) to get the result.

Another way to do this using an extension function:

  • Line 14 — this is how to create an extension function. What we’re saying in Line 14 is that we want to associate this function with the…


A destructuring declaration creates multiple variables at once.

Here are some examples where you can use destructuring:

Map

  • Line 2 — we’ve declared a hashmap here with 4 entries.
  • Line 7 — this is how we usually iterate throughout the entries of the map
  • Line 11 — but we can destructure our hashmap to separate key and value and use it independently. Here, instead of referencing key and value using i.key i.value in our loop, we’ve taken an instance and distributed the public member values to specific variables. …

MJ Manaog

Mobile Developer | Noob

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store