Fix small issues
This commit is contained in:
parent
f910427926
commit
d9e773b61d
8 changed files with 52 additions and 88 deletions
|
@ -23,7 +23,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="@color/distance_color"
|
||||
android:textColor="@color/wpt_distance_color"
|
||||
android:maxLines="2"
|
||||
android:textStyle="bold"
|
||||
android:textSize="15sp"/>
|
||||
|
|
|
@ -46,7 +46,9 @@
|
|||
|
||||
<!-- Distance to object suitable for all themes -->
|
||||
<color name="color_distance">#FD9822</color>
|
||||
|
||||
|
||||
<color name="color_myloc_distance">#0080FF</color>
|
||||
<color name="wpt_distance_color">#dd6CB336</color>
|
||||
<!-- Old dialogs colors -->
|
||||
<color name="color_white">#FFFFFF</color>
|
||||
<color name="color_black">#000000</color>
|
||||
|
@ -104,7 +106,7 @@
|
|||
<color name="osmbug_closed">#C800FF00</color> <!-- standard GREEN -->
|
||||
<color name="osmbug_not_submitted">#C8FFFF00</color> <!-- standard YELLOW -->
|
||||
|
||||
<color name="distance_color">#dd6CB336</color>
|
||||
|
||||
<color name="shadow_color">#33888888</color>
|
||||
<color name="sherpafy_selection">#ff33b5e5</color>
|
||||
<color name="sherpafy_add_text">#b9b9b9</color>
|
||||
|
|
|
@ -205,6 +205,10 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
distance = 0;
|
||||
points = 0;
|
||||
currentTrack.getModifiableGpxFile().points.clear();
|
||||
currentTrack.getModifiableGpxFile().tracks.clear();
|
||||
currentTrack.getModifiableGpxFile().modifiedTime = System.currentTimeMillis();
|
||||
currentTrack.getModifiablePointsToDisplay().clear();
|
||||
return warnings;
|
||||
}
|
||||
|
||||
|
|
|
@ -134,11 +134,11 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
Drawable iconDrawable;
|
||||
|
||||
if (recording.isAudio()) {
|
||||
iconDrawable = ctx.getIconsCache().getIcon(R.drawable.ic_type_audio, R.color.distance_color);
|
||||
iconDrawable = ctx.getIconsCache().getIcon(R.drawable.ic_type_audio, R.color.color_distance);
|
||||
} else if (recording.isVideo()) {
|
||||
iconDrawable = ctx.getIconsCache().getIcon(R.drawable.ic_type_video, R.color.distance_color);
|
||||
iconDrawable = ctx.getIconsCache().getIcon(R.drawable.ic_type_video, R.color.color_distance);
|
||||
} else {
|
||||
iconDrawable = ctx.getIconsCache().getIcon(R.drawable.ic_type_img, R.color.distance_color);
|
||||
iconDrawable = ctx.getIconsCache().getIcon(R.drawable.ic_type_img, R.color.color_distance);
|
||||
}
|
||||
icon.setImageDrawable(iconDrawable);
|
||||
return iconDrawable;
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.osmand.plus.dashboard;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
|
@ -25,20 +24,18 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
* on 21.11.2014.
|
||||
* Created by Denis on 21.11.2014.
|
||||
*/
|
||||
public class DashPluginsFragment extends DashBaseFragment {
|
||||
|
||||
public static final String TAG = "DASH_PLUGINS_FRAGMENT";
|
||||
|
||||
|
||||
private List<OsmandPlugin> plugins;
|
||||
|
||||
private final View.OnClickListener getListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
View pluginView = AndroidUtils.findParentViewById(view, R.id.dash_plugin_item);
|
||||
OsmandPlugin plugin = (OsmandPlugin)pluginView.getTag();
|
||||
OsmandPlugin plugin = (OsmandPlugin) pluginView.getTag();
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL())));
|
||||
}
|
||||
};
|
||||
|
@ -46,7 +43,7 @@ public class DashPluginsFragment extends DashBaseFragment {
|
|||
private final View.OnClickListener pluginDetailsListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
OsmandPlugin plugin = (OsmandPlugin)view.getTag();
|
||||
OsmandPlugin plugin = (OsmandPlugin) view.getTag();
|
||||
|
||||
Intent intent = new Intent(getActivity(), PluginActivity.class);
|
||||
intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, plugin.getId());
|
||||
|
@ -55,39 +52,38 @@ public class DashPluginsFragment extends DashBaseFragment {
|
|||
};
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View contentView = inflater.inflate(R.layout.dash_plugins_fragment, container, false);
|
||||
contentView.findViewById(R.id.show_all).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startActivity(new Intent(getActivity(),
|
||||
getMyApplication().getAppCustomization().getPluginsActivity()));
|
||||
startActivity(new Intent(getActivity(), getMyApplication().getAppCustomization().getPluginsActivity()));
|
||||
}
|
||||
});
|
||||
|
||||
LinearLayout pluginsContainer = (LinearLayout) contentView.findViewById(R.id.plugins);
|
||||
List<OsmandPlugin> notActivePlugins = OsmandPlugin.getNotEnabledPlugins();
|
||||
Collections.shuffle(notActivePlugins);
|
||||
for(OsmandPlugin plugin : notActivePlugins) {
|
||||
plugins = new ArrayList<OsmandPlugin>();
|
||||
for (OsmandPlugin plugin : notActivePlugins) {
|
||||
if (plugin instanceof OsmandDevelopmentPlugin) {
|
||||
continue;
|
||||
}
|
||||
|
||||
inflatePluginView(inflater, pluginsContainer, plugin);
|
||||
plugins.add(plugin);
|
||||
break;
|
||||
}
|
||||
for(OsmandPlugin plugin : OsmandPlugin.getEnabledPlugins()) {
|
||||
if (pluginsContainer.getChildCount() >= 5) {
|
||||
for (OsmandPlugin plugin : OsmandPlugin.getEnabledPlugins()) {
|
||||
if (plugins.size() >= 5) {
|
||||
break;
|
||||
}
|
||||
if (plugin instanceof OsmandDevelopmentPlugin) {
|
||||
continue;
|
||||
}
|
||||
|
||||
inflatePluginView(inflater, pluginsContainer, plugin);
|
||||
plugins.add(plugin);
|
||||
}
|
||||
for (OsmandPlugin p : plugins) {
|
||||
inflatePluginView(inflater, pluginsContainer, p);
|
||||
}
|
||||
|
||||
return contentView;
|
||||
}
|
||||
|
||||
|
@ -100,19 +96,15 @@ public class DashPluginsFragment extends DashBaseFragment {
|
|||
return;
|
||||
}
|
||||
LinearLayout pluginsContainer = (LinearLayout) contentView.findViewById(R.id.plugins);
|
||||
|
||||
for (int pluginIndex = 0; pluginIndex < pluginsContainer.getChildCount(); pluginIndex++) {
|
||||
for (int pluginIndex = 0; pluginIndex < plugins.size(); pluginIndex++) {
|
||||
View pluginView = pluginsContainer.getChildAt(pluginIndex);
|
||||
|
||||
updatePluginState(pluginView);
|
||||
updatePluginState(pluginView, plugins.get(pluginIndex));
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePluginState(View pluginView) {
|
||||
OsmandPlugin plugin = (OsmandPlugin)pluginView.getTag();
|
||||
CompoundButton enableDisableButton = (CompoundButton)pluginView.findViewById(
|
||||
R.id.plugin_enable_disable);
|
||||
Button getButton = (Button)pluginView.findViewById(R.id.get_plugin);
|
||||
private void updatePluginState(View pluginView, OsmandPlugin plugin) {
|
||||
CompoundButton enableDisableButton = (CompoundButton) pluginView.findViewById(R.id.plugin_enable_disable);
|
||||
Button getButton = (Button) pluginView.findViewById(R.id.get_plugin);
|
||||
if (plugin.needsInstallation()) {
|
||||
getButton.setVisibility(View.VISIBLE);
|
||||
enableDisableButton.setVisibility(View.GONE);
|
||||
|
@ -122,36 +114,32 @@ public class DashPluginsFragment extends DashBaseFragment {
|
|||
enableDisableButton.setChecked(plugin.isActive());
|
||||
}
|
||||
|
||||
ImageButton logoView = (ImageButton)pluginView.findViewById(R.id.plugin_logo);
|
||||
ImageButton logoView = (ImageButton) pluginView.findViewById(R.id.plugin_logo);
|
||||
if (plugin.isActive()) {
|
||||
logoView.setBackgroundResource(R.drawable.bg_plugin_logo_enabled);
|
||||
} else {
|
||||
TypedArray attributes = getActivity().getTheme().obtainStyledAttributes(
|
||||
new int[] {R.attr.bg_plugin_logo_disabled});
|
||||
new int[] { R.attr.bg_plugin_logo_disabled });
|
||||
logoView.setBackgroundDrawable(attributes.getDrawable(0));
|
||||
attributes.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
private void inflatePluginView(LayoutInflater inflater, ViewGroup container,
|
||||
final OsmandPlugin plugin) {
|
||||
private void inflatePluginView(LayoutInflater inflater, ViewGroup container, final OsmandPlugin plugin) {
|
||||
View view = inflater.inflate(R.layout.dash_plugin_item, container, false);
|
||||
view.setTag(plugin);
|
||||
|
||||
view.setOnClickListener(pluginDetailsListener);
|
||||
|
||||
TextView nameView = (TextView)view.findViewById(R.id.plugin_name);
|
||||
TextView nameView = (TextView) view.findViewById(R.id.plugin_name);
|
||||
nameView.setText(plugin.getName());
|
||||
|
||||
ImageButton logoView = (ImageButton)view.findViewById(R.id.plugin_logo);
|
||||
ImageButton logoView = (ImageButton) view.findViewById(R.id.plugin_logo);
|
||||
logoView.setImageResource(plugin.getLogoResourceId());
|
||||
|
||||
CompoundButton enableDisableButton =
|
||||
(CompoundButton)view.findViewById(R.id.plugin_enable_disable);
|
||||
Button getButton = (Button)view.findViewById(R.id.get_plugin);
|
||||
CompoundButton enableDisableButton = (CompoundButton) view.findViewById(R.id.plugin_enable_disable);
|
||||
Button getButton = (Button) view.findViewById(R.id.get_plugin);
|
||||
getButton.setOnClickListener(getListener);
|
||||
enableDisableButton.setOnCheckedChangeListener(null);
|
||||
updatePluginState(view);
|
||||
updatePluginState(view, plugin);
|
||||
final View pluginView = view;
|
||||
enableDisableButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
|
@ -160,8 +148,7 @@ public class DashPluginsFragment extends DashBaseFragment {
|
|||
return;
|
||||
}
|
||||
if (OsmandPlugin.enablePlugin(getActivity(), getMyApplication(), plugin, isChecked)) {
|
||||
|
||||
updatePluginState(pluginView);
|
||||
updatePluginState(pluginView, plugin);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -30,7 +30,7 @@ public class DashboardOnMap {
|
|||
|
||||
private MapActivity ma;
|
||||
FloatingActionButton fabButton;
|
||||
boolean floatingButtonVisible = false;
|
||||
boolean floatingButtonVisible = true;
|
||||
private FrameLayout dashboardView;
|
||||
private boolean visible = false;
|
||||
|
||||
|
@ -57,13 +57,12 @@ public class DashboardOnMap {
|
|||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
fabButton = new FloatingActionButton.Builder(ma)
|
||||
.withDrawable(ma.getResources().getDrawable(R.drawable.ic_action_map))
|
||||
.withButtonColor(Color.parseColor("#ff8f00")).withGravity(Gravity.BOTTOM | Gravity.RIGHT)
|
||||
.withMargins(0, 0, 16, 16).create();
|
||||
.withButtonColor(ma.getResources().getColor(R.color.color_myloc_distance)).withGravity(Gravity.TOP | Gravity.RIGHT)
|
||||
.withMargins(0, 160, 16, 0).create();
|
||||
fabButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
setDashboardVisibility(false);
|
||||
fabButton.hideFloatingActionButton();
|
||||
}
|
||||
});
|
||||
fabButton.hideFloatingActionButton();
|
||||
|
@ -82,9 +81,7 @@ public class DashboardOnMap {
|
|||
if (visible) {
|
||||
addDashboardFragments();
|
||||
dashboardView.setVisibility(View.VISIBLE);
|
||||
if (floatingButtonVisible) {
|
||||
fabButton.showFloatingActionButton();
|
||||
}
|
||||
fabButton.showFloatingActionButton();
|
||||
open(dashboardView.findViewById(R.id.content));
|
||||
ma.getMapActions().disableDrawer();
|
||||
ma.findViewById(R.id.MapInfoControls).setVisibility(View.GONE);
|
||||
|
@ -99,16 +96,16 @@ public class DashboardOnMap {
|
|||
}
|
||||
|
||||
// To animate view slide out from right to left
|
||||
public void open(View view){
|
||||
TranslateAnimation animate = new TranslateAnimation(0,0,ma.findViewById(R.id.ParentLayout).getHeight(),0);
|
||||
private void open(View view){
|
||||
TranslateAnimation animate = new TranslateAnimation(-ma.findViewById(R.id.ParentLayout).getWidth(),0,0,0);
|
||||
animate.setDuration(500);
|
||||
animate.setFillAfter(true);
|
||||
view.startAnimation(animate);
|
||||
view.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public void hide(View view) {
|
||||
TranslateAnimation animate = new TranslateAnimation(0, 0, 0, ma.findViewById(R.id.ParentLayout).getHeight());
|
||||
private void hide(View view) {
|
||||
TranslateAnimation animate = new TranslateAnimation(0, -ma.findViewById(R.id.ParentLayout).getWidth(), 0, 0);
|
||||
animate.setDuration(500);
|
||||
animate.setFillAfter(true);
|
||||
animate.setAnimationListener(new AnimationListener() {
|
||||
|
@ -141,9 +138,6 @@ public class DashboardOnMap {
|
|||
DashErrorFragment errorFragment = new DashErrorFragment();
|
||||
fragmentTransaction.add(R.id.content, errorFragment, DashErrorFragment.TAG);
|
||||
}
|
||||
// if (manager.findFragmentByTag(DashMapFragment.TAG) == null) {
|
||||
// fragmentTransaction.add(R.id.content, new DashMapFragment(), DashMapFragment.TAG);
|
||||
// }
|
||||
if (manager.findFragmentByTag(DashSearchFragment.TAG) == null) {
|
||||
fragmentTransaction.add(R.id.content, new DashSearchFragment(), DashSearchFragment.TAG);
|
||||
}
|
||||
|
@ -172,30 +166,7 @@ public class DashboardOnMap {
|
|||
private NotifyingScrollView.OnScrollChangedListener onScrollChangedListener = new NotifyingScrollView.OnScrollChangedListener() {
|
||||
public void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt) {
|
||||
//making background of actionbar transparent with scroll
|
||||
final int imageHeight = 200;
|
||||
final int headerHeight = 200;
|
||||
final float ratio = (float) Math.min(Math.max(t, 0), headerHeight) / headerHeight;
|
||||
int margintop = -(int)(ratio * 60);
|
||||
Resources r = ma.getResources();
|
||||
int px = (int) TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
margintop,
|
||||
r.getDisplayMetrics());
|
||||
int margin = px + (int)ma.getResources().getDimension(R.dimen.dashboard_map_bottom_padding);
|
||||
if (headerHeight < t - margin){
|
||||
//hiding action bar - showing floating button
|
||||
//getSupportActionBar().hide();
|
||||
if (fabButton != null) {
|
||||
fabButton.showFloatingActionButton();
|
||||
floatingButtonVisible = true;
|
||||
}
|
||||
} else {
|
||||
//getSupportActionBar().show();
|
||||
if (fabButton != null) {
|
||||
fabButton.hideFloatingActionButton();
|
||||
floatingButtonVisible = false;
|
||||
}
|
||||
}
|
||||
// TODO
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -426,7 +426,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
|||
bitmapPaint.setFilterBitmap(true);
|
||||
path = new Path();
|
||||
|
||||
int distanceColor = view.getResources().getColor(R.color.distance_color);
|
||||
int distanceColor = view.getResources().getColor(R.color.color_distance);
|
||||
paint = new Paint();
|
||||
paint.setStyle(Style.STROKE);
|
||||
paint.setStrokeWidth(7 * view.getDensity());
|
||||
|
|
|
@ -1334,7 +1334,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
selectedGpxHelper.getSelectedFileByName(child.getFileName());
|
||||
GPXTrackAnalysis analysis = null;
|
||||
if (sgpx != null) {
|
||||
icon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_gpx_track, R.color.distance_color));
|
||||
icon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_gpx_track, R.color.color_distance));
|
||||
analysis = sgpx.getTrackAnalysis();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue