Merge pull request #1110 from Bars107/master

Bugfixes and little improvements.
This commit is contained in:
vshcherb 2015-03-25 10:45:04 +01:00
commit a231eeda19
18 changed files with 175 additions and 49 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:drawable="@color/parking_card_selected" />
<item android:state_pressed="true" android:drawable="@color/parking_card_selected" />
<item android:state_focused="true" android:drawable="@color/parking_card_selected" />
<item android:drawable="@color/dashboard_blue" />
<item android:state_enabled="false" android:drawable="@color/dashboard_parking_light_selected" />
<item android:state_pressed="true" android:drawable="@color/dashboard_parking_light_selected" />
<item android:state_focused="true" android:drawable="@color/dashboard_parking_light_selected" />
<item android:drawable="@color/dashboard_parking_light_color" />
</selector>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#BB000000"
android:startColor="#00000000"
/>
</shape>

View file

@ -10,7 +10,7 @@
android:id="@+id/header_layout"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashHeaderHeight"
android:orientation="horizontal" >
android:orientation="horizontal">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/fav_text"
@ -18,10 +18,12 @@
android:text="@string/osmo"
osmand:typeface="@string/font_roboto_medium" />
<include layout="@layout/check_item_rel"/>
<net.osmand.plus.widgets.ButtonEx
android:id="@+id/manage"
style="?attr/dashboardGeneralButtonStyle"
android:text="@string/shared_string_show_all"
android:text="@string/dash_download_manage"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium" />
</LinearLayout>
@ -32,7 +34,7 @@
android:background="?attr/dashboard_divider" />
<LinearLayout
<LinearLayout android:id="@+id/card_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
@ -49,8 +51,9 @@
<ImageButton
android:id="@+id/share"
style="?attr/dashboardGeneralButtonStyle"
android:text="@string/shared_string_show_all"/>
android:layout_width="@dimen/dashListItemHeight"
android:layout_height="@dimen/dashListItemHeight"
style="?attr/dashboardGeneralButtonStyle"/>
<include layout="@layout/check_item_rel"/>
</LinearLayout>

View file

@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/expandable_list_item_background"
android:minHeight="@dimen/dashListItemHeight"
android:orientation="vertical">

View file

@ -68,13 +68,6 @@
android:layout_height="match_parent"
android:fadeScrollbars="true" >
</com.github.ksoichiro.android.observablescrollview.ObservableListView>
<!--
<android.support.v7.widget.Toolbar android:id="@+id/dash_toolbar"
android:background="@color/actionbar_light_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
></android.support.v7.widget.Toolbar>
-->
</FrameLayout>
<ImageButton
@ -86,6 +79,13 @@
android:layout_marginTop="@dimen/map_button_margin"
android:background="@drawable/btn_inset_circle"
android:src="@drawable/ic_action_remove_light" />
<net.osmand.plus.activities.search.toolbar.SplitToolbar
android:id="@+id/toolbar"
android:background="@drawable/gradient_toolbar"
android:layout_width="fill_parent"
android:layout_height="65dp"/>
</FrameLayout>
</FrameLayout>

View file

@ -5,7 +5,8 @@
<color name="osmo_header_dark">#2d383d</color>
<color name="osmo_header_light">#b36d12</color>
<color name="parking_card_selected">#234DDE</color>
<color name="dashboard_parking_light_selected">#007888</color>
<color name="dashboard_parking_light_color">#009688</color>
<color name="dashboard_parking_dark_color">#54778c</color>
<color name="dashboard_parking_dark_selected">#446072</color>

View file

@ -49,6 +49,5 @@ public class ActionBarProgressActivity extends OsmandActionBarActivity {
if (toolbar != null) {
toolbar.setVisibility(visible? View.VISIBLE : View.GONE);
}
}
}

View file

