Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
271ceb516e
11 changed files with 64 additions and 37 deletions
|
@ -56,7 +56,6 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SavingTrackHelper;
|
||||
import net.osmand.plus.activities.TabActivity.TabItem;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
|
@ -1311,8 +1310,6 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
|
||||
@Override
|
||||
public DashFragmentData getCardFragment() {
|
||||
return new DashFragmentData(DashAudioVideoNotesFragment.TAG,
|
||||
DashAudioVideoNotesFragment.class, DashAudioVideoNotesFragment.TITLE_ID,
|
||||
new DashboardOnMap.DefaultShouldShow(), 100, null);
|
||||
return DashAudioVideoNotesFragment.FRAGMENT_DATA;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ import net.osmand.plus.OsmandPlugin;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -28,6 +30,10 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
|
||||
public static final String TAG = "DASH_NOTES_FRAGMENT";
|
||||
public static final int TITLE_ID = R.string.map_widget_av_notes;
|
||||
private static final String ROW_NUMBER_TAG = TAG + "_row_number";
|
||||
static final DashFragmentData FRAGMENT_DATA =
|
||||
new DashFragmentData(TAG, DashAudioVideoNotesFragment.class, TITLE_ID,
|
||||
new DashboardOnMap.DefaultShouldShow(), 100, ROW_NUMBER_TAG);
|
||||
|
||||
AudioVideoNotesPlugin plugin;
|
||||
|
||||
|
@ -56,13 +62,13 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
|
||||
public void setupNotes() {
|
||||
View mainView = getView();
|
||||
if (plugin == null){
|
||||
if (plugin == null) {
|
||||
mainView.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
List<AudioVideoNotesPlugin.Recording> notes = new ArrayList<AudioVideoNotesPlugin.Recording>(plugin.getAllRecordings());
|
||||
if (notes.size() == 0){
|
||||
if (notes.size() == 0) {
|
||||
mainView.setVisibility(View.GONE);
|
||||
return;
|
||||
} else {
|
||||
|
@ -71,11 +77,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
|
||||
LinearLayout notesLayout = (LinearLayout) mainView.findViewById(R.id.items);
|
||||
notesLayout.removeAllViews();
|
||||
if (notes.size() > 3){
|
||||
while (notes.size() != 3){
|
||||
notes.remove(3);
|
||||
}
|
||||
}
|
||||
DashboardOnMap.handleNumberOfRows(notes, getMyApplication().getSettings(), ROW_NUMBER_TAG);
|
||||
|
||||
for (final AudioVideoNotesPlugin.Recording recording : notes) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
|
@ -107,7 +109,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
}
|
||||
|
||||
public static Drawable getNoteView(final AudioVideoNotesPlugin.Recording recording, View view,
|
||||
final OsmandApplication ctx) {
|
||||
final OsmandApplication ctx) {
|
||||
String name = recording.getName(ctx);
|
||||
TextView nameText = ((TextView) view.findViewById(R.id.name));
|
||||
nameText.setText(name);
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.osmand.plus.FavouritesDbHelper;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
@ -36,6 +37,9 @@ public class DashFavoritesFragment extends DashLocationFragment {
|
|||
List<FavouritePoint> points = new ArrayList<FavouritePoint>();
|
||||
|
||||
public static final String ROW_NUMBER_TAG = TAG + "_row_number";
|
||||
public static final DashFragmentData FRAGMENT_DATA =
|
||||
new DashFragmentData(TAG, DashFavoritesFragment.class, TITLE_ID,
|
||||
new DashboardOnMap.DefaultShouldShow(), 90, ROW_NUMBER_TAG);
|
||||
|
||||
@Override
|
||||
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
@ -81,13 +85,7 @@ public class DashFavoritesFragment extends DashLocationFragment {
|
|||
}
|
||||
LinearLayout favorites = (LinearLayout) mainView.findViewById(R.id.items);
|
||||
favorites.removeAllViews();
|
||||
int numberOfRows =
|
||||
getMyApplication().getSettings().registerIntPreference(ROW_NUMBER_TAG, 3).get();
|
||||
if (points.size() > numberOfRows) {
|
||||
while (points.size() != numberOfRows) {
|
||||
points.remove(numberOfRows);
|
||||
}
|
||||
}
|
||||
DashboardOnMap.handleNumberOfRows(points, getMyApplication().getSettings(), ROW_NUMBER_TAG);
|
||||
List<DashLocationView> distances = new ArrayList<DashLocationFragment.DashLocationView>();
|
||||
for (final FavouritePoint point : points) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.activities.search.SearchHistoryFragment;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||
|
@ -34,6 +35,10 @@ public class DashRecentsFragment extends DashLocationFragment {
|
|||
|
||||
private List<ImageView> arrows = new ArrayList<ImageView>();
|
||||
List<HistoryEntry> points = new ArrayList<HistoryEntry>();
|
||||
private static final String ROW_NUMBER_TAG = TAG + "_row_number";
|
||||
static final DashFragmentData FRAGMENT_DATA =
|
||||
new DashFragmentData(TAG, DashRecentsFragment.class, TITLE_ID,
|
||||
new DashboardOnMap.DefaultShouldShow(), 100, ROW_NUMBER_TAG);
|
||||
|
||||
@Override
|
||||
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
@ -76,9 +81,7 @@ public class DashRecentsFragment extends DashLocationFragment {
|
|||
|
||||
LinearLayout recents = (LinearLayout) mainView.findViewById(R.id.items);
|
||||
recents.removeAllViews();
|
||||
if (points.size() > 3) {
|
||||
points = points.subList(0, 3);
|
||||
}
|
||||
DashboardOnMap.handleNumberOfRows(points, getMyApplication().getSettings(), ROW_NUMBER_TAG);
|
||||
LatLon loc = getDefaultLocation();
|
||||
List<DashLocationView> distances = new ArrayList<DashLocationFragment.DashLocationView>();
|
||||
for (final HistoryEntry historyEntry : points) {
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.github.ksoichiro.android.observablescrollview.ScrollState;
|
|||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.osm.edit.OSMSettings;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnRowItemClick;
|
||||
|
@ -92,11 +93,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
DashWaypointsFragment.TITLE_ID, defaultShouldShow, 60, null),
|
||||
new DashFragmentData(DashSearchFragment.TAG, DashSearchFragment.class,
|
||||
DashSearchFragment.TITLE_ID, defaultShouldShow, 70, null),
|
||||
new DashFragmentData(DashRecentsFragment.TAG, DashRecentsFragment.class,
|
||||
DashRecentsFragment.TITLE_ID, defaultShouldShow, 80, null),
|
||||
new DashFragmentData(DashFavoritesFragment.TAG, DashFavoritesFragment.class,
|
||||
DashFavoritesFragment.TITLE_ID, defaultShouldShow, 90,
|
||||
DashFavoritesFragment.ROW_NUMBER_TAG),
|
||||
DashRecentsFragment.FRAGMENT_DATA,
|
||||
DashFavoritesFragment.FRAGMENT_DATA,
|
||||
new DashFragmentData(DashPluginsFragment.TAG, DashPluginsFragment.class,
|
||||
DashPluginsFragment.TITLE_ID, defaultShouldShow, 140, null)
|
||||
};
|
||||
|
@ -922,6 +920,18 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
return dashboardView;
|
||||
}
|
||||
|
||||
public static <T> List<T> handleNumberOfRows(List<T> list, OsmandSettings settings,
|
||||
String rowNumberTag) {
|
||||
int numberOfRows = settings.registerIntPreference(rowNumberTag, 3)
|
||||
.makeGlobal().get();
|
||||
if (list.size() > numberOfRows) {
|
||||
while (list.size() != numberOfRows) {
|
||||
list.remove(numberOfRows);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static class SettingsShouldShow implements DashFragmentData.ShouldShowFunction {
|
||||
@Override
|
||||
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.dashboard.tools;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.util.Log;
|
||||
|
@ -49,7 +50,6 @@ public final class TransactionBuilder {
|
|||
}
|
||||
|
||||
public FragmentTransaction getFragmentTransaction() {
|
||||
Log.v(TAG, "getFragmentTransaction(" + ")");
|
||||
FragmentTransaction fragmentTransaction = manager.beginTransaction();
|
||||
Collections.sort(fragments);
|
||||
for (DashFragmentData dashFragmentData : fragments) {
|
||||
|
|
|
@ -59,6 +59,7 @@ public class DownloadActivity extends BaseDownloadActivity {
|
|||
DownloadResources indexes = getDownloadThread().getIndexes();
|
||||
if (!indexes.isDownloadedFromInternet) {
|
||||
getDownloadThread().runReloadIndexFiles();
|
||||
|
||||
}
|
||||
|
||||
setContentView(R.layout.download);
|
||||
|
|
|
@ -25,6 +25,8 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.helpers.GpxUiHelper;
|
||||
import net.osmand.plus.myplaces.AvailableGPXFragment;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
|
@ -42,6 +44,11 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
public static final String TAG = "DASH_TRACK_FRAGMENT";
|
||||
public static final int TITLE_ID = R.string.shared_string_my_tracks;
|
||||
|
||||
private static final String ROW_NUMBER_TAG = TAG + "_row_number";
|
||||
static final DashFragmentData FRAGMENT_DATA =
|
||||
new DashFragmentData(TAG, DashTrackFragment.class, TITLE_ID,
|
||||
new DashboardOnMap.DefaultShouldShow(), 110, ROW_NUMBER_TAG);
|
||||
|
||||
private boolean updateEnable;
|
||||
|
||||
@Override
|
||||
|
@ -116,6 +123,8 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
return;
|
||||
} else {
|
||||
(mainView.findViewById(R.id.main_fav)).setVisibility(View.VISIBLE);
|
||||
DashboardOnMap.handleNumberOfRows(list,
|
||||
getMyApplication().getSettings(), ROW_NUMBER_TAG);
|
||||
}
|
||||
|
||||
LinearLayout tracks = (LinearLayout) mainView.findViewById(R.id.items);
|
||||
|
|
|
@ -469,8 +469,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
|||
|
||||
@Override
|
||||
public DashFragmentData getCardFragment() {
|
||||
return new DashFragmentData(DashTrackFragment.TAG, DashTrackFragment.class,
|
||||
DashTrackFragment.TITLE_ID, new DashboardOnMap.DefaultShouldShow(), 110, null);
|
||||
return DashTrackFragment.FRAGMENT_DATA;
|
||||
}
|
||||
|
||||
}
|
|
@ -18,6 +18,8 @@ import net.osmand.plus.ProgressImplementation;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.osmedit.dialogs.SendPoiDialogFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -33,6 +35,11 @@ public class DashOsmEditsFragment extends DashBaseFragment
|
|||
public static final String TAG = "DASH_OSM_EDITS_FRAGMENT";
|
||||
public static final int TITLE_ID = R.string.osm_settings;
|
||||
|
||||
private static final String ROW_NUMBER_TAG = TAG + "_row_number";
|
||||
static final DashFragmentData FRAGMENT_DATA =
|
||||
new DashFragmentData(TAG, DashOsmEditsFragment.class, TITLE_ID,
|
||||
new DashboardOnMap.DefaultShouldShow(), 130, ROW_NUMBER_TAG);
|
||||
|
||||
OsmEditingPlugin plugin;
|
||||
|
||||
@Override
|
||||
|
@ -78,6 +85,8 @@ public class DashOsmEditsFragment extends DashBaseFragment
|
|||
return;
|
||||
} else {
|
||||
mainView.setVisibility(View.VISIBLE);
|
||||
DashboardOnMap.handleNumberOfRows(dataPoints,
|
||||
getMyApplication().getSettings(), ROW_NUMBER_TAG);
|
||||
}
|
||||
|
||||
LinearLayout osmLayout = (LinearLayout) mainView.findViewById(R.id.items);
|
||||
|
|
|
@ -349,7 +349,6 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
|
||||
@Override
|
||||
public DashFragmentData getCardFragment() {
|
||||
return new DashFragmentData(DashOsmEditsFragment.TAG, DashOsmEditsFragment.class,
|
||||
DashOsmEditsFragment.TITLE_ID, new DashboardOnMap.DefaultShouldShow(), 130, null);
|
||||
return DashOsmEditsFragment.FRAGMENT_DATA;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue