Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Fix: Enhance UI of Level 1 scenarios. #1421

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.constraint.ConstraintLayout;
import android.support.constraint.ConstraintSet;
import android.support.v7.app.AlertDialog;
import android.text.method.ScrollingMovementMethod;
import android.util.TypedValue;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
Expand Down Expand Up @@ -63,6 +66,7 @@ public class GameActivity extends Activity implements GameScreenContract.IGameSc
private Button goToMap;
private ArrayAdapter<String> listAdapter;
private Context context;
private ImageView parent;
private GameScreenPresenter presenter;
//avatar views
@BindView(R.id.askerImageView)
Expand Down Expand Up @@ -473,6 +477,29 @@ public void onClick(View v) {
@Override
public void setScenarioBackground(int id) {
findViewById(R.id.root).setBackground(getResources().getDrawable(PowerUpUtils.SCENARIO_BACKGROUNDS[id]));
//Change in the guardian or parent position with the change in the background
if(PowerUpUtils.SCENARIO_BACKGROUNDS[id]==R.drawable.hospital||PowerUpUtils.SCENARIO_BACKGROUNDS[id]==R.drawable.hospital_bg)
{
Context context = this;
int pxValue = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40, context.getResources().getDisplayMetrics());
ConstraintSet constraintSet = new ConstraintSet();
parent = (ImageView) findViewById(R.id.askerImageView);
ConstraintLayout constraintLayout = (ConstraintLayout) findViewById(R.id.root);
constraintSet.clone(context,R.layout.game_activity);
constraintSet.connect(R.id.askerImageView, ConstraintSet.TOP, R.id.root, ConstraintSet.TOP, pxValue);
constraintSet.applyTo(constraintLayout);
}
if(PowerUpUtils.SCENARIO_BACKGROUNDS[id]==R.drawable.library)
{
Context context = this;
int pxValue = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 80, context.getResources().getDisplayMetrics());
ConstraintSet constraintSet = new ConstraintSet();
parent = (ImageView) findViewById(R.id.askerImageView);
ConstraintLayout constraintLayout = (ConstraintLayout) findViewById(R.id.root);
constraintSet.clone(context,R.layout.game_activity);
constraintSet.connect(R.id.askerImageView, ConstraintSet.BOTTOM, R.id.root, ConstraintSet.BOTTOM, pxValue);
constraintSet.applyTo(constraintLayout);
}
}

@Override
Expand Down