add style attrs

This commit is contained in:
madwasp79 2019-06-07 15:39:17 +03:00
parent 64f66afefa
commit e0fca256af
5 changed files with 36 additions and 54 deletions

View file

@ -140,13 +140,9 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginTop="@dimen/list_content_padding" android:layout_margin="@dimen/list_content_padding"
android:layout_marginBottom="@dimen/list_content_padding" app:primaryColor="@color/color_dialog_buttons_dark"
android:layout_marginStart="@dimen/list_content_padding" app:labelText="@string/profile_name_hint">
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
app:labelText="Profile Name">
<studio.carbonylgroup.textfieldboxes.ExtendedEditText <studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/profile_name_et" android:id="@+id/profile_name_et"
@ -219,15 +215,13 @@
android:id="@+id/navigation_type_otfb" android:id="@+id/navigation_type_otfb"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
app:primaryColor="@color/color_dialog_buttons_dark"
app:labelText="Navigation Type"> app:labelText="Navigation Type">
<studio.carbonylgroup.textfieldboxes.ExtendedEditText <studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/navigation_type_et" android:id="@+id/navigation_type_et"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableEnd="@drawable/ic_action_arrow_drop_down"
android:drawableRight="@drawable/ic_action_arrow_drop_down"
android:focusable="false" android:focusable="false"
android:maxLines="1" android:maxLines="1"
@ -476,7 +470,7 @@
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginLeft="@dimen/list_content_padding" android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:background="@drawable/btn_round_profile_gray" android:background="?attr/profile_cancel_btn"
android:text="@string/shared_string_cancel" android:text="@string/shared_string_cancel"
android:textAllCaps="false" android:textAllCaps="false"
android:textColor="@color/map_widget_blue"/> android:textColor="@color/map_widget_blue"/>
@ -492,7 +486,7 @@
android:layout_marginEnd="@dimen/list_content_padding" android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_marginRight="@dimen/list_content_padding" android:layout_marginRight="@dimen/list_content_padding"
android:background="@drawable/btn_round_profile_blue" android:background="?attr/profile_save_btn"
android:text="@string/shared_string_save" android:text="@string/shared_string_save"
android:textAllCaps="false" android:textAllCaps="false"
android:textColor="@color/color_white"/> android:textColor="@color/color_white"/>
@ -522,10 +516,10 @@
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginLeft="@dimen/list_content_padding" android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:background="@drawable/btn_round_profile_gray" android:background="?attr/profile_cancel_btn"
android:text="@string/shared_string_cancel" android:text="@string/shared_string_cancel"
android:textAllCaps="false" android:textAllCaps="false"
android:textColor="@color/map_widget_blue"/> android:textColor="?attr/active_color_basic"/>
<Button <Button
android:id="@+id/save_profile_btn" android:id="@+id/save_profile_btn"
@ -538,7 +532,7 @@
android:layout_marginEnd="@dimen/list_content_padding" android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_marginRight="@dimen/list_content_padding" android:layout_marginRight="@dimen/list_content_padding"
android:background="@drawable/btn_round_profile_blue" android:background="?attr/profile_save_btn"
android:text="@string/shared_string_save" android:text="@string/shared_string_save"
android:textAllCaps="false" android:textAllCaps="false"
android:textColor="@color/color_white"/> android:textColor="@color/color_white"/>

View file

@ -119,6 +119,8 @@
<attr name="dlg_btn_secondary" format="reference" /> <attr name="dlg_btn_secondary" format="reference" />
<attr name="dlg_btn_secondary_text" format="reference" /> <attr name="dlg_btn_secondary_text" format="reference" />
<attr name="dlg_btn_stroked" format="reference" /> <attr name="dlg_btn_stroked" format="reference" />
<attr name="profile_save_btn" format="reference"/>
<attr name="profile_cancel_btn" format="reference"/>
</declare-styleable> </declare-styleable>
<declare-styleable name="PagerSlidingTabStrip"> <declare-styleable name="PagerSlidingTabStrip">

View file

@ -11,6 +11,8 @@
Thx - Hardy Thx - Hardy
--> -->
<string name="profile_name_hint">Profile Name</string>
<string name="nav_type_hint">Navigation Type</string>
<string name="app_mode_taxi">Taxi</string> <string name="app_mode_taxi">Taxi</string>
<string name="app_mode_shuttle_bus">Shuttle bus</string> <string name="app_mode_shuttle_bus">Shuttle bus</string>
<string name="app_mode_subway">Subway</string> <string name="app_mode_subway">Subway</string>

View file

@ -251,6 +251,8 @@
<item name="dlg_btn_secondary">@drawable/dlg_btn_secondary_light</item> <item name="dlg_btn_secondary">@drawable/dlg_btn_secondary_light</item>
<item name="dlg_btn_secondary_text">@color/dlg_btn_secondary_text_light</item> <item name="dlg_btn_secondary_text">@color/dlg_btn_secondary_text_light</item>
<item name="dlg_btn_stroked">@drawable/dlg_btn_stroked_light</item> <item name="dlg_btn_stroked">@drawable/dlg_btn_stroked_light</item>
<item name="profile_save_btn">@drawable/btn_round_profile_blue</item>
<item name="profile_cancel_btn">@drawable/btn_round_profile_gray</item>
</style> </style>
<style name="OverflowMenuButton" parent="@style/Widget.AppCompat.ActionButton.Overflow"> <style name="OverflowMenuButton" parent="@style/Widget.AppCompat.ActionButton.Overflow">
@ -488,6 +490,8 @@
<item name="dlg_btn_secondary">@drawable/dlg_btn_secondary_dark</item> <item name="dlg_btn_secondary">@drawable/dlg_btn_secondary_dark</item>
<item name="dlg_btn_secondary_text">@color/dlg_btn_secondary_text_dark</item> <item name="dlg_btn_secondary_text">@color/dlg_btn_secondary_text_dark</item>
<item name="dlg_btn_stroked">@drawable/dlg_btn_stroked_dark</item> <item name="dlg_btn_stroked">@drawable/dlg_btn_stroked_dark</item>
<item name="profile_save_btn">@drawable/btn_round_profile_night</item>
<item name="profile_cancel_btn">@drawable/btn_round_profile_gray_n</item>
</style> </style>
<style name="FreeVersionBanner" parent="OsmandDarkTheme"> <style name="FreeVersionBanner" parent="OsmandDarkTheme">

View file

