use of android.app.Activity in project glitch-hq-android by tinyspeck.
the class EncyclopediaGiantDetailFragment method showEncyclopediaGiantPage.
private void showEncyclopediaGiantPage() {
Activity m_act = getActivity();
String packageName = m_act.getPackageName();
RelativeLayout topSection = (RelativeLayout) m_root.findViewById(R.id.encyclopedia_giant_detail_top_section);
int backgroundResID = m_act.getResources().getIdentifier("bg_" + m_giant.id + "_repeat", "drawable", packageName);
topSection.setBackgroundResource(backgroundResID);
ImageView icon = (ImageView) m_root.findViewById(R.id.encyclopedia_giant_detail_icon);
int symbolResID = m_act.getResources().getIdentifier(m_giant.id + "_symbol", "drawable", packageName);
icon.setImageBitmap(BitmapFactory.decodeResource(m_act.getResources(), symbolResID));
TextView name = (TextView) m_root.findViewById(R.id.encyclopedia_giant_detail_name_sex);
name.setTypeface(m_application.m_vagFont);
name.setText(m_giant.name + " " + m_giant.gender);
TextView personality = (TextView) m_root.findViewById(R.id.encyclopedia_giant_detail_personality);
personality.setText(m_giant.personality);
ImageView image = (ImageView) m_root.findViewById(R.id.encyclopedia_giant_detail_image);
int imageResID = m_act.getResources().getIdentifier(m_giant.id, "drawable", packageName);
image.setImageBitmap(BitmapFactory.decodeResource(m_act.getResources(), imageResID));
TextView desc = (TextView) m_root.findViewById(R.id.encyclopedia_giant_detail_desc);
desc.setText(m_giant.desc);
TextView followers = (TextView) m_root.findViewById(R.id.encyclopedia_giant_detail_adherents);
followers.setText("Adherents are known as \"" + m_giant.followers + "\".");
TextView skills = (TextView) m_root.findViewById(R.id.encyclopedia_giant_detail_skills);
String skillsStr = "";
Iterator<glitchGiantSkill> itr = m_giant.skills.iterator();
while (itr.hasNext()) {
glitchGiantSkill skill = itr.next();
skillsStr += skill.name;
if (itr.hasNext()) {
skillsStr += ", ";
}
}
skills.setText(skillsStr);
m_root.setVisibility(View.VISIBLE);
}
use of android.app.Activity in project jpHolo by teusink.
the class FileUtils method initialize.
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
this.filesystems = new ArrayList<Filesystem>();
String tempRoot = null;
String persistentRoot = null;
Activity activity = cordova.getActivity();
String packageName = activity.getPackageName();
String location = activity.getIntent().getStringExtra("androidpersistentfilelocation");
if (location == null) {
location = "compatibility";
}
tempRoot = activity.getCacheDir().getAbsolutePath();
if ("internal".equalsIgnoreCase(location)) {
persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/";
this.configured = true;
} else if ("compatibility".equalsIgnoreCase(location)) {
/*
* Fall-back to compatibility mode -- this is the logic implemented in
* earlier versions of this plugin, and should be maintained here so
* that apps which were originally deployed with older versions of the
* plugin can continue to provide access to files stored under those
* versions.
*/
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath();
tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + packageName + "/cache/";
} else {
persistentRoot = "/data/data/" + packageName;
}
this.configured = true;
}
if (this.configured) {
// Create the directories if they don't exist.
new File(tempRoot).mkdirs();
new File(persistentRoot).mkdirs();
// Register initial filesystems
// Note: The temporary and persistent filesystems need to be the first two
// registered, so that they will match window.TEMPORARY and window.PERSISTENT,
// per spec.
this.registerFilesystem(new LocalFilesystem("temporary", cordova, tempRoot));
this.registerFilesystem(new LocalFilesystem("persistent", cordova, persistentRoot));
this.registerFilesystem(new ContentFilesystem("content", cordova, webView));
registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity));
// Initialize static plugin reference for deprecated getEntry method
if (filePlugin == null) {
FileUtils.filePlugin = this;
}
} else {
Log.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)");
activity.finish();
}
}
use of android.app.Activity in project VirtualApp by asLody.
the class VActivityManager method finishActivity.
public void finishActivity(IBinder token) {
ActivityClientRecord r = getActivityRecord(token);
if (r != null) {
Activity activity = r.activity;
while (true) {
// We shouldn't use Activity.getParent(),
// because It may be overwritten.
Activity parent = mirror.android.app.Activity.mParent.get(activity);
if (parent == null) {
break;
}
activity = parent;
}
// because It may be overwritten.
if (!mirror.android.app.Activity.mFinished.get(activity)) {
int resultCode = mirror.android.app.Activity.mResultCode.get(activity);
Intent resultData = mirror.android.app.Activity.mResultData.get(activity);
ActivityManagerCompat.finishActivity(token, resultCode, resultData);
mirror.android.app.Activity.mFinished.set(activity, true);
}
}
}
use of android.app.Activity in project AppIntro by apl-devs.
the class OrientationChangeAction method perform.
@Override
public void perform(UiController uiController, View view) {
uiController.loopMainThreadUntilIdle();
final Activity activity = (Activity) view.getContext();
activity.setRequestedOrientation(orientation);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Collection<Activity> resumedActivities = ActivityLifecycleMonitorRegistry.getInstance().getActivitiesInStage(Stage.RESUMED);
if (resumedActivities.isEmpty()) {
throw new RuntimeException("Could not change orientation");
}
}
use of android.app.Activity in project floatingsearchview by arimorty.
the class SearchResultsListAdapter method animateItem.
private void animateItem(View view) {
view.setTranslationY(Util.getScreenHeight((Activity) view.getContext()));
view.animate().translationY(0).setInterpolator(new DecelerateInterpolator(3.f)).setDuration(700).start();
}
Aggregations