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 / root build.gradle
Last active June 28, 2018 13:56
Publishing your Android, Kotlin or Java library to jCenter from Android Studio
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// Add These Bintray and Maven Gradle Classpaths
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
}
@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 / ActivitiesLaunchingWay.kt
Last active April 3, 2023 08:12
Kotlin Extensions for simpler, easier and funw way of launching of Activities
/**
* Kotlin Extensions for simpler, easier and funw way
* of launching of Activities
*/
inline fun <reified T : Any> Activity.launchActivity (
requestCode: Int = -1,
options: Bundle? = null,
noinline init: Intent.() -> Unit = {})
{
@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 / 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>
@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 / 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">
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)
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() {