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
/** | |
* Change the current displayed fragment by a new one. | |
* - if the fragment is in backstack, it will pop it | |
* - if the fragment is already displayed (trying to change the fragment with the same), it will not do anything | |
* | |
* @param frag the new fragment to display | |
* @param saveInBackstack if we want the fragment to be in backstack | |
* @param animate if we want a nice animation or not | |
*/ |
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
@Override | |
public boolean onTouch(View v, MotionEvent event) { | |
switch (event.getAction() & MotionEvent.ACTION_MASK) { | |
case MotionEvent.ACTION_DOWN: | |
mStartNativeX = event.getX(); | |
mStartNativeY = event.getY(); | |
mIsNativeClick = true; |
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
/** | |
* Configure fresco using ONLY disk cache | |
*/ | |
public void configFresco() { | |
Supplier<File> diskSupplier = new Supplier<File>() { | |
public File get() { | |
return getApplicationContext().getCacheDir(); | |
} | |
}; |
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
private void changeFragment(Fragment frag, boolean saveInBackstack) { | |
String backStateName = ((Object) frag).getClass().getName(); | |
try { | |
FragmentManager manager = getSupportFragmentManager(); | |
boolean fragmentPopped = manager.popBackStackImmediate(backStateName, 0); | |
if (!fragmentPopped && manager.findFragmentByTag(backStateName) == null) { //fragment not in back stack, create it. | |
FragmentTransaction transaction = manager.beginTransaction(); |
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
private void getLocation(Context context) { | |
Log.d(LOG_TAG, "getLocation"); | |
if (context.getPackageManager().checkPermission( | |
Manifest.permission.ACCESS_FINE_LOCATION, context.getPackageName()) == PackageManager.PERMISSION_GRANTED || | |
context.getPackageManager().checkPermission( | |
Manifest.permission.ACCESS_COARSE_LOCATION, context.getPackageName()) == PackageManager.PERMISSION_GRANTED) { |
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
/** | |
* Blur the given bitmap and convert it to BitmapDrawable | |
* @param context the application context to use getRessources | |
* @param bitmapOriginal the bitmap you want to blur | |
* @param radius the blur radius (amount of blur) | |
* @return blured BitmapDrawable | |
*/ | |
public static Bitmap blur(Context context, Bitmap bitmapOriginal, int radius){ | |
try { |
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
private void clearSurface(SurfaceTexture texture) { | |
EGL10 egl = (EGL10) EGLContext.getEGL(); | |
EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); | |
egl.eglInitialize(display, null); | |
int[] attribList = { | |
EGL10.EGL_RED_SIZE, 8, | |
EGL10.EGL_GREEN_SIZE, 8, | |
EGL10.EGL_BLUE_SIZE, 8, | |
EGL10.EGL_ALPHA_SIZE, 8, |
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
@RunWith(RobolectricGradleTestRunner.class) | |
@Config(emulateSdk = 21, reportSdk = 21, constants = BuildConfig.class) | |
public class ServerClientTest extends GetAdResponseHandler { | |
private Transcript mTranscript; | |
public static final String LOG_TAG = "ServerClientTest"; | |
public static final String SERVER_URL = "/rich/"; | |
public static final String CONNECTION_NO_SETTINGS = "vastConnectionWithoutSettings.json"; |
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.annotation.TargetApi; | |
import android.content.Context; | |
import android.graphics.Color; | |
import android.graphics.SurfaceTexture; | |
import android.os.Build; | |
import android.util.Log; | |
import android.view.LayoutInflater; | |
import android.view.Surface; | |
import android.view.TextureView; |
NewerOlder