Android Open Source - GADemoGTM Message Activity






From Project

Back to project page GADemoGTM.

License

The source code is released under:

GNU General Public License

If you think the Android project GADemoGTM 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.pdro.gademogtm;
//from   w w w. j  a v a 2s  .co  m
import com.pdro.gademogtm.gtm.Utils;
import com.pdro.gademogtm.tools.ColorWheel;
import com.pdro.gademogtm.tools.FactBook;

import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

/**
 * Loads the a secondary page composed of a fact about GA and a button.
 * The button launches the {@link MainActivity}.
 */
// todo clean up Message Activity class
public class MessageActivity extends Activity {
    private FactBook mFactBook = new FactBook();
    private ColorWheel mColorWheel = new ColorWheel();
    private String screenName = "Message Screen";

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_display_message);

        // Enabling Up/Back navigation
        ActionBar actionBar = getActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);

        // Retrieving layout fields
        final TextView factLabel = (TextView) findViewById(R.id.factTextView);
        final Button backHomeButton = (Button) findViewById(R.id.returnHomeButton);
        final RelativeLayout factScreen = (RelativeLayout) findViewById(R.id.relativeLayout2);

        // Update the label with our dynamic fact
        String fact = mFactBook.getFact();
        factLabel.setText(fact);

        // Update the label with our dynamic color
        int color = mColorWheel.getColor();
        factScreen.setBackgroundColor(color);
        backHomeButton.setTextColor(color);

        screenEvent(screenName);

        backHomeButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startMainActivity();
            }
        });

    }

    private void startMainActivity() {
        Intent intent = new Intent(MessageActivity.this, MainActivity.class);
        startActivity(intent);
    }

    public void screenEvent(String eventName) {
        Utils.pushOpenScreenEvent(this, eventName);
        Log.e("GADemoGTM", eventName);

    }
}




Java Source Code List

com.pdro.gademogtm.MainActivity.java
com.pdro.gademogtm.MessageActivity.java
com.pdro.gademogtm.SplashScreen.java
com.pdro.gademogtm.gtm.ContainerHolderSingleton.java
com.pdro.gademogtm.gtm.Utils.java
com.pdro.gademogtm.tools.ColorWheel.java
com.pdro.gademogtm.tools.FactBook.java