Merge pull request #1021 from Bars107/master

Improvements.
This commit is contained in:
vshcherb 2014-12-24 02:19:40 +01:00
commit 4ca1098196
15 changed files with 166 additions and 81 deletions

View file

@ -128,6 +128,7 @@
<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.dashboard.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" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/main_scroll"
android:background="@color/dashboard_background" >
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="net.osmand.plus.dashboard.DashAudioVideoNotesFragment"
android:layout_marginTop="@dimen/dashCardMargin"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</ScrollView>

View file

@ -6,7 +6,8 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout android:orientation="horizontal"
<LinearLayout android:id="@+id/header"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashHeaderHeight">
<TextView android:id="@+id/notes_text"

View file

@ -5,13 +5,24 @@
android:background="@drawable/bg_cardui"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/error_header"
android:layout_height="wrap_content"
android:padding="@dimen/dashFavIconMargin"
android:layout_width="match_parent"
android:gravity="center_horizontal"
android:textColor="@color/dashboard_black"
android:layout_gravity="center_horizontal"/>
<LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView android:src="@drawable/ic_crashlog"
android:layout_marginLeft="@dimen/dashFavIconMargin"
android:layout_marginRight="@dimen/dashFavIconMargin"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/error_header"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginBottom="@dimen/subHeaderPadding"
android:layout_marginTop="@dimen/subHeaderPadding"
android:textColor="@color/dashboard_black"
android:layout_gravity="center_horizontal"/>
</LinearLayout>
<View android:layout_width="match_parent"
android:background="@color/dashboard_divider"
android:layout_height="1dp"/>

View file

@ -18,7 +18,7 @@
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/subHeaderPadding">
android:padding="@dimen/subHeaderPadding">
<LinearLayout android:id="@+id/loading"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashMapHeight"
@ -28,7 +28,7 @@
<ProgressBar
android:id="@+id/ProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/ProgressMessage"
@ -36,18 +36,18 @@
android:layout_height="wrap_content"
android:maxLines="3"
android:text="@string/loading_data"
android:textSize="@dimen/dashProgressTextSize" />
android:textSize="@dimen/dashProgressTextSize"/>
</LinearLayout>
<net.osmand.plus.views.OsmAndMapSurfaceView
android:id="@+id/MapView"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashMapHeight"
android:layout_marginLeft="@dimen/dashMapMargin"
android:layout_marginRight="@dimen/dashMapMargin"
android:layout_marginBottom="@dimen/dashMapMargin"
android:contentDescription="@string/map_view"
android:visibility="gone"/>
<ImageView android:id="@+id/map_image"
android:scaleType="centerCrop"
android:src="@drawable/background"
android:layout_width="match_parent"
android:layout_height="@dimen/dashMapHeight"
android:layout_marginLeft="@dimen/subHeaderPadding"
android:layout_marginRight="@dimen/subHeaderPadding"
android:layout_marginBottom="@dimen/subHeaderPadding"
android:visibility="gone"/>
</RelativeLayout>
</LinearLayout>

View file

@ -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">
<View android:layout_width="match_parent"
android:background="@color/dashboard_divider"
android:layout_height="1dp"/>
@ -43,9 +43,10 @@
<ImageButton android:id="@+id/play"
android:src="@drawable/ic_play_light"
android:background="@drawable/dashboard_button"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dashFavIconMargin"
android:layout_width="@dimen/dashHeaderHeight"
android:layout_height="@dimen/dashHeaderHeight"/>
android:layout_width="@dimen/dashListItemHeight"
android:layout_height="@dimen/dashListItemHeight"/>
</LinearLayout>

View file

@ -10,7 +10,6 @@
<dimen name="dashFavIconMargin">12dp</dimen>
<dimen name="dashFavDirectionSize">10dp</dimen>
<dimen name="dashMapHeight">110dp</dimen>
<dimen name="dashMapMargin">2dp</dimen>
<dimen name="dashNoteIconSize">28dp</dimen>
<dimen name="dashPluginPadding">4dp</dimen>
<dimen name="dashPluginMargin">8dp</dimen>

View file

@ -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);
}
}
}

View file

@ -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);
}

View file

@ -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);
}
}
}
}

View file

@ -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<LocalIndexInfo> 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<LocalIndexInfo> 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;
}