This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******This Gist explains how to create instagram like Gradient color transition in android.******/ | |
1. Create some gradient color drawables inside drawable Folder. | |
a) color1.xml | |
<?xml version="1.0" encoding="utf-8"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
<gradient | |
android:startColor="#c44e4e" | |
android:endColor="#dcb9b9" | |
android:angle="0"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.support.v4.view.ViewPager; | |
import android.util.AttributeSet; | |
import android.view.MotionEvent; | |
import android.view.View; | |
public class VerticalViewPager extends ViewPager { | |
public VerticalViewPager(Context context) { | |
super(context); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Add library to gradle. | |
compile 'com.android.support:palette-v7:23.0.1' | |
2. Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() { | |
public void onGenerated(Palette p) { | |
// Use generated instance | |
p.getDarkMutedColor(ContextCompat.getColor(getActivity(), R.color.textColorWhite)); | |
p.getDarkVibrantColor(ContextCompat.getColor(getActivity(), R.color.textColorWhite)); | |
p.getLightMutedColor(ContextCompat.getColor(getActivity(), R.color.textColorWhite)); | |
p.getLightVibrantColor(ContextCompat.getColor(getActivity(), R.color.textColorWhite)); | |
p.getMutedColor(ContextCompat.getColor(getActivity(), R.color.textColorWhite)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add fonts inside the *assets/fonts* folder | |
// create a class named customTextView.java | |
public class customTextView extends TextView { | |
private static final String SCHEMA = "http://schemas.android.com/apk/res/android"; | |
public customTextView(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
getStyle(attrs, context); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yourListView.setRecyclerListener(new RecyclerListener() { | |
@Override | |
public void onMovedToScrapHeap(View view) { | |
// get the holder of the list item from where you can update ui, stop media player etc. | |
Holder holder = (Holder)view.getTag(); | |
if(holder.mp!=null && holder.mp.isPlaying()){ | |
holder.mp.pause(); | |
holder.imageViewPlay.setBackgroundResource(R.drawable.icon_play); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.widget.AbsListView; | |
import android.widget.AbsListView.OnScrollListener; | |
import android.widget.ArrayAdapter; | |
import android.widget.ListView; | |
public class MainActivity extends AppCompatActivity { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Download the tesseract library from the following link named libs.zip. | |
https://www.dropbox.com/s/9fwqz88sck3xlk4/libs.zip?dl=0 | |
2. Extract the zip folder. | |
* If you are using Eclipse then copy all the files and folders from libs folder to libs folder in your project. | |
* if you are using Android Studio then Copy all th e folders from libs folder to src/main/jniLibs folder in your project and copy the classes.jar to libs folder. | |
3. Add image containing text inside your downloads folder and give the name a.png. | |
4. create folder named tessdata inside the assets folder in your project. |