Update sherpafy
This commit is contained in:
parent
2655856f1a
commit
ba8ce4db62
7 changed files with 99 additions and 84 deletions
5
OsmAnd/res/drawable/divider.xml
Normal file
5
OsmAnd/res/drawable/divider.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<gradient android:startColor="#ffcdcdcd" android:endColor="#ffcdcdcd" android:angle="270.0" />
|
||||||
|
</shape>
|
|
@ -14,7 +14,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:choiceMode="singleChoice"
|
android:choiceMode="singleChoice"
|
||||||
android:divider="@android:color/transparent"
|
android:divider="@drawable/divider"
|
||||||
android:dividerHeight="0dp"
|
android:dividerHeight="1px"
|
||||||
android:background="#111"/>
|
android:background="#b1b1b1"/>
|
||||||
</android.support.v4.widget.DrawerLayout>
|
</android.support.v4.widget.DrawerLayout>
|
39
OsmAnd/res/layout/sherpafy_drawer_list_item.xml
Normal file
39
OsmAnd/res/layout/sherpafy_drawer_list_item.xml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal" android:background="@color/color_white"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="10dp">
|
||||||
|
|
||||||
|
<FrameLayout >
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/TourImage"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/TourName"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:background="@color/shadow_color"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textColor="@color/color_white"
|
||||||
|
/>
|
||||||
|
</FrameLayout>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/TourDescription"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="3"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -2,38 +2,52 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal" android:background="@color/color_white"
|
android:layout_marginBottom="10dp"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginTop="15dp"
|
||||||
android:layout_marginRight="5dp"
|
android:background="#fafafa"
|
||||||
android:layout_marginTop="10dp"
|
android:orientation="vertical"
|
||||||
android:layout_marginBottom="10dp">
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingRight="5dp" >
|
||||||
|
|
||||||
<FrameLayout >
|
<FrameLayout
|
||||||
<ImageView
|
android:layout_width="match_parent"
|
||||||
android:id="@+id/TourImage"
|
android:layout_height="wrap_content" >
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"/>
|
<ImageView
|
||||||
<TextView
|
android:id="@+id/TourImage"
|
||||||
android:id="@+id/TourName"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content" />
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:maxLines="1"
|
<LinearLayout
|
||||||
android:background="@color/shadow_color"
|
android:layout_width="match_parent"
|
||||||
android:ellipsize="end"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="20sp"
|
android:background="@color/shadow_color"
|
||||||
android:textColor="@color/color_white"
|
android:gravity="bottom"
|
||||||
/>
|
android:paddingBottom="5dp"
|
||||||
|
android:paddingLeft="7dp"
|
||||||
|
android:paddingTop="5dp" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/TourName"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="@color/color_white"
|
||||||
|
android:textSize="24sp" />
|
||||||
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/TourDescription"
|
android:id="@+id/TourDescription"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:maxLines="3"
|
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:textSize="20sp"
|
android:maxLines="3"
|
||||||
android:layout_marginTop="5dp"
|
android:paddingLeft="5dp"
|
||||||
android:layout_marginLeft="5dp"
|
android:paddingRight="5dp"
|
||||||
android:layout_marginRight="5dp"
|
android:paddingTop="10dp"
|
||||||
android:layout_weight="1"/>
|
android:textSize="18sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -20,7 +20,12 @@ public class SherpafyLoadingFragment extends SherlockFragment {
|
||||||
public View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container,
|
public View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
view = inflater.inflate(R.layout.sherpafy_loading, container, false);
|
view = inflater.inflate(R.layout.sherpafy_loading, container, false);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(final View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
app.checkApplicationIsBeingInitialized(getActivity(), (TextView) view.findViewById(R.id.ProgressMessage),
|
app.checkApplicationIsBeingInitialized(getActivity(), (TextView) view.findViewById(R.id.ProgressMessage),
|
||||||
(ProgressBar) view.findViewById(R.id.ProgressBar), new Runnable() {
|
(ProgressBar) view.findViewById(R.id.ProgressBar), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -30,7 +35,6 @@ public class SherpafyLoadingFragment extends SherlockFragment {
|
||||||
((TourViewActivity)getSherlockActivity()).loadingFinished();
|
((TourViewActivity)getSherlockActivity()).loadingFinished();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return view;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -50,6 +50,7 @@ public class SherpafyToursFragment extends SherlockListFragment {
|
||||||
custom = (SherpafyCustomization) app.getAppCustomization();
|
custom = (SherpafyCustomization) app.getAppCustomization();
|
||||||
TourAdapter tourAdapter = new TourAdapter(custom.getTourInformations());
|
TourAdapter tourAdapter = new TourAdapter(custom.getTourInformations());
|
||||||
setListAdapter(tourAdapter);
|
setListAdapter(tourAdapter);
|
||||||
|
getListView().setBackgroundColor(0x00eeeeee);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,10 +59,11 @@ public class SherpafyToursFragment extends SherlockListFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
OsmandApplication app = (OsmandApplication) getActivity().getApplication();
|
|
||||||
boolean light = true; //app.getSettings().isLightActionBar();
|
|
||||||
com.actionbarsherlock.view.MenuItem menuItem = menu.add(0, ACTION_DOWNLOAD, 0, R.string.download_tours).setShowAsActionFlags(
|
com.actionbarsherlock.view.MenuItem menuItem = menu.add(0, ACTION_DOWNLOAD, 0, R.string.download_tours).setShowAsActionFlags(
|
||||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||||
|
// OsmandApplication app = (OsmandApplication) getActivity().getApplication();
|
||||||
|
// boolean light = true; //app.getSettings().isLightActionBar();
|
||||||
//menuItem = menuItem.setIcon(light ? R.drawable.ic_action_gdirections_light : R.drawable.ic_action_gdirections_dark);
|
//menuItem = menuItem.setIcon(light ? R.drawable.ic_action_gdirections_light : R.drawable.ic_action_gdirections_dark);
|
||||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,13 +12,8 @@ import net.osmand.plus.GPXUtilities.WptPt;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.OsmandApplication;
|
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.sherpafy.TourInformation.StageInformation;
|
import net.osmand.plus.sherpafy.TourInformation.StageInformation;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.AlertDialog.Builder;
|
|
||||||
import android.app.ProgressDialog;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
@ -26,41 +21,31 @@ import android.graphics.Bitmap;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.ActionBarDrawerToggle;
|
import android.support.v4.app.ActionBarDrawerToggle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v4.widget.DrawerLayout.DrawerListener;
|
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.Html.ImageGetter;
|
import android.text.Html.ImageGetter;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.EditorInfo;
|
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.LinearLayout.LayoutParams;
|
import android.widget.LinearLayout.LayoutParams;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
import android.widget.ToggleButton;
|
import android.widget.ToggleButton;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragment;
|
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
@ -153,6 +138,7 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
selectMenu(position, drawerAdapter.getItem(position));
|
selectMenu(position, drawerAdapter.getItem(position));
|
||||||
|
mDrawerLayout.closeDrawer(mDrawerList);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -163,20 +149,7 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
.commit();
|
.commit();
|
||||||
|
|
||||||
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer_light,
|
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer_light,
|
||||||
R.string.default_buttons_other_actions, R.string.close) {
|
R.string.default_buttons_other_actions, R.string.close);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDrawerOpened(View view) {
|
|
||||||
super.onDrawerOpened(view);
|
|
||||||
invalidateOptionsMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDrawerClosed(View view) {
|
|
||||||
super.onDrawerOpened(view);
|
|
||||||
invalidateOptionsMenu();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void selectMenu(int position, Object item) {
|
protected void selectMenu(int position, Object item) {
|
||||||
|
@ -260,20 +233,6 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
// TourInformation selectedTour = customization.getSelectedTour();
|
|
||||||
// if (selectedTour == null || currentTourInformations.contains(selectedTour)) {
|
|
||||||
// for (TourInformation i : customization.getTourInformations()) {
|
|
||||||
// if (!currentTourInformations.contains(i)) {
|
|
||||||
// currentTourInformations.add(i);
|
|
||||||
// selectedTour = i;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (selectedTour != null) {
|
|
||||||
// selectTourAsync(selectedTour);
|
|
||||||
// // startTourView();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTourInfoContent() {
|
private void setTourInfoContent() {
|
||||||
|
@ -392,19 +351,11 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
|
public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
|
||||||
if (state == STATE_TOUR_VIEW) {
|
|
||||||
// createMenuItem(menu, ACTION_GO_TO_MAP, R.string.start_tour, 0, 0,/* R.drawable.ic_action_marker_light, */
|
// createMenuItem(menu, ACTION_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, ACTION_SETTINGS_ID, R.string.settings, R.drawable.ic_action_settings_light,
|
// createMenuItem(menu, ACTION_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_SELECT_TOUR) {
|
|
||||||
if (customization.isTourSelected()) {
|
|
||||||
createMenuItem(menu, ACTION_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
|
|
||||||
| MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue