forked from organicmaps/organicmaps
Merge pull request #2457 from yunikkk/editor-ui-more
[android] Hide editor for legacy mwm mode.
This commit is contained in:
commit
4d572a759f
13 changed files with 31 additions and 30 deletions
|
@ -417,11 +417,6 @@ bool Framework::HasSpaceForMigration()
|
|||
return m_work.IsEnoughSpaceForMigrate();
|
||||
}
|
||||
|
||||
bool Framework::NeedMigrate()
|
||||
{
|
||||
return platform::migrate::NeedMigrate();
|
||||
}
|
||||
|
||||
void Framework::Migrate(bool keepOldMaps)
|
||||
{
|
||||
m_work.Migrate(keepOldMaps);
|
||||
|
|
|
@ -151,7 +151,6 @@ namespace android
|
|||
place_page::Info & GetPlacePageInfo();
|
||||
|
||||
bool HasSpaceForMigration();
|
||||
bool NeedMigrate();
|
||||
bool PreMigrate(ms::LatLon const & position, storage::Storage::TChangeCountryFunction const & statusChangeListener,
|
||||
storage::Storage::TProgressFunction const & progressListener);
|
||||
void Migrate(bool keepOldMaps);
|
||||
|
|
|
@ -3,10 +3,13 @@
|
|||
#include "../core/jni_helper.hpp"
|
||||
|
||||
#include "coding/internal/file_data.hpp"
|
||||
|
||||
#include "storage/storage.hpp"
|
||||
|
||||
#include "base/thread_checker.hpp"
|
||||
|
||||
#include "platform/mwm_version.hpp"
|
||||
|
||||
#include "std/bind.hpp"
|
||||
#include "std/shared_ptr.hpp"
|
||||
#include "std/unordered_map.hpp"
|
||||
|
@ -66,7 +69,6 @@ static TCountryId const GetRootId(JNIEnv * env, jstring root)
|
|||
{
|
||||
return (root ? jni::ToNativeString(env, root) : GetStorage().GetRootId());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
extern "C"
|
||||
|
@ -89,7 +91,7 @@ Java_com_mapswithme_maps_downloader_MapManager_nativeHasSpaceForMigration(JNIEnv
|
|||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_downloader_MapManager_nativeIsLegacyMode(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
return g_framework->NeedMigrate();
|
||||
return !version::IsSingleMwm(GetStorage().GetCurrentDataVersion());
|
||||
}
|
||||
|
||||
static void FinishMigration(JNIEnv * env)
|
||||
|
|
11
android/res/color/timetable_day_text.xml
Normal file
11
android/res/color/timetable_day_text.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:color="?android:textColorPrimary"
|
||||
android:state_enabled="true"/>
|
||||
|
||||
<item
|
||||
android:color="?android:textColorSecondary"/>
|
||||
</selector>
|
|
@ -187,6 +187,7 @@
|
|||
android:id="@+id/input"
|
||||
style="@style/MwmWidget.Editor.FieldLayout.EditText"
|
||||
android:hint="@string/phone"
|
||||
android:inputType="phone"
|
||||
tools:text="+937 99 92"/>
|
||||
|
||||
</com.mapswithme.maps.widget.CustomTextInputLayout>
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:textAppearance">@style/MwmTextAppearance.Body1</item>
|
||||
<item name="android:textColor">@color/timetable_add_complement_text</item>
|
||||
</style>
|
||||
|
||||
<style name="MwmWidget.Editor.DayLayout">
|
||||
|
@ -67,6 +68,8 @@
|
|||
<style name="MwmWidget.Editor.FieldLayout.EditText">
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:textAppearance">@style/MwmTextAppearance.Body1</item>
|
||||
<!-- TODO check night colors -->
|
||||
<item name="android:theme">@style/MwmTheme.Editor.EditText</item>
|
||||
</style>
|
||||
|
||||
<style name="MwmWidget.Editor.Problem" tools:ignore="NewApi">
|
||||
|
|
|
@ -145,7 +145,7 @@ public class MigrationFragment extends BaseMwmFragment
|
|||
return;
|
||||
|
||||
if (getActivity() instanceof MwmActivity)
|
||||
((MwmActivity)getActivity()).showDownloader(false);
|
||||
((MwmActivity) getActivity()).showDownloader(false);
|
||||
else
|
||||
getActivity().recreate();
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.support.annotation.IntRange;
|
|||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -95,7 +94,6 @@ public class SimpleTimetableAdapter extends RecyclerView.Adapter<SimpleTimetable
|
|||
protected void addTimetable()
|
||||
{
|
||||
mItems.add(OpeningHours.nativeGetComplementTimetable(mItems.toArray(new Timetable[mItems.size()])));
|
||||
printItems();
|
||||
notifyItemInserted(mItems.size() - 1);
|
||||
refreshComplement();
|
||||
}
|
||||
|
@ -103,7 +101,6 @@ public class SimpleTimetableAdapter extends RecyclerView.Adapter<SimpleTimetable
|
|||
protected void removeTimetable(int position)
|
||||
{
|
||||
mItems.remove(position);
|
||||
printItems();
|
||||
notifyItemRemoved(position);
|
||||
refreshComplement();
|
||||
}
|
||||
|
@ -154,18 +151,9 @@ public class SimpleTimetableAdapter extends RecyclerView.Adapter<SimpleTimetable
|
|||
final Timetable tts[] = mItems.toArray(new Timetable[mItems.size()]);
|
||||
mItems = new ArrayList<>(Arrays.asList(OpeningHours.nativeRemoveWorkingDay(tts, position, day)));
|
||||
refreshComplement();
|
||||
printItems();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
// FIXME remove
|
||||
private void printItems()
|
||||
{
|
||||
Log.d("TEST", "Items : \n");
|
||||
for (Timetable tt : mItems)
|
||||
Log.d("TEST", tt.toString() + "\n");
|
||||
}
|
||||
|
||||
private void setFullday(int position, boolean fullday)
|
||||
{
|
||||
mItems.set(position, OpeningHours.nativeSetIsFullday(mItems.get(position), fullday));
|
||||
|
@ -400,8 +388,8 @@ public class SimpleTimetableAdapter extends RecyclerView.Adapter<SimpleTimetable
|
|||
@Override
|
||||
void onBind()
|
||||
{
|
||||
// TODO @yunik add text with complement days
|
||||
add.setEnabled(mComplementItem != null && mComplementItem.weekdays.length != 0);
|
||||
add.setText(TimeFormatUtils.formatWeekdays(mComplementItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,9 +53,8 @@ public class TimeFormatUtils
|
|||
}
|
||||
|
||||
if (i < weekdays.length)
|
||||
{
|
||||
builder.append(", ").append(sShortWeekdays[weekdays[i]]);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
|
|
|
@ -414,7 +414,7 @@ public class MainMenu
|
|||
UiUtils.showIf(expandContent,
|
||||
mItemViews.get(Item.SEARCH),
|
||||
mItemViews.get(Item.BOOKMARKS));
|
||||
setVisible(Item.ADD_PLACE, !isRouting);
|
||||
setVisible(Item.ADD_PLACE, !isRouting && !MapManager.nativeIsLegacyMode());
|
||||
|
||||
if (isLayoutCorrected())
|
||||
{
|
||||
|
|
|
@ -54,6 +54,7 @@ import com.mapswithme.maps.bookmarks.data.DistanceAndAzimut;
|
|||
import com.mapswithme.maps.bookmarks.data.Icon;
|
||||
import com.mapswithme.maps.bookmarks.data.MapObject;
|
||||
import com.mapswithme.maps.bookmarks.data.Metadata;
|
||||
import com.mapswithme.maps.downloader.MapManager;
|
||||
import com.mapswithme.maps.editor.Editor;
|
||||
import com.mapswithme.maps.editor.OpeningHours;
|
||||
import com.mapswithme.maps.editor.data.TimeFormatUtils;
|
||||
|
@ -430,8 +431,10 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
|
|||
refreshMetadataOrHide(mMapObject.getMetadata(Metadata.MetadataType.FMD_INTERNET), mWifi, null);
|
||||
refreshMetadataOrHide(mMapObject.getMetadata(Metadata.MetadataType.FMD_FLATS), mEntrance, mTvEntrance);
|
||||
refreshOpeningHours();
|
||||
UiUtils.showIf(mMapObject != null && Editor.nativeIsFeatureEditable() && !RoutingController.get().isNavigating(), mEditor);
|
||||
UiUtils.showIf(!RoutingController.get().isNavigating(), mReport);
|
||||
UiUtils.showIf(mMapObject != null && Editor.nativeIsFeatureEditable() &&
|
||||
!RoutingController.get().isNavigating() && !MapManager.nativeIsLegacyMode(),
|
||||
mEditor);
|
||||
UiUtils.showIf(!RoutingController.get().isNavigating() && !MapManager.nativeIsLegacyMode(), mReport);
|
||||
}
|
||||
|
||||
private void refreshOpeningHours()
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace migrate
|
|||
{
|
||||
// Set of functions to support migration between different versions of MWM
|
||||
// with totaly incompatible formats.
|
||||
// 160107 - Migrate to small single file MWM
|
||||
// 160302 - Migrate to small single file MWM
|
||||
uint32_t constexpr kMinRequiredVersion = 160302;
|
||||
bool NeedMigrate()
|
||||
{
|
||||
|
|
|
@ -129,7 +129,7 @@ private:
|
|||
/// We support only one simultaneous request at the moment
|
||||
unique_ptr<MapFilesDownloader> m_downloader;
|
||||
|
||||
/// stores timestamp for update checks
|
||||
/// Stores timestamp for update checks
|
||||
int64_t m_currentVersion;
|
||||
|
||||
TCountryTree m_countries;
|
||||
|
@ -318,7 +318,7 @@ public:
|
|||
/// and will be added to |queuedChildren|.
|
||||
void GetQueuedChildren(TCountryId const & parent, TCountriesVec & queuedChildren) const;
|
||||
|
||||
/// \brief Returns current version for mwms which are available on the server.
|
||||
/// \brief Returns current version for mwms which are used by storage.
|
||||
inline int64_t GetCurrentDataVersion() const { return m_currentVersion; }
|
||||
|
||||
/// \brief Returns true if the node with countryId has been downloaded and false othewise.
|
||||
|
|
Loading…
Add table
Reference in a new issue