Merge pull request #9670 from osmandapp/theme_fixes

Fix Material Theme
This commit is contained in:
Vitaliy 2020-08-25 14:24:04 +03:00 committed by GitHub
commit 00bfa6e098
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 92 additions and 81 deletions

View file

@ -104,6 +104,7 @@
android:paddingRight="@dimen/content_padding_small"
android:paddingEnd="@dimen/content_padding_small"
android:paddingLeft="@dimen/content_padding_small"
android:textColor="?android:textColorSecondary"
android:text="@string/shared_string_meters" />
</FrameLayout>

View file

@ -43,6 +43,7 @@
android:ellipsize="end"
android:maxLines="2"
style="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="@null"
tools:text="Some description" />
</LinearLayout>

View file

@ -44,6 +44,7 @@
android:ellipsize="end"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="@null"
tools:text="Some description"/>
</LinearLayout>

View file

@ -44,6 +44,7 @@
android:ellipsize="end"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="@null"
tools:text="Some description"/>
</LinearLayout>

View file

@ -49,6 +49,7 @@
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textColor="@null"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
tools:text="Some description" />
</LinearLayout>

View file

@ -43,26 +43,32 @@
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll">
<com.google.android.material.textfield.TextInputLayout
<net.osmand.plus.widgets.OsmandTextFieldBoxes
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/shared_string_name"
app:labelText="@string/shared_string_name"
app:panelBackgroundColor="@color/color_transparent"
app:colorControlHighlight="@color/color_transparent"
app:primaryColor="@color/color_white"
app:secondaryColor="@color/white_50_transparent"
app:useDenseSpacing="true"
android:importantForAutofill="noExcludeDescendants"
android:layout_marginLeft="@dimen/settings_divider_margin_start"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginStart="@dimen/settings_divider_margin_start"
android:layout_marginEnd="@dimen/content_padding">
<EditText
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/poiNameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_transparent"
android:imeOptions="actionNext"
android:importantForAutofill="noExcludeDescendants"
android:inputType="textCapSentences"
tools:text="@string/lorem_ipsum"/>
</com.google.android.material.textfield.TextInputLayout>
</net.osmand.plus.widgets.OsmandTextFieldBoxes>
</LinearLayout>
<LinearLayout
@ -80,32 +86,33 @@
android:background="@null"
app:srcCompat="@drawable/ic_action_label"/>
<com.google.android.material.textfield.TextInputLayout
<net.osmand.plus.widgets.OsmandTextFieldBoxes
android:id="@+id/poiTypeTextInputLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/poi_dialog_poi_type"
android:importantForAutofill="noExcludeDescendants"
android:layout_marginLeft="24dp"
android:layout_weight="1"
android:layout_marginStart="24dp">
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:importantForAutofill="noExcludeDescendants"
app:endIcon="@drawable/ic_action_arrow_drop_down"
app:labelText="@string/poi_dialog_poi_type"
app:panelBackgroundColor="@color/color_transparent"
app:primaryColor="@color/color_white"
app:secondaryColor="@color/white_50_transparent">
<com.google.android.material.textfield.MaterialAutoCompleteTextView
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/poiTypeEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/wpt_list_item_height"
android:gravity="bottom|start"
android:paddingBottom="@dimen/text_margin_small"
android:completionThreshold="1"
app:drawableRightCompat="@drawable/ic_action_arrow_drop_down"
app:drawableEndCompat="@drawable/ic_action_arrow_drop_down"
android:importantForAutofill="noExcludeDescendants"
android:gravity="bottom|start"
android:imeOptions="actionSend"
android:importantForAutofill="noExcludeDescendants"
android:inputType="text"
android:paddingBottom="@dimen/text_margin_small"
tools:text="@string/lorem_ipsum" />
</com.google.android.material.textfield.TextInputLayout>
</net.osmand.plus.widgets.OsmandTextFieldBoxes>
<ImageButton
android:id="@+id/onlineDocumentationButton"

View file

@ -22,6 +22,7 @@
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_action_plus"
app:backgroundTint="?attr/active_color_basic"
app:tint="?attr/app_bar_primary_item_color"
app:fabSize="normal"
app:useCompatPadding="true"/>

View file

@ -24,6 +24,7 @@
android:ellipsize="end"
android:maxLines="5"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="@null"
tools:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard."
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding" />

View file