@ -66,6 +66,7 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.support.v7.widget.Toolbar;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
@ -134,6 +135,7 @@ public class MapActivity extends AccessibleActivity {
// Full screen is not used here
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
mapView = new OsmandMapTileView(this);
mapActions = new MapActivityActions(this);
mapLayers = new MapActivityLayers(this);
@ -141,6 +143,8 @@ public class MapActivity extends AccessibleActivity {
mapViewTrackingUtilities = new MapViewTrackingUtilities(app);
}
dashboardOnMap.createDashboardView();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setVisibility(View.GONE);
checkAppInitialization();
parseLaunchIntentLocation();
mapView.setTrackBallDelegate(new OsmandMapTileView.OnTrackBallListener() {
@ -232,7 +236,15 @@ public class MapActivity extends AccessibleActivity {
}
}
public Toolbar getClearToolbar(boolean visible){
return dashboardOnMap.getClearToolbar(visible);
}
public void setToolbarVisibility(boolean visible){
dashboardOnMap.setToolbarVisibility(visible);
}
private void setupOpenGLView(boolean init) {
if (settings.USE_OPENGL_RENDER.get() && NativeCoreContext.isInit()) {
ViewStub stub = (ViewStub) findViewById(R.id.atlasMapRendererViewStub);

View file

@ -631,6 +631,7 @@ public class MapActivityActions implements DialogProvider {
public void prepareConfigureMap() {
currentDrawer = DrawerType.CONFIGURE_MAP;
//mapActivity.getClearToolbar(true);
prepareOptionsMenu(new ConfigureMapMenu().createListAdapter(mapActivity, true));
}

View file

@ -88,13 +88,33 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
this.mapActivity = ma;
}
public Toolbar getClearToolbar(boolean visible) {
final Toolbar tb = (Toolbar) dashboardView.findViewById(R.id.toolbar);
if (tb == null) {
return null;
}
tb.setTitle(null);
tb.getMenu().clear();
setToolbarVisibility(visible);
return tb;
}
public void setToolbarVisibility(boolean visible){
int visibility = visible? View.VISIBLE : View.GONE;
View toolbar = dashboardView.findViewById(R.id.toolbar);
if (toolbar != null) {
toolbar.setVisibility(visibility);
}
View buttons = dashboardView.findViewById(R.id.map_menu_button);
if (buttons != null) {
buttons.setVisibility(visibility);
}
actionButton.setVisibility(visibility);
}
public void createDashboardView() {
landscape = !ScreenOrientationHelper.isOrientationPortrait(mapActivity);
// dashboardView = (FrameLayout) mapActivity.getLayoutInflater().inflate(R.layout.dashboard_over_map, null, false);
// dashboardView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
// ViewGroup.LayoutParams.MATCH_PARENT));
// ((FrameLayout) mapActivity.findViewById(R.id.MapHudButtonsOverlay)).addView(dashboardView);
dashboardView = (FrameLayout) mapActivity.findViewById(R.id.dashboard);
View.OnClickListener listener = new View.OnClickListener() {
@Override

View file

@ -509,10 +509,10 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
}
};
optionsMenuAdapter.item(R.string.local_index_mi_reload)
.iconColor(R.drawable.ic_action_refresh_dark)
.icon(R.drawable.ic_action_refresh_dark)
.listen(listener).position(1).reg();
optionsMenuAdapter.item(R.string.shared_string_delete)
.iconColor(R.drawable.ic_action_delete_dark)
.icon(R.drawable.ic_action_delete_dark)
.listen(listener).position(2).reg();
optionsMenuAdapter.item(R.string.local_index_mi_backup)
.listen(listener).position(3).reg();

View file

@ -203,7 +203,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
if (fragment instanceof AvailableGPXFragment) {
final AvailableGPXFragment f = ((AvailableGPXFragment) fragment);
optionsMenuAdapter.item(R.string.local_index_mi_upload_gpx)
.iconColor(R.drawable.ic_action_export)
.icon(R.drawable.ic_action_export)
.listen(new OnContextMenuClick() {
@Override

View file

@ -75,21 +75,26 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups
private void setupOsMoView() {
View mainView = getView();
boolean show = plugin != null;
if (show) {
show = plugin.getService().isEnabled();
}
if (!show) {
if (plugin == null) {
mainView.setVisibility(View.GONE);
return;
} else {
mainView.setVisibility(View.VISIBLE);
}
updateStatus();
}
private void setupHader(final View header) {
CompoundButton trackr = (CompoundButton) header.findViewById(R.id.check_item);
CompoundButton enableService = (CompoundButton)header.findViewById(R.id.header_layout).findViewById(R.id.check_item);
CompoundButton trackr = (CompoundButton) header.findViewById(R.id.card_content).findViewById(R.id.check_item);
enableService.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
plugin.getService().connect(true);
}
});
final OsmandApplication app = getMyApplication();
trackr.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@ -132,6 +137,19 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups
if (getView() == null) {
return;
}
View cardContent = header.findViewById(R.id.card_content);
View enableOsmo = header.findViewById(R.id.header_layout).findViewById(R.id.check_item);
if (plugin.getService().isEnabled()) {
cardContent.setVisibility(View.VISIBLE);
enableOsmo.setVisibility(View.GONE);
} else {
cardContent.setVisibility(View.GONE);
enableOsmo.setVisibility(View.VISIBLE);
getClearContentList(header);
return;
}
CompoundButton trackr = (CompoundButton) header.findViewById(R.id.check_item);
if (plugin != null && plugin.getTracker() != null) {
trackr.setChecked(plugin.getTracker().isEnabledTracker());
@ -151,23 +169,40 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups
break;
}
}
LinearLayout contentList = (LinearLayout) mainView.findViewById(R.id.items);
contentList.removeAllViews();
LinearLayout contentList = getClearContentList(mainView);
if (mainGroup == null) {
return;
}
String trackerId = plugin.getService().getMyGroupTrackerId();
List<OsMoGroupsStorage.OsMoDevice> devices =
new ArrayList<>(mainGroup.getVisibleGroupUsers(plugin.getService().getMyGroupTrackerId()));
new ArrayList<>(mainGroup.getVisibleGroupUsers(trackerId));
while (devices.size() > 3) {
devices.remove(devices.size() - 1);
if (devices.size() > 3) {
while (devices.size() > 3) {
devices.remove(devices.size() - 1);
}
} else {
if (groups.size() > 0){
for (OsMoGroupsStorage.OsMoGroup grp : groups) {
if (grp.getVisibleGroupUsers(trackerId).size() > 0) {
}
}
}
}
setupDeviceViews(contentList, devices);
if (devices.size() < 3 && groups.size() > 0) {
setupGroupsViews(3 - devices.size(), groups, contentList);
}
// if (devices.size() < 3 && groups.size() > 0) {
// setupGroupsViews(3 - devices.size(), groups, contentList);
// }
}
private LinearLayout getClearContentList(View mainView) {
LinearLayout contentList = (LinearLayout) mainView.findViewById(R.id.items);
contentList.removeAllViews();
return contentList;
}
private void setupGroupsViews(int toAddCount, ArrayList<OsMoGroupsStorage.OsMoGroup> groups, LinearLayout contentList) {
@ -293,7 +328,7 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateConnectedDevices(getView());
updateStatus();
}
});
}

View file

@ -433,10 +433,18 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
actionMode = startSupportActionMode(new ActionMode.Callback() {
private OsMoDevice device;
private OsMoGroup group;
private Menu menu;
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
selectedObject = o;
boolean portrait = ScreenOrientationHelper.isOrientationPortrait(OsMoGroupsActivity.this);
if (portrait) {
menu = getClearToolbar(true).getMenu();
} else {
getClearToolbar(false);
}
this.menu = menu;
device = (OsMoDevice) (o instanceof OsMoDevice ? o : null);
group = (OsMoGroup) (o instanceof OsMoGroup ? o : null);
MenuItem mi = null;
@ -446,31 +454,31 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
}
if (device != null && device.getLastLocation() != null) {
createMenuItem(menu, SHOW_ON_MAP_ID, R.string.shared_string_show_on_map, R.drawable.ic_action_marker_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark,
// there is a bug in Android 4.2 layout
device != null && device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
device != null && device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
///
if (device != null) {
createMenuItem(menu, SETTINGS_DEV_ID, R.string.shared_string_settings, R.drawable.ic_action_settings_enabled_dark,
// there is a bug in Android 4.2 layout
device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
if (device != null && device.getLastLocation() != null) {
MenuItem menuItem = createMenuItem(menu, TRACK_DEV_ID, R.string.osmo_set_moving_target, R.drawable.ic_action_flage_dark,
// there is a bug in Android 4.2 layout
device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
menuItem.setTitleCondensed(getString(R.string.osmo_follow));
}
if (group != null) {
createMenuItem(menu, GROUP_INFO, R.string.osmo_group_info, R.drawable.ic_action_info_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
if ((group != null && !group.isMainGroup()) || (device != null && device.getGroup().isMainGroup())) {
createMenuItem(menu, DELETE_ACTION_ID, R.string.shared_string_delete,
R.drawable.ic_action_delete_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
@ -500,6 +508,9 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
public void onDestroyActionMode(ActionMode mode) {
selectedObject = null;
refreshList();
if (ScreenOrientationHelper.isOrientationPortrait(OsMoGroupsActivity.this)){
onCreateOptionsMenu(menu);
}
}
@Override

View file

@ -5,6 +5,7 @@ import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
@ -129,12 +130,24 @@ public class SettingsOsMoActivity extends SettingsBaseActivity {
ScrollView sv = new ScrollView(this);
TextView tv = new TextView(this);
sv.addView(tv);
tv.setText(bs.toString());
final String log = bs.toString();
tv.setText(log);
tv.setPadding(5, 0, 5, 5);
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 19);
tv.setMovementMethod(LinkMovementMethod.getInstance());
bld.setView(sv);
bld.setPositiveButton(R.string.shared_string_ok, null);
bld.setNegativeButton(R.string.shared_string_ok, null);
bld.setPositiveButton(R.string.shared_string_share, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_fav_subject));
sendIntent.putExtra(Intent.EXTRA_TEXT, log);
sendIntent.setType("text/plain");
startActivity(sendIntent);
}
});
bld.show();
return true;
} else if(preference == trackerId) {

View file

@ -0,0 +1,8 @@
/*___Generated_by_IDEA___*/
package net.osmand.addressPlugin;
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = Boolean.parseBoolean(null);
}

View file

@ -0,0 +1,7 @@
/*___Generated_by_IDEA___*/
package net.osmand.addressPlugin;
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
}

View file

@ -0,0 +1,7 @@
/*___Generated_by_IDEA___*/
package net.osmand.addressPlugin;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
}