diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index e1905ebb8e..2ec21f1f25 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -128,6 +128,7 @@ + diff --git a/OsmAnd/res/drawable-hdpi/ic_crashlog.png b/OsmAnd/res/drawable-hdpi/ic_crashlog.png new file mode 100644 index 0000000000..796b116b8c Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/ic_crashlog.png differ diff --git a/OsmAnd/res/drawable-mdpi/ic_crashlog.png b/OsmAnd/res/drawable-mdpi/ic_crashlog.png new file mode 100644 index 0000000000..83a198cbee Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/ic_crashlog.png differ diff --git a/OsmAnd/res/drawable-xhdpi/ic_crashlog.png b/OsmAnd/res/drawable-xhdpi/ic_crashlog.png new file mode 100644 index 0000000000..97aa82029b Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/ic_crashlog.png differ diff --git a/OsmAnd/res/drawable-xxhdpi/ic_crashlog.png b/OsmAnd/res/drawable-xxhdpi/ic_crashlog.png new file mode 100644 index 0000000000..e4aa9135c0 Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/ic_crashlog.png differ diff --git a/OsmAnd/res/layout/audio_video_notes_all.xml b/OsmAnd/res/layout/audio_video_notes_all.xml new file mode 100644 index 0000000000..e244ce646b --- /dev/null +++ b/OsmAnd/res/layout/audio_video_notes_all.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/dash_audio_video_notes_plugin.xml b/OsmAnd/res/layout/dash_audio_video_notes_plugin.xml index 926b742694..704f2517c1 100644 --- a/OsmAnd/res/layout/dash_audio_video_notes_plugin.xml +++ b/OsmAnd/res/layout/dash_audio_video_notes_plugin.xml @@ -6,7 +6,8 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> - - + + + + + diff --git a/OsmAnd/res/layout/dash_map_fragment.xml b/OsmAnd/res/layout/dash_map_fragment.xml index a60eb5fea1..6edac06495 100644 --- a/OsmAnd/res/layout/dash_map_fragment.xml +++ b/OsmAnd/res/layout/dash_map_fragment.xml @@ -18,7 +18,7 @@ + android:padding="@dimen/subHeaderPadding"> + android:layout_height="wrap_content"/> + android:textSize="@dimen/dashProgressTextSize"/> - + \ No newline at end of file diff --git a/OsmAnd/res/layout/dash_note_item.xml b/OsmAnd/res/layout/dash_note_item.xml index a444674569..f889db83f8 100644 --- a/OsmAnd/res/layout/dash_note_item.xml +++ b/OsmAnd/res/layout/dash_note_item.xml @@ -4,7 +4,7 @@ android:orientation="vertical" android:layout_width="match_parent" android:background="@drawable/dashboard_button" - android:layout_height="@dimen/dashHeaderHeight"> + android:layout_height="@dimen/dashListItemHeight"> @@ -43,9 +43,10 @@ + android:layout_width="@dimen/dashListItemHeight" + android:layout_height="@dimen/dashListItemHeight"/> diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index 940a84032c..84c424d03e 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -10,7 +10,6 @@ 12dp 10dp 110dp - 2dp 28dp 4dp 8dp diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashAudioVideoNotesActivity.java b/OsmAnd/src/net/osmand/plus/dashboard/DashAudioVideoNotesActivity.java new file mode 100644 index 0000000000..2a9857a0c2 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashAudioVideoNotesActivity.java @@ -0,0 +1,38 @@ +package net.osmand.plus.dashboard; + +import android.content.Intent; +import android.graphics.drawable.ColorDrawable; +import com.actionbarsherlock.app.ActionBar; +import com.actionbarsherlock.app.SherlockFragmentActivity; +import com.actionbarsherlock.view.MenuItem; +import net.osmand.plus.R; +import net.osmand.plus.activities.MainMenuActivity; + +/** + * Created by Denis on 23.12.2014. + */ +public class DashAudioVideoNotesActivity extends SherlockFragmentActivity { + + @Override + protected void onResume() { + super.onResume(); + setContentView(R.layout.audio_video_notes_all); + + ColorDrawable color = new ColorDrawable(getResources().getColor(R.color.actionbar_color)); + ActionBar actionBar = getSupportActionBar(); + actionBar.setTitle(R.string.audionotes_plugin_name); + actionBar.setBackgroundDrawable(color); + actionBar.setIcon(android.R.color.transparent); + actionBar.setHomeButtonEnabled(true); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + this.finish(); + default: + return super.onOptionsItemSelected(item); + } + } +} diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashAudioVideoNotesFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashAudioVideoNotesFragment.java index a6fd5e0cc3..7f0084a4a9 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashAudioVideoNotesFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashAudioVideoNotesFragment.java @@ -1,5 +1,7 @@ package net.osmand.plus.dashboard; +import android.app.Activity; +import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle; import android.support.annotation.Nullable; @@ -11,8 +13,10 @@ import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import net.osmand.plus.OsmAndAppCustomization; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; import net.osmand.plus.audionotes.AudioVideoNotesPlugin; import net.osmand.plus.helpers.FontCache; @@ -24,23 +28,31 @@ import java.util.List; */ public class DashAudioVideoNotesFragment extends DashBaseFragment { AudioVideoNotesPlugin plugin; + boolean allNotes; @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class); View view = getActivity().getLayoutInflater().inflate(R.layout.dash_audio_video_notes_plugin, container, false); - Typeface typeface = FontCache.getRobotoMedium(getActivity()); - ((TextView) view.findViewById(R.id.notes_text)).setTypeface(typeface); - ((Button) view.findViewById(R.id.show_all)).setTypeface(typeface); + allNotes = getActivity() instanceof DashAudioVideoNotesActivity; + if (allNotes) { + view.findViewById(R.id.header).setVisibility(View.GONE); + } else { + Typeface typeface = FontCache.getRobotoMedium(getActivity()); + ((TextView) view.findViewById(R.id.notes_text)).setTypeface(typeface); + ((Button) view.findViewById(R.id.show_all)).setTypeface(typeface); - (view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - - } - }); + (view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Activity activity = getActivity(); + final Intent favorites = new Intent(activity, DashAudioVideoNotesActivity.class); + favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); + activity.startActivity(favorites); + } + }); + } return view; } @@ -80,7 +92,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment { LinearLayout notesLayout = (LinearLayout) mainView.findViewById(R.id.notes); notesLayout.removeAllViews(); - if (notes.size() > 3){ + if (notes.size() > 3 && !allNotes){ while (notes.size() != 3){ notes.remove(3); } @@ -95,6 +107,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment { ((TextView) view.findViewById(R.id.descr)).setText(recording.getDescription(getActivity())); } else { ((TextView) view.findViewById(R.id.name)).setText(recording.getDescription(getActivity())); + view.findViewById(R.id.descr).setVisibility(View.GONE); } ImageView icon = (ImageView) view.findViewById(R.id.icon); @@ -105,16 +118,27 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment { } else { icon.setImageResource(R.drawable.ic_type_img); } + + view.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15, null, + recording.name != null ? recording.name : recording.getDescription(getActivity()), + recording); //$NON-NLS-1$ + MapActivity.launchMapActivityMoveToTop(getActivity()); + } + }); view.findViewById(R.id.play).setOnClickListener(new View.OnClickListener() { @Override - public void onClick(View view) { + public void onClick(View v) { plugin.playRecording(getActivity(), recording); } }); - int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, getResources().getDisplayMetrics()); - LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height); - view.setLayoutParams(lp); + //int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, getResources().getDisplayMetrics()); + + //LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height); + //view.setLayoutParams(lp); notesLayout.addView(view); } diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashMapFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashMapFragment.java index 8bf3b8e8b2..7df80f08f3 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashMapFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashMapFragment.java @@ -1,5 +1,7 @@ package net.osmand.plus.dashboard; +import android.graphics.Bitmap; +import android.widget.ImageView; import net.osmand.data.LatLon; import net.osmand.map.MapTileDownloader.DownloadRequest; import net.osmand.map.MapTileDownloader.IMapDownloaderCallback; @@ -28,7 +30,6 @@ import android.widget.TextView; public class DashMapFragment extends DashBaseFragment implements IMapDownloaderCallback { public static final String TAG = "DASH_MAP_FRAGMENT"; - private OsmandMapTileView osmandMapTileView; @Override public void onDestroy() { @@ -52,7 +53,7 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader Typeface typeface = FontCache.getRobotoMedium(getActivity()); ((TextView) view.findViewById(R.id.map_text)).setTypeface(typeface); ((Button) view.findViewById(R.id.show_map)).setTypeface(typeface); - setupMapView(view); + (view.findViewById(R.id.show_map)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -61,48 +62,40 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader }); - return view; - } - - private void setupMapView(View view){ - OsmAndMapSurfaceView surf = (OsmAndMapSurfaceView) view.findViewById(R.id.MapView); - surf.setOnClickListener(new View.OnClickListener() { - + view.findViewById(R.id.map_image).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startMapActivity(); } }); - osmandMapTileView = surf.getMapView(); - osmandMapTileView.getView().setVisibility(View.VISIBLE); - osmandMapTileView.removeAllLayers(); - MapVectorLayer mapVectorLayer = new MapVectorLayer(null, true); - MapTextLayer mapTextLayer = new MapTextLayer(); - mapTextLayer.setAlwaysVisible(true); - // 5.95 all labels - osmandMapTileView.addLayer(mapTextLayer, 5.95f); - osmandMapTileView.addLayer(mapVectorLayer, 0.5f); - osmandMapTileView.setMainLayer(mapVectorLayer); - mapVectorLayer.setVisible(true); - osmandMapTileView.setShowMapPosition(false); + setMapImage(view); + + return view; } - + + private void setMapImage(View view) { + if (view == null) { + return; + } + Bitmap image = getMyApplication().getResourceManager().getRenderer().getBitmap(); + ImageView map = (ImageView) view.findViewById(R.id.map_image); + if (image != null){ + map.setImageBitmap(image); + } + } + + @Override public void onResume() { super.onResume(); - LatLon lm = getMyApplication().getSettings().getLastKnownMapLocation(); - int zm = getMyApplication().getSettings().getLastKnownMapZoom(); - //Let us not change zoom here, it provides for a smoother transition between the map and the dashboard screens, and provides better recognition of the map fragment - //zm = Math.max(zm - 3, 4); - osmandMapTileView.setLatLon(lm.getLatitude(), lm.getLongitude()); - osmandMapTileView.setComplexZoom(zm, osmandMapTileView.getSettingsMapDensity()); - osmandMapTileView.refreshMap(true); + setMapImage(getView()); + } @Override public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - view.findViewById(R.id.MapView).setVisibility(View.GONE); + view.findViewById(R.id.map_image).setVisibility(View.GONE); if(getMyApplication().isApplicationInitializing()) { getMyApplication().checkApplicationIsBeingInitialized(getActivity(), (TextView) view.findViewById(R.id.ProgressMessage), (ProgressBar) view.findViewById(R.id.ProgressBar), new Runnable() { @@ -121,7 +114,7 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader MainMenuActivity dashboardActivity =((MainMenuActivity)getSherlockActivity()); if (dashboardActivity != null){ dashboardActivity.updateDownloads(); - view.findViewById(R.id.MapView).setVisibility(View.VISIBLE); + view.findViewById(R.id.map_image).setVisibility(View.VISIBLE); } } @@ -130,11 +123,7 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader if(request != null && !request.error && request.fileToSave != null){ ResourceManager mgr = getMyApplication().getResourceManager(); mgr.tileDownloaded(request); + setMapImage(getView()); } - if(request == null || !request.error){ - if(osmandMapTileView != null) { - osmandMapTileView.tileDownloaded(request); - } - } } } diff --git a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java index 4845138db2..107e5d1ea5 100644 --- a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java @@ -91,6 +91,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { ExpandableListView listView = (ExpandableListView)view.findViewById(android.R.id.list); listAdapter = new LocalIndexesAdapter(getActivity()); listView.setAdapter(listAdapter); + expandAllGroups(); setListView(listView); //getDownloadActivity().getSupportActionBar().setLogo(R.drawable.tab_download_screen_icon); descriptionText = (TextView) view.findViewById(R.id.DescriptionText); @@ -261,6 +262,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { listAdapter.addLocalIndexInfo(v); } listAdapter.notifyDataSetChanged(); + expandAllGroups(); } public void setResult(List result) { @@ -272,6 +274,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { listAdapter.addLocalIndexInfo(v); } listAdapter.notifyDataSetChanged(); + expandAllGroups(); onPostExecute(result); } } @@ -489,6 +492,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { } listAdapter.sortData(); getExpandableListView().setAdapter(listAdapter); + expandAllGroups(); } ActionBar actionBar = getDownloadActivity().getSupportActionBar(); //hide action bar from downloadindexfragment @@ -577,11 +581,10 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { } - private void collapseAllGroups() { + private void expandAllGroups() { for (int i = 0; i < listAdapter.getGroupCount(); i++) { - getExpandableListView().collapseGroup(i); + getExpandableListView().expandGroup(i); } - } private void openSelectionMode(final int actionResId, final int actionIconId, @@ -596,7 +599,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { AccessibleToast.makeText(getDownloadActivity(), getString(R.string.local_index_no_items_to_do, actionButton.toLowerCase()), Toast.LENGTH_SHORT).show(); return; } - collapseAllGroups(); + expandAllGroups(); selectionMode = true; selectedItems.clear(); @@ -641,7 +644,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { descriptionText.setVisibility(View.VISIBLE); updateDescriptionTextWithSize(); listAdapter.cancelFilter(); - collapseAllGroups(); + expandAllGroups(); listAdapter.notifyDataSetChanged(); } @@ -998,7 +1001,9 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { if (group.isBackupedData()) { t.append(" - ").append(getString(R.string.local_indexes_cat_backup)); } - adjustIndicator(groupPosition, isExpanded, v); + + v.findViewById(R.id.explist_indicator).setVisibility(View.GONE); + TextView nameView = ((TextView) v.findViewById(R.id.category_name)); List list = data.get(group); int size = 0; @@ -1027,6 +1032,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { nameView.setTypeface(Typeface.DEFAULT, Typeface.ITALIC); } + v.setOnClickListener(null); return v; }