Search in sources :

Example 56 with Resources

use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.

the class Texture2D method load.

void load() {
    RenderScriptGL rs = SceneManager.getRS();
    Resources res = SceneManager.getRes();
    if (mFileName != null && mFileName.length() > 0) {
        String shortName = mFileName.substring(mFileName.lastIndexOf('/') + 1);
        setTexture(SceneManager.loadTexture2D(mFileDir + shortName, rs, res));
    } else if (mResourceID != 0) {
        setTexture(SceneManager.loadTexture2D(mResourceID, rs, res));
    }
}
Also used : Resources(android.content.res.Resources)

Example 57 with Resources

use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.

the class Texture2D method getRsData.

ScriptField_Texture_s getRsData(boolean loadNow) {
    if (mField != null) {
        return mField;
    }
    RenderScriptGL rs = SceneManager.getRS();
    Resources res = SceneManager.getRes();
    if (rs == null || res == null) {
        return null;
    }
    mField = new ScriptField_Texture_s(rs, 1);
    if (loadNow) {
        load();
    } else {
        mData.texture = SceneManager.getDefaultTex2D();
        new SingleImageLoaderTask().execute(this);
    }
    mField.set(mData, 0, true);
    return mField;
}
Also used : Resources(android.content.res.Resources)

Example 58 with Resources

use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.

the class TextureCube method getRsData.

ScriptField_Texture_s getRsData(boolean loadNow) {
    if (mField != null) {
        return mField;
    }
    RenderScriptGL rs = SceneManager.getRS();
    Resources res = SceneManager.getRes();
    if (rs == null || res == null) {
        return null;
    }
    mField = new ScriptField_Texture_s(rs, 1);
    if (loadNow) {
        load();
    } else {
        mData.texture = SceneManager.getDefaultTexCube();
        new SingleImageLoaderTask().execute(this);
    }
    mField.set(mData, 0, true);
    return mField;
}
Also used : Resources(android.content.res.Resources)

Example 59 with Resources

use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.

the class VersionDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Activity activity = getActivity();
    // Need to use our library's resources for showing the dialog.
    final Context context;
    try {
        context = activity.createPackageContext(SharedLibraryMain.LIBRARY_PACKAGE, 0);
    } catch (PackageManager.NameNotFoundException e) {
        throw new IllegalStateException("Can't find my package!", e);
    }
    final Resources res = context.getResources();
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setTitle(res.getText(R.string.upgrade_title));
    builder.setMessage(res.getString(R.string.upgrade_body, activity.getApplicationInfo().loadLabel(activity.getPackageManager()), context.getApplicationInfo().loadLabel(context.getPackageManager())));
    builder.setPositiveButton(res.getText(R.string.upgrade_button), new Dialog.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            // Launch play store into the details of our app.
            try {
                activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + SharedLibraryMain.LIBRARY_PACKAGE)));
            } catch (android.content.ActivityNotFoundException anfe) {
                activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + SharedLibraryMain.LIBRARY_PACKAGE)));
            }
        }
    });
    return builder.create();
}
Also used : Context(android.content.Context) AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Activity(android.app.Activity) Intent(android.content.Intent) PackageManager(android.content.pm.PackageManager) AlertDialog(android.app.AlertDialog) Dialog(android.app.Dialog) Resources(android.content.res.Resources)

Example 60 with Resources

use of android.content.res.Resources in project Anki-Android by Ramblurr.

the class PreviewClass method initLayout.

private void initLayout(Integer layout) {
    setContentView(layout);
    mMainLayout = findViewById(R.id.main_layout);
    Themes.setContentStyle(mMainLayout, Themes.CALLER_REVIEWER);
    mCardContainer = (FrameLayout) findViewById(R.id.flashcard_frame);
    //setInAnimation(false);
    mCardFrame = (FrameLayout) findViewById(R.id.flashcard);
    mTouchLayer = (FrameLayout) findViewById(R.id.touch_layer);
    mTouchLayer.setOnTouchListener(mGestureListener);
    gestureDetector = new GestureDetector(new MyGestureDetector());
    mCardFrame.removeAllViews();
    mCardFrame.setVisibility(View.GONE);
    mTouchLayer.setVisibility(View.GONE);
    if (!mChangeBorderStyle) {
        ((View) findViewById(R.id.flashcard_border)).setVisibility(View.VISIBLE);
    }
    // hunt for input issue 720, like android issue 3341
    if (AnkiDroidApp.SDK_VERSION <= 7 && (mCard != null)) {
        mCard.setFocusableInTouchMode(true);
    }
    Resources res = getResources();
    mEase1Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease1);
    mEase2Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease2);
    mEase3Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease3);
    mEase4Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease4);
    mNext1 = (TextView) findViewById(R.id.nextTime1);
    mNext2 = (TextView) findViewById(R.id.nextTime2);
    mNext3 = (TextView) findViewById(R.id.nextTime3);
    mNext4 = (TextView) findViewById(R.id.nextTime4);
    mNext1.setTextColor(res.getColor(R.color.next_time_failed_color));
    mNext2.setTextColor(res.getColor(R.color.next_time_usual_color));
    if (!mshowNextReviewTime) {
        ((TextView) findViewById(R.id.nextTimeflip)).setVisibility(View.GONE);
        mNext1.setVisibility(View.GONE);
        mNext2.setVisibility(View.GONE);
        mNext3.setVisibility(View.GONE);
        mNext4.setVisibility(View.GONE);
    }
    mFlipCard = (Button) findViewById(R.id.flip_card);
    mFlipCardLayout = (LinearLayout) findViewById(R.id.flashcard_layout_flip);
    mFlipCardLayout.setOnClickListener(mFlipCardListener);
    mFlipCard.setVisibility(View.GONE);
    mFlipCardLayout.setVisibility(View.GONE);
    mChosenAnswer = (TextView) findViewById(R.id.choosen_answer);
    if (mPrefWhiteboard) {
        mWhiteboard = new Whiteboard(this, mInvertedColors, mBlackWhiteboard);
        FrameLayout.LayoutParams lp2 = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
        mWhiteboard.setLayoutParams(lp2);
        FrameLayout fl = (FrameLayout) findViewById(R.id.whiteboard);
        fl.addView(mWhiteboard);
    }
    mAnswerField = (EditText) findViewById(R.id.answer_field);
    mNextTimeTextColor = getResources().getColor(R.color.next_time_usual_color);
    mNextTimeTextRecomColor = getResources().getColor(R.color.next_time_recommended_color);
    mForegroundColor = getResources().getColor(R.color.next_time_usual_color);
    try {
        top_bar = (RelativeLayout) findViewById(R.id.top_bar);
        top_bar.setVisibility(View.GONE);
    } catch (Exception er) {
        er.printStackTrace();
    }
    initControls();
}
Also used : LayoutParams(android.widget.FrameLayout.LayoutParams) LayoutParams(android.widget.FrameLayout.LayoutParams) FrameLayout(android.widget.FrameLayout) GestureDetector(android.view.GestureDetector) MyGestureDetector(com.ichi2.anki.Reviewer.MyGestureDetector) TextView(android.widget.TextView) ScrollTextView(com.ichi2.anki.Reviewer.ScrollTextView) Resources(android.content.res.Resources) MyGestureDetector(com.ichi2.anki.Reviewer.MyGestureDetector) ImageView(android.widget.ImageView) View(android.view.View) WebView(android.webkit.WebView) TextView(android.widget.TextView) ScrollTextView(com.ichi2.anki.Reviewer.ScrollTextView) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException)

Aggregations

Resources (android.content.res.Resources)3268 Context (android.content.Context)304 Intent (android.content.Intent)286 View (android.view.View)239 TextView (android.widget.TextView)217 PackageManager (android.content.pm.PackageManager)216 IOException (java.io.IOException)212 Drawable (android.graphics.drawable.Drawable)199 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)179 Paint (android.graphics.Paint)179 DisplayMetrics (android.util.DisplayMetrics)175 Bitmap (android.graphics.Bitmap)174 Configuration (android.content.res.Configuration)154 Point (android.graphics.Point)153 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)139 ArrayList (java.util.ArrayList)137 XmlResourceParser (android.content.res.XmlResourceParser)133 TypedArray (android.content.res.TypedArray)132 Test (org.junit.Test)127 PendingIntent (android.app.PendingIntent)123