Changed old pop up dialogs to new. Updated local indexes size progress view
This commit is contained in:
parent
c39afc45f9
commit
37e46dd08c
19 changed files with 126 additions and 146 deletions
30
OsmAnd/res/drawable/size_progressbar_dark.xml
Normal file
30
OsmAnd/res/drawable/size_progressbar_dark.xml
Normal file
|
@ -0,0 +1,30 @@
|
|||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- Define the background properties like color etc -->
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="#475259"
|
||||
android:centerColor="#475259"
|
||||
android:centerY="1.0"
|
||||
android:endColor="#475259"
|
||||
android:angle="270"
|
||||
/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- Define the progress properties like start color, end color etc -->
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="@color/color_distance"
|
||||
android:centerColor="@color/color_distance"
|
||||
android:centerY="1.0"
|
||||
android:endColor="@color/color_distance"
|
||||
android:angle="270"
|
||||
/>
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
30
OsmAnd/res/drawable/size_progressbar_light.xml
Normal file
30
OsmAnd/res/drawable/size_progressbar_light.xml
Normal file
|
@ -0,0 +1,30 @@
|
|||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- Define the background properties like color etc -->
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="#475259"
|
||||
android:centerColor="#475259"
|
||||
android:centerY="1.0"
|
||||
android:endColor="#475259"
|
||||
android:angle="270"
|
||||
/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- Define the progress properties like start color, end color etc -->
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="@color/color_distance"
|
||||
android:centerColor="@color/color_distance"
|
||||
android:centerY="1.0"
|
||||
android:endColor="@color/color_distance"
|
||||
android:angle="270"
|
||||
/>
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -74,7 +74,7 @@
|
|||
android:orientation="horizontal">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/DeterminateProgressBar"
|
||||
android:id="@+id/memory_progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DescriptionText"
|
||||
android:id="@+id/memory_size"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
|
|
|
@ -9,35 +9,37 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/dialog_content_margin"
|
||||
android:paddingRight="@dimen/dialog_content_margin"
|
||||
android:paddingLeft="@dimen/dialog_content_bottom_margin"
|
||||
android:paddingRight="@dimen/dialog_content_bottom_margin"
|
||||
android:layout_marginBottom="@dimen/dialog_content_bottom_margin"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/local_size_height"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/device_memory"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DescriptionText"
|
||||
android:id="@+id/memory_size"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/free"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/DeterminateProgressBar"
|
||||
android:id="@+id/memory_progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:progressDrawable="?attr/size_progress_bar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
android:layout_height="20dp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DescriptionText"
|
||||
android:id="@+id/memory_size"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
android:text="@string/gpx_description_txt" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/DescriptionText"
|
||||
android:id="@+id/memory_size"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
<attr name="expandable_list_item_background" format="color"/>
|
||||
<attr name="expandable_list_background" format="color"/>
|
||||
<attr name="list_settings_icon" format="reference"/>
|
||||
<attr name="size_progress_bar" format="reference"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="PagerSlidingTabStrip">
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
<dimen name="dialog_elements_vertical_margin">16dp</dimen>
|
||||
<dimen name="dialog_content_margin">24dp</dimen>
|
||||
<dimen name="dialog_content_bottom_margin">16dp</dimen>
|
||||
<dimen name="local_size_height">34dp</dimen>
|
||||
|
||||
<!-- TextSizes -->
|
||||
<dimen name="list_header_text_size">14sp</dimen>
|
||||
|
|
|
@ -164,6 +164,7 @@
|
|||
<item name="expandable_list_item_background">@color/expandable_list_item_light</item>
|
||||
<item name="expandable_list_background">@color/color_white</item>
|
||||
<item name="list_settings_icon">@drawable/ic_overflow_menu_light</item>
|
||||
<item name="size_progress_bar">@drawable/size_progressbar_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
|
||||
|
@ -205,6 +206,7 @@
|
|||
<item name="expandable_list_item_background">@color/list_item_background_dark</item>
|
||||
<item name="expandable_list_background">@color/list_background_dark</item>
|
||||
<item name="list_settings_icon">@drawable/ic_overflow_menu_dark</item>
|
||||
<item name="size_progress_bar">@drawable/size_progressbar_light</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Styled.ActionBarDark" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.Locale;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Handler;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
|
@ -322,7 +321,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
enableSelectionMode(false);
|
||||
getView().findViewById(R.id.DescriptionText).setVisibility(View.GONE);
|
||||
getView().findViewById(R.id.memory_size).setVisibility(View.GONE);
|
||||
runSelection(false);
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
@ -384,15 +383,15 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
enableSelectionMode(false);
|
||||
getView().findViewById(R.id.DescriptionText).setVisibility(View.GONE);
|
||||
getView().findViewById(R.id.memory_size).setVisibility(View.GONE);
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (R.string.local_index_mi_upload_gpx == actionResId) {
|
||||
((TextView) getView().findViewById(R.id.DescriptionText)).setText(R.string.local_index_upload_gpx_description);
|
||||
((TextView) getView().findViewById(R.id.DescriptionText)).setVisibility(View.VISIBLE);
|
||||
((TextView) getView().findViewById(R.id.memory_size)).setText(R.string.local_index_upload_gpx_description);
|
||||
((TextView) getView().findViewById(R.id.memory_size)).setVisibility(View.VISIBLE);
|
||||
}
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.Comparator;
|
|||
import java.util.List;
|
||||
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.*;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
|
@ -115,18 +116,10 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
|
|||
FavouritePoint point = favouritesAdapter.getItem(position);
|
||||
String name = getString(R.string.favorite) + ": " + point.getName();
|
||||
LatLon location = new LatLon(point.getLatitude(), point.getLongitude());
|
||||
View.OnClickListener onshow = new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
settings.SHOW_FAVORITES.set(true);
|
||||
}
|
||||
};
|
||||
ContextMenuAdapter qa = new ContextMenuAdapter(v.getContext());
|
||||
qa.setAnchor(v);
|
||||
DirectionsDialogs.createDirectionsActions(qa, location, point, name, settings.getLastKnownMapZoom(), getActivity(),
|
||||
true, false);
|
||||
MapActivityActions.showObjectContextMenu(qa, getActivity(), onshow);
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, point, name, settings.getLastKnownMapZoom(),
|
||||
getActivity(), true, false);
|
||||
optionsMenu.show();
|
||||
} else {
|
||||
Intent intent = getActivity().getIntent();
|
||||
intent.putExtra(SELECT_FAVORITE_POINT_INTENT_KEY, favouritesAdapter.getItem(position));
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Locale;
|
|||
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.*;
|
||||
import android.view.MenuItem.OnMenuItemClickListener;
|
||||
|
@ -227,12 +228,11 @@ public class SearchAddressOnlineFragment extends Fragment implements SearchActiv
|
|||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Place item = adapter.getItem(position);
|
||||
ContextMenuAdapter qa = new ContextMenuAdapter(view.getContext());
|
||||
qa.setAnchor(view);
|
||||
DirectionsDialogs.createDirectionsActions(qa, new LatLon(item.lat, item.lon), item,
|
||||
getString(R.string.address)+ " : " + item.displayName, Math.max(15, settings.getLastKnownMapZoom()),
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), view);
|
||||
DirectionsDialogs.createDirectionsActionsPopUpMenu(optionsMenu, new LatLon(item.lat, item.lon), item,
|
||||
getString(R.string.address) + " : " + item.displayName, Math.max(15, settings.getLastKnownMapZoom()),
|
||||
getActivity(), true);
|
||||
MapActivityActions.showObjectContextMenu(qa, getActivity(), null);
|
||||
optionsMenu.show();
|
||||
}
|
||||
|
||||
private static class Place {
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.activities.search;
|
|||
import java.util.List;
|
||||
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.view.*;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
|
@ -114,19 +115,12 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
|
|||
}
|
||||
|
||||
private void selectModel(final HistoryEntry model, View v) {
|
||||
ContextMenuAdapter qa = new ContextMenuAdapter(v.getContext());
|
||||
qa.setAnchor(v);
|
||||
String name = model.getName();
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
OsmandSettings settings = ((OsmandApplication) getActivity().getApplication()).getSettings();
|
||||
OnClickListener onShow = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
helper.selectEntry(model);
|
||||
}
|
||||
};
|
||||
DirectionsDialogs.createDirectionsActions(qa, new LatLon(model.getLat(), model.getLon()),
|
||||
DirectionsDialogs.createDirectionsActionsPopUpMenu(optionsMenu, new LatLon(model.getLat(), model.getLon()),
|
||||
model, name, settings.getLastKnownMapZoom(), getActivity(), false);
|
||||
MapActivityActions.showObjectContextMenu(qa, getActivity(), onShow);
|
||||
optionsMenu.show();
|
||||
}
|
||||
|
||||
class HistoryAdapter extends ArrayAdapter<HistoryEntry> {
|
||||
|
|
|
@ -6,6 +6,7 @@ package net.osmand.plus.activities.search;
|
|||
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import gnu.trove.set.hash.TLongHashSet;
|
||||
|
||||
|
@ -568,21 +569,19 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
@Override
|
||||
public void onItemClick(AdapterView<?> parent,final View view, int position, long id) {
|
||||
final Amenity amenity = ((AmenityAdapter) getListAdapter()).getItem(position);
|
||||
ContextMenuAdapter adapter = new ContextMenuAdapter(view.getContext());
|
||||
adapter.setAnchor(view);
|
||||
String poiSimpleFormat = OsmAndFormatter.getPoiSimpleFormat(amenity, getMyApplication(), settings.usingEnglishNames());
|
||||
String name = poiSimpleFormat;
|
||||
int z = Math.max(16, settings.getLastKnownMapZoom());
|
||||
|
||||
DirectionsDialogs.createDirectionsActions(adapter, amenity.getLocation(), amenity, name, z, this, true );
|
||||
final PopupMenu optionsMenu = new PopupMenu(this, view);
|
||||
DirectionsDialogs.createDirectionsActionsPopUpMenu(optionsMenu, amenity.getLocation(), amenity, name, z, this, true);
|
||||
final String d = OsmAndFormatter.getAmenityDescriptionContent(getMyApplication(), amenity, false);
|
||||
if(d.toString().trim().length() > 0) {
|
||||
Item poiDescr = adapter.item(R.string.poi_context_menu_showdescription).icons(
|
||||
R.drawable.ic_action_note_dark, R.drawable.ic_action_note_light);
|
||||
poiDescr.listen(new OnContextMenuClick() {
|
||||
|
||||
MenuItem item = optionsMenu.getMenu().add(R.string.poi_context_menu_showdescription).
|
||||
setIcon(getMyApplication().getSettings().isLightContent() ?
|
||||
R.drawable.ic_action_note_light : R.drawable.ic_action_note_dark);
|
||||
item.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
// Build text(amenity)
|
||||
|
||||
// Find and format links
|
||||
|
@ -602,20 +601,19 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
textView.setLinksClickable(true);
|
||||
return true;
|
||||
}
|
||||
}).reg();
|
||||
});
|
||||
}
|
||||
if (((OsmandApplication)getApplication()).accessibilityEnabled()) {
|
||||
Item showDetails = adapter.item(R.string.show_details);
|
||||
showDetails.listen(new OnContextMenuClick() {
|
||||
|
||||
MenuItem item = optionsMenu.getMenu().add(R.string.show_details);
|
||||
item.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
showPOIDetails(amenity, settings.usingEnglishNames());
|
||||
return true;
|
||||
}
|
||||
}).reg();
|
||||
});
|
||||
}
|
||||
MapActivityActions.showObjectContextMenu(adapter, this, null);
|
||||
optionsMenu.show();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,12 +52,13 @@ public class DirectionsDialogs {
|
|||
}
|
||||
}
|
||||
|
||||
public static void createDirectionsActions(final ContextMenuAdapter qa , final LatLon location, final Object obj, final String name,
|
||||
final int z, final Activity activity, final boolean saveHistory) {
|
||||
createDirectionsActions(qa, location, obj, name, z, activity, saveHistory, true);
|
||||
public static void createDirectionsActionsPopUpMenu(final PopupMenu optionsMenu , final LatLon location, final Object obj, final String name,
|
||||
final int z, final Activity activity, final boolean saveHistory) {
|
||||
createDirectionActionsPopUpMenu(optionsMenu, location, obj, name, z, activity, saveHistory, true);
|
||||
}
|
||||
|
||||
public static PopupMenu createDirectionActionsPopUpMenu(final PopupMenu optionsMenu, final LatLon location, final Object obj, final String name,
|
||||
|
||||
public static void createDirectionActionsPopUpMenu(final PopupMenu optionsMenu, final LatLon location, final Object obj, final String name,
|
||||
final int z, final Activity activity, final boolean saveHistory, boolean favorite) {
|
||||
setupPopUpMenuIcon(optionsMenu);
|
||||
final OsmandApplication app = ((OsmandApplication) activity.getApplication());
|
||||
|
@ -121,75 +122,8 @@ public class DirectionsDialogs {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
return optionsMenu;
|
||||
}
|
||||
|
||||
public static void createDirectionsActions(final ContextMenuAdapter qa , final LatLon location, final Object obj, final String name,
|
||||
final int z, final Activity activity, final boolean saveHistory, boolean favorite) {
|
||||
|
||||
final OsmandApplication app = ((OsmandApplication) activity.getApplication());
|
||||
final TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
||||
|
||||
|
||||
Item dir = qa.item(R.string.context_menu_item_directions_to).icons(
|
||||
R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light);
|
||||
dir.listen(
|
||||
new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
directionsToDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
|
||||
return true;
|
||||
}
|
||||
}).reg();
|
||||
Item intermediate;
|
||||
if (targetPointsHelper.getPointToNavigate() != null) {
|
||||
intermediate = qa.item(R.string.context_menu_item_intermediate_point).icons(
|
||||
R.drawable.ic_action_flage_dark,R.drawable.ic_action_flage_light);
|
||||
} else {
|
||||
intermediate = qa.item(R.string.context_menu_item_destination_point).icons(
|
||||
R.drawable.ic_action_flag_dark, R.drawable.ic_action_flag_light);
|
||||
}
|
||||
intermediate.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
addWaypointDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
|
||||
return true;
|
||||
}
|
||||
}).reg();
|
||||
|
||||
Item showOnMap = qa.item(R.string.show_poi_on_map).icons(
|
||||
R.drawable.ic_action_marker_dark, R.drawable.ic_action_marker_light );
|
||||
showOnMap.listen(
|
||||
new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), z, saveHistory ? name : null, name,
|
||||
obj); //$NON-NLS-1$
|
||||
MapActivity.launchMapActivityMoveToTop(activity);
|
||||
return true;
|
||||
}
|
||||
}).reg();
|
||||
if (favorite) {
|
||||
Item addToFavorite = qa.item(R.string.add_to_favourite).icons(
|
||||
R.drawable.ic_action_fav_dark, R.drawable.ic_action_fav_light);
|
||||
addToFavorite.listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
Bundle args = new Bundle();
|
||||
Dialog dlg = FavoriteDialogs.createAddFavouriteDialog(activity, args);
|
||||
dlg.show();
|
||||
FavoriteDialogs.prepareAddFavouriteDialog(activity, dlg, args, location.getLatitude(), location.getLongitude(),
|
||||
name);
|
||||
return true;
|
||||
}
|
||||
}).reg();
|
||||
}
|
||||
}
|
||||
|
||||
public static void addWaypointDialogAndLaunchMap(final Activity act, final double lat, final double lon, final String name) {
|
||||
final OsmandApplication ctx = (OsmandApplication) act.getApplication();
|
||||
final TargetPointsHelper targetPointsHelper = ctx.getTargetPointsHelper();
|
||||
|
|
|
@ -6,11 +6,8 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import android.app.FragmentManager;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
|
@ -111,7 +108,7 @@ public class DownloadActivity extends BaseDownloadActivity {
|
|||
settings = ((OsmandApplication)getApplication()).getSettings();
|
||||
|
||||
indeterminateProgressBar = (ProgressBar) findViewById(R.id.IndeterminateProgressBar);
|
||||
determinateProgressBar = (ProgressBar) findViewById(R.id.DeterminateProgressBar);
|
||||
determinateProgressBar = (ProgressBar) findViewById(R.id.memory_progress);
|
||||
progressView = findViewById(R.id.ProgressView);
|
||||
progressMessage = (TextView) findViewById(R.id.ProgressMessage);
|
||||
progressPercent = (TextView) findViewById(R.id.ProgressPercent);
|
||||
|
|
|
@ -56,7 +56,7 @@ import android.widget.CheckBox;
|
|||
import android.widget.EditText;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -81,6 +81,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
private ActionMode actionMode;
|
||||
|
||||
private TextView descriptionText;
|
||||
private ProgressBar sizeProgress;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
@ -94,7 +95,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
expandAllGroups();
|
||||
setListView(listView);
|
||||
//getDownloadActivity().getSupportActionBar().setLogo(R.drawable.tab_download_screen_icon);
|
||||
descriptionText = (TextView) view.findViewById(R.id.DescriptionText);
|
||||
descriptionText = (TextView) view.findViewById(R.id.memory_size);
|
||||
sizeProgress = (ProgressBar) view.findViewById(R.id.memory_progress);
|
||||
updateDescriptionTextWithSize();
|
||||
return view;
|
||||
}
|
||||
|
@ -657,11 +659,13 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
private void updateDescriptionTextWithSize(){
|
||||
File dir = getMyApplication().getAppPath("").getParentFile();
|
||||
String size = formatGb.format(new Object[]{0});
|
||||
int percent = 0;
|
||||
if(dir.canRead()){
|
||||
StatFs fs = new StatFs(dir.getAbsolutePath());
|
||||
size = formatGb.format(new Object[]{(float) (fs.getAvailableBlocks()) * fs.getBlockSize() / (1 << 30) });
|
||||
size = formatGb.format(new Object[]{(float) (fs.getAvailableBlocks()) * fs.getBlockSize() / (1 << 30) });
|
||||
percent = (int) (fs.getAvailableBytes() * 100 / fs.getTotalBytes());
|
||||
}
|
||||
|
||||
sizeProgress.setProgress(percent);
|
||||
String text = getString(R.string.free, size);
|
||||
int l = text.indexOf('.');
|
||||
if(l == -1) {
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.osmand.plus.activities.AvailableGPXFragment.GpxInfo;
|
|||
import net.osmand.plus.activities.EnumAdapter;
|
||||
import net.osmand.plus.activities.EnumAdapter.IEnumWithResource;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SettingsActivity;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.app.Activity;
|
||||
|
@ -25,10 +24,6 @@ import android.app.AlertDialog.Builder;
|
|||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
@ -232,7 +227,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
Builder bldr = new AlertDialog.Builder(la);
|
||||
LayoutInflater inflater = (LayoutInflater)la.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
final View view = inflater.inflate(R.layout.send_gpx_osm, null);
|
||||
final EditText descr = (EditText) view.findViewById(R.id.DescriptionText);
|
||||
final EditText descr = (EditText) view.findViewById(R.id.memory_size);
|
||||
if(info.length > 0 && info[0].getFileName() != null) {
|
||||
int dt = info[0].getFileName().indexOf('.');
|
||||
descr.setText(info[0].getFileName().substring(0, dt));
|
||||
|
|
Loading…
Reference in a new issue