@ -64,19 +64,21 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.8"
android:minHeight="48dp"
android:minHeight="@dimen/card_row_min_height"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half"
android:paddingBottom="@dimen/content_padding_half"
android:paddingStart="@dimen/content_padding"
android:paddingRight="0dp"
android:paddingEnd="0dp"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingStart="@dimen/content_padding">
android:gravity="center_vertical">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="?android:textColorPrimary"
android:paddingTop="@dimen/content_padding_half"
android:paddingBottom="@dimen/content_padding_half"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
android:text="@string/shared_string_show_on_map"/>
@ -119,14 +121,16 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.6"
android:minHeight="48dp"
android:minHeight="@dimen/card_row_min_height"
android:paddingLeft="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:paddingRight="0dp"
android:paddingEnd="0dp"
android:paddingTop="@dimen/content_padding_half"
android:paddingBottom="@dimen/content_padding_half"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingStart="@dimen/content_padding">
android:gravity="center_vertical">
<TextView
android:id="@+id/split_interval_title"
@ -166,7 +170,7 @@
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="48dp"
android:minHeight="@dimen/card_row_min_height"
android:orientation="horizontal"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half"

View file

@ -34,10 +34,8 @@
android:visibility="gone"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingRight="@dimen/dialog_content_margin"
android:paddingEnd="@dimen/dialog_content_margin"
android:paddingLeft="0dp"
android:paddingStart="0dp"
android:layout_marginRight="@dimen/dialog_content_margin"
android:layout_marginEnd="@dimen/dialog_content_margin"
android:clickable="false"
android:focusableInTouchMode="false" />

View file

@ -44,6 +44,7 @@
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="@null"
android:visibility="gone"
tools:text="Some description"
tools:visibility="visible"/>

View file

@ -46,7 +46,8 @@
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" />
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="@null" />
</LinearLayout>

View file

@ -519,6 +519,7 @@
android:lines="1"
android:text="@string/replace_point_descr"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="@null"
tools:text="@string/replace_point_descr" />
</LinearLayout>

View file

@ -22,9 +22,11 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:paddingRight="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="0dp"
android:paddingStart="0dp"
app:srcCompat="@drawable/ic_action_arrow_drop_down"
android:tint="@color/settings_divider"
android:paddingEnd="@dimen/content_padding" />
android:tint="@color/settings_divider" />
<net.osmand.plus.widgets.OsmandTextFieldBoxes
android:id="@+id/master_profile_otfb"

View file

@ -60,6 +60,7 @@
android:ellipsize="end"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="@null"
tools:text="Some description" />
</LinearLayout>

View file

@ -66,6 +66,7 @@
android:ellipsize="end"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="@null"
tools:text="Some description" />
</LinearLayout>

View file

@ -31,6 +31,7 @@
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/content_padding"
android:contentDescription="@string/quick_action_new_action"
app:tint="?attr/app_bar_primary_item_color"
app:backgroundTint="?attr/color_dialog_buttons"
app:srcCompat="@drawable/ic_action_plus" />

View file

@ -54,6 +54,7 @@
android:ellipsize="end"
android:maxLines="3"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="@null"
tools:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard."/>
</LinearLayout>
@ -84,6 +85,7 @@
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="@null"
tools:text="England • United Kingdom"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding" />

View file

@ -61,6 +61,7 @@
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="@null"
tools:text="Amstellend North Holland"/>
<TextView
@ -70,6 +71,7 @@
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="@null"
tools:text="En, Ru, De, ..."/>
</LinearLayout>

View file

