Search in sources :

Example 6 with Resources

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);
}
Also used : Resources(android.content.res.Resources)

Example 7 with Resources

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();
}
Also used : DateFormatSymbols(java.text.DateFormatSymbols) Resources(android.content.res.Resources) TextView(android.widget.TextView) View(android.view.View)

Example 8 with Resources

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);
}
Also used : Resources(android.content.res.Resources) Uri(android.net.Uri)

Example 9 with Resources

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) {
    }
}
Also used : Resources(android.content.res.Resources) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) NotFoundException(android.content.res.Resources.NotFoundException)

Example 10 with Resources

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);
}
Also used : Resources(android.content.res.Resources)

Aggregations

Resources (android.content.res.Resources)3195 Context (android.content.Context)292 Intent (android.content.Intent)280 View (android.view.View)236 TextView (android.widget.TextView)214 IOException (java.io.IOException)209 PackageManager (android.content.pm.PackageManager)206 Drawable (android.graphics.drawable.Drawable)197 Paint (android.graphics.Paint)178 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)176 Bitmap (android.graphics.Bitmap)174 DisplayMetrics (android.util.DisplayMetrics)165 Configuration (android.content.res.Configuration)151 Point (android.graphics.Point)151 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)137 ArrayList (java.util.ArrayList)134 XmlResourceParser (android.content.res.XmlResourceParser)132 TypedArray (android.content.res.TypedArray)129 Test (org.junit.Test)126 PendingIntent (android.app.PendingIntent)122