Skip to content

arindamxd/kotlin-development

Repository files navigation

Kotlin Everywhere

Kotlin Development Practises (Android)

Open Source Love License


1. App Link ↗

Handling Android App Links (Deep linking)

Secure and specific, Seamless user experience, Android Instant Apps support, Engage users from Google Search

Manifest

<intent-filter android:autoVerify="true" tools:targetApi="m">
      <action android:name="android.intent.action.VIEW" />
  
      <category android:name="android.intent.category.DEFAULT" />
      <category android:name="android.intent.category.BROWSABLE" />
  
      <data
            android:host="arindamxd.github.io"
            android:path="/main"
            android:scheme="https" />
</intent-filter>

Activity/Fragment (Kotlin)

override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      
      // ATTENTION: This was auto-generated to handle app links.
      val appLinkIntent = intent
      val appLinkAction = appLinkIntent.action
      val appLinkData = appLinkIntent.data
}

App Link URL

2. Kotlin Training

#30DaysOfKotlin

3. Dynamic & Pinned Shortcuts ↗

Handling Dynamic & Pinned Shortcuts (Package)

Although you can publish up to five shortcuts (static and dynamic shortcuts combined) at a time for your app, most launchers can only display four. However, there is no limit to the number of pinned shortcuts to your app that users can create. Even though your app cannot remove pinned shortcuts, it can still disable them.

4. Activity Alias Element ↗

Understanding Activity Aliases in Android To Preserve Your Launchers

So, in order to keep the shortcut on the home screen, even after the change in the Launcher Activity name, we use the concept of Activtiy-Alias.

5. Material Dark Theme ↗

Implementing Dark Mode Theme in Android

Some of the most common benefits of a dark theme include conserving battery power for devices with OLED screens, reducing eye strain, and facilitating use in low-light environments. Starting with Android Q, users are now able to switch their device into dark theme via a new system setting, which applies to both the Android system UI and apps running on the device.

An image loading library for Android backed by Kotlin Coroutines.

  • Fast: Coil performs a number of optimizations including memory and disk caching, downsampling the image in memory, re-using Bitmaps, automatically pausing/cancelling requests, and more.
  • Lightweight: Coil adds ~1500 methods to your APK (for apps that already use OkHttp and Coroutines), which is comparable to Picasso and significantly less than Glide and Fresco.
  • Easy to use: Coil's API leverages Kotlin's language features for simplicity and minimal boilerplate.
  • Modern: Coil is Kotlin-first and uses modern libraries including Coroutines, OkHttp, Okio, and AndroidX Lifecycles.

7. The Bubble API (Android Q Preview)

Bubbles are a new preview feature in Android Q, which let users easily multi-task from anywhere on their device.

Note: Bubbles are currently enabled for all users in the Q developer previews. In the final release, Bubbles will be available for developer use only.

  • Bubbles take up screen real estate and cover other app content. You should only send a notification as a bubble if it is important enough such as ongoing communications, or if the user has explicitly requested a bubble for some content.
  • Note that the bubble can be disabled by the user. In that case, a bubble notification is shown as a normal notification. You should always make sure your bubble notification works as a normal notification as well.
  • Processes that are launched from a bubble (such as activities and dialogs) appear within the bubble container. This means a bubble can have a task stack. Things can get complicated if there is a lot of functionality or navigation within your bubble. We recommend keeping the functionality as specific and light-weight as possible.

7. Caching with RxJava Operators

Implement Caching in Android using RxJava Operators

First, we need to understand why caching is useful? Caching is very useful in the following situations:

  • Reduce network calls: We can reduce the network calls by caching the network response.

  • Fetch the data very fast: We can fetch the data very fast if it is cached.

  • Activity:


Find this project useful ? ❤️

Support it by clicking the ⭐ button on the upper right of this page. ✌️

TODO

Add many more features and bug fixes.

Contact - Let's become friends

License

   Copyright (C) 2019 Arindam Karmakar, Android Open Source Project

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

Contributing to Advanced Android Training

All pull requests are welcome, make sure to follow the contribution guidelines when you submit pull request.