Android Open Source - droidcon-android-espresso Main Activity






From Project

Back to project page droidcon-android-espresso.

License

The source code is released under:

Apache License

If you think the Android project droidcon-android-espresso listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.xrigau.droidcon.espresso.presentation;
// w ww  . j  a  v a2s  . co  m
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.xrigau.droidcon.espresso.R;

import java.util.Random;

public class MainActivity extends Activity {

    private static final int VISITOR_NUMBER = new Random().nextInt(Integer.MAX_VALUE);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setUpViews();
    }

    private void setUpViews() {
        Button button = (Button) findViewById(R.id.hello_visitor);
        button.setText(getString(R.string.hello_visitor, VISITOR_NUMBER));
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, VisitorActivity.class)
                        .putExtra(VisitorActivity.VISITOR_ID, VISITOR_NUMBER);
                startActivity(intent);
            }
        });

        findViewById(R.id.button_with_id).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, PostListActivity.class);
                startActivity(intent);
            }
        });

        findViewById(R.id.idling_resource).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, IdlingResourceActivity.class);
                startActivity(intent);
            }
        });
    }

}




Java Source Code List

com.xrigau.droidcon.core.debug.MockClient.java
com.xrigau.droidcon.core.model.PostList.java
com.xrigau.droidcon.core.model.PostShould.java
com.xrigau.droidcon.core.model.Post.java
com.xrigau.droidcon.core.service.Services.java
com.xrigau.droidcon.core.task.NewsTask.java
com.xrigau.droidcon.core.task.TaskExecutorShould.java
com.xrigau.droidcon.core.task.TaskExecutor.java
com.xrigau.droidcon.core.task.Task.java
com.xrigau.droidcon.espresso.AndroidUnitTest.java
com.xrigau.droidcon.espresso.helper.DrawableMatcher.java
com.xrigau.droidcon.espresso.helper.EspressoTestsMatchers.java
com.xrigau.droidcon.espresso.loader.LoaderListener.java
com.xrigau.droidcon.espresso.loader.PostsTaskLoaderCallbacks.java
com.xrigau.droidcon.espresso.loader.PostsTaskLoader.java
com.xrigau.droidcon.espresso.presentation.IdlingResourceActivityTest.java
com.xrigau.droidcon.espresso.presentation.IdlingResourceActivity.java
com.xrigau.droidcon.espresso.presentation.MainActivityTest.java
com.xrigau.droidcon.espresso.presentation.MainActivity.java
com.xrigau.droidcon.espresso.presentation.PostListActivityTest.java
com.xrigau.droidcon.espresso.presentation.PostListActivity.java
com.xrigau.droidcon.espresso.presentation.VisitorActivityTest.java
com.xrigau.droidcon.espresso.presentation.VisitorActivity.java
com.xrigau.droidcon.espresso.presentation.WorldDestructionCountdown.java
com.xrigau.droidcon.espresso.presentation.adapter.EmptyAdapter.java
com.xrigau.droidcon.espresso.presentation.adapter.PostsAdapter.java
com.xrigau.droidcon.espresso.util.DeveloperError.java