More changes to the clouds.
BIN
AndorsTrail/res/drawable-nodpi/ts_background.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 9.9 KiB |
BIN
AndorsTrail/res/drawable-nodpi/ts_midground.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 907 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 936 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 867 B |
|
Before Width: | Height: | Size: 695 B After Width: | Height: | Size: 625 B |
|
Before Width: | Height: | Size: 990 B After Width: | Height: | Size: 627 B |
|
Before Width: | Height: | Size: 561 B After Width: | Height: | Size: 520 B |
|
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 443 B |
|
Before Width: | Height: | Size: 505 B After Width: | Height: | Size: 514 B |
@@ -7,10 +7,9 @@
|
||||
<include layout="@layout/title_bg_sky_layout"/>
|
||||
|
||||
<com.gpl.rpg.AndorsTrail.view.CloudsAnimatorView
|
||||
android:id="@+id/ts_clouds_animator"
|
||||
android:id="@+id/ts_clouds_animator_back"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:elevation="10dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
@@ -18,16 +17,39 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="-200sp"
|
||||
android:scaleType="centerCrop"
|
||||
android:elevation="20dp"
|
||||
android:src="@drawable/ts_foreground"/>
|
||||
android:src="@drawable/ts_background"/>
|
||||
|
||||
<com.gpl.rpg.AndorsTrail.view.CloudsAnimatorView
|
||||
android:id="@+id/ts_clouds_animator_mid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="-200sp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ts_midground"/>
|
||||
|
||||
<com.gpl.rpg.AndorsTrail.view.CloudsAnimatorView
|
||||
android:id="@+id/ts_clouds_animator_front"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="-200sp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ts_foreground"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="horizontal"
|
||||
android:elevation="30dp" >
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_logo_placeholder_above"
|
||||
|
||||
@@ -7,10 +7,9 @@
|
||||
<include layout="@layout/title_bg_sky_layout"/>
|
||||
|
||||
<com.gpl.rpg.AndorsTrail.view.CloudsAnimatorView
|
||||
android:id="@+id/ts_clouds_animator"
|
||||
android:id="@+id/ts_clouds_animator_back"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:elevation="10dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
@@ -18,15 +17,39 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="-100sp"
|
||||
android:scaleType="centerCrop"
|
||||
android:elevation="20dp"
|
||||
android:src="@drawable/ts_foreground"/>
|
||||
android:src="@drawable/ts_background"/>
|
||||
|
||||
<com.gpl.rpg.AndorsTrail.view.CloudsAnimatorView
|
||||
android:id="@+id/ts_clouds_animator_mid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="-100sp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ts_midground"/>
|
||||
|
||||
<com.gpl.rpg.AndorsTrail.view.CloudsAnimatorView
|
||||
android:id="@+id/ts_clouds_animator_front"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="-100sp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ts_foreground"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="vertical"
|
||||
android:elevation="30dp" >
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_logo_placeholder_above"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="vertical"
|
||||
android:elevation="0dp" >
|
||||
|
||||
<!--
|
||||
<ImageView
|
||||
android:id="@+id/title_bg_top"
|
||||
android:layout_width="match_parent"
|
||||
@@ -13,14 +13,14 @@
|
||||
android:layout_weight="0.4"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/ts_sky_top" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/title_bg_centerpattern"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/sky_gradient_drawable" />
|
||||
|
||||
-->
|
||||
<ImageView
|
||||
android:id="@+id/title_bg_bottom"
|
||||
android:layout_width="match_parent"
|
||||
@@ -28,5 +28,7 @@
|
||||
android:layout_weight="0.6"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/ts_sky_bottom" />
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -72,7 +72,12 @@ public final class StartScreenActivity extends FragmentActivity implements OnNew
|
||||
development_version.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
clouds = (CloudsAnimatorView) findViewById(R.id.ts_clouds_animator);
|
||||
clouds = (CloudsAnimatorView) findViewById(R.id.ts_clouds_animator_back);
|
||||
clouds.setCloudsCount(40, 0, 0);
|
||||
clouds = (CloudsAnimatorView) findViewById(R.id.ts_clouds_animator_mid);
|
||||
clouds.setCloudsCount(0, 15, 0);
|
||||
clouds = (CloudsAnimatorView) findViewById(R.id.ts_clouds_animator_front);
|
||||
clouds.setCloudsCount(0, 0, 8);
|
||||
|
||||
View background = findViewById(R.id.title_bg);
|
||||
if (background != null) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.gpl.rpg.AndorsTrail.view;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -20,26 +21,32 @@ import com.gpl.rpg.AndorsTrail.util.L;
|
||||
public class CloudsAnimatorView extends FrameLayout {
|
||||
|
||||
private static final float Y_MIN = 0f;
|
||||
private static final float Y_MAX = 0.6f;
|
||||
private static final float Y_MAX_LANDSCAPE = 0.55f;
|
||||
private static final float Y_MAX_PORTRAIT = 0.65f;
|
||||
|
||||
private static final int DEFAULT_DURATION = 30000;
|
||||
private static final int DEFAULT_DURATION = 50000;
|
||||
private static final float SPEED_VARIANCE = 0.2f;
|
||||
private static final float BELOW_SPEED_FACTOR = 0.5f;
|
||||
private static final float CENTER_SPEED_FACTOR = 1.0f;
|
||||
private static final float ABOVE_SPEED_FACTOR = 1.5f;
|
||||
|
||||
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 BELOW_CLOUD_COUNT = 40;
|
||||
private static final int CENTER_CLOUD_COUNT = 15;
|
||||
private static final int ABOVE_CLOUD_COUNT = 8;
|
||||
|
||||
|
||||
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;
|
||||
private int belowCount = BELOW_CLOUD_COUNT;
|
||||
private int centerCount = CENTER_CLOUD_COUNT;
|
||||
private int aboveCount = ABOVE_CLOUD_COUNT;
|
||||
private ViewGroup belowLayer, centerLayer, aboveLayer;
|
||||
private int duration = DEFAULT_DURATION;
|
||||
private float yMax = Y_MAX_PORTRAIT;
|
||||
|
||||
private final ConcurrentHashMap<ImageView, PausableTranslateAnimation> animations = new ConcurrentHashMap<ImageView, PausableTranslateAnimation>(BELOW_CLOUD_COUNT + CENTER_CLOUD_COUNT + ABOVE_CLOUD_COUNT);
|
||||
private final ConcurrentHashMap<ImageView, PausableTranslateAnimation> animations = new ConcurrentHashMap<ImageView, PausableTranslateAnimation>(belowCount + centerCount + aboveCount);
|
||||
|
||||
|
||||
public CloudsAnimatorView(Context context) {
|
||||
@@ -57,15 +64,32 @@ public class CloudsAnimatorView extends FrameLayout {
|
||||
init();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
private void init() {
|
||||
setFocusable(false);
|
||||
inflate(getContext(), R.layout.clouds_animator, this);
|
||||
switch (getResources().getConfiguration().orientation) {
|
||||
case Configuration.ORIENTATION_LANDSCAPE:
|
||||
yMax = Y_MAX_LANDSCAPE;
|
||||
break;
|
||||
case Configuration.ORIENTATION_PORTRAIT:
|
||||
yMax = Y_MAX_PORTRAIT;
|
||||
break;
|
||||
default:
|
||||
yMax = Y_MAX_LANDSCAPE;
|
||||
break;
|
||||
}
|
||||
|
||||
belowLayer = (ViewGroup) findViewById(R.id.ts_clouds_below);
|
||||
centerLayer = (ViewGroup) findViewById(R.id.ts_clouds_center);
|
||||
aboveLayer = (ViewGroup) findViewById(R.id.ts_clouds_above);
|
||||
}
|
||||
|
||||
public void setCloudsCount(int below, int center, int above) {
|
||||
belowCount = below;
|
||||
centerCount = center;
|
||||
aboveCount = above;
|
||||
}
|
||||
|
||||
private void createCloudBelow() {
|
||||
createCloud(belowLayer, belowDrawablesId, BELOW_SPEED_FACTOR);
|
||||
}
|
||||
@@ -83,17 +107,18 @@ public class CloudsAnimatorView extends FrameLayout {
|
||||
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
||||
layer.addView(iv, lp);
|
||||
|
||||
final float y = Y_MIN + (float) (layer.getHeight() * Math.random() * (Y_MAX - Y_MIN));
|
||||
final float y = (float) (layer.getHeight() * (Y_MIN + (Math.random() * (yMax - Y_MIN)))) - iv.getDrawable().getMinimumHeight();
|
||||
float ratio = (float)Math.random();
|
||||
final float x = (float) (((1-ratio) * (iv.getWidth() + layer.getWidth())) - iv.getWidth());
|
||||
final float x = (float) (((1-ratio) * (iv.getDrawable().getMinimumWidth() + layer.getWidth())) - iv.getDrawable().getMinimumWidth());
|
||||
final long d = (long)((ratio * duration) / (speedFactor + (Math.random() * SPEED_VARIANCE)));
|
||||
|
||||
L.log("Cloud added at "+x+","+y);
|
||||
|
||||
prepareAnimation(iv, layer, speedFactor, x, y, d);
|
||||
}
|
||||
|
||||
private void resetCloud(final ViewGroup layer, final float speedFactor, final ImageView iv) {
|
||||
final float y = Y_MIN + (float) (layer.getHeight() * Math.random() * (Y_MAX - Y_MIN));
|
||||
final float y = (float) (layer.getHeight() * (Y_MIN + (Math.random() * (yMax - Y_MIN)))) - iv.getDrawable().getMinimumHeight();
|
||||
final float x = -iv.getWidth();
|
||||
final long d = (long)(duration / (speedFactor + (Math.random() * SPEED_VARIANCE)));
|
||||
|
||||
@@ -128,15 +153,15 @@ public class CloudsAnimatorView extends FrameLayout {
|
||||
}
|
||||
|
||||
public void startAnimation() {
|
||||
int i = BELOW_CLOUD_COUNT;
|
||||
int i = belowCount;
|
||||
while (i-- > 0) {
|
||||
createCloudBelow();
|
||||
}
|
||||
i = CENTER_CLOUD_COUNT;
|
||||
i = centerCount;
|
||||
while (i-- > 0) {
|
||||
createCloudCenter();
|
||||
}
|
||||
i = ABOVE_CLOUD_COUNT;
|
||||
i = aboveCount;
|
||||
while (i-- > 0) {
|
||||
createCloudAbove();
|
||||
}
|
||||
|
||||