Update sherpafy

This commit is contained in:
Victor Shcherb 2014-07-20 03:17:05 +02:00
parent 2655856f1a
commit ba8ce4db62
7 changed files with 99 additions and 84 deletions

View 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>

View file

@ -14,7 +14,7 @@
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
android:divider="@drawable/divider"
android:dividerHeight="1px"
android:background="#b1b1b1"/>
</android.support.v4.widget.DrawerLayout>

View 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>

View file

@ -2,38 +2,52 @@
<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">
android:layout_marginBottom="10dp"
android:layout_marginTop="15dp"
android:background="#fafafa"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<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
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/TourImage"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/shadow_color"
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>
<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"/>
android:maxLines="3"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="10dp"
android:textSize="18sp" />
</LinearLayout>

View file

@ -20,7 +20,12 @@ public class SherpafyLoadingFragment extends SherlockFragment {
public View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container,
Bundle savedInstanceState) {
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),
(ProgressBar) view.findViewById(R.id.ProgressBar), new Runnable() {
@Override
@ -30,7 +35,6 @@ public class SherpafyLoadingFragment extends SherlockFragment {
((TourViewActivity)getSherlockActivity()).loadingFinished();
}
});
return view;
}
}

View file

@ -50,6 +50,7 @@ public class SherpafyToursFragment extends SherlockListFragment {
custom = (SherpafyCustomization) app.getAppCustomization();
TourAdapter tourAdapter = new TourAdapter(custom.getTourInformations());
setListAdapter(tourAdapter);
getListView().setBackgroundColor(0x00eeeeee);
}
@Override
@ -58,10 +59,11 @@ public class SherpafyToursFragment extends SherlockListFragment {
@Override
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(
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.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override

View file

@ -12,13 +12,8 @@ import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.DownloadIndexActivity;
import net.osmand.plus.sherpafy.TourInformation.StageInformation;
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.pm.ActivityInfo;
import android.content.res.Configuration;
@ -26,41 +21,31 @@ import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.DrawerLayout.DrawerListener;
import android.text.Html;
import android.text.Html.ImageGetter;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;
import com.actionbarsherlock.app.SherlockFragment;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
@ -153,6 +138,7 @@ public class TourViewActivity extends SherlockFragmentActivity {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectMenu(position, drawerAdapter.getItem(position));
mDrawerLayout.closeDrawer(mDrawerList);
}
});
@ -163,20 +149,7 @@ public class TourViewActivity extends SherlockFragmentActivity {
.commit();
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer_light,
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();
}
};
R.string.default_buttons_other_actions, R.string.close);
}
protected void selectMenu(int position, Object item) {
@ -260,20 +233,6 @@ public class TourViewActivity extends SherlockFragmentActivity {
@Override
protected void 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() {
@ -392,19 +351,11 @@ public class TourViewActivity extends SherlockFragmentActivity {
@Override
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, */
// 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,
// R.drawable.ic_action_settings_dark, MenuItem.SHOW_AS_ACTION_IF_ROOM
// | 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);
}