List of usage examples for android.util TypedValue TypedValue
TypedValue
From source file:com.geecko.QuickLyric.broadcastReceiver.WearableRequestReceiver.java
@Override public void onLyricsDownloaded(Lyrics lyrics) { if (lyrics.isLRC()) { LrcView lrcView = new LrcView(mContext, null); lrcView.setOriginalLyrics(lyrics); lrcView.setSourceLrc(lyrics.getText()); lyrics.setText(lrcView.getStaticLyrics().getText()); }//ww w. j av a 2 s . co m NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(mContext); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(mContext); Intent activityIntent = new Intent("com.geecko.QuickLyric.getLyrics").putExtra("TAGS", new String[] { lyrics.getArtist(), lyrics.getTitle() }); PendingIntent openAction = PendingIntent.getActivity(mContext, 0, activityIntent, PendingIntent.FLAG_CANCEL_CURRENT); BigTextStyle bigStyle = new BigTextStyle(); bigStyle.bigText(lyrics.getText() != null ? Html.fromHtml(lyrics.getText()) : ""); int[] themes = new int[] { R.style.Theme_QuickLyric, R.style.Theme_QuickLyric_Red, R.style.Theme_QuickLyric_Purple, R.style.Theme_QuickLyric_Indigo, R.style.Theme_QuickLyric_Green, R.style.Theme_QuickLyric_Lime, R.style.Theme_QuickLyric_Brown, R.style.Theme_QuickLyric_Dark }; int themeNum = Integer.valueOf(sharedPref.getString("pref_theme", "0")); int notificationPref = Integer.valueOf(sharedPref.getString("pref_notifications", "0")); TypedValue primaryColorValue = new TypedValue(); mContext.setTheme(themes[themeNum]); mContext.getTheme().resolveAttribute(R.attr.colorPrimary, primaryColorValue, true); notifBuilder.setSmallIcon(R.drawable.ic_notif).setContentTitle(mContext.getString(R.string.app_name)) .setContentText(String.format("%s - %s", lyrics.getArtist(), lyrics.getTitle())).setStyle(bigStyle) .setGroup("Lyrics_Notification").setOngoing(false).setColor(primaryColorValue.data) .setGroupSummary(false).setContentIntent(openAction).setVisibility(-1); // Notification.VISIBILITY_SECRET if (notificationPref == 2) notifBuilder.setPriority(-2); if (lyrics.getFlag() < 0) notifBuilder.extend(new NotificationCompat.WearableExtender().setContentIntentAvailableOffline(false)); Notification notif = notifBuilder.build(); NotificationManagerCompat.from(mContext).notify(8, notif); }
From source file:com.Duo.music.player.BlacklistManagerActivity.BlacklistManagerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { //Initialize Context and SharedPreferences. mContext = this; mActivity = this; mApp = (Common) this.getApplicationContext(); sharedPreferences = mContext.getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE); //Set the UI theme. if (mApp.getCurrentTheme() == Common.DARK_THEME) { setTheme(R.style.AppTheme);/*from w w w . j a v a2s . c o m*/ } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); 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); } } //Retrieve the actionbar. actionBar = getActionBar(); //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(); //Retrieve a list of blacklisted songs. AsyncGetAllSongIdsBlacklistStatusTask task = new AsyncGetAllSongIdsBlacklistStatusTask(); task.execute(); }
From source file:android.support.v7.app.AppCompatDialog.java
private static int getThemeResId(Context context, int themeId) { if (themeId == 0) { // If the provided theme is 0, then retrieve the dialogTheme from our theme TypedValue outValue = new TypedValue(); context.getTheme().resolveAttribute(R.attr.dialogTheme, outValue, true); themeId = outValue.resourceId;// w w w . j ava 2 s. com } return themeId; }
From source file:com.caseybrooks.scripturememory.fragments.HelpFragment.java
@Override public void onResume() { super.onResume(); TypedValue typedValue = new TypedValue(); Resources.Theme theme = context.getTheme(); theme.resolveAttribute(R.attr.color_toolbar, typedValue, true); mCallbacks.setToolBar("Help", typedValue.data); MetaSettings.putDrawerSelection(context, 6, 0); }
From source file:com.aniruddhc.acemusic.player.BlacklistManagerActivity.BlacklistManagerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { //Initialize Context and SharedPreferences. mContext = this; mActivity = this; mApp = (Common) this.getApplicationContext(); sharedPreferences = mContext.getSharedPreferences("com.aniruddhc.acemusic.player", Context.MODE_PRIVATE); //Set the UI theme. if (mApp.getCurrentTheme() == Common.DARK_THEME) { setTheme(R.style.AppTheme);//from w ww. j a v a 2 s . com } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); 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); } } //Retrieve the actionbar. actionBar = getActionBar(); //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(); //Retrieve a list of blacklisted songs. AsyncGetAllSongIdsBlacklistStatusTask task = new AsyncGetAllSongIdsBlacklistStatusTask(); task.execute(); }
From source file:android_network.hetnet.vpn_service.AdapterLog.java
public AdapterLog(Context context, Cursor cursor, boolean resolve, boolean organization) { super(context, cursor, 0); this.resolve = resolve; this.organization = organization; colID = cursor.getColumnIndex("ID"); colTime = cursor.getColumnIndex("time"); colVersion = cursor.getColumnIndex("version"); colProtocol = cursor.getColumnIndex("protocol"); colFlags = cursor.getColumnIndex("flags"); colSAddr = cursor.getColumnIndex("saddr"); colSPort = cursor.getColumnIndex("sport"); colDAddr = cursor.getColumnIndex("daddr"); colDPort = cursor.getColumnIndex("dport"); colDName = cursor.getColumnIndex("dname"); colUid = cursor.getColumnIndex("uid"); colData = cursor.getColumnIndex("data"); colAllowed = cursor.getColumnIndex("allowed"); colConnection = cursor.getColumnIndex("connection"); colInteractive = cursor.getColumnIndex("interactive"); TypedValue tv = new TypedValue(); context.getTheme().resolveAttribute(R.attr.colorOn, tv, true); colorOn = tv.data;//from w w w. j a v a 2 s .co m context.getTheme().resolveAttribute(R.attr.colorOff, tv, true); colorOff = tv.data; iconSize = Util.dips2pixels(24, context); try { List<InetAddress> lstDns = ServiceSinkhole.getDns(context); dns1 = (lstDns.size() > 0 ? lstDns.get(0) : null); dns2 = (lstDns.size() > 1 ? lstDns.get(1) : null); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); vpn4 = InetAddress.getByName(prefs.getString("vpn4", "10.1.10.1")); vpn6 = InetAddress.getByName(prefs.getString("vpn6", "fd00:1:fd00:1:fd00:1:fd00:1")); } catch (UnknownHostException ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } }
From source file:com.invariantlabs.hashavua.main.MainActivity.java
private void setupSwipeRefreshLayout() { swipeRefreshLayout.setOnRefreshListener(this); swipeRefreshLayout.setColorSchemeResources(R.color.primary); TypedValue tv = new TypedValue(); getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true); int actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics()); int delta = Util.dpToPx(this, 64); swipeRefreshLayout.setProgressViewOffset(false, actionBarHeight, actionBarHeight + delta); }
From source file:com.alimuzaffar.ramadanalarm.widget.SlidingTabLayout.java
public SlidingTabLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Disable the Scroll Bar setHorizontalScrollBarEnabled(false); // Make sure that the Tab Strips fills this View setFillViewport(true);// w w w.j ava 2s. com mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density); mTabStrip = new SlidingTabStrip(context); TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(R.attr.colorPrimary, outValue, true); mTabStrip.setBackgroundColor(getContext().getResources().getColor(outValue.resourceId)); addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); }
From source file:com.greatbytes.guestmode.SetupActivity.java
private void updateBottomBar() { int position = mPager.getCurrentItem(); mNextButton.setText(mLastPage ? R.string.done : R.string.next); mNextButton.setBackgroundResource(R.drawable.selectable_item_background); TypedValue v = new TypedValue(); getTheme().resolveAttribute(android.R.attr.textAppearanceMedium, v, true); mNextButton.setTextAppearance(this, v.resourceId); mPrevButton.setVisibility(position <= 0 ? View.INVISIBLE : View.VISIBLE); }