Skip to content

Instantly share code, notes, and snippets.

@aqua30
aqua30 / ScrollParallaxActivity.java
Last active May 9, 2022 05:34
Simplest ScrollView Parallax technique in Android. No library required and just with 4 lines of code, you can easily create parallax effect.
/**
* 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 August 7, 2021 21:49
Show/Hide view on up/down scroll in android - Using ScrollView
/**
* 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 September 20, 2017 08:05
Parallax effect using RecyclerView in the most simple way using scroll listener of recycler view.
/**
* 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;
/**
* 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;
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 September 27, 2017 08:28
Hide the view binding using ButterKnife and Abstraction.
/**
* 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 09:29
Adjusting View Pager which adjusts its height according to the view's height in focus
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 October 31, 2021 08:51
Kotlin version of gradle file
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 October 31, 2021 08:53
Application class
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 October 31, 2021 08:57
Application config
ktor {
deployment {
port = 8080
port = ${?PORT}
}
application {
modules = [ com.aqua30.ApplicationKt.module ]
}
}