Current shape is now saved

This commit is contained in:
=
2017-10-27 17:43:04 +02:00
parent 757c13c31c
commit 0bc6a09d17
251 changed files with 5076 additions and 11634 deletions

View File

@ -12,11 +12,13 @@ import de.frajul.endlessroll.entities.textures.TexturePack;
*/
public enum PlayerShape {
BALL(R.string.playershape_name_ball, R.drawable.playershapes_ball), CLOCK(R.string.playershape_name_clock,
R.drawable.playershapes_clock), HYPNO_SPIRAL(R.string.playershape_name_hypno_spiral,
R.drawable.playershapes_hypno_spiral), PACMAN(R.string.playershape_name_pacman,
R.drawable.playershapes_pacman), SMILEY(R.string.playershape_name_smiley,
R.drawable.playershapes_smiley);
BALL(R.string.playershape_name_ball, R.drawable.playershapes_ball),
CLOCK(R.string.playershape_name_clock, R.drawable.playershapes_clock),
HYPNO_SPIRAL(R.string.playershape_name_hypno_spiral, R.drawable.playershapes_hypno_spiral),
PACMAN(R.string.playershape_name_pacman, R.drawable.playershapes_pacman),
SMILEY(R.string.playershape_name_smiley, R.drawable.playershapes_smiley),
WHEEL(R.string.playershape_name_wheel, R.drawable.playershapes_wheel),
SUN(R.string.playershape_name_sun, R.drawable.playershapes_sun);
@StringRes
private int nameId;

View File

@ -1,6 +1,7 @@
package de.frajul.endlessroll.main.screens;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TableRow;
import de.frajul.endlessroll.R;
@ -18,14 +19,14 @@ public class PlayerShapeShopScreen extends Screen<LinearLayout> implements Playe
private PlayerShapeButton activeButton;
private TopBar topBar;
private TableRow topRow;
private TableRow bottomRow;
private LinearLayout topRow;
private LinearLayout bottomRow;
public PlayerShapeShopScreen(GameActivity gameActivity) {
super(ScreenType.SHAPE_SHOP, gameActivity, R.layout.shape_shop);
topBar = super.createTopBar(R.id.shape_shop_topbar);
topRow = (TableRow) layout.findViewById(R.id.shape_shop_topRow);
bottomRow = (TableRow) layout.findViewById(R.id.shape_shop_bottomRow);
topRow = (LinearLayout) layout.findViewById(R.id.shape_shop_topRow);
bottomRow = (LinearLayout) layout.findViewById(R.id.shape_shop_bottomRow);
}
private void createViews() {
@ -34,8 +35,10 @@ public class PlayerShapeShopScreen extends Screen<LinearLayout> implements Playe
int i = 0;
int totalShapes = PlayerShape.values().length;
for (PlayerShape playerShape : PlayerShape.values()) {
PlayerShapeButton button = new PlayerShapeButton(gameActivity, playerShape, this);
if (i < totalShapes / 2)
boolean lastInRow = i == totalShapes / 2 || i == totalShapes - 1;
PlayerShapeButton button = new PlayerShapeButton(gameActivity, playerShape, this,
!lastInRow);
if (i < totalShapes / 2 + 1)
topRow.addView(button.getView());
else
bottomRow.addView(button.getView());
@ -57,6 +60,7 @@ public class PlayerShapeShopScreen extends Screen<LinearLayout> implements Playe
@Override
public void onBackKeyDown() {
gameActivity.getDataStorageHandler().writeUserData(gameActivity.getUser());
flipToCaller();
}

View File

@ -1,18 +1,19 @@
package de.frajul.endlessroll.views;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import de.frajul.endlessroll.R;
import de.frajul.endlessroll.entities.shapes.PlayerShape;
import de.frajul.endlessroll.entities.shapes.PlayerShapeButtonOnClickListener;
import de.frajul.endlessroll.main.GameLog;
import de.frajul.endlessroll.main.GameActivity;
/**
* Created by Julian on 22.10.2017.
@ -28,16 +29,26 @@ public class PlayerShapeButton implements View.OnClickListener {
private Button button;
private Animation rotation;
public PlayerShapeButton(Context context, PlayerShape playerShape, PlayerShapeButtonOnClickListener clickListener) {
public PlayerShapeButton(GameActivity gameActivity, PlayerShape playerShape, PlayerShapeButtonOnClickListener clickListener, boolean marginToRight) {
this.clickListener = clickListener;
this.playerShape = playerShape;
view = LayoutInflater.from(context).inflate(R.layout.shape_button, null);
view = LayoutInflater.from(gameActivity).inflate(R.layout.shape_button, null);
view.setLayoutParams(createLayoutParams(marginToRight));
textView = (TextView) view.findViewById(R.id.shape_button_textview);
textView.setTypeface(gameActivity.getTypeface());
textView.setText(playerShape.getNameId());
button = (Button) view.findViewById(R.id.shape_button_button);
button.setBackgroundDrawable(context.getResources().getDrawable(playerShape.getDrawableId()));
button.setBackgroundDrawable(gameActivity.getResources().getDrawable(playerShape.getDrawableId()));
button.setOnClickListener(this);
rotation = AnimationUtils.loadAnimation(context, R.anim.shape_button_rotation);
rotation = AnimationUtils.loadAnimation(gameActivity, R.anim.shape_button_rotation);
}
private LinearLayout.LayoutParams createLayoutParams(boolean marginToRight){
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
if(marginToRight)
params.setMargins(0, 0, 60, 0);
return params;
}
public void startRotating() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -10,12 +10,12 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/button_placeholder"
android:textSize="25sp"/>
android:textSize="30sp"/>
<Button
android:id="@+id/shape_button_button"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/playershapes_ball"/>

View File

@ -13,43 +13,43 @@
android:layout_gravity="top"
android:layout_marginBottom="5dp"/>
<HorizontalScrollView
android:id="@+id/horizontalScrollView"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
android:orientation="vertical">
<TableLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="*">
android:layout_weight="1">
<TableRow
<LinearLayout
android:id="@+id/shape_shop_topRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal"/>
<!--Will be removed before content is added. Just there because android 7.0 doesn't like empty tableRows ;-) -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
</TableRow>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<TableRow
<LinearLayout
android:id="@+id/shape_shop_bottomRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal"/>
<!--Will be removed before content is added. Just there because android 7.0 doesn't like empty tableRows ;-) -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
</RelativeLayout>
</TableLayout>
</HorizontalScrollView>
</LinearLayout>
</LinearLayout>

View File

@ -47,6 +47,8 @@
<string name="playershape_name_hypno_spiral">Hypno</string>
<string name="playershape_name_pacman">Pacman</string>
<string name="playershape_name_smiley">Smiley</string>
<string name="playershape_name_wheel">Wheel</string>
<string name="playershape_name_sun">Sun</string>
<string name="tool_name_unknown">\?\?\?</string>
<string name="tool_name_ramp">Ramp</string>