forked from organicmaps/organicmaps
Improved error handling for improper time format.
Signed-off-by: Nishant <nishantbhandari0019@gmail.com>
This commit is contained in:
parent
5739fa3c14
commit
b4101783c8
4 changed files with 20 additions and 11 deletions
8
android/res/color/image_view.xml
Normal file
8
android/res/color/image_view.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="true"
|
||||
android:color="@color/white_primary"/>
|
||||
|
||||
<item android:state_enabled="false"
|
||||
android:color="@color/white_54"/>
|
||||
</selector>
|
|
@ -4,6 +4,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
|
@ -27,6 +28,7 @@
|
|||
tools:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
app:tint="@color/image_view"
|
||||
android:id="@+id/save"
|
||||
android:layout_width="?actionBarSize"
|
||||
android:layout_height="?actionBarSize"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package app.organicmaps.editor;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
|
@ -8,6 +9,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
|
@ -28,6 +30,7 @@ public class AdvancedTimetableFragment extends BaseMwmFragment
|
|||
private EditText mInput;
|
||||
private WebView mExample;
|
||||
private TextView mExamplesTitle;
|
||||
private static ImageView mSaveButton;
|
||||
@Nullable
|
||||
private String mInitTimetables;
|
||||
@Nullable
|
||||
|
@ -65,6 +68,7 @@ public class AdvancedTimetableFragment extends BaseMwmFragment
|
|||
mExamplesTitle = view.findViewById(R.id.tv__examples_title);
|
||||
setExampleDrawables(R.drawable.ic_type_text, R.drawable.ic_expand_more);
|
||||
setTextChangedListener(mInput, mListener);
|
||||
mSaveButton = getParentFragment().getParentFragment().getView().findViewById(R.id.save);
|
||||
}
|
||||
|
||||
private void showExample(boolean show)
|
||||
|
@ -137,7 +141,10 @@ public class AdvancedTimetableFragment extends BaseMwmFragment
|
|||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count)
|
||||
{
|
||||
mSaveButton.setEnabled(OpeningHours.nativeIsTimetableStringValid(s.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s)
|
||||
|
|
|
@ -301,16 +301,8 @@ public class EditorHostFragment extends BaseMwmToolbarFragment
|
|||
{
|
||||
case OPENING_HOURS:
|
||||
final String timetables = ((TimetableContainerFragment) getChildFragmentManager().findFragmentByTag(TimetableContainerFragment.class.getName())).getTimetable();
|
||||
if (OpeningHours.nativeIsTimetableStringValid(timetables))
|
||||
{
|
||||
Editor.nativeSetOpeningHours(timetables);
|
||||
editMapObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO (yunikkk) correct translation
|
||||
showMistakeDialog(R.string.editor_correct_mistake);
|
||||
}
|
||||
Editor.nativeSetOpeningHours(timetables);
|
||||
editMapObject();
|
||||
break;
|
||||
case STREET:
|
||||
setStreet(((StreetFragment) getChildFragmentManager().findFragmentByTag(StreetFragment.class.getName())).getStreet());
|
||||
|
|
Loading…
Add table
Reference in a new issue