Fix small bugs
This commit is contained in:
parent
918da65e63
commit
d66b9c1bd8
6 changed files with 160 additions and 125 deletions
|
@ -15,7 +15,7 @@
|
||||||
android:id="@+id/select_tour"
|
android:id="@+id/select_tour"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="right|center_vertical"
|
android:gravity="center"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="@string/select_tour" />
|
android:text="@string/select_tour" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
android:id="@+id/download_tour"
|
android:id="@+id/download_tour"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="right|center_vertical"
|
android:gravity="center"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="@string/download_tour" />
|
android:text="@string/download_tour" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -17,18 +16,11 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textOn=""
|
android:textOn=""
|
||||||
android:textOff=""
|
android:textOff=""
|
||||||
|
android:textSize="21sp"
|
||||||
|
android:checked="true"
|
||||||
android:button="@drawable/expandable_category"
|
android:button="@drawable/expandable_category"
|
||||||
android:background="@null" />
|
android:background="@null" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tour_name"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="@string/select_tour"
|
|
||||||
android:textSize="21sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -593,7 +593,7 @@ public class OsmandApplication extends Application {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(pb != null) {
|
if(pb != null) {
|
||||||
|
pb.run();
|
||||||
}
|
}
|
||||||
if (toDismiss != null) {
|
if (toDismiss != null) {
|
||||||
// TODO handling this dialog is bad, we need a better standard way
|
// TODO handling this dialog is bad, we need a better standard way
|
||||||
|
|
|
@ -170,11 +170,13 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
return selectedStage;
|
return selectedStage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectStage(StageInformation tour, IProgress progress) {
|
public void selectStage(StageInformation stage, IProgress progress) {
|
||||||
if(tour == null) {
|
if(stage == null) {
|
||||||
selectedStagePref.set(null);
|
selectedStagePref.set(null);
|
||||||
|
selectedStage = null;
|
||||||
} else {
|
} else {
|
||||||
selectedStagePref.set(tour.getName());
|
selectedStagePref.set(stage.getName());
|
||||||
|
selectedStage = stage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,9 +79,13 @@ public class TourInformation {
|
||||||
stage.description = text;
|
stage.description = text;
|
||||||
} else if(stage != null && tag.equals("fullDescription")) {
|
} else if(stage != null && tag.equals("fullDescription")) {
|
||||||
stage.fullDescription = text;
|
stage.fullDescription = text;
|
||||||
|
} else if(stage != null && tag.equals("image")) {
|
||||||
|
if(text.startsWith(FILE_PREFIX)) {
|
||||||
|
stage.imgFile = getFile(text);
|
||||||
|
}
|
||||||
} else if(stage != null && tag.equals("gpx")) {
|
} else if(stage != null && tag.equals("gpx")) {
|
||||||
if(text.startsWith(FILE_PREFIX)) {
|
if(text.startsWith(FILE_PREFIX)) {
|
||||||
stage.gpxFile = new File(folder, text.substring(FILE_PREFIX.length()));
|
stage.gpxFile = getFile(text);
|
||||||
}
|
}
|
||||||
} else if(tag.equals("fullDescription")) {
|
} else if(tag.equals("fullDescription")) {
|
||||||
fulldescription = text;
|
fulldescription = text;
|
||||||
|
@ -89,7 +93,7 @@ public class TourInformation {
|
||||||
shortDescription = text;
|
shortDescription = text;
|
||||||
} else if(tag.equals("defaultImage")) {
|
} else if(tag.equals("defaultImage")) {
|
||||||
if(text.startsWith(FILE_PREFIX)) {
|
if(text.startsWith(FILE_PREFIX)) {
|
||||||
imgFile = new File(folder, text.substring(FILE_PREFIX.length()));
|
imgFile = getFile(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
text = "";
|
text = "";
|
||||||
|
@ -98,6 +102,11 @@ public class TourInformation {
|
||||||
reader.close();
|
reader.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private File getFile(String text) {
|
||||||
|
return new File(folder, text.substring(FILE_PREFIX.length()));
|
||||||
|
}
|
||||||
|
|
||||||
private String getDefAttribute(XmlPullParser parser, String string, String def) {
|
private String getDefAttribute(XmlPullParser parser, String string, String def) {
|
||||||
String vl = parser.getAttributeValue("", string);
|
String vl = parser.getAttributeValue("", string);
|
||||||
if(vl != null && vl.length() > 0) {
|
if(vl != null && vl.length() > 0) {
|
||||||
|
@ -142,6 +151,8 @@ public class TourInformation {
|
||||||
String name = "";
|
String name = "";
|
||||||
String description = "";
|
String description = "";
|
||||||
String fullDescription = "";
|
String fullDescription = "";
|
||||||
|
Bitmap img = null;
|
||||||
|
File imgFile;
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
|
@ -159,6 +170,13 @@ public class TourInformation {
|
||||||
return gpxFile;
|
return gpxFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Bitmap getImageBitmap() {
|
||||||
|
if(img == null && imgFile != null && imgFile.exists()) {
|
||||||
|
img = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.DownloadIndexActivity;
|
import net.osmand.plus.activities.DownloadIndexActivity;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.sherpafy.TourInformation.StageInformation;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
|
@ -16,8 +17,8 @@ import android.content.pm.ActivityInfo;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
@ -42,14 +43,13 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
private static final int STATE_TOUR_VIEW = 1;
|
private static final int STATE_TOUR_VIEW = 1;
|
||||||
private static final int STATE_LOADING = 0;
|
private static final int STATE_LOADING = 0;
|
||||||
private static final int STATE_SELECT_TOUR = -1;
|
private static final int STATE_SELECT_TOUR = -1;
|
||||||
int state = 0;
|
private static int state = STATE_LOADING;
|
||||||
private SherpafyCustomization customization;
|
private SherpafyCustomization customization;
|
||||||
ImageView img;
|
ImageView img;
|
||||||
TextView description;
|
TextView description;
|
||||||
TextView fullDescription;
|
TextView fullDescription;
|
||||||
List<TourInformation.StageInformation> stagesInfo;
|
|
||||||
TourInformation curTour;
|
|
||||||
RadioGroup stages;
|
RadioGroup stages;
|
||||||
|
private ToggleButton collapser;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,14 +69,23 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
getSupportActionBar().setTitle(R.string.sherpafy_app_name);
|
getSupportActionBar().setTitle(R.string.sherpafy_app_name);
|
||||||
|
|
||||||
setContentView(R.layout.sherpafy_loading);
|
setContentView(R.layout.sherpafy_loading);
|
||||||
state = STATE_LOADING;
|
if (state == STATE_LOADING) {
|
||||||
getMyApplication().checkApplicationIsBeingInitialized(this, (TextView) findViewById(R.id.ProgressMessage),
|
getMyApplication().checkApplicationIsBeingInitialized(this, (TextView) findViewById(R.id.ProgressMessage),
|
||||||
(ProgressBar) findViewById(R.id.ProgressBar), new Runnable() {
|
(ProgressBar) findViewById(R.id.ProgressBar), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
setMainContent();
|
if(customization.getSelectedTour() != null) {
|
||||||
|
startTourView();
|
||||||
|
} else {
|
||||||
|
startSettings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if(state == STATE_SELECT_TOUR ){
|
||||||
|
startSettings();
|
||||||
|
} else if(state == STATE_TOUR_VIEW){
|
||||||
|
startTourView();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,24 +93,20 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
private void setTourInfoContent() {
|
private void setTourInfoContent() {
|
||||||
setContentView(R.layout.sherpafy_tour_info);
|
setContentView(R.layout.sherpafy_tour_info);
|
||||||
|
|
||||||
ToggleButton collapser = (ToggleButton) findViewById(R.id.collapse);
|
collapser = (ToggleButton) findViewById(R.id.collapse);
|
||||||
stages = (RadioGroup) findViewById(R.id.stages);
|
stages = (RadioGroup) findViewById(R.id.stages);
|
||||||
stages.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
stages.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(RadioGroup radioGroup, int i) {
|
public void onCheckedChanged(RadioGroup radioGroup, int i) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
customization.selectStage(null, IProgress.EMPTY_PROGRESS);
|
customization.selectStage(null, IProgress.EMPTY_PROGRESS);
|
||||||
fullDescription.setText(curTour.getFulldescription());
|
|
||||||
description.setText((curTour.getShortDescription()));
|
|
||||||
((TextView)findViewById(R.id.tour_name)).setText(getString(R.string.overview));
|
|
||||||
prepareBitmap();
|
|
||||||
} else {
|
} else {
|
||||||
customization.selectStage(stagesInfo.get(i - 1), IProgress.EMPTY_PROGRESS);
|
final StageInformation st = customization.getSelectedTour().getStageInformation().get(i - 1);
|
||||||
description.setText(stagesInfo.get(i - 1).getDescription());
|
customization.selectStage(st, IProgress.EMPTY_PROGRESS);
|
||||||
fullDescription.setText(stagesInfo.get(i - 1).getFullDescription());
|
|
||||||
((TextView)findViewById(R.id.tour_name)).setText(stagesInfo.get(i - 1).getName());
|
|
||||||
}
|
}
|
||||||
|
updateTourContentView();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
collapser.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
collapser.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@ -117,6 +122,30 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateTourContentView() {
|
||||||
|
if (customization.getSelectedStage() == null) {
|
||||||
|
if (customization.getSelectedTour() != null) {
|
||||||
|
TourInformation curTour = customization.getSelectedTour();
|
||||||
|
fullDescription.setText(curTour.getFulldescription());
|
||||||
|
description.setText((curTour.getShortDescription()));
|
||||||
|
// ((TextView)findViewById(R.id.tour_name)).setText(getString(R.string.overview));
|
||||||
|
collapser.setText(getString(R.string.overview));
|
||||||
|
collapser.setTextOff(getString(R.string.overview));
|
||||||
|
collapser.setTextOn(getString(R.string.overview));
|
||||||
|
prepareBitmap(curTour.getImageBitmap());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
StageInformation st = customization.getSelectedStage();
|
||||||
|
description.setText(st.getDescription());
|
||||||
|
fullDescription.setText(st.getFullDescription());
|
||||||
|
// ((TextView)findViewById(R.id.tour_name)).setText(st.getName());
|
||||||
|
collapser.setText(st.getName());
|
||||||
|
collapser.setTextOff(st.getName());
|
||||||
|
collapser.setTextOn(st.getName());
|
||||||
|
prepareBitmap(st.getImageBitmap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void startSettings() {
|
private void startSettings() {
|
||||||
if(state != STATE_SELECT_TOUR) {
|
if(state != STATE_SELECT_TOUR) {
|
||||||
setTourSelectionContentView();
|
setTourSelectionContentView();
|
||||||
|
@ -135,28 +164,20 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMainContent() {
|
|
||||||
if(customization.getSelectedTour() != null) {
|
|
||||||
startTourView();
|
|
||||||
} else {
|
|
||||||
startSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
|
public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
|
||||||
if (state == STATE_SELECT_TOUR) {
|
if (state == STATE_TOUR_VIEW) {
|
||||||
createMenuItem(menu, GO_TO_MAP, R.string.start_tour, 0, 0,/* R.drawable.ic_action_marker_light, */
|
createMenuItem(menu, GO_TO_MAP, R.string.start_tour, 0, 0,/* R.drawable.ic_action_marker_light, */
|
||||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||||
createMenuItem(menu, SETTINGS_ID, R.string.osmo_share_session, R.drawable.ic_action_settings_light,
|
createMenuItem(menu, SETTINGS_ID, R.string.settings, R.drawable.ic_action_settings_light,
|
||||||
R.drawable.ic_action_settings_dark, MenuItem.SHOW_AS_ACTION_IF_ROOM
|
R.drawable.ic_action_settings_dark, MenuItem.SHOW_AS_ACTION_IF_ROOM
|
||||||
| MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
| MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||||
} else if(state == STATE_TOUR_VIEW) {
|
} else if(state == STATE_SELECT_TOUR) {
|
||||||
if (customization.isTourSelected()) {
|
if (customization.isTourSelected()) {
|
||||||
createMenuItem(menu, TOUR_ID, R.string.osmo_share_session, R.drawable.ic_action_ok_light,
|
createMenuItem(menu, TOUR_ID, R.string.default_buttons_ok, R.drawable.ic_action_ok_light,
|
||||||
R.drawable.ic_action_ok_dark, MenuItem.SHOW_AS_ACTION_IF_ROOM
|
R.drawable.ic_action_ok_dark, MenuItem.SHOW_AS_ACTION_IF_ROOM
|
||||||
| MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
| MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||||
}
|
}
|
||||||
|
@ -182,8 +203,8 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
|
|
||||||
|
|
||||||
private void updateTourView() {
|
private void updateTourView() {
|
||||||
curTour = customization.getSelectedTour();
|
TourInformation curTour = customization.getSelectedTour();
|
||||||
stagesInfo = curTour.getStageInformation();
|
List<StageInformation> stagesInfo = curTour.getStageInformation();
|
||||||
|
|
||||||
img = (ImageView) findViewById(R.id.tour_image);
|
img = (ImageView) findViewById(R.id.tour_image);
|
||||||
description = (TextView) findViewById(R.id.tour_description);
|
description = (TextView) findViewById(R.id.tour_description);
|
||||||
|
@ -210,24 +231,21 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
rb[i].setText(stagesInfo.get(i - 1).getName());
|
rb[i].setText(stagesInfo.get(i - 1).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
TourInformation.StageInformation curStage = customization.getSelectedStage();
|
StageInformation stage = customization.getSelectedStage();
|
||||||
if (curStage == null) {
|
|
||||||
stages.check(0);
|
int i = 0;
|
||||||
description.setText(curTour.getShortDescription());
|
if (stage != null) {
|
||||||
fullDescription.setText(curTour.getFulldescription());
|
|
||||||
prepareBitmap();
|
|
||||||
} else {
|
|
||||||
int i;
|
|
||||||
for (i = 1; i < count; i++) {
|
for (i = 1; i < count; i++) {
|
||||||
if (curStage.equals(stagesInfo.get(i - 1)))
|
if (stage == stagesInfo.get(i - 1))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (i != count) {
|
if (i != count) {
|
||||||
stages.check(i);
|
stages.check(i);
|
||||||
} else {
|
} else {
|
||||||
stages.check(0);
|
stages.check(0);
|
||||||
}
|
}
|
||||||
}
|
// updateTourContentView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void goToMap() {
|
private void goToMap() {
|
||||||
|
@ -235,8 +253,7 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
// TODO select GPX
|
// TODO select GPX
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareBitmap() {
|
private void prepareBitmap(Bitmap imageBitmap) {
|
||||||
final Bitmap imageBitmap = curTour.getImageBitmap();
|
|
||||||
if (imageBitmap != null) {
|
if (imageBitmap != null) {
|
||||||
img.setImageBitmap(imageBitmap);
|
img.setImageBitmap(imageBitmap);
|
||||||
img.setAdjustViewBounds(true);
|
img.setAdjustViewBounds(true);
|
||||||
|
@ -272,14 +289,31 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
|
|
||||||
private void setTourSelectionContentView() {
|
private void setTourSelectionContentView() {
|
||||||
setContentView(R.layout.sherpafy_start);
|
setContentView(R.layout.sherpafy_start);
|
||||||
final Button selectTour = (Button) findViewById(R.id.select_tour);
|
|
||||||
final Button downloadTour = (Button) findViewById(R.id.download_tour);
|
final Button downloadTour = (Button) findViewById(R.id.download_tour);
|
||||||
int width = Math.max(downloadTour.getWidth(), selectTour.getWidth());
|
final Button selectTour = (Button) findViewById(R.id.select_tour);
|
||||||
downloadTour.setWidth(width);
|
if(customization.getTourInformations().isEmpty()) {
|
||||||
selectTour.setWidth(width);
|
((ViewGroup)selectTour.getParent()).setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
((ViewGroup) selectTour.getParent()).setVisibility(View.VISIBLE);
|
||||||
selectTour.setOnClickListener(new View.OnClickListener() {
|
selectTour.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
selectTourDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadTour.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final Intent download = new Intent(v.getContext(), DownloadIndexActivity.class);
|
||||||
|
download.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
v.getContext().startActivity(download);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectTourDialog() {
|
||||||
// creating alert dialog with multiple tours to select
|
// creating alert dialog with multiple tours to select
|
||||||
AlertDialog.Builder adb = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder adb = new AlertDialog.Builder(getActivity());
|
||||||
final List<TourInformation> tours = customization.getTourInformations();
|
final List<TourInformation> tours = customization.getTourInformations();
|
||||||
|
@ -300,7 +334,7 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
selectTour(tours.get(i));
|
selectTourAsync(tours.get(i));
|
||||||
dialogInterface.dismiss();
|
dialogInterface.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -317,7 +351,7 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectTour(tours.get(i - 1));
|
selectTourAsync(tours.get(i - 1));
|
||||||
dialogInterface.dismiss();
|
dialogInterface.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -327,24 +361,13 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
adb.setNegativeButton(R.string.default_buttons_cancel, null);
|
adb.setNegativeButton(R.string.default_buttons_cancel, null);
|
||||||
adb.show();
|
adb.show();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
downloadTour.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
final Intent download = new Intent(v.getContext(), DownloadIndexActivity.class);
|
|
||||||
download.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
||||||
v.getContext().startActivity(download);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private Activity getActivity() {
|
private Activity getActivity() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectTour(final TourInformation tour){
|
private void selectTourAsync(final TourInformation tour){
|
||||||
new AsyncTask<TourInformation, Void, Void>(){
|
new AsyncTask<TourInformation, Void, Void>(){
|
||||||
private ProgressDialog dlg;
|
private ProgressDialog dlg;
|
||||||
|
|
||||||
|
@ -363,7 +386,7 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
|
|
||||||
protected void onPostExecute(Void result) {
|
protected void onPostExecute(Void result) {
|
||||||
dlg.dismiss();
|
dlg.dismiss();
|
||||||
setTourInfoContent();
|
startTourView();
|
||||||
};
|
};
|
||||||
}.execute(tour);
|
}.execute(tour);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue