Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xabber-android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
xabber-android
Commits
2c7d2e16
Commit
2c7d2e16
authored
Aug 07, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AccountInfoEditor: "save" menu item state stored correctly.
parent
53b9fcbb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
30 deletions
+43
-30
AccountInfoEditor.java
...rc/main/java/com/xabber/android/ui/AccountInfoEditor.java
+14
-3
AccountInfoEditorFragment.java
...java/com/xabber/android/ui/AccountInfoEditorFragment.java
+29
-27
No files found.
app/src/main/java/com/xabber/android/ui/AccountInfoEditor.java
View file @
2c7d2e16
...
...
@@ -21,6 +21,8 @@ public class AccountInfoEditor extends ManagedActivity implements Toolbar.OnMenu
public
static
final
String
ARG_VCARD
=
"com.xabber.android.ui.AccountInfoEditor.ARG_VCARD"
;
public
static
final
int
SAVE_MENU
=
R
.
menu
.
save
;
public
static
final
String
ARGUMENT_SAVE_BUTTON_ENABLED
=
"com.xabber.android.ui.AccountInfoEditor.ARGUMENT_SAVE_BUTTON_ENABLED"
;
private
Toolbar
toolbar
;
...
...
@@ -64,16 +66,25 @@ public class AccountInfoEditor extends ManagedActivity implements Toolbar.OnMenu
BarPainter
barPainter
=
new
BarPainter
(
this
,
toolbar
);
barPainter
.
updateWithAccountName
(
account
);
toolbar
.
inflateMenu
(
SAVE_MENU
);
toolbar
.
setOnMenuItemClickListener
(
this
);
boolean
isSaveButtonEnabled
=
false
;
if
(
savedInstanceState
==
null
)
{
getFragmentManager
().
beginTransaction
()
.
add
(
R
.
id
.
fragment_container
,
AccountInfoEditorFragment
.
newInstance
(
account
,
vCard
)).
commit
();
}
else
{
isSaveButtonEnabled
=
savedInstanceState
.
getBoolean
(
ARGUMENT_SAVE_BUTTON_ENABLED
);
}
toolbar
.
getMenu
().
findItem
(
R
.
id
.
action_save
).
setEnabled
(
isSaveButtonEnabled
);
getWindow
().
setSoftInputMode
(
WindowManager
.
LayoutParams
.
SOFT_INPUT_STATE_HIDDEN
);
}
toolbar
.
inflateMenu
(
SAVE_MENU
);
toolbar
.
setOnMenuItemClickListener
(
this
);
toolbar
.
getMenu
().
findItem
(
R
.
id
.
action_save
).
setEnabled
(
false
);
@Override
protected
void
onSaveInstanceState
(
Bundle
outState
)
{
super
.
onSaveInstanceState
(
outState
);
outState
.
putBoolean
(
ARGUMENT_SAVE_BUTTON_ENABLED
,
toolbar
.
getMenu
().
findItem
(
R
.
id
.
action_save
).
isEnabled
());
}
@Override
...
...
app/src/main/java/com/xabber/android/ui/AccountInfoEditorFragment.java
View file @
2c7d2e16
...
...
@@ -65,42 +65,35 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
public
static
final
String
DATE_FORMAT_INT_TO_STRING
=
"%d-%02d-%02d"
;
private
VCard
vCard
;
private
String
account
;
private
View
progressBar
;
private
boolean
isSaveSuccess
;
private
Listener
listener
;
private
boolean
updateFromVCardFlag
=
true
;
private
TextView
account_jid
;
private
LinearLayout
fields
;
private
EditText
formattedName
;
private
EditText
prefixName
;
private
EditText
givenName
;
private
EditText
middleName
;
private
EditText
familyName
;
private
EditText
suffixName
;
private
EditText
nickName
;
private
String
account
;
private
EditText
organization
;
private
EditText
organizationUnit
;
private
EditText
title
;
private
EditText
role
;
private
EditText
organizationUnit
;
private
EditText
organization
;
private
EditText
url
;
private
EditText
description
;
private
EditText
emailHome
;
private
EditText
emailWork
;
private
EditText
phoneHome
;
private
EditText
phoneWork
;
private
EditText
formattedName
;
private
View
progressBar
;
private
boolean
isSaveSuccess
;
private
LinearLayout
fields
;
private
TextView
avatarSize
;
private
Listener
listener
;
private
TextView
birthDate
;
private
DatePickerDialog
datePicker
;
private
View
changeAvatarButton
;
private
ImageView
avatar
;
private
Uri
newAvatarImageUri
;
private
Uri
photoFileUri
;
private
boolean
removeAvatarFlag
=
false
;
private
View
birthDateRemoveButton
;
private
TextView
account_jid
;
private
EditText
addressHomePostOfficeBox
;
private
EditText
addressHomePostExtended
;
private
EditText
addressHomePostStreet
;
...
...
@@ -108,6 +101,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
private
EditText
addressHomeRegion
;
private
EditText
addressHomeCountry
;
private
EditText
addressHomePostalCode
;
private
EditText
addressWorkPostOfficeBox
;
private
EditText
addressWorkPostExtended
;
private
EditText
addressWorkPostStreet
;
...
...
@@ -115,7 +109,17 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
private
EditText
addressWorkRegion
;
private
EditText
addressWorkCountry
;
private
EditText
addressWorkPostalCode
;
private
boolean
updateFromVCardFlag
=
false
;
private
ImageView
avatar
;
private
TextView
avatarSize
;
private
View
changeAvatarButton
;
private
Uri
newAvatarImageUri
;
private
Uri
photoFileUri
;
private
boolean
removeAvatarFlag
=
false
;
private
TextView
birthDate
;
private
DatePickerDialog
datePicker
;
private
View
birthDateRemoveButton
;
interface
Listener
{
void
onVCardSavingStarted
();
...
...
@@ -258,6 +262,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
if
(
vCardManager
.
isVCardRequested
(
account
)
||
vCardManager
.
isVCardSaveRequested
(
account
))
{
enableProgressMode
();
}
updateFromVCardFlag
=
false
;
}
@Override
...
...
@@ -275,8 +280,6 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
}
private
void
setFieldsFromVCard
()
{
updateFromVCardFlag
=
true
;
account_jid
.
setText
(
Jid
.
getBareAddress
(
account
));
formattedName
.
setText
(
vCard
.
getField
(
VCardProperty
.
FN
.
name
()));
...
...
@@ -334,8 +337,6 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
addressWorkRegion
.
setText
(
vCard
.
getAddressFieldWork
(
AddressProperty
.
REGION
.
name
()));
addressWorkCountry
.
setText
(
vCard
.
getAddressFieldWork
(
AddressProperty
.
CTRY
.
name
()));
addressWorkPostalCode
.
setText
(
vCard
.
getAddressFieldWork
(
AddressProperty
.
PCODE
.
name
()));
updateFromVCardFlag
=
false
;
}
public
void
updateDatePickerDialog
()
{
...
...
@@ -615,9 +616,10 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
getActivity
().
finish
();
}
else
{
disableProgressMode
();
this
.
vCard
=
vCard
;
updateFromVCardFlag
=
true
;
setFieldsFromVCard
();
updateFromVCardFlag
=
false
;
}
}
...
...
@@ -657,7 +659,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
@Override
public
void
onTextChanged
(
CharSequence
s
,
int
start
,
int
before
,
int
count
)
{
if
(!
updateFromVCardFlag
)
{
if
(!
updateFromVCardFlag
&&
listener
!=
null
)
{
listener
.
enableSave
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment