Shapes can now be recieved through fulfilling tasks
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
package de.frajul.endlessroll.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -29,25 +28,29 @@ public class PlayerShapeButton implements View.OnClickListener {
|
||||
private Button button;
|
||||
private Animation rotation;
|
||||
|
||||
public PlayerShapeButton(GameActivity gameActivity, PlayerShape playerShape, PlayerShapeButtonOnClickListener clickListener, boolean marginToRight) {
|
||||
private boolean locked;
|
||||
|
||||
public PlayerShapeButton(GameActivity gameActivity, PlayerShape playerShape, PlayerShapeButtonOnClickListener clickListener, boolean locked, boolean marginToRight) {
|
||||
this.clickListener = clickListener;
|
||||
this.playerShape = playerShape;
|
||||
this.locked = locked;
|
||||
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());
|
||||
textView.setText(locked ? R.string.playershape_name_locked : playerShape.getNameId());
|
||||
button = (Button) view.findViewById(R.id.shape_button_button);
|
||||
button.setBackgroundDrawable(gameActivity.getResources().getDrawable(playerShape.getDrawableId()));
|
||||
button.setBackgroundDrawable(
|
||||
gameActivity.getResources().getDrawable(locked ? R.drawable.playershapes_locked : playerShape.getDrawableId()));
|
||||
button.setOnClickListener(this);
|
||||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -68,6 +71,10 @@ public class PlayerShapeButton implements View.OnClickListener {
|
||||
return view;
|
||||
}
|
||||
|
||||
public boolean isLocked() {
|
||||
return locked;
|
||||
}
|
||||
|
||||
public PlayerShape getPlayerShape() {
|
||||
return playerShape;
|
||||
}
|
||||
|
Reference in New Issue
Block a user