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
2023e181
Commit
2023e181
authored
Aug 04, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AccountInfoEditor: avatar max size set to 192 - it will be resized automatically.
parent
988aa750
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
AccountInfoEditorFragment.java
...java/com/xabber/android/ui/AccountInfoEditorFragment.java
+8
-8
No files found.
app/src/main/java/com/xabber/android/ui/AccountInfoEditorFragment.java
View file @
2023e181
...
...
@@ -41,6 +41,9 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
public
static
final
String
ARGUMENT_ACCOUNT
=
"com.xabber.android.ui.AccountInfoEditorFragment.ARGUMENT_ACCOUNT"
;
public
static
final
String
ARGUMENT_VCARD
=
"com.xabber.android.ui.AccountInfoEditorFragment.ARGUMENT_USER"
;
public
static
final
int
ACCOUNT_INFO_EDITOR_RESULT_NEED_VCARD_REQUEST
=
2
;
public
static
final
int
MAX_AVATAR_SIZE_PIXELS
=
192
;
public
static
final
String
TEMP_FILE_NAME
=
"cropped"
;
public
static
final
int
KB_SIZE_IN_BYTES
=
1024
;
private
VCard
vCard
;
private
EditText
prefixName
;
...
...
@@ -239,22 +242,19 @@ public class AccountInfoEditorFragment extends Fragment implements OnVCardSaveLi
}
private
void
beginCrop
(
Uri
source
)
{
croppedImageUri
=
Uri
.
fromFile
(
new
File
(
getActivity
().
getCacheDir
(),
"cropped"
));
Crop
.
of
(
source
,
croppedImageUri
).
start
(
getActivity
());
croppedImageUri
=
Uri
.
fromFile
(
new
File
(
getActivity
().
getCacheDir
(),
TEMP_FILE_NAME
));
Crop
.
of
(
source
,
croppedImageUri
).
withMaxSize
(
MAX_AVATAR_SIZE_PIXELS
,
MAX_AVATAR_SIZE_PIXELS
).
start
(
getActivity
());
}
private
void
handleCrop
(
int
resultCode
,
Intent
result
)
{
if
(
resultCode
==
Activity
.
RESULT_OK
)
{
// null prompts image view to reload file.
avatar
.
setImageURI
(
null
);
avatar
.
setImageURI
(
croppedImageUri
);
File
f
=
new
File
(
croppedImageUri
.
getPath
());
long
size
=
f
.
length
();
File
file
=
new
File
(
croppedImageUri
.
getPath
());
avatarSize
.
setText
(
file
.
length
()
/
KB_SIZE_IN_BYTES
+
"KB"
);
avatarSize
.
setVisibility
(
View
.
VISIBLE
);
avatarSize
.
setText
(
size
/
1024
+
"KB"
);
}
else
if
(
resultCode
==
Crop
.
RESULT_ERROR
)
{
avatarSize
.
setVisibility
(
View
.
INVISIBLE
);
Toast
.
makeText
(
getActivity
(),
Crop
.
getError
(
result
).
getMessage
(),
Toast
.
LENGTH_SHORT
).
show
();
...
...
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