@ -561,7 +561,10 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
ActionBar actionBar = getDownloadActivity().getSupportActionBar();
//hide action bar from downloadindexfragment
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
int iconColorResId = getMyApplication().getSettings().isLightContent() ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark;
boolean nightMode = !getMyApplication().getSettings().isLightContent();
UiUtilities iconsCache = getMyApplication().getUIUtilities();
int iconColorResId = nightMode ?
R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light;
optionsMenuAdapter = new ContextMenuAdapter(requireMyApplication());
ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
@Override
@ -600,7 +603,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(j);
if (j + 1 >= max && optionsMenuAdapter.length() > max) {
if (split == null) {
Drawable icOverflowMenu = getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white);
Drawable icOverflowMenu = iconsCache.getIcon(R.drawable.ic_overflow_menu_white, iconColorResId);
split = menu.addSubMenu(0, 1, j + 1, R.string.shared_string_more_actions);
split.setIcon(icOverflowMenu);
split.getItem();

View file

@ -19,7 +19,6 @@ import android.util.TypedValue;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
@ -27,7 +26,6 @@ import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
@ -40,6 +38,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatImageButton;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.ViewCompat;
import androidx.fragment.app.DialogFragment;
@ -50,7 +49,6 @@ import androidx.fragment.app.FragmentTransaction;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.textfield.TextInputLayout;
import net.osmand.AndroidUtils;
import net.osmand.CallbackWithObject;
@ -75,6 +73,7 @@ import net.osmand.plus.osmedit.OsmPoint.Action;
import net.osmand.plus.osmedit.dialogs.PoiSubTypeDialogFragment;
import net.osmand.plus.osmedit.dialogs.PoiTypeDialogFragment;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.widgets.OsmandTextFieldBoxes;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
@ -89,6 +88,8 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import studio.carbonylgroup.textfieldboxes.ExtendedEditText;
public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
public static final String TAG = EditPoiDialogFragment.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(EditPoiDialogFragment.class);
@ -111,11 +112,11 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
private EditPoiData editPoiData;
private EditPoiViewPager viewPager;
private AutoCompleteTextView poiTypeEditText;
private ExtendedEditText poiTypeEditText;
private OnSaveButtonClickListener onSaveButtonClickListener;
private OpenstreetmapUtil mOpenstreetmapUtil;
private TextInputLayout poiTypeTextInputLayout;
private OsmandTextFieldBoxes poiTypeTextInputLayout;
private View view;
public static final int AMENITY_TEXT_LENGTH= 255;
@ -250,7 +251,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
}
});
EditText poiNameEditText = (EditText) view.findViewById(R.id.poiNameEditText);
ExtendedEditText poiNameEditText = (ExtendedEditText) view.findViewById(R.id.poiNameEditText);
AndroidUtils.setTextHorizontalGravity(poiNameEditText, Gravity.START);
poiNameEditText.addTextChangedListener(new TextWatcher() {
@Override
@ -276,8 +277,8 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
poiNameEditText.setText(editPoiData.getTag(OSMSettings.OSMTagKey.NAME.getValue()));
poiNameEditText.requestFocus();
AndroidUtils.showSoftKeyboard(getActivity(), poiNameEditText);
poiTypeTextInputLayout = (TextInputLayout) view.findViewById(R.id.poiTypeTextInputLayout);
poiTypeEditText = (AutoCompleteTextView) view.findViewById(R.id.poiTypeEditText);
poiTypeTextInputLayout = (OsmandTextFieldBoxes) view.findViewById(R.id.poiTypeTextInputLayout);
poiTypeEditText = (ExtendedEditText) view.findViewById(R.id.poiTypeEditText);
AndroidUtils.setTextHorizontalGravity(poiTypeEditText, Gravity.START);
poiTypeEditText.setText(editPoiData.getPoiTypeString());
poiTypeEditText.addTextChangedListener(new TextWatcher() {
@ -296,7 +297,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
if (!getMyApplication().isApplicationInitializing()) {
PoiCategory category = editPoiData.getPoiCategory();
if (category != null) {
poiTypeTextInputLayout.setHint(category.getTranslation());
poiTypeTextInputLayout.setLabelText(category.getTranslation());
}
}
}
@ -304,45 +305,24 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
});
poiNameEditText.setOnEditorActionListener(mOnEditorActionListener);
poiTypeEditText.setOnEditorActionListener(mOnEditorActionListener);
poiTypeEditText.setOnTouchListener(new View.OnTouchListener() {
AppCompatImageButton expandButton = poiTypeTextInputLayout.getEndIconImageButton();
expandButton.setColorFilter(R.color.gpx_chart_red);
expandButton.setOnClickListener(new View.OnClickListener() {
@Override
public boolean onTouch(final View v, MotionEvent event) {
Context ctx = getContext();
if (ctx == null) {
return false;
}
boolean isLayoutRtl = AndroidUtils.isLayoutRtl(getContext());
final EditText editText = (EditText) v;
if (event.getAction() == MotionEvent.ACTION_UP) {
final int DRAWABLE_END = 2;
int expandBtnWidth = AndroidUtils.getCompoundDrawables(editText)[DRAWABLE_END].getBounds().width();
boolean expandButtonPressed = false;
if (isLayoutRtl) {
expandButtonPressed = event.getX() <= (editText.getLeft() + expandBtnWidth
+ editText.getPaddingLeft());
} else {
expandButtonPressed = event.getX() >= (editText.getRight() - expandBtnWidth
- editText.getPaddingRight());
}
if (expandButtonPressed) {
PoiCategory category = editPoiData.getPoiCategory();
if (category != null) {
PoiSubTypeDialogFragment dialogFragment =
PoiSubTypeDialogFragment.createInstance(category);
dialogFragment.setOnItemSelectListener(new PoiSubTypeDialogFragment.OnItemSelectListener() {
@Override
public void select(String category) {
setSubCategory(category);
}
});
dialogFragment.show(getChildFragmentManager(), "PoiSubTypeDialogFragment");
public void onClick(View v) {
PoiCategory category = editPoiData.getPoiCategory();
if (category != null) {
PoiSubTypeDialogFragment dialogFragment =
PoiSubTypeDialogFragment.createInstance(category);
dialogFragment.setOnItemSelectListener(new PoiSubTypeDialogFragment.OnItemSelectListener() {
@Override
public void select(String category) {
setSubCategory(category);
}
return true;
}
});
dialogFragment.show(getChildFragmentManager(), "PoiSubTypeDialogFragment");
}
return false;
}
});