Search in sources :

Example 36 with Activity

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);
}
Also used : RelativeLayout(android.widget.RelativeLayout) Activity(android.app.Activity) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Example 37 with Activity

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();
    }
}
Also used : Activity(android.app.Activity) File(java.io.File)

Example 38 with Activity

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);
        }
    }
}
Also used : Activity(android.app.Activity) Intent(android.content.Intent)

Example 39 with Activity

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");
    }
}
Also used : Activity(android.app.Activity)

Example 40 with Activity

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();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Activity(android.app.Activity)

Aggregations

Activity (android.app.Activity)1215 View (android.view.View)206 Test (org.junit.Test)187 Intent (android.content.Intent)184 TextView (android.widget.TextView)88 ArrayList (java.util.ArrayList)62 Bundle (android.os.Bundle)58 Context (android.content.Context)57 ViewGroup (android.view.ViewGroup)50 DialogInterface (android.content.DialogInterface)47 AlertDialog (android.app.AlertDialog)45 Robolectric.buildActivity (org.robolectric.Robolectric.buildActivity)40 LayoutInflater (android.view.LayoutInflater)38 ImageView (android.widget.ImageView)38 Twitter (twitter4j.Twitter)35 AppCompatActivity (android.support.v7.app.AppCompatActivity)34 DisplayMetrics (android.util.DisplayMetrics)32 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)29 Robolectric.setupActivity (org.robolectric.Robolectric.setupActivity)28 Uri (android.net.Uri)27