Search in sources :

Example 96 with TypedValue

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));
    }
}
Also used : TypedValue(android.util.TypedValue)

Example 97 with TypedValue

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));
    }
}
Also used : TypedValue(android.util.TypedValue)

Example 98 with TypedValue

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);
        }
    }
}
Also used : DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions) DBAccessHelper(com.jams.music.player.DBHelpers.DBAccessHelper) SpannableString(android.text.SpannableString) View(android.view.View) Tab(android.app.ActionBar.Tab) FadeInBitmapDisplayer(com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer) BitmapFactory(android.graphics.BitmapFactory) ActionBar(android.app.ActionBar) TypedValue(android.util.TypedValue)

Example 99 with TypedValue

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);
    }
}
Also used : DisplayMetrics(android.util.DisplayMetrics) TypedValue(android.util.TypedValue)

Example 100 with TypedValue

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;
}
Also used : TypedValue(android.util.TypedValue)

Aggregations

TypedValue (android.util.TypedValue)836 TypedArray (android.content.res.TypedArray)185 Resources (android.content.res.Resources)92 ContextThemeWrapper (android.view.ContextThemeWrapper)52 Context (android.content.Context)49 Drawable (android.graphics.drawable.Drawable)49 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)46 TextView (android.widget.TextView)44 Paint (android.graphics.Paint)41 IOException (java.io.IOException)40 AttributeSet (android.util.AttributeSet)34 XmlResourceParser (android.content.res.XmlResourceParser)29 View (android.view.View)27 ResourceValue (com.android.ide.common.rendering.api.ResourceValue)26 Point (android.graphics.Point)25 ColorStateList (android.content.res.ColorStateList)23 DisplayMetrics (android.util.DisplayMetrics)23 LinearLayout (android.widget.LinearLayout)20 SpannableString (android.text.SpannableString)19 Bundle (android.os.Bundle)18