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
35a71d42
Commit
35a71d42
authored
Aug 05, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AccountInfoEditorFragment: avatar removing fixed - avatar would no be removed if unchanged.
parent
8aea3233
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
14 deletions
+21
-14
AccountInfoEditor.java
...rc/main/java/com/xabber/android/ui/AccountInfoEditor.java
+1
-1
AccountInfoEditorFragment.java
...java/com/xabber/android/ui/AccountInfoEditorFragment.java
+20
-13
No files found.
app/src/main/java/com/xabber/android/ui/AccountInfoEditor.java
View file @
35a71d42
...
...
@@ -17,7 +17,7 @@ import com.xabber.android.data.intent.EntityIntentBuilder;
import
com.xabber.android.ui.helper.BarPainter
;
import
com.xabber.android.ui.helper.ManagedActivity
;
public
class
AccountInfoEditor
extends
ManagedActivity
implements
Toolbar
.
OnMenuItemClickListener
,
AccountInfoEditorFragment
.
Lister
{
public
class
AccountInfoEditor
extends
ManagedActivity
implements
Toolbar
.
OnMenuItemClickListener
,
AccountInfoEditorFragment
.
Liste
ne
r
{
public
static
final
String
ARG_VCARD
=
"com.xabber.android.ui.AccountInfoEditor.ARG_VCARD"
;
public
static
final
int
SAVE_MENU
=
R
.
menu
.
save
;
...
...
app/src/main/java/com/xabber/android/ui/AccountInfoEditorFragment.java
View file @
35a71d42
...
...
@@ -69,11 +69,9 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
private
EditText
suffixName
;
private
EditText
nickName
;
private
String
account
;
private
ImageView
avatar
;
private
Uri
newAvatarImageUri
;
private
EditText
organization
;
private
EditText
organizationUnit
;
private
TextView
birthDate
;
private
EditText
title
;
private
EditText
role
;
private
EditText
url
;
...
...
@@ -88,12 +86,18 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
private
LinearLayout
fields
;
private
TextView
avatarSize
;
private
Lister
lister
;
private
Listener
listener
;
private
TextView
birthDate
;
private
DatePickerDialog
datePicker
;
private
View
changeAvatarButton
;
private
ImageView
avatar
;
private
Uri
newAvatarImageUri
;
private
Uri
photoFileUri
;
private
DatePickerDialog
datePicker
;
private
boolean
removeAvatarFlag
=
false
;
interface
Lister
{
interface
Liste
ne
r
{
void
onVCardSavingStarted
();
void
onVCardSavingFinished
();
}
...
...
@@ -114,7 +118,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
@Override
public
void
onAttach
(
Activity
activity
)
{
super
.
onAttach
(
activity
);
liste
r
=
(
List
er
)
activity
;
liste
ner
=
(
Listen
er
)
activity
;
}
@Override
...
...
@@ -212,7 +216,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
@Override
public
void
onDetach
()
{
super
.
onDetach
();
lister
=
null
;
liste
ne
r
=
null
;
}
private
void
setFieldsFromVCard
()
{
...
...
@@ -319,6 +323,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
private
void
chooseFromGallery
()
{
Crop
.
pickImage
(
getActivity
());
}
private
void
takePhoto
()
{
Intent
takePictureIntent
=
new
Intent
(
MediaStore
.
ACTION_IMAGE_CAPTURE
);
if
(
takePictureIntent
.
resolveActivity
(
getActivity
().
getPackageManager
())
!=
null
)
{
...
...
@@ -350,6 +355,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
private
void
removeAvatar
()
{
newAvatarImageUri
=
null
;
removeAvatarFlag
=
true
;
avatar
.
setImageDrawable
(
AvatarManager
.
getInstance
().
getDefaultAccountAvatar
(
account
));
}
...
...
@@ -375,6 +381,7 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
// null prompts image view to reload file.
avatar
.
setImageURI
(
null
);
avatar
.
setImageURI
(
newAvatarImageUri
);
removeAvatarFlag
=
false
;
File
file
=
new
File
(
newAvatarImageUri
.
getPath
());
avatarSize
.
setText
(
file
.
length
()
/
KB_SIZE_IN_BYTES
+
"KB"
);
...
...
@@ -413,14 +420,14 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
vCard
.
setField
(
VCardProperty
.
FN
.
name
(),
formattedNameText
);
}
if
(
newAvatarImageUri
!=
null
)
{
if
(
removeAvatarFlag
)
{
vCard
.
removeAvatar
();
}
else
if
(
newAvatarImageUri
!=
null
)
{
try
{
vCard
.
setAvatar
(
new
URL
(
newAvatarImageUri
.
toString
()));
}
catch
(
MalformedURLException
e
)
{
e
.
printStackTrace
();
}
}
else
{
vCard
.
removeAvatar
();
}
vCard
.
setField
(
VCardProperty
.
BDAY
.
name
(),
getValueFromEditText
(
birthDate
));
...
...
@@ -453,13 +460,13 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
public
void
enableProgressMode
()
{
setEnabledRecursive
(
false
,
fields
);
progressBar
.
setVisibility
(
View
.
VISIBLE
);
lister
.
onVCardSavingStarted
();
liste
ne
r
.
onVCardSavingStarted
();
}
public
void
disableProgressMode
()
{
progressBar
.
setVisibility
(
View
.
GONE
);
setEnabledRecursive
(
true
,
fields
);
lister
.
onVCardSavingFinished
();
liste
ne
r
.
onVCardSavingFinished
();
}
private
void
setEnabledRecursive
(
boolean
enabled
,
ViewGroup
viewGroup
){
...
...
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