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
d1ffe032
Commit
d1ffe032
authored
Aug 03, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AccountInfoEditorFragment: input controls disabled while vCard saving.
parent
4dcd09d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
7 deletions
+35
-7
AccountInfoEditorFragment.java
...java/com/xabber/android/ui/AccountInfoEditorFragment.java
+32
-6
account_info_editor_fragment.xml
app/src/main/res/layout/account_info_editor_fragment.xml
+3
-1
No files found.
app/src/main/java/com/xabber/android/ui/AccountInfoEditorFragment.java
View file @
d1ffe032
...
...
@@ -11,6 +11,7 @@ import android.view.View;
import
android.view.ViewGroup
;
import
android.widget.EditText
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.Toast
;
import
com.xabber.android.R
;
...
...
@@ -62,6 +63,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
private
EditText
formattedName
;
private
View
progressBar
;
private
boolean
isSaveSuccess
;
private
LinearLayout
fields
;
public
static
AccountInfoEditorFragment
newInstance
(
String
account
,
String
vCard
)
{
AccountInfoEditorFragment
fragment
=
new
AccountInfoEditorFragment
();
...
...
@@ -97,6 +99,8 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
account_info_editor_fragment
,
container
,
false
);
fields
=
(
LinearLayout
)
view
.
findViewById
(
R
.
id
.
vcard_fields_layout
);
progressBar
=
view
.
findViewById
(
R
.
id
.
vcard_save_progress_bar
);
prefixName
=
(
EditText
)
view
.
findViewById
(
R
.
id
.
vcard_prefix_name
);
...
...
@@ -284,16 +288,37 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
updateVCardFromFields
();
VCardManager
.
getInstance
().
saveVCard
(
account
,
vCard
);
isSaveSuccess
=
false
;
enableProgressMode
();
}
public
void
enableProgressMode
()
{
setEnabledRecursive
(
false
,
fields
);
progressBar
.
setVisibility
(
View
.
VISIBLE
);
}
public
void
disableProgressMode
()
{
progressBar
.
setVisibility
(
View
.
GONE
);
setEnabledRecursive
(
true
,
fields
);
}
private
void
setEnabledRecursive
(
boolean
enabled
,
ViewGroup
viewGroup
){
for
(
int
i
=
0
;
i
<
viewGroup
.
getChildCount
();
i
++){
View
child
=
viewGroup
.
getChildAt
(
i
);
child
.
setEnabled
(
enabled
);
if
(
child
instanceof
ViewGroup
){
setEnabledRecursive
(
enabled
,
(
ViewGroup
)
child
);
}
}
}
@Override
public
void
onVCardSaveSuccess
(
String
account
)
{
if
(!
Jid
.
getBareAddress
(
this
.
account
).
equals
(
Jid
.
getBareAddress
(
account
)))
{
return
;
}
progressBar
.
setVisibility
(
View
.
VISIBLE
);
enableProgressMode
(
);
VCardManager
.
getInstance
().
request
(
account
,
account
);
isSaveSuccess
=
true
;
}
...
...
@@ -304,7 +329,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
return
;
}
progressBar
.
setVisibility
(
View
.
GONE
);
disableProgressMode
(
);
Toast
.
makeText
(
getActivity
(),
getString
(
R
.
string
.
account_user_info_save_fail
),
Toast
.
LENGTH_LONG
).
show
();
isSaveSuccess
=
false
;
}
...
...
@@ -315,10 +340,6 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
return
;
}
progressBar
.
setVisibility
(
View
.
GONE
);
this
.
vCard
=
vCard
;
setFieldsFromVCard
();
if
(
isSaveSuccess
)
{
Toast
.
makeText
(
getActivity
(),
getString
(
R
.
string
.
account_user_info_save_success
),
Toast
.
LENGTH_LONG
).
show
();
...
...
@@ -329,6 +350,11 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
getActivity
().
setResult
(
Activity
.
RESULT_OK
,
data
);
getActivity
().
finish
();
}
else
{
disableProgressMode
();
this
.
vCard
=
vCard
;
setFieldsFromVCard
();
}
}
...
...
app/src/main/res/layout/account_info_editor_fragment.xml
View file @
d1ffe032
...
...
@@ -11,7 +11,9 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
android:id=
"@+id/vcard_fields_layout"
>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
...
...
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