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

View file

@ -119,6 +119,8 @@
<attr name="dlg_btn_secondary" format="reference" />
<attr name="dlg_btn_secondary_text" 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 name="PagerSlidingTabStrip">

View file

@ -11,6 +11,8 @@
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_shuttle_bus">Shuttle bus</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_text">@color/dlg_btn_secondary_text_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 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_text">@color/dlg_btn_secondary_text_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 name="FreeVersionBanner" parent="OsmandDarkTheme">

View file

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