- Added avatar to account view

This commit is contained in:
Stefan Schueller 2019-01-27 16:29:59 +01:00
parent 5464c51a18
commit 359a795efe
2 changed files with 23 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
@ -30,6 +31,7 @@ import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.iconics.IconicsDrawable;
import com.squareup.picasso.Picasso;
import net.schueller.peertube.R;
import net.schueller.peertube.adapter.ChannelAdapter;
@ -37,6 +39,7 @@ import net.schueller.peertube.adapter.VideoAdapter;
import net.schueller.peertube.helper.APIUrlHelper;
import net.schueller.peertube.helper.MetaDataHelper;
import net.schueller.peertube.model.Account;
import net.schueller.peertube.model.Avatar;
import net.schueller.peertube.model.ChannelList;
import net.schueller.peertube.model.VideoList;
import net.schueller.peertube.network.GetUserService;
@ -191,6 +194,17 @@ public class AccountActivity extends CommonActivity {
joined.setText(account.getCreatedAt().toString());
ImageView accountAvatar = findViewById(R.id.account_avatar);
// set Avatar
Avatar avatar = account.getAvatar();
if (avatar != null) {
String avatarPath = avatar.getPath();
Picasso.with(AccountActivity.this)
.load(APIUrlHelper.getUrl(AccountActivity.this) + avatarPath)
.into(accountAvatar);
}
} else {
Toast.makeText(AccountActivity.this, getString(R.string.api_error), Toast.LENGTH_SHORT).show();
}

View File

@ -45,6 +45,15 @@
android:layout_marginEnd="12dp"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/account_avatar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:paddingStart="12dp"
android:paddingTop="12dp"
android:paddingEnd="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"