Skip to content

Instantly share code, notes, and snippets.

Avatar
🇮🇳

Saurabh Pant aqua30

🇮🇳
View GitHub Profile
@aqua30
aqua30 / ScrollParallaxActivity.java
Last active May 9, 2022
Simplest ScrollView Parallax technique in Android. No library required and just with 4 lines of code, you can easily create parallax effect.
View ScrollParallaxActivity.java
/**
* Created by Saurabh(aqua) in 2017.
*/
public class ParallaxActivity extends BaseActivity {
/* view binding */
@BindView(R.id.scrollView)ScrollView scrollView;
@BindView(R.id.parallax_image)ImageView parallaxImage;
@BindView(R.id.tv_perhour)TextView textView;
@aqua30
aqua30 / HideShowScrollParallaxActivity.java
Last active Aug 7, 2021
Show/Hide view on up/down scroll in android - Using ScrollView
View HideShowScrollParallaxActivity.java
/**
* Created by Saurabh(aqua) in 2017.
*/
public class ScrollActivity extends BaseActivity {
/* view binding */
@BindView(R.id.scrollView)ScrollView scrollView;
@BindView(R.id.parallax_image)ImageView parallaxImage;
@BindView(R.id.tv_perhour)TextView textView;
@aqua30
aqua30 / RecyclerParallaxActivity.java
Created Sep 20, 2017
Parallax effect using RecyclerView in the most simple way using scroll listener of recycler view.
View RecyclerParallaxActivity.java
/**
* Created by Saurabh(aqua) in 2017.
*/
public class RecyclerParallaxActivity extends BaseActivity {
/* view binding */
@BindView(R.id.recycler_view)RecyclerView recyclerView;
@BindView(R.id.parallax_image)ImageView parallaxImage;
View HideShowRecyclerParallaxActivity.java
/**
* Created by Saurabh(aqua) in 2017.
*/
public class HideShowRecyclerParallaxActivity extends BaseActivity {
/* view binding */
@BindView(R.id.recycler_view)RecyclerView recyclerView;
@BindView(R.id.parallax_image)ImageView parallaxImage;
@BindView(R.id.tv_heading)AppTextView heading;
View ConnectionLiveData.java
package test;
import android.arch.lifecycle.LiveData;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@aqua30
aqua30 / BaseActivity.java
Last active Sep 27, 2017
Hide the view binding using ButterKnife and Abstraction.
View BaseActivity.java
/**
* Created by Saurabh(aqua) on 21-03-2017.
*/
public abstract class BaseActivity extends AppCompatActivity implements LifecycleRegistryOwner {
private LifecycleRegistry lifecycleRegistry = new LifecycleRegistry(this);
private Unbinder unbinder;
@Override
@aqua30
aqua30 / AdjustingViewPager.kt
Created May 1, 2021
Adjusting View Pager which adjusts its height according to the view's height in focus
View AdjustingViewPager.kt
package com.aqua30.learningproject
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.View
import android.view.View.MeasureSpec
import androidx.viewpager.widget.ViewPager
class AdjustingViewPager: ViewPager {
@aqua30
aqua30 / build.gradle.kts
Last active Oct 31, 2021
Kotlin version of gradle file
View build.gradle.kts
val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project
plugins {
application
kotlin("jvm") version "1.5.31"
id("org.jetbrains.kotlin.plugin.serialization") version "1.5.31"
}
@aqua30
aqua30 / Application.kt
Created Oct 31, 2021
Application class
View Application.kt
fun main(args: Array<String>): Unit =
io.ktor.server.netty.EngineMain.main(args)
@Suppress("unused") // application.conf references the main function. This annotation prevents the IDE from marking it as unused.
fun Application.module() {
configureSerialization()
configureMonitoring()
registerDogsRoute()
}
@aqua30
aqua30 / application.conf
Created Oct 31, 2021
Application config
View application.conf
ktor {
deployment {
port = 8080
port = ${?PORT}
}
application {
modules = [ com.aqua30.ApplicationKt.module ]
}
}