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
private void flipCard() { | |
if (mShowingBack) { | |
getFragmentManager().popBackStack(); | |
return; | |
} | |
// Flip to the back. | |
mShowingBack = true; |
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
/** | |
* Sets full screen mode on the device, by setting parameters in the current | |
* window and View | |
* @param fullscreen | |
*/ | |
public void setFullScreen(boolean fullscreen) { | |
// If full screen is set, sets the fullscreen flag in the Window manager | |
getWindow().setFlags( | |
fullscreen ? WindowManager.LayoutParams.FLAG_FULLSCREEN : 0, | |
WindowManager.LayoutParams.FLAG_FULLSCREEN); |
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
/* | |
* A user-agent string that's sent to the HTTP site. It includes information about the device | |
* and the build that the device is running. | |
*/ | |
public static final String USER_AGENT = "Mozilla/5.0 (Linux; U; Android " | |
+ android.os.Build.VERSION.RELEASE + ";" | |
+ Locale.getDefault().toString() + "; " + android.os.Build.DEVICE | |
+ "/" + android.os.Build.ID + ")"; |
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 (C) ${year} The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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 (C) 2012 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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 (C) 2012 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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 ScreenUtils { | |
public static float dpToPx(Context context, float dp) { | |
if (context == null) { | |
return -1; | |
} | |
return dp * context.getResources().getDisplayMetrics().density; | |
} | |
public static float pxToDp(Context context, float px) { |
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.graphics.Bitmap; | |
/** | |
* Created by paveld on 3/6/14. | |
*/ | |
public class FastBlur { | |
public static Bitmap doBlur(Bitmap sentBitmap, int radius, boolean canReuseInBitmap) { | |
// Stack Blur v1.0 from |
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 DatabaseManager { | |
private AtomicInteger mOpenCounter = new AtomicInteger(); | |
private static DatabaseManager instance; | |
private static SQLiteOpenHelper mDatabaseHelper; | |
private SQLiteDatabase mDatabase; | |
public static synchronized void initializeInstance(SQLiteOpenHelper helper) { | |
if (instance == null) { |
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
private void calculateVideoSize() { | |
try { | |
AssetFileDescriptor afd = getAssets().openFd(FILE_NAME); | |
MediaMetadataRetriever metaRetriever = new MediaMetadataRetriever(); | |
metaRetriever.setDataSource( | |
afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); | |
String height = metaRetriever | |
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT); | |
String width = metaRetriever | |
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH); |