@ -19,7 +19,6 @@ import android.graphics.drawable.GradientDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.app.AlertDialog.Builder; import android.support.v7.app.AlertDialog.Builder;
@ -80,7 +79,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
private boolean isUserProfile = false; private boolean isUserProfile = false;
private boolean isDataChanged = false; private boolean isDataChanged = false;
private boolean isCancelAllowed = true; private boolean isCancelAllowed = true;
private boolean isNightMode; private boolean nightMode;
private SelectProfileListener navTypeListener = null; private SelectProfileListener navTypeListener = null;
private SelectProfileListener iconIdListener = null; private SelectProfileListener iconIdListener = null;
@ -119,7 +118,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
mode = ApplicationMode.valueOfStringKey(modeName, ApplicationMode.DEFAULT); mode = ApplicationMode.valueOfStringKey(modeName, ApplicationMode.DEFAULT);
profile = new ApplicationProfileObject(mode, isNew, isUserProfile); profile = new ApplicationProfileObject(mode, isNew, isUserProfile);
} }
isNightMode = !app.getSettings().isLightContent(); nightMode = !app.getSettings().isLightContent();
routingProfileDataObjects = getRoutingProfiles(app); routingProfileDataObjects = getRoutingProfiles(app);
} }
@ -155,28 +154,11 @@ public class EditProfileFragment extends BaseOsmAndFragment {
profileNameEt.setFocusable(true); profileNameEt.setFocusable(true);
profileNameEt.setSelectAllOnFocus(true); profileNameEt.setSelectAllOnFocus(true);
profileIconBtn.setBackgroundResource(R.drawable.rounded_background_3dp); profileIconBtn.setBackgroundResource(R.drawable.rounded_background_3dp);
GradientDrawable selectIconBtnBackground = (GradientDrawable) profileIconBtn GradientDrawable selectIconBtnBackground = (GradientDrawable) profileIconBtn.getBackground();
.getBackground(); if (nightMode) {
selectIconBtnBackground.setColor(app.getResources().getColor(R.color.text_field_box_dark));
if (isNightMode) {
profileNameTextBox
.setPrimaryColor(ContextCompat.getColor(app, R.color.color_dialog_buttons_dark));
navTypeTextBox
.setPrimaryColor(ContextCompat.getColor(app, R.color.color_dialog_buttons_dark));
selectIconBtnBackground
.setColor(app.getResources().getColor(R.color.text_field_box_dark));
saveButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_round_profile_night));
saveButtonSV.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_round_profile_night));
cancelBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_round_profile_gray_n));
cancelBtnSV.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_round_profile_gray_n));
saveButton.setTextColor(getResources().getColor(R.color.main_font_dark));
saveButtonSV.setTextColor(getResources().getColor(R.color.main_font_dark));
cancelBtn.setTextColor(getResources().getColor(R.color.active_buttons_and_links_dark));
cancelBtnSV.setTextColor(getResources().getColor(R.color.active_buttons_and_links_dark));
} else { } else {
selectIconBtnBackground selectIconBtnBackground.setColor(app.getResources().getColor(R.color.text_field_box_light));
.setColor(app.getResources().getColor(R.color.text_field_box_light));
} }
String title = "New Profile"; String title = "New Profile";
@ -208,11 +190,10 @@ public class EditProfileFragment extends BaseOsmAndFragment {
baseModeIcon.setImageDrawable( baseModeIcon.setImageDrawable(
app.getUIUtilities().getIcon(profile.iconId, R.color.icon_color)); app.getUIUtilities().getIcon(profile.iconId, R.color.icon_color));
} }
if (isUserProfile || isNightMode) { if (isUserProfile || isNew) {
typeSelectionBtn.setOnClickListener(new OnClickListener() { typeSelectionBtn.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (isUserProfile || isNew) {
final SelectProfileBottomSheetDialogFragment dialog = new SelectProfileBottomSheetDialogFragment(); final SelectProfileBottomSheetDialogFragment dialog = new SelectProfileBottomSheetDialogFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
if (profile.parent != null) { if (profile.parent != null) {
@ -225,7 +206,6 @@ public class EditProfileFragment extends BaseOsmAndFragment {
.add(dialog, "select_base_type").commitAllowingStateLoss(); .add(dialog, "select_base_type").commitAllowingStateLoss();
} }
} }
}
}); });
} else { } else {
typeSelectionBtn.setClickable(false); typeSelectionBtn.setClickable(false);
@ -262,7 +242,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
if (!isUserProfile) { if (!isUserProfile) {
iconColor = R.color.icon_color; iconColor = R.color.icon_color;
} else { } else {
iconColor = isNightMode iconColor = nightMode
? R.color.active_buttons_and_links_dark ? R.color.active_buttons_and_links_dark
: R.color.active_buttons_and_links_light; : R.color.active_buttons_and_links_light;
} }
@ -470,7 +450,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
profile.iconId = pos; profile.iconId = pos;
profile.iconStringName = stringRes; profile.iconStringName = stringRes;
profileIcon.setImageDrawable(app.getUIUtilities().getIcon(pos, profileIcon.setImageDrawable(app.getUIUtilities().getIcon(pos,
isNightMode ? R.color.active_buttons_and_links_dark nightMode ? R.color.active_buttons_and_links_dark
: R.color.active_buttons_and_links_light)); : R.color.active_buttons_and_links_light));
} }
}; };