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.Context; | |
import android.graphics.drawable.Drawable; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
/* | |
* An ImageView that scales its bounds while following the aspect ratio | |
* of its drawable. This is useful for showing images in fill_parent | |
* situations when the drawable itself is smaller than the dimensions of | |
* the view. |
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.Context; | |
import android.support.v4.view.ViewPager; | |
import android.util.AttributeSet; | |
import android.view.View; | |
/* | |
* A simple view pager that supports wrapping of content | |
* by measuring first child and setting that as the viewpager's height. | |
*/ | |
public class WrapContentViewPager extends ViewPager{ |
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.Context; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
/* | |
* An ImageView that adjusts its height according | |
* to a given ratio. This is useful for dynamic layouts where | |
* the ImageView's height must adjust accordingly when its width | |
* changes, say, for instances where its width is fill_parent. | |
* |
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 static void openOrInstallApp(Context context, String packageName) { | |
Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName); | |
if (intent == null) { | |
intent = new Intent(Intent.ACTION_VIEW); | |
intent.setData(Uri.parse("market://details?id=" + packageName)); | |
// intent.setData(Uri.parse("http://play.google.com/store/apps/details?id=" + packageName)); | |
} | |
context.startActivity(intent); |
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 java.util.HashMap; | |
import java.util.Map; | |
import java.util.Set; | |
import android.content.Context; | |
import android.content.SharedPreferences; | |
import android.content.SharedPreferences.Editor; | |
import android.util.Log; | |
import com.stratpoint.starstrak.StarstrakApplication; |
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 Song mSong; | |
private RemoteControlClient remoteControlClient; | |
private AudioManager audioManager; | |
// ... | |
private void broadcastTrackInfoToLockscreen(){ | |
MetadataEditor editor = remoteControlClient.editMetadata(false); | |
editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, mSong.getFullAlbumTitle()); |
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.Context; | |
import android.graphics.Bitmap; | |
import android.util.Log; | |
public class Blur { | |
public static Bitmap fastblur(Context context, Bitmap sentBitmap, int radius) { | |
float scaleFactor = 8; | |
Bitmap bitmap = Bitmap.createScaledBitmap(sentBitmap, (int) (sentBitmap.getWidth() / scaleFactor), (int) (sentBitmap.getHeight() / scaleFactor), 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
package com.myspace.ilike.common.util; | |
import android.app.Activity; | |
import android.graphics.Rect; | |
import android.view.View; | |
import android.view.ViewTreeObserver; | |
import android.widget.FrameLayout; | |
public class AndroidBug5497Workaround { |
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 java.util.Locale; | |
public class FormatUtil { | |
public static final String formatTimeInMillisToHMS(int timeInMillis){ | |
int s = (timeInMillis / 1000) % 60; | |
int m = (timeInMillis / (1000 * 60)) % 60; | |
int h = (timeInMillis) % 24; | |
return String.format(Locale.US, "%d:%02d:%02d", h, m, s); | |
} | |
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.ColorStateList; | |
import android.graphics.Bitmap; | |
import android.graphics.Bitmap.Config; | |
import android.graphics.BitmapShader; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.ColorFilter; | |
import android.graphics.Matrix; | |
import android.graphics.Paint; |
OlderNewer