Remove useless features

This commit is contained in:
Thomas 2020-09-03 18:57:53 +02:00
parent 14faca9b35
commit f6ca2e8265
4 changed files with 25 additions and 61 deletions

View File

@ -83,7 +83,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
private ViewPager mPager;
private TabLayout tabLayout;
private TextView account_note;
private String userId;
private Relationship relationship;
private int maxScrollSize;
private boolean avatarShown = true;
@ -99,7 +98,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
setContentView(R.layout.activity_show_account);
setTitle("");
Bundle b = getIntent().getExtras();
@ -117,8 +115,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
accountId = account.getId();
}
ischannel = b.getBoolean("ischannel", false);
userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
} else {
Toasty.error(ShowAccountActivity.this, getString(R.string.toast_error_loading_account), Toast.LENGTH_LONG).show();
}
@ -330,11 +326,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
}
});
TextView account_date = findViewById(R.id.account_date);
account_date.setText(Helper.shortDateToString(account.getCreated_at()));
account_date.setVisibility(View.VISIBLE);
}
@Override
@ -362,11 +353,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
this.relationship = relationships.get(0);
manageButtonVisibility();
//The authenticated account is followed by the account
if (relationship != null && relationship.isFollowed_by() && !accountId.equals(userId)) {
TextView account_followed_by = findViewById(R.id.account_followed_by);
account_followed_by.setVisibility(View.VISIBLE);
}
invalidateOptionsMenu();
}

View File

@ -76,7 +76,21 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
boolean ownVideos = peertube.getAccount().getInstance().compareTo(Helper.getLiveInstance(context)) == 0 && userId != null && peertube.getAccount().getId() != null && peertube.getAccount().getId().compareTo(userId) == 0;
holder.peertube_account_name.setText(account.getAcct());
if( peertube.getChannel() == null) {
holder.peertube_account_name.setText(account.getAcct());
if (account.getAvatar() != null && !account.getAvatar().equals("null") && !account.getAvatar().startsWith("http")) {
account.setAvatar("https://" + peertube.getInstance() + account.getAvatar());
account.setAvatar_static(account.getAvatar());
}
Helper.loadGiF(context, account, holder.peertube_profile);
} else {
holder.peertube_account_name.setText(peertube.getChannel().getAcct());
if (peertube.getChannel().getAvatar() != null && !peertube.getChannel().getAvatar().equals("null") && !peertube.getChannel().getAvatar().startsWith("http")) {
peertube.getChannel().setAvatar("https://" + peertube.getInstance() + peertube.getChannel().getAvatar());
peertube.getChannel().setAvatar_static(peertube.getChannel().getAvatar());
}
Helper.loadGiF(context, peertube.getChannel(), holder.peertube_profile);
}
holder.peertube_title.setText(peertube.getName());
holder.peertube_duration.setText(context.getString(R.string.duration_video, Helper.secondsToString(peertube.getDuration())));
holder.peertube_date.setText(String.format(" - %s", Helper.dateDiff(context, peertube.getCreated_at())));
@ -85,17 +99,18 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
Glide.with(holder.peertube_video_image.getContext())
.load("https://" + peertube.getInstance() + peertube.getThumbnailPath())
.into(holder.peertube_video_image);
if (account.getAvatar() != null && !account.getAvatar().equals("null") && !account.getAvatar().startsWith("http")) {
account.setAvatar("https://" + peertube.getInstance() + account.getAvatar());
account.setAvatar_static(account.getAvatar());
}
Helper.loadGiF(context, account, holder.peertube_profile);
if (!ownVideos) {
holder.peertube_profile.setOnClickListener(v -> {
Intent intent = new Intent(context, ShowAccountActivity.class);
Bundle b = new Bundle();
b.putParcelable("account", peertube.getAccount());
if( peertube.getChannel() == null) {
b.putParcelable("account", peertube.getAccount());
}else{
b.putParcelable("account", peertube.getChannel());
b.putBoolean("ischannel", true);
}
intent.putExtras(b);
context.startActivity(intent);
});

View File

@ -116,6 +116,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end"
android:textColor="@android:color/white"
android:textSize="14sp" />
</LinearLayout>
@ -173,46 +174,6 @@
android:textColor="@android:color/white"
android:textIsSelectable="true"
android:visibility="gone" />
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:id="@+id/account_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="3dp"
android:layout_marginEnd="3dp"
android:background="@drawable/colored_border"
android:singleLine="true"
android:textColor="?colorAccent"
android:visibility="gone" />
<TextView
android:id="@+id/account_followed_by"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="3dp"
android:layout_marginEnd="3dp"
android:background="@drawable/colored_border"
android:singleLine="true"
android:text="@string/followed_by"
android:textColor="?colorAccent"
android:visibility="gone" />
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
</RelativeLayout>

View File

@ -84,6 +84,8 @@
android:id="@+id/peertube_account_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end"
android:layout_gravity="center_vertical" />
<LinearLayout