mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Code style
This commit is contained in:
@@ -259,12 +259,12 @@ public class CreateProfileActivity extends BaseActionBarActivity {
|
||||
private void initializeProfileAvatar() {
|
||||
String address = DcHelper.get(this, DcHelper.CONFIG_ADDRESS);
|
||||
|
||||
if (AvatarHelper.getSelfAvatarFile(this, address).exists() && AvatarHelper.getSelfAvatarFile(this, address).length() > 0) {
|
||||
if (AvatarHelper.getSelfAvatarFile(this).exists() && AvatarHelper.getSelfAvatarFile(this).length() > 0) {
|
||||
new AsyncTask<Void, Void, byte[]>() {
|
||||
@Override
|
||||
protected byte[] doInBackground(Void... params) {
|
||||
try {
|
||||
return Util.readFully(AvatarHelper.getInputStreamFor(CreateProfileActivity.this, address));
|
||||
return Util.readFully(AvatarHelper.getInputStreamFor(CreateProfileActivity.this));
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
return null;
|
||||
|
||||
@@ -61,23 +61,18 @@ public class AvatarHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static InputStream getInputStreamFor(@NonNull Context context, @NonNull String address)
|
||||
public static InputStream getInputStreamFor(@NonNull Context context)
|
||||
throws IOException {
|
||||
return new FileInputStream(getSelfAvatarFile(context, address));
|
||||
return new FileInputStream(getSelfAvatarFile(context));
|
||||
}
|
||||
|
||||
public static File getSelfAvatarFile(@NonNull Context context, @NonNull Address address) {
|
||||
String name = new File(address.serialize()).getName();
|
||||
return getSelfAvatarFile(context, name);
|
||||
}
|
||||
|
||||
public static File getSelfAvatarFile(@NonNull Context context, @NonNull String address) {
|
||||
public static File getSelfAvatarFile(@NonNull Context context) {
|
||||
String dirString = DcHelper.getContext(context).getConfig(DcHelper.CONFIG_SELF_AVATAR);
|
||||
return new File(dirString);
|
||||
}
|
||||
|
||||
public static void setSelfAvatar(@NonNull Context context, @NonNull String address, @Nullable byte[] data) throws IOException {
|
||||
File avatar = getSelfAvatarFile(context, address);
|
||||
File avatar = getSelfAvatarFile(context);
|
||||
if (data == null) {
|
||||
avatar.delete();
|
||||
DcHelper.set(context, DcHelper.CONFIG_SELF_AVATAR, null);
|
||||
|
||||
Reference in New Issue
Block a user