Commit a9aa1b8c authored by Grigory Fedorov's avatar Grigory Fedorov

AccountInfoEditorFragment: birth date "Change" button removed, click on text...

AccountInfoEditorFragment: birth date "Change" button removed, click on text view used. Added button to remove birthdate.
drawer_touch renamed to ripple_background.
parent bcea6f5a
...@@ -96,6 +96,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi ...@@ -96,6 +96,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
private Uri newAvatarImageUri; private Uri newAvatarImageUri;
private Uri photoFileUri; private Uri photoFileUri;
private boolean removeAvatarFlag = false; private boolean removeAvatarFlag = false;
private View birthDateRemoveButton;
interface Listener { interface Listener {
void onVCardSavingStarted(); void onVCardSavingStarted();
...@@ -167,15 +168,21 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi ...@@ -167,15 +168,21 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
); );
birthDate = (TextView) view.findViewById(R.id.vcard_birth_date); birthDate = (TextView) view.findViewById(R.id.vcard_birth_date);
birthDate.setOnClickListener(new View.OnClickListener() {
View changeBirthDateButton = view.findViewById(R.id.vcard_change_birth_date);
changeBirthDateButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
datePicker.show(); datePicker.show();
} }
}); });
birthDateRemoveButton = view.findViewById(R.id.vcard_birth_date_remove_button);
birthDateRemoveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setBirthDate(null);
}
});
title = (EditText) view.findViewById(R.id.vcard_title); title = (EditText) view.findViewById(R.id.vcard_title);
role = (EditText) view.findViewById(R.id.vcard_role); role = (EditText) view.findViewById(R.id.vcard_role);
organization = (EditText) view.findViewById(R.id.vcard_organization_name); organization = (EditText) view.findViewById(R.id.vcard_organization_name);
...@@ -234,7 +241,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi ...@@ -234,7 +241,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
avatar.setImageDrawable(AvatarManager.getInstance().getAccountAvatar(account)); avatar.setImageDrawable(AvatarManager.getInstance().getAccountAvatar(account));
birthDate.setText(vCard.getField(VCardProperty.BDAY.name())); setBirthDate(vCard.getField(VCardProperty.BDAY.name()));
updateDatePickerDialog(); updateDatePickerDialog();
...@@ -545,6 +552,16 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi ...@@ -545,6 +552,16 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
@Override @Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
birthDate.setText(String.format(DATE_FORMAT_INT_TO_STRING, year, monthOfYear + 1, dayOfMonth)); setBirthDate(String.format(DATE_FORMAT_INT_TO_STRING, year, monthOfYear + 1, dayOfMonth));
}
public void setBirthDate(String date) {
birthDate.setText(date);
birthDate.setTextColor(getResources().getColor(android.R.color.primary_text_light));
if (date == null) {
birthDateRemoveButton.setVisibility(View.INVISIBLE);
} else {
birthDateRemoveButton.setVisibility(View.VISIBLE);
}
} }
} }
...@@ -195,13 +195,13 @@ ...@@ -195,13 +195,13 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginTop="8dp" android:layout_marginTop="16dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
> >
<TextView <TextView
android:layout_width="100dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/vcard_birth_date" android:hint="@string/vcard_birth_date"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
...@@ -210,15 +210,21 @@ ...@@ -210,15 +210,21 @@
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:inputType="date" android:inputType="date"
android:paddingLeft="4dp" android:paddingLeft="4dp"
android:paddingTop="16dp" android:paddingRight="8dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:background="@drawable/ripple_background"
/> />
<Button <ImageButton
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/change" android:src="@drawable/ic_close_circle_grey600_24dp"
android:id="@+id/vcard_change_birth_date" android:padding="8dp"
android:layout_marginLeft="16dp" /> android:background="@drawable/ripple_background"
android:id="@+id/vcard_birth_date_remove_button"
/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
android:paddingRight="8dp" android:paddingRight="8dp"
android:paddingTop="16dp" android:paddingTop="16dp"
android:paddingBottom="8dp" android:paddingBottom="8dp"
android:background="@drawable/drawer_touch" android:background="@drawable/ripple_background"
android:id="@+id/muc_get_hosted_rooms" android:id="@+id/muc_get_hosted_rooms"
android:contentDescription="@string/muc_get_hosted_conferences" android:contentDescription="@string/muc_get_hosted_conferences"
android:layout_gravity="bottom|right" android:layout_gravity="bottom|right"
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:background="@drawable/drawer_touch" android:background="@drawable/ripple_background"
/> />
</RelativeLayout> </RelativeLayout>
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:src="@drawable/ic_close_circle_grey600_24dp" android:src="@drawable/ic_close_circle_grey600_24dp"
android:background="@drawable/drawer_touch" android:background="@drawable/ripple_background"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
android:id="@+id/drawer_action_settings" android:id="@+id/drawer_action_settings"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"
android:background="@drawable/drawer_touch" android:background="@drawable/ripple_background"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp"> android:paddingRight="16dp">
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
android:id="@+id/drawer_action_about" android:id="@+id/drawer_action_about"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"
android:background="@drawable/drawer_touch" android:background="@drawable/ripple_background"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp"> android:paddingRight="16dp">
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
android:id="@+id/drawer_action_exit" android:id="@+id/drawer_action_exit"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"
android:background="@drawable/drawer_touch" android:background="@drawable/ripple_background"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp"> android:paddingRight="16dp">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment