added hiding/showing stages

This commit is contained in:
unknown 2014-06-03 19:22:56 +03:00
parent c9f5696e7a
commit 4e5b293e32
2 changed files with 54 additions and 21 deletions

View file

@ -24,6 +24,30 @@
android:text="Itenerary"/>
</RelativeLayout>
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
>
<Button android:id="@+id/collapse"
android:layout_width="30dp"
android:text="-"
android:background="@color/color_black"
android:layout_height="30dp"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:textSize="20dp"
android:layout_toRightOf="@+id/collapse"
android:textColor="@color/color_black"
android:text="Stages"/>
</RelativeLayout>
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -39,14 +63,6 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:textColor="@color/color_black"
android:id="@+id/tour_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textSize="25sp" >
</TextView>
<TextView
android:textColor="@color/color_black"

View file

@ -24,9 +24,10 @@ public class TourViewActivity extends SherlockFragmentActivity {
ImageView img;
TextView description;
TextView fullDescription;
TextView name;
List<TourInformation.StageInformation> stages_info;
TourInformation cur_tour;
RadioGroup stages;
@Override
@ -44,6 +45,33 @@ public class TourViewActivity extends SherlockFragmentActivity {
getMyApplication().checkApplicationIsBeingInitialized(this, startProgressDialog);
setContentView(R.layout.custom_tour_info);
Button collapser = (Button) findViewById(R.id.collapse);
stages = (RadioGroup) findViewById(R.id.stages);
collapser.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Button btn = (Button) view;
if (btn.getText().equals("+")){
btn.setText("-");
stages.setVisibility(View.VISIBLE);
} else{
btn.setText("+");
stages.setVisibility(View.GONE);
}
}
});
Button settings = (Button) findViewById(R.id.btn_settings);
settings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), SherpafyStartActivity.class);
intent.putExtra("settings", "settings");
startActivity(intent);
}
});
}
@Override
@ -63,12 +91,10 @@ public class TourViewActivity extends SherlockFragmentActivity {
description.setVisibility(View.VISIBLE);
fullDescription = (TextView) findViewById(R.id.tour_fulldescription);
fullDescription.setVisibility(View.VISIBLE);
name = (TextView) findViewById(R.id.tour_name);
Button start_tour = (Button) findViewById(R.id.start_tour);
Button itenerary = (Button) findViewById(R.id.itenerary);
Button settings = (Button) findViewById(R.id.btn_settings);
RadioGroup stages = (RadioGroup) findViewById(R.id.stages);
//in case of reloading view - remove all previous radio buttons
stages.removeAllViews();
start_tour.setOnClickListener(new View.OnClickListener() {
@ -97,14 +123,6 @@ public class TourViewActivity extends SherlockFragmentActivity {
}
});
settings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), SherpafyStartActivity.class);
intent.putExtra("settings", "settings");
startActivity(intent);
}
});
//get count of radio buttons
@ -122,7 +140,6 @@ public class TourViewActivity extends SherlockFragmentActivity {
TourInformation.StageInformation cur_stage = customization.getSelectedStage();
name.setText(cur_tour.getName());
//if there's no current stage - overview should be selected
if (cur_stage == null) {