use of android.util.TypedValue in project JamsMusicPlayer by psaravan.
the class SettingsAppearanceFragment method applyKitKatTranslucency.
/**
* Applies KitKat specific translucency.
*/
private void applyKitKatTranslucency() {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
//Calculate ActionBar and navigation bar height.
TypedValue tv = new TypedValue();
int actionBarHeight = 0;
if (getActivity().getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
}
mListView.setBackgroundColor(0xFFEEEEEE);
mRootView.setPadding(0, actionBarHeight + mApp.getStatusBarHeight(mContext), 0, 0);
mListView.setPadding(10, 0, 10, mApp.getNavigationBarHeight(mContext));
mListView.setClipToPadding(false);
//Set the window color.
getActivity().getWindow().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext));
}
}
use of android.util.TypedValue in project JamsMusicPlayer by psaravan.
the class SettingsLayoutsFragment method applyKitKatTranslucency.
/**
* Applies KitKat specific translucency.
*/
private void applyKitKatTranslucency() {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
//Calculate ActionBar and navigation bar height.
TypedValue tv = new TypedValue();
int actionBarHeight = 0;
if (getActivity().getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
}
mListView.setBackgroundColor(0xFFEEEEEE);
mRootView.setPadding(0, actionBarHeight + mApp.getStatusBarHeight(mContext), 0, 0);
mListView.setPadding(10, 0, 10, mApp.getNavigationBarHeight(mContext));
mListView.setClipToPadding(false);
//Set the window color.
getActivity().getWindow().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext));
}
}
use of android.util.TypedValue in project JamsMusicPlayer by psaravan.
the class MusicLibraryEditorActivity method onCreate.
@SuppressWarnings("unchecked")
@Override
public void onCreate(Bundle savedInstanceState) {
//Initialize Context and SharedPreferences.
mContext = this;
mApp = (Common) mContext.getApplicationContext();
//Retrieve the name/icon of the library from the arguments.
libraryName = getIntent().getExtras().getString("LIBRARY_NAME");
libraryIconName = getIntent().getExtras().getString("LIBRARY_ICON");
if (getIntent().getExtras().getSerializable("SONG_IDS_HASH_SET") != null) {
songDBIdsList = (HashSet<String>) getIntent().getExtras().getSerializable("SONG_IDS_HASH_SET");
}
//Set the UI theme.
if (mApp.getCurrentTheme() == Common.DARK_THEME) {
setTheme(R.style.AppTheme);
} else {
setTheme(R.style.AppThemeLight);
}
super.onCreate(savedInstanceState);
//Initialize the database helper.
dbHelper = new DBAccessHelper(mContext.getApplicationContext());
//Create a set of options to optimize the bitmap memory usage.
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
options.inJustDecodeBounds = false;
options.inPurgeable = true;
//Display Image Options.
int defaultArt = UIElementsHelper.getIcon(mContext, "default_album_art_padded");
displayImageOptions = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.default_album_art).showImageOnFail(R.drawable.default_album_art).showStubImage(R.drawable.transparent_drawable).cacheInMemory(false).cacheOnDisc(true).decodingOptions(options).imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565).displayer(new FadeInBitmapDisplayer(400)).delayBeforeLoading(100).build();
//Attach tabs to the ActionBar.
ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
//Add the artists tab.
String artistsLabel = getResources().getString(R.string.artists);
Tab tab = actionBar.newTab();
tab.setText(artistsLabel);
TabListener<ArtistsPickerFragment> artistsTabListener = new TabListener<ArtistsPickerFragment>(this, artistsLabel, ArtistsPickerFragment.class);
tab.setTabListener(artistsTabListener);
actionBar.addTab(tab);
//Add the albums tab.
String albumsLabel = getResources().getString(R.string.albums);
tab = actionBar.newTab();
tab.setText(albumsLabel);
TabListener<AlbumsPickerFragment> albumsTabListener = new TabListener<AlbumsPickerFragment>(this, albumsLabel, AlbumsPickerFragment.class);
tab.setTabListener(albumsTabListener);
actionBar.addTab(tab);
//Add the songs tab.
String songsLabel = getResources().getString(R.string.songs);
tab = actionBar.newTab();
tab.setText(songsLabel);
TabListener<SongsPickerFragment> songsTabListener = new TabListener<SongsPickerFragment>(this, songsLabel, SongsPickerFragment.class);
tab.setTabListener(songsTabListener);
actionBar.addTab(tab);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext));
int topPadding = Common.getStatusBarHeight(mContext);
View activityView = (View) findViewById(android.R.id.content);
//Calculate ActionBar height
TypedValue tv = new TypedValue();
int actionBarHeight = 0;
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
}
if (activityView != null) {
activityView.setPadding(0, topPadding + actionBarHeight, 0, 0);
}
}
}
use of android.util.TypedValue in project httpclient by pixmob.
the class FakeDialogPhoneWindow method onMeasure.
/* Stolen from PhoneWindow */
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
final boolean isPortrait = metrics.widthPixels < metrics.heightPixels;
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = getMeasuredWidth();
boolean measure = false;
widthMeasureSpec = MeasureSpec.makeMeasureSpec(width, EXACTLY);
final TypedValue tv = isPortrait ? mMinWidthMinor : mMinWidthMajor;
if (tv.type != TypedValue.TYPE_NULL) {
final int min;
if (tv.type == TypedValue.TYPE_DIMENSION) {
min = (int) tv.getDimension(metrics);
} else if (tv.type == TypedValue.TYPE_FRACTION) {
min = (int) tv.getFraction(metrics.widthPixels, metrics.widthPixels);
} else {
min = 0;
}
if (width < min) {
widthMeasureSpec = MeasureSpec.makeMeasureSpec(min, EXACTLY);
measure = true;
}
}
if (measure) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
use of android.util.TypedValue in project chromeview by pwnall.
the class AndroidProtocolHandler method getValueType.
private static int getValueType(Context context, int field_id) {
TypedValue value = new TypedValue();
context.getResources().getValue(field_id, value, true);
return value.type;
}
Aggregations