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

Fix: Enhancement in scenarios UI #1427

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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,9 +14,12 @@
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.view.View;
import android.util.TypedValue;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
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 @@ -359,6 +363,7 @@ public void onBackPressed(){
// The flag FLAG_ACTIVITY_CLEAR_TOP checks if an instance of the activity is present and it
// clears the activities that were created after the found instance of the required activity
startActivity(new Intent(GameActivity.this, MapActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
overridePendingTransition(R.animator.fade_in_custom, R.animator.fade_out_custom);
finish();
}
}
Expand Down Expand Up @@ -472,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
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
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.view.View;
import android.util.TypedValue;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
Expand Down Expand Up @@ -63,6 +66,7 @@ public class GameLevel2Activity extends Activity implements GameScreenLevel2Cont
private ArrayAdapter<String> listAdapter;
private static boolean isStateChanged = false;
private Context context;
private ImageView parent;
private GameScreenLevel2Presenter presenter;
//avatar views
@BindView(R.id.eye_view)
Expand Down Expand Up @@ -353,6 +357,7 @@ public void onBackPressed(){
// The flag FLAG_ACTIVITY_CLEAR_TOP checks if an instance of the activity is present and it
// clears the activities that were created after the found instance of the required activity
startActivity(new Intent(GameLevel2Activity.this, MapLevel2Activity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
overridePendingTransition(R.animator.fade_in_custom, R.animator.fade_out_custom);
finish();
}
}
Expand All @@ -364,6 +369,7 @@ public void gotToMapDialogue(){
builder.setPositiveButton(getString(R.string.game_confirm_message), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
startActivity(new Intent(GameLevel2Activity.this, MapLevel2Activity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
overridePendingTransition(R.animator.fade_in_custom, R.animator.fade_out_custom);
SessionHistory.totalPoints -= SessionHistory.currScenePoints;
finish();
dataSource.setReplayedScenario(scene.getScenarioName());
Expand Down Expand Up @@ -466,6 +472,30 @@ 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, 50, 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.activity_game_level_2);
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, 65, 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.activity_game_level_2);
constraintSet.connect(R.id.askerImageView, ConstraintSet.BOTTOM, R.id.root, ConstraintSet.BOTTOM, pxValue);
constraintSet.applyTo(constraintLayout);
}
}

@Override
Expand Down