use of android.content.res.Resources in project android-betterpickers by code-troopers.
the class TimeZonePickerUtils method cacheOverrides.
private void cacheOverrides(Context context) {
Resources res = context.getResources();
mOverrideIds = res.getStringArray(R.array.timezone_rename_ids);
mOverrideLabels = res.getStringArray(R.array.timezone_rename_labels);
}
use of android.content.res.Resources in project android-betterpickers by code-troopers.
the class TimePicker method onFinishInflate.
@Override
protected void onFinishInflate() {
super.onFinishInflate();
View v1 = findViewById(R.id.first);
View v2 = findViewById(R.id.second);
View v3 = findViewById(R.id.third);
View v4 = findViewById(R.id.fourth);
mEnteredTime = (TimerView) findViewById(R.id.timer_time_text);
mDelete = (ImageButton) findViewById(R.id.delete);
mDelete.setOnClickListener(this);
mDelete.setOnLongClickListener(this);
mNumbers[1] = (Button) v1.findViewById(R.id.key_left);
mNumbers[2] = (Button) v1.findViewById(R.id.key_middle);
mNumbers[3] = (Button) v1.findViewById(R.id.key_right);
mNumbers[4] = (Button) v2.findViewById(R.id.key_left);
mNumbers[5] = (Button) v2.findViewById(R.id.key_middle);
mNumbers[6] = (Button) v2.findViewById(R.id.key_right);
mNumbers[7] = (Button) v3.findViewById(R.id.key_left);
mNumbers[8] = (Button) v3.findViewById(R.id.key_middle);
mNumbers[9] = (Button) v3.findViewById(R.id.key_right);
mLeft = (Button) v4.findViewById(R.id.key_left);
mNumbers[0] = (Button) v4.findViewById(R.id.key_middle);
mRight = (Button) v4.findViewById(R.id.key_right);
setLeftRightEnabled(false);
for (int i = 0; i < 10; i++) {
mNumbers[i].setOnClickListener(this);
mNumbers[i].setText(String.format("%d", i));
mNumbers[i].setTag(R.id.numbers_key, new Integer(i));
}
updateTime();
Resources res = mContext.getResources();
mAmpm = new DateFormatSymbols().getAmPmStrings();
if (mIs24HoursMode) {
mLeft.setText(res.getString(R.string.time_picker_00_label));
mRight.setText(res.getString(R.string.time_picker_30_label));
} else {
mLeft.setText(mAmpm[0]);
mRight.setText(mAmpm[1]);
}
mLeft.setOnClickListener(this);
mRight.setOnClickListener(this);
mAmPmLabel = (TextView) findViewById(R.id.ampm_label);
mAmPmState = AMPM_NOT_SELECTED;
mDivider = findViewById(R.id.divider);
restyleViews();
updateKeypad();
}
use of android.content.res.Resources in project cw-omnibus by commonsguy.
the class VideoPresenter method onBindViewHolder.
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
Video video = (Video) item;
Holder h = (Holder) viewHolder;
Resources res = ctxt.getResources();
h.cardView.setTitleText(video.toString());
h.cardView.setMainImageDimensions((int) res.getDimension(R.dimen.card_width), (int) res.getDimension(R.dimen.card_height));
Uri thumbnailUri = ContentUris.withAppendedId(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, video.id);
h.updateCardViewImage(thumbnailUri);
}
use of android.content.res.Resources in project PlayerHater by chrisrhoden.
the class Config method load.
private void load(XmlResourceParser parser, Context context) {
Resources res = context.getResources();
try {
parser.next();
int eventType = parser.getEventType();
boolean pluginEnabled = false;
boolean pluginDisabled = false;
String pluginName = null;
int currentTagType = INVALID_TAG;
while (eventType != XmlResourceParser.END_DOCUMENT) {
if (eventType == XmlResourceParser.START_TAG) {
if (parser.getName().equals("plugin")) {
currentTagType = PLUGIN;
}
pluginEnabled = loadBooleanOrResourceBoolean(res, parser, "enabled", true);
pluginDisabled = loadBooleanOrResourceBoolean(res, parser, "disabled", false);
pluginName = parser.getAttributeValue(null, "name");
} else if (eventType == XmlResourceParser.END_TAG) {
switch(currentTagType) {
case PLUGIN:
if (pluginEnabled && pluginName != null) {
mPlugins.add(pluginName);
} else if (pluginDisabled && pluginName != null) {
mPlugins.remove(pluginName);
}
break;
}
}
eventType = parser.next();
}
} catch (Exception e) {
}
}
use of android.content.res.Resources in project cw-omnibus by commonsguy.
the class MenuBuilder method setHeaderInternal.
private void setHeaderInternal(final int titleRes, final CharSequence title, final int iconRes, final Drawable icon, final View view) {
final Resources r = getResources();
if (view != null) {
mHeaderView = view;
// If using a custom view, then the title and icon aren't used
mHeaderTitle = null;
mHeaderIcon = null;
} else {
if (titleRes > 0) {
mHeaderTitle = r.getText(titleRes);
} else if (title != null) {
mHeaderTitle = title;
}
if (iconRes > 0) {
mHeaderIcon = r.getDrawable(iconRes);
} else if (icon != null) {
mHeaderIcon = icon;
}
// If using the title or icon, then a custom view isn't used
mHeaderView = null;
}
// Notify of change
onItemsChanged(false);
}
Aggregations