本文整理匯總了Java中android.content.res.Resources.getIntArray方法的典型用法代碼示例。如果您正苦於以下問題:Java Resources.getIntArray方法的具體用法?Java Resources.getIntArray怎麽用?Java Resources.getIntArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.content.res.Resources
的用法示例。
在下文中一共展示了Resources.getIntArray方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.content.res.Resources; //導入方法依賴的package包/類
@Override
public void onCreate(final Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.prefs_screen_theme);
final PreferenceScreen screen = getPreferenceScreen();
final Context context = getActivity();
final Resources res = getResources();
final String[] keyboardThemeNames = res.getStringArray(R.array.keyboard_theme_names);
final int[] keyboardThemeIds = res.getIntArray(R.array.keyboard_theme_ids);
for (int index = 0; index < keyboardThemeNames.length; index++) {
final KeyboardThemePreference pref = new KeyboardThemePreference(
context, keyboardThemeNames[index], keyboardThemeIds[index]);
screen.addPreference(pref);
pref.setOnRadioButtonClickedListener(this);
}
final KeyboardTheme keyboardTheme = KeyboardTheme.getKeyboardTheme(context);
mSelectedThemeId = keyboardTheme.mThemeId;
}
示例2: CoordinatorLayout
import android.content.res.Resources; //導入方法依賴的package包/類
public CoordinatorLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
// ThemeUtils.checkAppCompatTheme(context);
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CoordinatorLayout,
defStyleAttr, R.style.Widget_Design_CoordinatorLayout);
final int keylineArrayRes = a.getResourceId(R.styleable.CoordinatorLayout_keylines, 0);
if (keylineArrayRes != 0) {
final Resources res = context.getResources();
mKeylines = res.getIntArray(keylineArrayRes);
final float density = res.getDisplayMetrics().density;
final int count = mKeylines.length;
for (int i = 0; i < count; i++) {
mKeylines[i] = (int) (mKeylines[i] * density);
}
}
mStatusBarBackground = a.getDrawable(R.styleable.CoordinatorLayout_statusBarBackground);
a.recycle();
setupForInsets();
super.setOnHierarchyChangeListener(new HierarchyChangeListener());
}
示例3: ImageAnimator
import android.content.res.Resources; //導入方法依賴的package包/類
ImageAnimator(CollapsingToolbarLayout collapsingToolbar, ImageView targetImage, ImageView outgoingImage) {
this.collapsingToolbar = collapsingToolbar;
mTargetImage = targetImage;
mOutgoingImage = outgoingImage;
BindingUtils.loadImg(mTargetImage, mImages[0]);
Resources mResources = App.getAppContext().getResources();
int[] mColorDay = mResources.getIntArray(R.array.day_color_tab);
int[] mColorNight = mResources.getIntArray(R.array.night_color_tab);
mColors = SpUtil.isNight() ? mColorNight : mColorDay;
collapsingToolbar.setContentScrimColor(mColors[0]);
collapsingToolbar.setStatusBarScrimColor(mColors[0]);
}
示例4: getQariList
import android.content.res.Resources; //導入方法依賴的package包/類
/**
* Get a list of QariItem representing the qaris to show
*
* This method takes into account qaris that exist both in gapped and gapless, and, in those
* cases, hides the gapped version if it contains no files.
*
* @param context the current context
* @return a list of QariItem representing the qaris to show.
*/
public static List<QariItem> getQariList(@NonNull Context context) {
final Resources resources = context.getResources();
final String[] shuyookh = resources.getStringArray(R.array.quran_readers_name);
final String[] paths = resources.getStringArray(R.array.quran_readers_path);
final String[] urls = resources.getStringArray(R.array.quran_readers_urls);
final String[] databases = resources.getStringArray(R.array.quran_readers_db_name);
final int[] hasGaplessEquivalent =
resources.getIntArray(R.array.quran_readers_have_gapless_equivalents);
List<QariItem> items = new ArrayList<>(shuyookh.length);
for (int i=0; i < shuyookh.length; i++) {
if (hasGaplessEquivalent[i] == 0 || haveAnyFiles(context, paths[i])) {
items.add(new QariItem(i, shuyookh[i], urls[i], paths[i], databases[i]));
}
}
Collections.sort(items, new Comparator<QariItem>() {
@Override
public int compare(QariItem lhs, QariItem rhs) {
boolean lhsGapless = lhs.isGapless();
boolean rhsGapless = rhs.isGapless();
if (lhsGapless != rhsGapless) {
return lhsGapless ? -1 : 1;
}
return lhs.getName().compareTo(rhs.getName());
}
});
return items;
}
示例5: updateKeyboardThemeSummary
import android.content.res.Resources; //導入方法依賴的package包/類
static void updateKeyboardThemeSummary(final Preference pref) {
final Context context = pref.getContext();
final Resources res = context.getResources();
final KeyboardTheme keyboardTheme = KeyboardTheme.getKeyboardTheme(context);
final String[] keyboardThemeNames = res.getStringArray(R.array.keyboard_theme_names);
final int[] keyboardThemeIds = res.getIntArray(R.array.keyboard_theme_ids);
for (int index = 0; index < keyboardThemeNames.length; index++) {
if (keyboardTheme.mThemeId == keyboardThemeIds[index]) {
pref.setSummary(keyboardThemeNames[index]);
return;
}
}
}
示例6: CoordinatorLayout
import android.content.res.Resources; //導入方法依賴的package包/類
public CoordinatorLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.mLayoutDependencyComparator = new Comparator<View>() {
public int compare(View lhs, View rhs) {
if (lhs == rhs) {
return 0;
}
if (((LayoutParams) lhs.getLayoutParams()).dependsOn(CoordinatorLayout.this, lhs, rhs)) {
return 1;
}
return ((LayoutParams) rhs.getLayoutParams()).dependsOn(CoordinatorLayout.this, rhs, lhs) ? -1 : 0;
}
};
this.mDependencySortedChildren = new ArrayList();
this.mTempList1 = new ArrayList();
this.mTempDependenciesList = new ArrayList();
this.mTempRect1 = new Rect();
this.mTempRect2 = new Rect();
this.mTempRect3 = new Rect();
this.mTempIntPair = new int[2];
this.mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
ThemeUtils.checkAppCompatTheme(context);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CoordinatorLayout, defStyleAttr, R.style.Widget_Design_CoordinatorLayout);
int keylineArrayRes = a.getResourceId(R.styleable.CoordinatorLayout_keylines, 0);
if (keylineArrayRes != 0) {
Resources res = context.getResources();
this.mKeylines = res.getIntArray(keylineArrayRes);
float density = res.getDisplayMetrics().density;
int count = this.mKeylines.length;
for (int i = 0; i < count; i++) {
int[] iArr = this.mKeylines;
iArr[i] = (int) (((float) iArr[i]) * density);
}
}
this.mStatusBarBackground = a.getDrawable(R.styleable.CoordinatorLayout_statusBarBackground);
a.recycle();
if (INSETS_HELPER != null) {
INSETS_HELPER.setupForWindowInsets(this, new ApplyInsetsListener());
}
super.setOnHierarchyChangeListener(new HierarchyChangeListener());
}
示例7: CircularProgressBar
import android.content.res.Resources; //導入方法依賴的package包/類
public CircularProgressBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (isInEditMode()) {
setIndeterminateDrawable(new CircularProgressDrawable.Builder(context, true).build());
return;
}
Resources res = context.getResources();
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircularProgressBar, defStyle, 0);
final int color = a.getColor(R.styleable.CircularProgressBar_cpb_color, res.getColor(R.color.cpb_default_color));
final float strokeWidth = a.getDimension(R.styleable.CircularProgressBar_cpb_stroke_width, res.getDimension(R.dimen.cpb_default_stroke_width));
final float sweepSpeed = a.getFloat(R.styleable.CircularProgressBar_cpb_sweep_speed, Float.parseFloat(res.getString(R.string.cpb_default_sweep_speed)));
final float rotationSpeed = a.getFloat(R.styleable.CircularProgressBar_cpb_rotation_speed, Float.parseFloat(res.getString(R.string.cpb_default_rotation_speed)));
final int colorsId = a.getResourceId(R.styleable.CircularProgressBar_cpb_colors, 0);
final int minSweepAngle = a.getInteger(R.styleable.CircularProgressBar_cpb_min_sweep_angle, res.getInteger(R.integer.cpb_default_min_sweep_angle));
final int maxSweepAngle = a.getInteger(R.styleable.CircularProgressBar_cpb_max_sweep_angle, res.getInteger(R.integer.cpb_default_max_sweep_angle));
a.recycle();
int[] colors = null;
//colors
if (colorsId != 0) {
colors = res.getIntArray(colorsId);
}
Drawable indeterminateDrawable;
CircularProgressDrawable.Builder builder = new CircularProgressDrawable.Builder(context)
.sweepSpeed(sweepSpeed)
.rotationSpeed(rotationSpeed)
.strokeWidth(strokeWidth)
.minSweepAngle(minSweepAngle)
.maxSweepAngle(maxSweepAngle);
if (colors != null && colors.length > 0)
builder.colors(colors);
else
builder.color(color);
indeterminateDrawable = builder.build();
setIndeterminateDrawable(indeterminateDrawable);
}