diff --git a/AndorsTrail/AndroidManifest.xml b/AndorsTrail/AndroidManifest.xml
index fcb1c0ab2..dbf215ca7 100644
--- a/AndorsTrail/AndroidManifest.xml
+++ b/AndorsTrail/AndroidManifest.xml
@@ -23,6 +23,8 @@
+
+
diff --git a/AndorsTrail/res/layout-land/title_bg_layout.xml b/AndorsTrail/res/layout-land/title_bg_layout.xml
index fab7e6891..380813e79 100644
--- a/AndorsTrail/res/layout-land/title_bg_layout.xml
+++ b/AndorsTrail/res/layout-land/title_bg_layout.xml
@@ -1,15 +1,24 @@
-
+
+
@@ -17,7 +26,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
- android:orientation="horizontal" >
+ android:orientation="horizontal"
+ android:elevation="30dp" >
+ android:layout_weight="0" >
+ android:layout_weight="0.7" >
diff --git a/AndorsTrail/res/layout/clouds_animator.xml b/AndorsTrail/res/layout/clouds_animator.xml
new file mode 100644
index 000000000..f352effa9
--- /dev/null
+++ b/AndorsTrail/res/layout/clouds_animator.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AndorsTrail/res/layout/title_bg_layout.xml b/AndorsTrail/res/layout/title_bg_layout.xml
index 132444306..483cf8ca6 100644
--- a/AndorsTrail/res/layout/title_bg_layout.xml
+++ b/AndorsTrail/res/layout/title_bg_layout.xml
@@ -1,24 +1,32 @@
-
-
+
+
+ android:orientation="vertical"
+ android:elevation="30dp" >
+ android:orientation="vertical"
+ android:elevation="0dp" >
0) {
getSupportFragmentManager().popBackStack();
+ currentFragment = getSupportFragmentManager().findFragmentById(R.id.startscreen_fragment_container);
}
}
+
+
public void onNewGameRequested() {
if (findViewById(R.id.startscreen_fragment_container) != null) {
StartScreenActivity_NewGame newGameFragment = new StartScreenActivity_NewGame();
@@ -121,6 +172,8 @@ public final class StartScreenActivity extends FragmentActivity implements OnNew
.replace(R.id.startscreen_fragment_container, newGameFragment)
.addToBackStack(null)
.commit();
+
+ currentFragment = newGameFragment;
}
}
@@ -129,5 +182,10 @@ public final class StartScreenActivity extends FragmentActivity implements OnNew
public void onGameCreationCancelled() {
backPressed();
}
+
+ @Override
+ public void onBackStackChanged() {
+ currentFragment = getSupportFragmentManager().findFragmentById(R.id.startscreen_fragment_container);
+ }
}
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/CloudsAnimatorView.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/CloudsAnimatorView.java
new file mode 100644
index 000000000..9b947f0cf
--- /dev/null
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/CloudsAnimatorView.java
@@ -0,0 +1,184 @@
+package com.gpl.rpg.AndorsTrail.view;
+
+import java.util.List;
+
+import com.gpl.rpg.AndorsTrail.R;
+import com.gpl.rpg.AndorsTrail.util.L;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.Animation;
+import android.view.animation.TranslateAnimation;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+
+public class CloudsAnimatorView extends FrameLayout {
+
+ private static final int Y_MIN = 0;
+ private static final int Y_MAX = 100;
+
+ private static final int DURATION = 12000;
+ private static final int SPEED_MIN = 10;
+ private static final int SPEED_MAX = 15;
+
+ private static final float BELOW_SPEED_FACTOR = 0.8f;
+ private static final float CENTER_SPEED_FACTOR = 1.0f;
+ private static final float ABOVE_SPEED_FACTOR = 1.2f;
+
+ private static final int BELOW_CLOUD_COUNT = 30;
+ private static final int CENTER_CLOUD_COUNT = 20;
+ private static final int ABOVE_CLOUD_COUNT = 15;
+
+ private static final int[] belowDrawablesId = new int[]{R.drawable.ts_clouds_s_01, R.drawable.ts_clouds_s_02, R.drawable.ts_clouds_s_03};
+ private static final int[] centerDrawablesId = new int[]{R.drawable.ts_clouds_m_01, R.drawable.ts_clouds_m_02};
+ private static final int[] aboveDrawablesId = new int[]{R.drawable.ts_clouds_l_01, R.drawable.ts_clouds_l_02, R.drawable.ts_clouds_l_03, R.drawable.ts_clouds_l_04};
+
+ ViewGroup belowLayer, centerLayer, aboveLayer;
+ View belowStart, centerStart, aboveStart;
+
+
+
+ public CloudsAnimatorView(Context context) {
+ super(context);
+ init();
+ }
+
+ public CloudsAnimatorView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ }
+
+ public CloudsAnimatorView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ init();
+ }
+
+ public void init() {
+ L.log("Cloud animator created");
+ setFocusable(false);
+ inflate(getContext(), R.layout.clouds_animator, this);
+
+ belowLayer = (ViewGroup) findViewById(R.id.ts_clouds_below);
+ centerLayer = (ViewGroup) findViewById(R.id.ts_clouds_center);
+ aboveLayer = (ViewGroup) findViewById(R.id.ts_clouds_above);
+
+ belowStart = (ViewGroup) findViewById(R.id.ts_clouds_below_start);
+ centerStart = (ViewGroup) findViewById(R.id.ts_clouds_center_start);
+ aboveStart = (ViewGroup) findViewById(R.id.ts_clouds_above_start);
+ }
+
+ private void addCloudBelow() {
+ if (belowLayer == null) {
+ L.log("Cloud below is null. Deferring.");
+ postDelayed(new Runnable() {
+ @Override
+ public void run() {addCloudBelow();}
+ }, (int)(DURATION * Math.random()));
+ } else {
+ addCloud(belowLayer, R.id.ts_clouds_below_start, belowDrawablesId, BELOW_SPEED_FACTOR);
+ }
+
+ }
+ private void addCloudCenter() {
+ if (centerLayer == null) {
+ L.log("Cloud center is null. Deferring.");
+ postDelayed(new Runnable() {
+ @Override
+ public void run() {addCloudCenter();}
+ }, (int)(DURATION * Math.random()));
+ } else {
+ addCloud(centerLayer, R.id.ts_clouds_center_start, centerDrawablesId, CENTER_SPEED_FACTOR);
+ }
+ }
+ private void addCloudAbove() {
+ if (aboveLayer == null) {
+ L.log("Cloud above is null. Deferring.");
+ postDelayed(new Runnable() {
+ @Override
+ public void run() {addCloudAbove();}
+ }, (int)(DURATION * Math.random()));
+ } else {
+ addCloud(aboveLayer, R.id.ts_clouds_above_start, aboveDrawablesId, ABOVE_SPEED_FACTOR);
+ }
+ }
+
+
+ private void addCloud(final ViewGroup layer, final int startId, final int[] ids, final float speedFactor) {
+ final ImageView iv = new ImageView(getContext());
+ iv.setImageDrawable(getResources().getDrawable(ids[(int)(ids.length * Math.random())]));
+ RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
+ //lp.addRule(RelativeLayout.LEFT_OF, startId);
+// lp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+// lp.topMargin = (int) (layer.getHeight() * Math.random());
+ final float y = (float) (layer.getHeight() * Math.random());
+ L.log("Cloud added at y="+y);
+ layer.addView(iv, lp);
+ TranslateAnimation anim = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, -1.0f, TranslateAnimation.RELATIVE_TO_PARENT, 2.0f,
+ TranslateAnimation.ABSOLUTE, y, TranslateAnimation.ABSOLUTE, y);
+ anim.setAnimationListener(new Animation.AnimationListener() {
+
+ @Override
+ public void onAnimationStart(Animation animation) {
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ L.log("Cloud ended at y="+y);
+ layer.removeView(iv);
+ if (CloudsAnimatorView.this.getVisibility() == View.VISIBLE) {
+ postDelayed(new Runnable() {
+ @Override
+ public void run() {addCloud(layer, startId, ids, speedFactor);}
+ }, (int)(DURATION * Math.random()));
+ }
+ }
+ });
+ anim.setDuration((long)(DURATION / speedFactor));
+ iv.startAnimation(anim);
+ }
+
+ /*@Override
+ protected void onVisibilityChanged(View changedView, int visibility) {
+ super.onVisibilityChanged(changedView, visibility);
+ if (changedView == this && visibility == View.VISIBLE) {
+ startAnimation();
+ } else if (changedView == this) {
+ stopAll();
+ }
+ }*/
+
+ public void startAnimation() {
+ L.log("Cloud animator started");
+ int i = BELOW_CLOUD_COUNT;
+ while (i-- > 0) {
+ postDelayed(new Runnable() {
+ @Override
+ public void run() {addCloudBelow();}
+ }, (int)(DURATION * Math.random()));
+ }
+ i = CENTER_CLOUD_COUNT;
+ while (i-- > 0) {
+ postDelayed(new Runnable() {
+ @Override
+ public void run() {addCloudCenter();}
+ }, (int)(DURATION * Math.random()));
+ }
+ i = ABOVE_CLOUD_COUNT;
+ while (i-- > 0) {
+ postDelayed(new Runnable() {
+ @Override
+ public void run() {addCloudAbove();}
+ }, (int)(DURATION * Math.random()));
+ }
+ }
+
+// private void stopAll() {}
+
+}