Skip to content

Instantly share code, notes, and snippets.

View wajahatkarim3's full-sized avatar
:octocat:
Subscribe to my newsletter: remotekaro.substack.com

Wajahat Karim wajahatkarim3

:octocat:
Subscribe to my newsletter: remotekaro.substack.com
View GitHub Profile
@wajahatkarim3
wajahatkarim3 / splash_drawable.xml
Created August 13, 2018 12:39
Splash Drawable
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/colorPrimary"/>
<item
android:drawable="@drawable/bg_watermark" />
<item android:bottom="@dimen/_70sdp"
@wajahatkarim3
wajahatkarim3 / bintrayv1.gradle
Created August 16, 2018 13:26
JCenter Uploading Scripts
apply plugin: 'com.jfrog.bintray'
version = libraryVersion
if (project.hasProperty("android")) { // Android libraries
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
@wajahatkarim3
wajahatkarim3 / ConstraintLayoutLiveTemplates.csv
Last active August 29, 2019 14:38
A table for ConstraintLayout live templates
Abbrevation Description
center Centers any view in the parent horizontally and vertically
centerh Centers any view horizontally in the parent
centerv Centers any view vertically in the parent
vertical Centers any view vertically in any other view
horizontal Centers any view horizontally in any other view
fill Fills any view on all edges to parent
over Puts any view over an other view by setting same constrains as the original view. Works like fill but for any other view
above Puts any view above another view
below Puts any view below another view
@wajahatkarim3
wajahatkarim3 / AndroidManifest.xml
Created December 25, 2019 09:32
The AndroidManifest.xml file for your app
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wajahatkarim.splashscreen.demo">
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
@wajahatkarim3
wajahatkarim3 / splash_drawable.xml
Last active December 25, 2019 10:03
The splash screen drawable to be set in the theme
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
<!-- The white background color as one in Amazon, YouTube, or Drive app -->
<item android:drawable="@android:color/white"/>
<!-- App logo -->
<item>
<bitmap
@wajahatkarim3
wajahatkarim3 / styles.xml
Last active December 25, 2019 10:07
The styles.xml theme file to set splash screen as your theme
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Your AppTheme or other themes/styles here -->
<!-- The splash theme. to set the background with your splash screen drawable -->
<style name=”AppTheme.Splash” parent="Theme.AppCompat.DayNight.NoActionBar">
<item name=”android:windowBackground”>@drawable/splash_drawable</item>
</style>
package com.wajahatkarim.splashscreen
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
class SplashThemeActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash_theme)
@wajahatkarim3
wajahatkarim3 / TimerSplashActivity.kt
Created December 25, 2019 12:21
Splash screen with Timer
package com.wajahatkarim.splashscreen
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.coroutines.cancel
import java.util.*
import kotlin.concurrent.schedule
class TimerSplashActivity : AppCompatActivity() {
package com.wajahatkarim.splashscreen
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import androidx.core.os.postDelayed
class CommonSplashActivity : AppCompatActivity() {
@wajahatkarim3
wajahatkarim3 / build.gradle
Created January 5, 2020 21:20
Adding Navigation Components in Android app
def nav_version = "2.1.0"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
// For BottomNavigationView from Material Components
implementation 'com.google.android.material:material:1.0.0'