Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
44e4c39099
16 changed files with 157 additions and 250 deletions
|
@ -131,7 +131,6 @@
|
|||
<activity android:name="net.osmand.plus.monitoring.SettingsMonitoringActivity" android:configChanges="keyboardHidden|orientation" />
|
||||
<activity android:name="net.osmand.plus.rastermaps.SettingsRasterMapsActivity" android:configChanges="keyboardHidden|orientation" />
|
||||
<activity android:name="net.osmand.plus.routepointsnavigation.RoutePointsActivity" />
|
||||
<activity android:name="net.osmand.plus.audionotes.DashAudioVideoNotesActivity" />
|
||||
|
||||
<activity android:name="net.osmand.plus.osmedit.SettingsOsmEditingActivity" android:configChanges="keyboardHidden|orientation" />
|
||||
<activity android:name="net.osmand.plus.development.SettingsDevelopmentActivity" android:configChanges="keyboardHidden|orientation" />
|
||||
|
|
|
@ -32,13 +32,32 @@
|
|||
tools:text="@string/app_version"
|
||||
android:maxLines="7"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_descr"
|
||||
style="@style/ListText.Small"
|
||||
android:textSize="@dimen/download_descr_text_size"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
tools:text="@string/app_version"/>
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/download_descr"
|
||||
style="@style/ListText.Small"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:textSize="@dimen/download_descr_text_size"
|
||||
tools:text="@string/app_version"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/update_descr"
|
||||
style="@style/ListText.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/color_distance"
|
||||
android:textSize="@dimen/download_descr_text_size"
|
||||
tools:text="@string/lorem_ipsum"
|
||||
android:maxLines="1"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
|
||||
<string name="days_behind">days behind</string>
|
||||
<string name="plugin_nautical_descr1">Activating this view changes the map style to Nautical, thus showing all nautical navigation marks and chart symbols.</string>
|
||||
<string name="plugin_nautical_descr2">A map file containing all nautical symbols globally is availabe as one single download called \'World seamarks\'.</string>
|
||||
<string name="plugin_nautical_descr3">This view can be reverted by either de-activating it again here, or by changing the \'Map style\' under \'Configure map\' as desired.</string>
|
||||
|
|
|
@ -529,12 +529,11 @@ public class FavouritesDbHelper {
|
|||
conn = context.getSQLiteAPI().getOrCreateDatabase(FAVOURITE_DB_NAME, readonly);
|
||||
}
|
||||
if (conn.getVersion() == 0) {
|
||||
conn.setVersion(DATABASE_VERSION);
|
||||
onCreate(conn);
|
||||
} else {
|
||||
onUpgrade(conn, conn.getVersion(), DATABASE_VERSION);
|
||||
}
|
||||
|
||||
conn.setVersion(DATABASE_VERSION);
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
|
|
|
@ -9,21 +9,23 @@ import net.osmand.IProgress;
|
|||
import net.osmand.Location;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.access.AccessibilityPlugin;
|
||||
import net.osmand.plus.activities.FavoritesActivity;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SettingsActivity;
|
||||
import net.osmand.plus.activities.TabActivity.TabItem;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||
import net.osmand.plus.distancecalculator.DistanceCalculatorPlugin;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.touringview.TouringViewPlugin;
|
||||
import net.osmand.plus.skimapsplugin.SkiMapsPlugin;
|
||||
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||
import net.osmand.plus.osmo.OsMoPlugin;
|
||||
import net.osmand.plus.parkingpoint.ParkingPositionPlugin;
|
||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
||||
import net.osmand.plus.routepointsnavigation.RoutePointsPlugin;
|
||||
import net.osmand.plus.skimapsplugin.SkiMapsPlugin;
|
||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||
import net.osmand.plus.touringview.TouringViewPlugin;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -188,6 +190,8 @@ public abstract class OsmandPlugin {
|
|||
|
||||
public void updateLocation(Location location) {}
|
||||
|
||||
public void addMyPlacesTab(FavoritesActivity favoritesActivity, List<TabItem> mTabs, Intent intent) { }
|
||||
|
||||
public void contextMenuFragment(Activity activity, Fragment fragment, Object info, ContextMenuAdapter adapter) {}
|
||||
|
||||
public void optionsMenuFragment(Activity activity, Fragment fragment, ContextMenuAdapter optionsMenuAdapter) {}
|
||||
|
@ -371,7 +375,10 @@ public abstract class OsmandPlugin {
|
|||
return getEnabledPlugin(OsmandDevelopmentPlugin.class) != null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void addMyPlacesTabPlugins(FavoritesActivity favoritesActivity, List<TabItem> mTabs, Intent intent) {
|
||||
for(OsmandPlugin p : getEnabledPlugins()){
|
||||
p.addMyPlacesTab(favoritesActivity, mTabs, intent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,32 +8,28 @@ import java.lang.ref.WeakReference;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.view.MenuItem;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.OsmAndLocationProvider;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
|
||||
import android.app.Activity;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||
import net.osmand.plus.audionotes.NotesFragment;
|
||||
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -45,7 +41,7 @@ public class FavoritesActivity extends TabActivity {
|
|||
// public static int FAVORITES_TAB = 0;
|
||||
// public static int GPX_TAB = 1;
|
||||
// public static int SELECTED_GPX_TAB = 2;
|
||||
public static String TAB_PARAM = "TAB_PARAM";
|
||||
// public static String TAB_PARAM = "TAB_PARAM";
|
||||
protected List<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
|
||||
|
||||
@Override
|
||||
|
@ -56,53 +52,39 @@ public class FavoritesActivity extends TabActivity {
|
|||
getSupportActionBar().setElevation(0);
|
||||
|
||||
File[] lf = ((OsmandApplication) getApplication()).getAppPath(TRACKS).listFiles();
|
||||
boolean hasGpx = false;
|
||||
if(lf != null) {
|
||||
for(File t : lf) {
|
||||
if(t.isDirectory() || (t.getName().toLowerCase().endsWith(".gpx"))) {
|
||||
boolean hasGpx = false;
|
||||
if (lf != null) {
|
||||
for (File t : lf) {
|
||||
if (t.isDirectory() || (t.getName().toLowerCase().endsWith(".gpx"))) {
|
||||
hasGpx = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!hasGpx) {
|
||||
setContentView(R.layout.search_activity_single);
|
||||
getSupportFragmentManager().beginTransaction().add(R.id.layout, new FavoritesTreeFragment()).commit();
|
||||
} else {
|
||||
setContentView(R.layout.tab_content);
|
||||
setContentView(R.layout.tab_content);
|
||||
|
||||
PagerSlidingTabStrip mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs);
|
||||
OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings();
|
||||
Integer tab = settings.FAVORITES_TAB.get();
|
||||
ViewPager mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
PagerSlidingTabStrip mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs);
|
||||
OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings();
|
||||
|
||||
List<TabItem> mTabs = new ArrayList<TabItem>();
|
||||
mTabs.add(getTabIndicator(R.string.my_favorites, FavoritesTreeFragment.class));
|
||||
AudioVideoNotesPlugin audioVideoNotesPlugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||
if (audioVideoNotesPlugin != null && audioVideoNotesPlugin.isActive()
|
||||
&& audioVideoNotesPlugin.getAllRecordings().size() > 0){
|
||||
mTabs.add(getTabIndicator(R.string.notes, NotesFragment.class));
|
||||
}
|
||||
ViewPager mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
|
||||
List<TabItem> mTabs = new ArrayList<TabItem>();
|
||||
mTabs.add(getTabIndicator(R.string.my_favorites, FavoritesTreeFragment.class));
|
||||
if (hasGpx) {
|
||||
mTabs.add(getTabIndicator(R.string.my_tracks, AvailableGPXFragment.class));
|
||||
mTabs.add(getTabIndicator(R.string.selected_track, SelectedGPXFragment.class));
|
||||
|
||||
setViewPagerAdapter(mViewPager, mTabs);
|
||||
mSlidingTabLayout.setViewPager(mViewPager);
|
||||
|
||||
|
||||
Intent intent = getIntent();
|
||||
if(intent != null) {
|
||||
int tt = intent.getIntExtra(TAB_PARAM, -1);
|
||||
if(tt >= 0) {
|
||||
mViewPager.setCurrentItem(tt);
|
||||
}
|
||||
} else {
|
||||
mViewPager.setCurrentItem(tab);
|
||||
}
|
||||
updateSelectedTracks();
|
||||
}
|
||||
//setupHomeButton();
|
||||
OsmandPlugin.addMyPlacesTabPlugins(this, mTabs, getIntent());
|
||||
|
||||
Integer tab = settings.FAVORITES_TAB.get();
|
||||
|
||||
setViewPagerAdapter(mViewPager, mTabs);
|
||||
mSlidingTabLayout.setViewPager(mViewPager);
|
||||
|
||||
mViewPager.setCurrentItem(tab);
|
||||
updateSelectedTracks();
|
||||
// setupHomeButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,34 +1,28 @@
|
|||
package net.osmand.plus.activities;
|
||||
|
||||
import android.graphics.Color;
|
||||
import java.util.List;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
* on 26.01.2015.
|
||||
*/
|
||||
public class TabActivity extends ActionBarProgressActivity {
|
||||
|
||||
protected TabItem getTabIndicator(int resId, Class<?> fragment){
|
||||
return new TabItem(getString(resId), Color.DKGRAY, Color.LTGRAY, fragment);
|
||||
public TabItem getTabIndicator(int resId, Class<?> fragment){
|
||||
return new TabItem(getString(resId), fragment);
|
||||
}
|
||||
|
||||
public static class TabItem {
|
||||
public final CharSequence mTitle;
|
||||
private final int mIndicatorColor;
|
||||
private final int mDividerColor;
|
||||
public final Class<?> fragment;
|
||||
|
||||
public TabItem(CharSequence mTitle, int mIndicatorColor, int mDividerColor, Class<?> fragment) {
|
||||
public TabItem(CharSequence mTitle, Class<?> fragment) {
|
||||
this.mTitle = mTitle;
|
||||
this.mIndicatorColor = mIndicatorColor;
|
||||
this.mDividerColor = mDividerColor;
|
||||
this.fragment = fragment;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,10 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.FavoritesActivity;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SavingTrackHelper;
|
||||
import net.osmand.plus.activities.TabActivity.TabItem;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.views.MapInfoLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
|
@ -927,6 +929,16 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMyPlacesTab(FavoritesActivity favoritesActivity, List<TabItem> mTabs, Intent intent) {
|
||||
if (getAllRecordings().size() > 0) {
|
||||
mTabs.add(favoritesActivity.getTabIndicator(R.string.notes, NotesFragment.class));
|
||||
if (intent != null && "AUDIO".equals(intent.getStringExtra("TAB"))) {
|
||||
app.getSettings().FAVORITES_TAB.set(mTabs.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean indexSingleFile(File f) {
|
||||
boolean oldFileExist = recordingByFileName.containsKey(f.getName());
|
||||
if (oldFileExist) {
|
||||
|
|
|
@ -1,139 +0,0 @@
|
|||
package net.osmand.plus.audionotes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
* on 23.12.2014.
|
||||
*/
|
||||
public class DashAudioVideoNotesActivity extends OsmandActionBarActivity {
|
||||
AudioVideoNotesPlugin plugin;
|
||||
List<AudioVideoNotesPlugin.Recording> items;
|
||||
NotesAdapter listAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
((OsmandApplication)getApplication()).applyTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.editing_poi_filter);
|
||||
|
||||
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
|
||||
Window window = getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
}
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setTitle(R.string.audionotes_plugin_name);
|
||||
actionBar.setIcon(android.R.color.transparent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
items = new ArrayList<AudioVideoNotesPlugin.Recording>(plugin.getAllRecordings());
|
||||
listAdapter = new NotesAdapter(items);
|
||||
((ListView)findViewById(android.R.id.list)).setAdapter(listAdapter);
|
||||
}
|
||||
|
||||
private void showContextMenu(final AudioVideoNotesPlugin.Recording recording){
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(this);
|
||||
ContextMenuAdapter.OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(final ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||
if (resId == R.string.local_index_mi_delete) {
|
||||
AlertDialog.Builder confirm = new AlertDialog.Builder(DashAudioVideoNotesActivity.this);
|
||||
confirm.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
plugin.deleteRecording(recording);
|
||||
items.remove(recording);
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
confirm.setNegativeButton(R.string.default_buttons_no, null);
|
||||
confirm.setMessage(getString(R.string.delete_confirmation_msg, recording.file.getName()));
|
||||
confirm.show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
adapter.item(R.string.local_index_mi_delete).listen(listener).position(0).reg();
|
||||
|
||||
builder.setItems(adapter.getItemNames(), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
ContextMenuAdapter.OnContextMenuClick clk = adapter.getClickAdapter(which);
|
||||
if (clk != null){
|
||||
clk.onContextMenuClick(null, adapter.getElementId(which), which, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
this.finish();
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class NotesAdapter extends ArrayAdapter<AudioVideoNotesPlugin.Recording> {
|
||||
NotesAdapter(List<AudioVideoNotesPlugin.Recording> recordingList) {
|
||||
super(DashAudioVideoNotesActivity.this, R.layout.dash_audio_video_notes_item, recordingList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
View row = convertView;
|
||||
if (row == null){
|
||||
row = inflater.inflate(R.layout.dash_audio_video_notes_item, parent, false);
|
||||
row.findViewById(R.id.divider).setVisibility(View.GONE);
|
||||
}
|
||||
boolean light = ((OsmandApplication)getApplication()).getSettings().isLightContent();
|
||||
if (light) {
|
||||
row.setBackgroundColor(getResources().getColor(R.color.expandable_list_item_light));
|
||||
} else {
|
||||
row.setBackgroundColor(getResources().getColor(R.color.list_item_background_dark));
|
||||
}
|
||||
final AudioVideoNotesPlugin.Recording recording = getItem(position);
|
||||
DashAudioVideoNotesFragment.getNoteView(recording, row, DashAudioVideoNotesActivity.this, plugin);
|
||||
row.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
showContextMenu(recording);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return row;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,9 +6,11 @@ import java.util.List;
|
|||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.FavoritesActivity;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -43,7 +45,9 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
Activity activity = getActivity();
|
||||
final Intent favorites = new Intent(activity, DashAudioVideoNotesActivity.class);
|
||||
Class<FavoritesActivity> fa = getMyApplication().getAppCustomization().getFavoritesActivity();
|
||||
final Intent favorites = new Intent(activity, fa);
|
||||
favorites.putExtra("TAB", "AUDIO");
|
||||
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
activity.startActivity(favorites);
|
||||
}
|
||||
|
@ -98,7 +102,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
public void onClick(View v) {
|
||||
getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15,
|
||||
new PointDescription(PointDescription.POINT_TYPE_NOTE,
|
||||
recording.getName() != null ? recording.getName() : recording.getDescription(getActivity())), true,
|
||||
!Algorithms.isEmpty(recording.getName())? recording.getName() : recording.getDescription(getActivity())), true,
|
||||
recording); //$NON-NLS-1$
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
|
|
|
@ -95,9 +95,9 @@ public class DownloadActivity extends BaseDownloadActivity {
|
|||
ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
|
||||
PagerSlidingTabStrip mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs);
|
||||
|
||||
mTabs.add(new TabActivity.TabItem(getString(R.string.download_tab_local), Color.DKGRAY, Color.LTGRAY, LocalIndexesFragment.class));
|
||||
mTabs.add(new TabActivity.TabItem(getString(R.string.download_tab_downloads), Color.DKGRAY, Color.LTGRAY, DownloadIndexFragment.class));
|
||||
mTabs.add(new TabActivity.TabItem(getString(R.string.download_tab_updates), Color.DKGRAY, Color.LTGRAY, UpdatesIndexFragment.class));
|
||||
mTabs.add(new TabActivity.TabItem(getString(R.string.download_tab_local), LocalIndexesFragment.class));
|
||||
mTabs.add(new TabActivity.TabItem(getString(R.string.download_tab_downloads), DownloadIndexFragment.class));
|
||||
mTabs.add(new TabActivity.TabItem(getString(R.string.download_tab_updates), UpdatesIndexFragment.class));
|
||||
|
||||
viewPager.setAdapter(new TabActivity.OsmandFragmentPagerAdapter(getSupportFragmentManager(), mTabs));
|
||||
mSlidingTabLayout.setViewPager(viewPager);
|
||||
|
|
|
@ -269,14 +269,12 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
|
|||
final boolean updatableResource = indexActivatedFileNames.containsKey(sfName);
|
||||
String date = updatableResource ? indexActivatedFileNames.get(sfName) : indexFileNames.get(sfName);
|
||||
boolean outdated = DownloadActivity.downloadListIndexThread.checkIfItemOutdated(e);
|
||||
description.setText(date + " " + e.getSizeDescription(clctx));
|
||||
// up to date
|
||||
String updateDescr = downloadFragment.getResources().getString(R.string.local_index_installed) + ": "
|
||||
+ date;
|
||||
uptodate.setText(updateDescr);
|
||||
update.setText(updateDescr);
|
||||
uptodate.setVisibility(outdated ? View.VISIBLE : View.GONE);
|
||||
update.setVisibility(outdated ? View.GONE : View.VISIBLE);
|
||||
uptodate.setVisibility(!outdated ? View.VISIBLE : View.GONE);
|
||||
update.setVisibility(!outdated ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
}
|
||||
return row;
|
||||
|
|
|
@ -927,10 +927,11 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
} else if (child.isLoaded()) {
|
||||
// users confused okColor here with "uptodate", so let's leave white (black in dark app theme) as "isLoaded"
|
||||
//viewName.setTextColor(okColor);
|
||||
}
|
||||
if (child.isBackupedData()) {
|
||||
viewName.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
|
||||
} else {
|
||||
if (child.isBackupedData()) {
|
||||
viewName.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
|
||||
}
|
||||
viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
||||
}
|
||||
TextView sizeText = (TextView) v.findViewById(R.id.local_index_size);
|
||||
if (child.getSize() >= 0) {
|
||||
|
|
|
@ -10,16 +10,17 @@ import android.support.v4.view.MenuItemCompat;
|
|||
import android.support.v7.app.ActionBar;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.map.OsmandRegions;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -260,6 +261,7 @@ public class UpdatesIndexFragment extends ListFragment {
|
|||
|
||||
TextView name = (TextView) v.findViewById(R.id.download_item);
|
||||
TextView description = (TextView) v.findViewById(R.id.download_descr);
|
||||
TextView updateDescr = (TextView) v.findViewById(R.id.update_descr);
|
||||
final CheckBox ch = (CheckBox) v.findViewById(R.id.check_download_item);
|
||||
IndexItem e = items.get(position);
|
||||
if (e.getFileName().equals(getString(R.string.everything_up_to_date))) {
|
||||
|
@ -275,9 +277,24 @@ public class UpdatesIndexFragment extends ListFragment {
|
|||
String eName = e.getVisibleName(getMyApplication(), osmandRegions);
|
||||
|
||||
name.setText(eName.trim().replace('\n', ' ').replace("TTS","")); //$NON-NLS-1$
|
||||
String d = getMapDescription(e);
|
||||
String d = getMapDescription(e);
|
||||
description.setText(d);
|
||||
|
||||
String sfName = e.getTargetFileName();
|
||||
Map<String, String> indexActivatedFileNames = getMyApplication().getResourceManager().getIndexFileNames();
|
||||
String dt = indexActivatedFileNames.get(sfName);
|
||||
updateDescr.setText("");
|
||||
if(dt != null ) {
|
||||
try {
|
||||
Date tm = format.parse(dt);
|
||||
long days = Math.max(1, (e.getTimestamp() - tm.getTime()) / (24 * 60 * 60 * 1000) + 1);
|
||||
updateDescr.setText(days + " " + getString(R.string.days_behind));
|
||||
} catch (ParseException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ch.setChecked(getDownloadActivity().getEntriesToDownload().containsKey(e));
|
||||
ch.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -306,7 +323,7 @@ public class UpdatesIndexFragment extends ListFragment {
|
|||
|
||||
private String getMapDescription(IndexItem item){
|
||||
String typeName = getTypeName(item.getType().getResource());
|
||||
String date = item.getDate(new SimpleDateFormat("dd.MM.yyyy"));
|
||||
String date = item.getDate(format);
|
||||
String size = item.getSizeDescription(getActivity());
|
||||
return typeName + " " + date + " " + size;
|
||||
|
||||
|
|
|
@ -7,9 +7,7 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -142,7 +140,7 @@ public class SearchHistoryHelper {
|
|||
}
|
||||
|
||||
public void setFrequency(String intervalsString, String values) {
|
||||
if(!Algorithms.isEmpty(intervalsString) && !Algorithms.isEmpty(values)) {
|
||||
if(Algorithms.isEmpty(intervalsString) || Algorithms.isEmpty(values)) {
|
||||
markAsAccessed(this.lastAccessedTime);
|
||||
return;
|
||||
}
|
||||
|
@ -278,11 +276,11 @@ public class SearchHistoryHelper {
|
|||
conn = context.getSQLiteAPI().getOrCreateDatabase(DB_NAME, readonly);
|
||||
}
|
||||
if (conn.getVersion() == 0) {
|
||||
conn.setVersion(DB_VERSION);
|
||||
onCreate(conn);
|
||||
} else {
|
||||
onUpgrade(conn, conn.getVersion(), DB_VERSION);
|
||||
}
|
||||
conn.setVersion(DB_VERSION);
|
||||
|
||||
}
|
||||
return conn;
|
||||
|
@ -337,7 +335,10 @@ public class SearchHistoryHelper {
|
|||
if(db != null){
|
||||
try {
|
||||
db.execSQL(
|
||||
"UPDATE " + HISTORY_TABLE_NAME + " SET time = ? and freq_intervals = ? and freq_values = ? WHERE " + HISTORY_COL_NAME + " = ?",
|
||||
"UPDATE " + HISTORY_TABLE_NAME + " SET " + HISTORY_COL_TIME + "= ? "+
|
||||
", " + HISTORY_COL_FREQ_INTERVALS + " = ? " +
|
||||
", " +HISTORY_COL_FREQ_VALUES + "= ? WHERE " +
|
||||
HISTORY_COL_NAME + " = ?",
|
||||
new Object[] { e.getLastAccessTime(), e.getIntervals(), e.getIntervalsValues(),
|
||||
e.getSerializedName() }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
} finally {
|
||||
|
@ -366,6 +367,7 @@ public class SearchHistoryHelper {
|
|||
"INSERT INTO " + HISTORY_TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?)",
|
||||
new Object[] { e.getSerializedName(), e.getLastAccessTime(),
|
||||
e.getIntervals(), e.getIntervalsValues(), e.getLat(), e.getLon() }); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
System.out.println("Insert " + e.getSerializedName());
|
||||
}
|
||||
|
||||
public List<HistoryEntry> getLegacyEntries(SQLiteConnection db){
|
||||
|
@ -417,24 +419,33 @@ public class SearchHistoryHelper {
|
|||
" FROM " + HISTORY_TABLE_NAME , null); //$NON-NLS-1$//$NON-NLS-2$
|
||||
Map<String, HistoryEntry> st = new TreeMap<String, HistoryEntry>();
|
||||
if (query.moveToFirst()) {
|
||||
boolean reinsert = false;
|
||||
do {
|
||||
String name = query.getString(0);
|
||||
HistoryEntry prev = st.get(name);
|
||||
HistoryEntry e = new HistoryEntry(query.getDouble(1), query.getDouble(2),
|
||||
PointDescription.deserializeFromString(name));
|
||||
long time = query.getLong(3);
|
||||
e.setLastAccessTime(time);
|
||||
e.setFrequency(query.getString(4), query.getString(5));
|
||||
if(prev != null) {
|
||||
entries.remove(prev);
|
||||
}
|
||||
if(prev != null || !Algorithms.objectEquals(name, e.getSerializedName())) {
|
||||
removeQuery(name, db);
|
||||
insert(e, db);
|
||||
if(st.containsKey(name) || st.containsKey(e.getSerializedName())
|
||||
|| !Algorithms.objectEquals(name, e.getSerializedName())) {
|
||||
reinsert = true;
|
||||
}
|
||||
entries.add(e);
|
||||
st.put(name, e);
|
||||
st.put(e.getSerializedName(), e);
|
||||
System.out.println(e.getSerializedName() + " ("+name+") " + new Date(e.getLastAccessTime()) + " " +
|
||||
e.getIntervalsValues() + " " + e.getIntervals());
|
||||
} while (query.moveToNext());
|
||||
if(reinsert) {
|
||||
System.err.println("Reinsert all values");
|
||||
db.execSQL("DELETE FROM " + HISTORY_TABLE_NAME); //$NON-NLS-1$
|
||||
entries.clear();
|
||||
entries.addAll(st.values());
|
||||
for(HistoryEntry he : entries) {
|
||||
insert(he, db);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
query.close();
|
||||
} finally {
|
||||
|
|
|
@ -70,16 +70,19 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
|||
|
||||
public OsMoPlugin(final OsmandApplication app) {
|
||||
this.app = app;
|
||||
service = new OsMoService(app, this);
|
||||
tracker = new OsMoTracker(service, app.getSettings().OSMO_SAVE_TRACK_INTERVAL,
|
||||
app.getSettings().OSMO_SEND_LOCATIONS_STATE);
|
||||
deviceControl = new OsMoControlDevice(app, this, service, tracker);
|
||||
groups = new OsMoGroups(this, service, tracker, app);
|
||||
ApplicationMode.regWidget("osmo_control", (ApplicationMode[])null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean init(final OsmandApplication app, Activity activity) {
|
||||
if (service == null) {
|
||||
service = new OsMoService(app, this);
|
||||
tracker = new OsMoTracker(service, app.getSettings().OSMO_SAVE_TRACK_INTERVAL,
|
||||
app.getSettings().OSMO_SEND_LOCATIONS_STATE);
|
||||
deviceControl = new OsMoControlDevice(app, this, service, tracker);
|
||||
groups = new OsMoGroups(this, service, tracker, app);
|
||||
}
|
||||
ApplicationMode.regWidget("osmo_control", (ApplicationMode[])null);
|
||||
if(app.getSettings().OSMO_AUTO_CONNECT.get() ||
|
||||
(System.currentTimeMillis() - app.getSettings().OSMO_LAST_PING.get() < 5 * 60 * 1000 )) {
|
||||
service.connect(true);
|
||||
|
|
Loading…
Reference in a new issue