This file contains 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
/* | |
** Created by bapspatil | |
*/ | |
public class ExoPlayerDemoFragment extends Fragment { | |
@BindView(R.id.video_exoplayer_view) SimpleExoPlayerView mPlayerView; | |
private SimpleExoPlayer mPlayer; | |
private Unbinder unbinder; | |
public ExoPlayerDemoFragment() { |
This file contains 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.res.Resources; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.View; | |
import org.hamcrest.Description; | |
import org.hamcrest.Matcher; | |
import org.hamcrest.TypeSafeMatcher; | |
/** | |
* Created by bapspatil | |
*/ |
This file contains 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
/* | |
** Created by bapspatil | |
*/ | |
// Load JSON from URL | |
public static String loadJsonFromUrl(URL url) throws IOException { | |
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); | |
try { | |
InputStream in = urlConnection.getInputStream(); | |
Scanner scanner = new Scanner(in); |
This file contains 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
/* | |
** Created by bapspatil | |
*/ | |
// Checks if the device is in portrait mode or not | |
public boolean isDeviceInPortrait() { | |
// Use Configuration.ORIENTATION_LANDSCAPE if you want to check for landscape orientation | |
if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) |
This file contains 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
/* | |
** Created by bapspatil | |
*/ | |
private void immersiveMode() { | |
getWindow().getDecorView().setSystemUiVisibility( | |
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | |
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | |
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | |
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar |
This file contains 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
/* | |
** Created by bapspatil | |
*/ | |
private static String extractVideoId(String ytUrl) { | |
String vId = null; | |
Pattern pattern = Pattern.compile("(?<=watch\\\\?v=|/videos/|embed\\\\/|youtu.be\\\\/|\\\\/v\\\\/|\\\\/e\\\\/|watch\\\\?v%3D|watch\\\\?feature=player_embedded&v=|%2Fvideos%2F|embed%\\u200C\\u200B2F|youtu.be%2F|%2Fv%2F)[^#\\\\&\\\\?\\\\n]*"); | |
Matcher matcher = pattern.matcher(ytUrl); | |
if (matcher.matches()){ | |
vId = matcher.group(1); |
This file contains 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
/* | |
** Created by bapspatil | |
*/ | |
public abstract class EndlessScrollListener extends RecyclerView.OnScrollListener { | |
// The minimum amount of items to have below your current scroll position | |
// before loading more. | |
private int visibleThreshold = 5; | |
// The current offset index of data you have loaded |
This file contains 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
// Copyright 2012 Square, Inc. | |
package com.squareup.widgets; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
/** Maintains an aspect ratio based on either width or height. Disabled by default. */ | |
public class AspectRatioImageView extends ImageView { |
This file contains 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
package com.mpayme.znap.core.widget; | |
import java.lang.reflect.Field; | |
import android.content.Context; | |
import android.text.SpannableStringBuilder; | |
import android.text.TextUtils; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.widget.TextView; |
This file contains 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
public class AnimatedActivity extends Activity | |
{ | |
@Override | |
protected void onCreate(Bundle savedInstanceState) | |
{ | |
super.onCreate(savedInstanceState); | |
//opening transition animations | |
overridePendingTransition(R.anim.activity_open_translate,R.anim.activity_close_scale); | |
} |
OlderNewer