Skip to content

Instantly share code, notes, and snippets.

View Krishan14sharma's full-sized avatar

krishan sharma Krishan14sharma

View GitHub Profile
public class ParallaxPageTransformer implements ViewPager.PageTransformer {
public void transformPage(View view, float position) {
int pageWidth = view.getWidth();
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
view.setAlpha(1);
public void transformPage(View view, float position) {
int pageWidth = view.getWidth();
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
view.setAlpha(0);
} else if (position <= 1) { // [-1,1]
package com.github.manuelpeinado.toolbartest;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.View;
package com.dnn.zapbuild.sports.view;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ImageView;
import com.dnn.zapbuild.sports.R;
@Krishan14sharma
Krishan14sharma / CustomSwipeToRefresh.java
Created March 13, 2015 09:29
Fixed issue with View pager and listview.
package com.zap.catchthecup.view;
import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
public class CustomSwipeToRefresh extends SwipeRefreshLayout {
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="zapbuild.kr.myexperimentwithview.MainActivity2">
<zapbuild.kr.myexperimentwithview.fancytoolbar.NotifyingScrollView
android:id="@+id/notifyScroll"
android:layout_width="match_parent"
android:layout_height="match_parent">
@Krishan14sharma
Krishan14sharma / MainActivity2.java
Created April 24, 2015 05:28
Expandable Toolbar
package zapbuild.kr.myexperimentwithview;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import butterknife.ButterKnife;
@Krishan14sharma
Krishan14sharma / build.gradle
Created April 29, 2015 11:39
common dependencies
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "mvp.dagger.yify.yify"
minSdkVersion 15
@Krishan14sharma
Krishan14sharma / NotifyingScrollView.java
Created July 3, 2015 05:36
For scrollview listener
package zapbuild.kr.myexperimentwithview.fancytoolbar;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ScrollView;
/**
* Created by Krishan on 23/4/15.
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator"
android:zAdjustment="bottom">
<scale
android:duration="@android:integer/config_mediumAnimTime"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="50%p"
android:pivotY="50%p"