New fixes
This commit is contained in:
parent
d800d2b10c
commit
b4e7c3f8e2
|
@ -270,7 +270,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
|
|
||||||
binding.closeReply.setOnClickListener(v->closeCommentThread());
|
binding.closeReply.setOnClickListener(v->closeCommentThread());
|
||||||
|
|
||||||
commentListAdapter = new CommentListAdapter(comments, Helper.isVideoOwner(PeertubeActivity.this, peertube));
|
commentListAdapter = new CommentListAdapter(comments, isMyVideo || Helper.isVideoOwner(PeertubeActivity.this, peertube));
|
||||||
commentListAdapter.allCommentRemoved = PeertubeActivity.this;
|
commentListAdapter.allCommentRemoved = PeertubeActivity.this;
|
||||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
||||||
binding.peertubeComments.setLayoutManager(mLayoutManager);
|
binding.peertubeComments.setLayoutManager(mLayoutManager);
|
||||||
|
@ -537,8 +537,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
if (peertube.isCommentsEnabled()) {
|
if (peertube.isCommentsEnabled()) {
|
||||||
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
|
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
|
||||||
commentViewModel.getThread(sepiaSearch?peertubeInstance:null, videoUuid, max_id).observe(PeertubeActivity.this, this::manageVIewComment);
|
commentViewModel.getThread(sepiaSearch?peertubeInstance:null, videoUuid, max_id).observe(PeertubeActivity.this, this::manageVIewComment);
|
||||||
binding.writeCommentContainerReply.setVisibility(View.GONE);
|
if( Helper.isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
||||||
binding.writeCommentContainer.setVisibility(View.GONE);
|
binding.writeCommentContainerReply.setVisibility(View.VISIBLE);
|
||||||
|
binding.writeCommentContainer.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
binding.writeCommentContainerReply.setVisibility(View.GONE);
|
binding.writeCommentContainerReply.setVisibility(View.GONE);
|
||||||
|
@ -554,9 +556,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
|
|
||||||
|
|
||||||
binding.peertubeTitle.setText(peertube.getName());
|
binding.peertubeTitle.setText(peertube.getName());
|
||||||
binding.peertubeDislikeCount.setText(String.valueOf(peertube.getDislikes()));
|
binding.peertubeDislikeCount.setText(Helper.withSuffix(peertube.getDislikes()));
|
||||||
binding.peertubeLikeCount.setText(String.valueOf(peertube.getLikes()));
|
binding.peertubeLikeCount.setText(Helper.withSuffix(peertube.getLikes()));
|
||||||
binding.peertubeViewCount.setText(String.valueOf(peertube.getViews()));
|
binding.peertubeViewCount.setText(Helper.withSuffix(peertube.getViews()));
|
||||||
video_id = peertube.getId();
|
video_id = peertube.getId();
|
||||||
|
|
||||||
changeColor();
|
changeColor();
|
||||||
|
|
|
@ -120,13 +120,17 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||||
|
|
||||||
|
|
||||||
String message = "";
|
String message = "";
|
||||||
|
boolean myVideo = false;
|
||||||
if (notification.getVideo() != null) {
|
if (notification.getVideo() != null) {
|
||||||
if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_PUBLISHED) {
|
if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_PUBLISHED) {
|
||||||
message = context.getString(R.string.peertube_video_published, notification.getVideo().getName());
|
message = context.getString(R.string.peertube_video_published, notification.getVideo().getName());
|
||||||
|
myVideo = true;
|
||||||
} else if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_IMPORT_ERROR) {
|
} else if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_IMPORT_ERROR) {
|
||||||
message = context.getString(R.string.peertube_video_import_error, notification.getVideo().getName());
|
message = context.getString(R.string.peertube_video_import_error, notification.getVideo().getName());
|
||||||
|
myVideo = true;
|
||||||
} else if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_IMPORT_SUCCESS) {
|
} else if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_IMPORT_SUCCESS) {
|
||||||
message = context.getString(R.string.peertube_video_import_success, notification.getVideo().getName());
|
message = context.getString(R.string.peertube_video_import_success, notification.getVideo().getName());
|
||||||
|
myVideo = true;
|
||||||
} else if (notification.getType() == DisplayNotificationsFragment.NEW_VIDEO_FROM_SUBSCRIPTION) {
|
} else if (notification.getType() == DisplayNotificationsFragment.NEW_VIDEO_FROM_SUBSCRIPTION) {
|
||||||
channelAction = notification.getVideo().getChannel();
|
channelAction = notification.getVideo().getChannel();
|
||||||
message = context.getString(R.string.peertube_video_from_subscription, channelAction.getDisplayName(), notification.getVideo().getName());
|
message = context.getString(R.string.peertube_video_from_subscription, channelAction.getDisplayName(), notification.getVideo().getName());
|
||||||
|
@ -139,11 +143,13 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||||
holder.peertube_notif_message.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));
|
holder.peertube_notif_message.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));
|
||||||
else
|
else
|
||||||
holder.peertube_notif_message.setText(Html.fromHtml(message));
|
holder.peertube_notif_message.setText(Html.fromHtml(message));
|
||||||
|
boolean finalMyVideo = myVideo;
|
||||||
holder.peertube_notif_message.setOnClickListener(v -> {
|
holder.peertube_notif_message.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent(context, PeertubeActivity.class);
|
Intent intent = new Intent(context, PeertubeActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
b.putParcelable("video", notification.getVideo());
|
b.putParcelable("video", notification.getVideo());
|
||||||
b.putString("peertube_instance", Helper.getLiveInstance(context));
|
b.putString("peertube_instance", Helper.getLiveInstance(context));
|
||||||
|
b.putBoolean("isMyVideo", finalMyVideo);
|
||||||
b.putString("video_id", notification.getVideo().getId());
|
b.putString("video_id", notification.getVideo().getId());
|
||||||
b.putString("video_uuid", notification.getVideo().getUuid());
|
b.putString("video_uuid", notification.getVideo().getUuid());
|
||||||
intent.putExtras(b);
|
intent.putExtras(b);
|
||||||
|
|
|
@ -58,6 +58,7 @@ import app.fedilab.fedilabtube.MainActivity;
|
||||||
import app.fedilab.fedilabtube.R;
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.WebviewActivity;
|
import app.fedilab.fedilabtube.WebviewActivity;
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
||||||
|
import app.fedilab.fedilabtube.client.data.ChannelData;
|
||||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||||
import app.fedilab.fedilabtube.client.entities.File;
|
import app.fedilab.fedilabtube.client.entities.File;
|
||||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||||
|
@ -438,7 +439,7 @@ public class Helper {
|
||||||
|
|
||||||
@SuppressWarnings("SameParameterValue")
|
@SuppressWarnings("SameParameterValue")
|
||||||
private static void loadGif(final Context context, String instance, String url, final ImageView imageView, int round) {
|
private static void loadGif(final Context context, String instance, String url, final ImageView imageView, int round) {
|
||||||
if (url == null || url.trim().toLowerCase().compareTo("null") == 0) {
|
if (url == null || url.trim().toLowerCase().compareTo("null") == 0 || url.endsWith("null")) {
|
||||||
Glide.with(imageView.getContext())
|
Glide.with(imageView.getContext())
|
||||||
.asDrawable()
|
.asDrawable()
|
||||||
.load(R.drawable.missing_peertube)
|
.load(R.drawable.missing_peertube)
|
||||||
|
@ -658,8 +659,11 @@ public class Helper {
|
||||||
String userName = sharedpreferences.getString(Helper.PREF_KEY_NAME, "");
|
String userName = sharedpreferences.getString(Helper.PREF_KEY_NAME, "");
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, "");
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, "");
|
||||||
Account account = video.getAccount();
|
Account account = video.getAccount();
|
||||||
if (instance != null && userName != null) {
|
ChannelData.Channel channel = video.getChannel();
|
||||||
|
if (account != null && instance != null && userName != null) {
|
||||||
return account.getUsername().compareTo(userName) == 0 && account.getHost().compareTo(instance) == 0;
|
return account.getUsername().compareTo(userName) == 0 && account.getHost().compareTo(instance) == 0;
|
||||||
|
} else if (channel != null && instance != null && userName != null) {
|
||||||
|
return channel.getName().compareTo(userName) == 0 && channel.getHost().compareTo(instance) == 0;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ public class RetrieveInfoService extends Service implements NetworkStateReceiver
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID,
|
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID,
|
||||||
getString(R.string.notification_channel_name),
|
getString(R.string.notification_channel_name),
|
||||||
|
@ -84,6 +83,23 @@ public class RetrieveInfoService extends Service implements NetworkStateReceiver
|
||||||
|
|
||||||
startForeground(1, notification);
|
startForeground(1, notification);
|
||||||
}
|
}
|
||||||
|
Thread thread = new Thread() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
EmojiHelper.fillMapEmoji(getApplicationContext());
|
||||||
|
peertubeInformation = new PeertubeInformation();
|
||||||
|
peertubeInformation.setCategories(new LinkedHashMap<>());
|
||||||
|
peertubeInformation.setLanguages(new LinkedHashMap<>());
|
||||||
|
peertubeInformation.setLicences(new LinkedHashMap<>());
|
||||||
|
peertubeInformation.setPrivacies(new LinkedHashMap<>());
|
||||||
|
peertubeInformation.setPlaylistPrivacies(new LinkedHashMap<>());
|
||||||
|
peertubeInformation.setTranslations(new LinkedHashMap<>());
|
||||||
|
peertubeInformation = new RetrofitPeertubeAPI(RetrieveInfoService.this).getPeertubeInformation();
|
||||||
|
stopForeground(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
thread.start();
|
||||||
return START_NOT_STICKY;
|
return START_NOT_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue