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));
}
}
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;
}
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;
}
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();
}
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();
}
Aggregations