Android Open Source - android-google-engine-app-example Introduction Activity






From Project

Back to project page android-google-engine-app-example.

License

The source code is released under:

Apache License

If you think the Android project android-google-engine-app-example 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.google.cloud.backend.sample.guestbook;
/*from   w w w.  j a v  a  2  s. c  o  m*/
import com.google.cloud.backend.R;

import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.Window;

/**
 * This activity holds the Fragments of the introduction and coordinates
 * communication.
 */
public class IntroductionActivity extends Activity implements OnIntroNavListener {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_introduction);

        FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
        fragmentTransaction.add(
                R.id.intro_frame, new IntroFirstFragment(), IntroFirstFragment.TAG);
        fragmentTransaction.commit();
    }

    @Override
    public void toFirst(String fromTag) {
        goToFragment(fromTag, IntroFirstFragment.TAG, new IntroFirstFragment());
    }

    @Override
    public void toSecond(String fromTag) {
        goToFragment(fromTag, IntroSecondFragment.TAG, new IntroSecondFragment());
    }

    @Override
    public void toThird(String fromTag) {
        goToFragment(fromTag, IntroThirdFragment.TAG, new IntroThirdFragment());
    }

    @Override
    public void done(boolean skipFutureIntro) {
        if (skipFutureIntro) {
            updateIntroPrefs();
        }
        FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
        Fragment fragment = getFragmentManager().findFragmentByTag(IntroThirdFragment.TAG);
        if (fragment != null) {
            fragmentTransaction.remove(
                    getFragmentManager().findFragmentByTag(IntroThirdFragment.TAG));
        }
        fragmentTransaction.commit();
        finish();

    }

    private void updateIntroPrefs() {
        SharedPreferences settings = getSharedPreferences(
                GuestbookActivity.GUESTBOOK_SHARED_PREFS, Context.MODE_PRIVATE);
        if (settings != null) {
            SharedPreferences.Editor editor = settings.edit();
            editor.putBoolean(GuestbookActivity.SHOW_INTRO_PREFS_KEY, false);
            editor.commit();
        }
    }

    private void goToFragment(String oldFragmentTag, String newFragmentTag, Fragment newFragment) {
        FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
        fragmentTransaction.add(R.id.intro_frame, newFragment, newFragmentTag);
        Fragment fragment = getFragmentManager().findFragmentByTag(oldFragmentTag);
        if (fragment != null) {
            fragmentTransaction.remove(getFragmentManager().findFragmentByTag(oldFragmentTag));
        }
        fragmentTransaction.commit();
    }
}




Java Source Code List

com.google.cloud.backend.GCMBroadcastReceiver.java
com.google.cloud.backend.GCMIntentService.java
com.google.cloud.backend.android.mobilebackend.MobilebackendRequestInitializer.java
com.google.cloud.backend.android.mobilebackend.MobilebackendRequest.java
com.google.cloud.backend.android.mobilebackend.Mobilebackend.java
com.google.cloud.backend.android.mobilebackend.model.BlobAccess.java
com.google.cloud.backend.android.mobilebackend.model.EntityDto.java
com.google.cloud.backend.android.mobilebackend.model.EntityListDto.java
com.google.cloud.backend.android.mobilebackend.model.FilterDto.java
com.google.cloud.backend.android.mobilebackend.model.Filter.java
com.google.cloud.backend.android.mobilebackend.model.QueryDto.java
com.google.cloud.backend.core.CloudBackendAsync.java
com.google.cloud.backend.core.CloudBackendFragment.java
com.google.cloud.backend.core.CloudBackendMessaging.java
com.google.cloud.backend.core.CloudBackend.java
com.google.cloud.backend.core.CloudCallbackHandler.java
com.google.cloud.backend.core.CloudEndpointUtils.java
com.google.cloud.backend.core.CloudEntity.java
com.google.cloud.backend.core.CloudQuery.java
com.google.cloud.backend.core.Consts.java
com.google.cloud.backend.core.Filter.java
com.google.cloud.backend.sample.guestbook.GuestbookActivity.java
com.google.cloud.backend.sample.guestbook.IntroFirstFragment.java
com.google.cloud.backend.sample.guestbook.IntroSecondFragment.java
com.google.cloud.backend.sample.guestbook.IntroThirdFragment.java
com.google.cloud.backend.sample.guestbook.IntroductionActivity.java
com.google.cloud.backend.sample.guestbook.OnIntroNavListener.java
com.google.cloud.backend.sample.guestbook.PostAdapter.java
com.google.cloud.backend.sample.guestbook.SplashFragment.java