List of usage examples for android.util TypedValue TypedValue
TypedValue
From source file:com.android.settings.dashboard.DashboardDecorator.java
public DashboardDecorator(Context context) { mContext = context;//from w w w. ja va 2s . co m TypedValue value = new TypedValue(); mContext.getTheme().resolveAttribute(android.R.attr.listDivider, value, true); mDivider = mContext.getDrawable(value.resourceId); }
From source file:com.cnpaypal.ObservableScrollView.BaseActivity.java
protected int getActionBarSize() { TypedValue typedValue = new TypedValue(); int[] textSizeAttr = new int[] { R.attr.actionBarSize }; int indexOfAttrTextSize = 0; TypedArray a = obtainStyledAttributes(typedValue.data, textSizeAttr); int actionBarSize = a.getDimensionPixelSize(indexOfAttrTextSize, -1); a.recycle();/*w w w . j av a2s . co m*/ return actionBarSize; }
From source file:com.gudong.appkit.utils.Utils.java
/** * ?/* w w w . jav a 2 s . c o m*/ * * @param context * @return */ public static int getAccentColor(Context context) { TypedValue typedValue = new TypedValue(); Resources.Theme theme = context.getTheme(); theme.resolveAttribute(R.attr.theme_accent_color, typedValue, true); return typedValue.data; }
From source file:com.druk.bonjour.browser.ui.adapter.TxtRecordsAdapter.java
public TxtRecordsAdapter(Context context, Map<String, String> records) { TypedValue mTypedValue = new TypedValue(); context.getTheme().resolveAttribute(R.attr.selectableItemBackground, mTypedValue, true); mBackground = mTypedValue.resourceId; mRecords.putAll(records);//from www . ja v a 2 s .com }
From source file:com.aaa.activity.main.BaseFragment.java
protected int getActionBarSize() { Activity activity = getActivity();//from w w w . java 2 s .c om if (activity == null) { return 0; } TypedValue typedValue = new TypedValue(); int[] textSizeAttr = new int[] { R.attr.actionBarSize }; int indexOfAttrTextSize = 0; TypedArray a = activity.obtainStyledAttributes(typedValue.data, textSizeAttr); int actionBarSize = a.getDimensionPixelSize(indexOfAttrTextSize, -1); a.recycle(); return actionBarSize; }
From source file:com.dm.material.dashboard.candybar.helpers.ColorHelper.java
public static int getAttributeColor(@NonNull Context context, int attr) { TypedValue typedValue = new TypedValue(); Resources.Theme theme = context.getTheme(); theme.resolveAttribute(attr, typedValue, true); return typedValue.data; }
From source file:com.glacialsoftware.googolplex.GoogolplexPreferenceFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater, container, savedInstanceState); TypedValue typedValue = new TypedValue(); getActivity().getTheme().resolveAttribute(android.R.attr.windowBackground, typedValue, true); if (typedValue.type >= TypedValue.TYPE_FIRST_COLOR_INT && typedValue.type <= TypedValue.TYPE_LAST_COLOR_INT) { int backgroundColor = typedValue.data; view.setBackgroundColor(backgroundColor); } else {//from www. ja v a 2 s . com Drawable drawable = getActivity().getResources().getDrawable(typedValue.resourceId); view.setBackgroundDrawable(drawable); } return view; }
From source file:cm.aptoide.pt.ScreenshotsViewer.java
@Override protected void onCreate(Bundle arg0) { AptoideThemePicker.setAptoideTheme(this); super.onCreate(arg0); setContentView(R.layout.screenshots_viewer); // getSupportActionBar().hide(); context = this; final ViewPager screenshots = (ViewPager) findViewById(R.id.screenShotsPager); final CirclePageIndicator pi = (CirclePageIndicator) findViewById(R.id.indicator); pi.setCentered(true);//from ww w .ja v a 2 s . co m pi.setSnap(true); pi.setRadius(7.5f); TypedValue a = new TypedValue(); getTheme().resolveAttribute(R.attr.custom_color, a, true); pi.setFillColor(a.data); new Thread(new Runnable() { ArrayList<String> uri; public void run() { try { HttpClient client = new DefaultHttpClient(); HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000); uri = getIntent().getStringArrayListExtra("url"); hashCode = getIntent().getStringExtra("hashCode"); images = uri.toArray(images); } catch (Exception e) { e.printStackTrace(); } finally { runOnUiThread(new Runnable() { public void run() { if (images != null && images.length > 0) { screenshots .setAdapter(new ViewPagerAdapterScreenshots(context, uri, hashCode, true)); pi.setViewPager(screenshots); screenshots.setCurrentItem(getIntent().getIntExtra("position", 0)); } } }); } } }).start(); }
From source file:com.gudong.appkit.utils.Utils.java
/** * ??//from w w w . ja v a2 s . c om * * @return */ public static int getThemePrimaryDarkColor(Context context) { TypedValue typedValue = new TypedValue(); Resources.Theme theme = context.getTheme(); theme.resolveAttribute(R.attr.theme_color_dark, typedValue, true); return typedValue.data; }
From source file:com.example.android.support.design.widget.NavigationViewUsage.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.design_navigation); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mTextMessage = (TextView) findViewById(R.id.message); // Set the color of status bar TypedValue value = new TypedValue(); getTheme().resolveAttribute(R.attr.colorPrimaryDark, value, true); mDrawerLayout.setStatusBarBackgroundColor(value.data); // Retrieve the Toolbar from our content view, and set it as the action bar Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*from w w w. j ava 2s.c om*/ // Toggle icon toolbar.setNavigationIcon(R.drawable.ic_action_navigation_menu); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mDrawerLayout.openDrawer(GravityCompat.START); } }); // Menu NavigationView navigation = (NavigationView) findViewById(R.id.navigation); navigation.setNavigationItemSelectedListener(mNavigationItemSelectedListener); navigation.inflateHeaderView(R.layout.design_navigation_header); }