Some fixes

This commit is contained in:
Thomas 2020-11-19 12:00:39 +01:00
parent 38f73a5d60
commit 8ff3b81112
7 changed files with 337 additions and 276 deletions

View File

@ -233,7 +233,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = ActivityPeertubeBinding.inflate(getLayoutInflater()); binding = ActivityPeertubeBinding.inflate(getLayoutInflater());
View view = binding.getRoot(); View view = binding.getRoot();
setContentView(view); setContentView(view);
@ -407,7 +406,17 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
if (autoFullscreen && autoPlay) { if (autoFullscreen && autoPlay) {
openFullscreenDialog(); openFullscreenDialog();
} }
binding.postCommentButton.setOnClickListener(v -> openPostComment(null, 0)); binding.postCommentButton.setOnClickListener(v -> {
if (isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
openPostComment(null, 0);
} else {
if (sepiaSearch) {
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
} else {
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
}
}
});
} }
@ -591,21 +600,22 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
VideoData.Description description = api.getVideoDescription(videoUuid); VideoData.Description description = api.getVideoDescription(videoUuid);
Handler mainHandler = new Handler(Looper.getMainLooper()); Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> { Runnable myRunnable = () -> {
if (description == null) { if (!isFinishing()) {
binding.peertubeDescriptionMore.setVisibility(View.GONE); if (description == null) {
show_more_content = null; binding.peertubeDescriptionMore.setVisibility(View.GONE);
} else { show_more_content = null;
if (!PeertubeActivity.this.isFinishing()) { } else {
if ((peertube.getDescription() == null && description.getDescription() != null) || (peertube.getDescription() != null && description.getDescription() != null && description.getDescription().compareTo(peertube.getDescription()) > 0)) { if (!PeertubeActivity.this.isFinishing()) {
binding.peertubeDescriptionMore.setVisibility(View.VISIBLE); if ((peertube.getDescription() == null && description.getDescription() != null) || (peertube.getDescription() != null && description.getDescription() != null && description.getDescription().compareTo(peertube.getDescription()) > 0)) {
show_more_content = description.getDescription(); binding.peertubeDescriptionMore.setVisibility(View.VISIBLE);
} else { show_more_content = description.getDescription();
binding.peertubeDescriptionMore.setVisibility(View.GONE); } else {
show_more_content = null; binding.peertubeDescriptionMore.setVisibility(View.GONE);
show_more_content = null;
}
} }
} }
} }
}; };
mainHandler.post(myRunnable); mainHandler.post(myRunnable);
} catch (Exception e) { } catch (Exception e) {
@ -614,6 +624,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
}).start(); }).start();
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) { if (item.getItemId() == android.R.id.home) {
@ -768,7 +779,13 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
binding.peertubeDislikeCount.setText(Helper.withSuffix(peertube.getDislikes())); binding.peertubeDislikeCount.setText(Helper.withSuffix(peertube.getDislikes()));
binding.peertubeLikeCount.setText(Helper.withSuffix(peertube.getLikes())); binding.peertubeLikeCount.setText(Helper.withSuffix(peertube.getLikes()));
binding.peertubeViewCount.setText(Helper.withSuffix(peertube.getViews())); binding.peertubeViewCount.setText(Helper.withSuffix(peertube.getViews()));
loadGiF(PeertubeActivity.this, peertube.getChannel().getAvatar() != null ? peertube.getChannel().getAvatar().getPath() : null, binding.ppChannel); String ppChannelURL;
if (sepiaSearch) {
ppChannelURL = peertube.getChannel().getAvatar() != null ? "https://" + peertubeInstance + peertube.getChannel().getAvatar().getPath() : null;
} else {
ppChannelURL = peertube.getChannel().getAvatar() != null ? peertube.getChannel().getAvatar().getPath() : null;
}
loadGiF(PeertubeActivity.this, ppChannelURL, binding.ppChannel);
binding.ppChannel.setOnClickListener(v -> { binding.ppChannel.setOnClickListener(v -> {
Intent intent = new Intent(PeertubeActivity.this, ShowChannelActivity.class); Intent intent = new Intent(PeertubeActivity.this, ShowChannelActivity.class);
Bundle b = new Bundle(); Bundle b = new Bundle();
@ -1194,7 +1211,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class); CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
binding.peertubeReply.setVisibility(View.GONE); binding.peertubeReply.setVisibility(View.GONE);
commentViewModel.getRepliesComment(videoUuid, comment.getId()).observe(PeertubeActivity.this, apiResponse -> manageVIewCommentReply(comment, apiResponse)); commentViewModel.getRepliesComment(sepiaSearch ? peertubeInstance : null, videoUuid, comment.getId()).observe(PeertubeActivity.this, apiResponse -> manageVIewCommentReply(comment, apiResponse));
binding.replyThread.setVisibility(View.VISIBLE); binding.replyThread.setVisibility(View.VISIBLE);
TranslateAnimation animate = new TranslateAnimation( TranslateAnimation animate = new TranslateAnimation(
@ -1225,7 +1242,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
DisplayMetrics displayMetrics = new DisplayMetrics(); DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels; int height = displayMetrics.heightPixels;
binding.doubleTapPlayerView.hideController();
List<MenuItemVideo> menuItemVideos = new ArrayList<>(); List<MenuItemVideo> menuItemVideos = new ArrayList<>();
if (peertube.getFiles() != null && peertube.getFiles().size() > 0) { if (peertube.getFiles() != null && peertube.getFiles().size() > 0) {
MenuItemVideo resolutionItem = new MenuItemVideo(); MenuItemVideo resolutionItem = new MenuItemVideo();

View File

@ -28,11 +28,6 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
@ -65,13 +60,13 @@ import app.fedilab.fedilabtube.client.data.VideoData.Video;
import app.fedilab.fedilabtube.client.entities.Item; import app.fedilab.fedilabtube.client.entities.Item;
import app.fedilab.fedilabtube.client.entities.ItemStr; import app.fedilab.fedilabtube.client.entities.ItemStr;
import app.fedilab.fedilabtube.client.entities.VideoParams; import app.fedilab.fedilabtube.client.entities.VideoParams;
import app.fedilab.fedilabtube.databinding.ActivityPeertubeEditBinding;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.viewmodel.ChannelsVM; import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
import app.fedilab.fedilabtube.viewmodel.MyVideoVM; import app.fedilab.fedilabtube.viewmodel.MyVideoVM;
import app.fedilab.fedilabtube.viewmodel.PostActionsVM; import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
import app.fedilab.fedilabtube.viewmodel.TimelineVM; import app.fedilab.fedilabtube.viewmodel.TimelineVM;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;
import mabbas007.tagsedittext.TagsEditText;
import static app.fedilab.fedilabtube.MainActivity.peertubeInformation; import static app.fedilab.fedilabtube.MainActivity.peertubeInformation;
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.PEERTUBEDELETEVIDEO; import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.PEERTUBEDELETEVIDEO;
@ -85,23 +80,20 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
private final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 724; private final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 724;
Item licenseToSend, privacyToSend, categoryToSend; Item licenseToSend, privacyToSend, categoryToSend;
ItemStr languageToSend; ItemStr languageToSend;
private Button set_upload_submit;
private Spinner set_upload_privacy, set_upload_categories, set_upload_licenses, set_upload_languages, set_upload_channel;
private EditText p_video_title, p_video_description;
private TagsEditText p_video_tags;
private CheckBox set_upload_nsfw, set_upload_enable_comments;
private LinkedHashMap<String, String> channels; private LinkedHashMap<String, String> channels;
private String videoId; private String videoId;
private Channel channel; private Channel channel;
private ImageView p_video_preview;
private Button set_preview;
private VideoParams videoParams; private VideoParams videoParams;
private Video video; private Video video;
private String channelToSendId; private String channelToSendId;
private ActivityPeertubeEditBinding binding;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = ActivityPeertubeEditBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
@ -116,23 +108,8 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
} }
if (getSupportActionBar() != null) if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.activity_peertube_edit);
set_upload_submit = findViewById(R.id.set_upload_submit);
Button set_upload_delete = findViewById(R.id.set_upload_delete);
set_upload_privacy = findViewById(R.id.set_upload_privacy);
set_upload_channel = findViewById(R.id.set_upload_channel);
set_upload_categories = findViewById(R.id.set_upload_categories);
set_upload_licenses = findViewById(R.id.set_upload_licenses);
set_upload_languages = findViewById(R.id.set_upload_languages);
p_video_title = findViewById(R.id.p_video_title);
p_video_description = findViewById(R.id.p_video_description);
p_video_tags = findViewById(R.id.p_video_tags);
p_video_preview = findViewById(R.id.p_video_preview);
set_upload_nsfw = findViewById(R.id.set_upload_nsfw);
set_upload_enable_comments = findViewById(R.id.set_upload_enable_comments);
set_preview = findViewById(R.id.set_preview);
set_upload_delete.setOnClickListener(v -> { binding.setUploadDelete.setOnClickListener(v -> {
AlertDialog.Builder builderInner; AlertDialog.Builder builderInner;
builderInner = new AlertDialog.Builder(PeertubeEditUploadActivity.this); builderInner = new AlertDialog.Builder(PeertubeEditUploadActivity.this);
builderInner.setMessage(getString(R.string.delete_video_confirmation)); builderInner.setMessage(getString(R.string.delete_video_confirmation));
@ -168,7 +145,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
} }
ArrayAdapter<String> adapterCatgories = new ArrayAdapter<>(PeertubeEditUploadActivity.this, ArrayAdapter<String> adapterCatgories = new ArrayAdapter<>(PeertubeEditUploadActivity.this,
android.R.layout.simple_spinner_dropdown_item, categoriesA); android.R.layout.simple_spinner_dropdown_item, categoriesA);
set_upload_categories.setAdapter(adapterCatgories); binding.setUploadCategories.setAdapter(adapterCatgories);
//Populate licenses //Populate licenses
@ -186,7 +163,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
} }
ArrayAdapter<String> adapterLicenses = new ArrayAdapter<>(PeertubeEditUploadActivity.this, ArrayAdapter<String> adapterLicenses = new ArrayAdapter<>(PeertubeEditUploadActivity.this,
android.R.layout.simple_spinner_dropdown_item, licensesA); android.R.layout.simple_spinner_dropdown_item, licensesA);
set_upload_licenses.setAdapter(adapterLicenses); binding.setUploadLicenses.setAdapter(adapterLicenses);
//Populate languages //Populate languages
@ -204,7 +181,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
} }
ArrayAdapter<String> adapterLanguages = new ArrayAdapter<>(PeertubeEditUploadActivity.this, ArrayAdapter<String> adapterLanguages = new ArrayAdapter<>(PeertubeEditUploadActivity.this,
android.R.layout.simple_spinner_dropdown_item, languagesA); android.R.layout.simple_spinner_dropdown_item, languagesA);
set_upload_languages.setAdapter(adapterLanguages); binding.setUploadLanguages.setAdapter(adapterLanguages);
//Populate languages //Populate languages
@ -223,7 +200,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
ArrayAdapter<String> adapterPrivacies = new ArrayAdapter<>(PeertubeEditUploadActivity.this, ArrayAdapter<String> adapterPrivacies = new ArrayAdapter<>(PeertubeEditUploadActivity.this,
android.R.layout.simple_spinner_dropdown_item, privaciesA); android.R.layout.simple_spinner_dropdown_item, privaciesA);
set_upload_privacy.setAdapter(adapterPrivacies); binding.setUploadPrivacy.setAdapter(adapterPrivacies);
TimelineVM feedsViewModel = new ViewModelProvider(PeertubeEditUploadActivity.this).get(TimelineVM.class); TimelineVM feedsViewModel = new ViewModelProvider(PeertubeEditUploadActivity.this).get(TimelineVM.class);
@ -235,7 +212,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
} }
public void manageUpdate(APIResponse apiResponse) { public void manageUpdate(APIResponse apiResponse) {
set_upload_submit.setEnabled(true); binding.setUploadSubmit.setEnabled(true);
if (apiResponse.getError() != null) { if (apiResponse.getError() != null) {
if (apiResponse.getError() != null && apiResponse.getError().getError() != null) if (apiResponse.getError() != null && apiResponse.getError().getError() != null)
Toasty.error(PeertubeEditUploadActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show(); Toasty.error(PeertubeEditUploadActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
@ -251,7 +228,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
Toasty.error(PeertubeEditUploadActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show(); Toasty.error(PeertubeEditUploadActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
else else
Toasty.error(PeertubeEditUploadActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show(); Toasty.error(PeertubeEditUploadActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
set_upload_submit.setEnabled(true); binding.setUploadSubmit.setEnabled(true);
return; return;
} }
@ -267,11 +244,11 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
categoryToSend = video.getCategory(); categoryToSend = video.getCategory();
if (video.getThumbnailPath() != null) { if (video.getThumbnailPath() != null) {
Helper.loadGiF(PeertubeEditUploadActivity.this, video.getThumbnailPath(), p_video_preview); Helper.loadGiF(PeertubeEditUploadActivity.this, video.getThumbnailPath(), binding.pVideoPreview);
} }
set_preview.setOnClickListener(v -> { binding.setPreview.setOnClickListener(v -> {
if (ContextCompat.checkSelfPermission(PeertubeEditUploadActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != if (ContextCompat.checkSelfPermission(PeertubeEditUploadActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
PackageManager.PERMISSION_GRANTED) { PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(PeertubeEditUploadActivity.this, ActivityCompat.requestPermissions(PeertubeEditUploadActivity.this,
@ -328,11 +305,11 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
boolean commentEnabled = video.isCommentsEnabled(); boolean commentEnabled = video.isCommentsEnabled();
boolean isNSFW = video.isNsfw(); boolean isNSFW = video.isNsfw();
set_upload_enable_comments.setChecked(commentEnabled); binding.setUploadEnableComments.setChecked(commentEnabled);
set_upload_nsfw.setChecked(isNSFW); binding.setUploadNsfw.setChecked(isNSFW);
p_video_title.setText(title); binding.pVideoTitle.setText(title);
p_video_description.setText(video.getDescription()); binding.pVideoDescription.setText(video.getDescription());
new Thread(() -> { new Thread(() -> {
try { try {
@ -341,8 +318,8 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
VideoData.Description description = api.getVideoDescription(video.getUuid()); VideoData.Description description = api.getVideoDescription(video.getUuid());
Handler mainHandler = new Handler(Looper.getMainLooper()); Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> { Runnable myRunnable = () -> {
if (description == null) { if (description != null) {
p_video_description.setText(description.getDescription()); binding.pVideoDescription.setText(description.getDescription());
} }
}; };
mainHandler.post(myRunnable); mainHandler.post(myRunnable);
@ -403,7 +380,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
} }
} }
//Manage privacies //Manage privacies
set_upload_privacy.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { binding.setUploadPrivacy.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
updatePrivacyPosition(position); updatePrivacyPosition(position);
@ -414,7 +391,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
} }
}); });
set_upload_licenses.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { binding.setUploadLicenses.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
updateLicensePosition(position); updateLicensePosition(position);
@ -426,7 +403,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
} }
}); });
//Manage categories //Manage categories
set_upload_categories.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { binding.setUploadCategories.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
updateCategoryPosition(position); updateCategoryPosition(position);
@ -439,7 +416,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
}); });
//Manage languages //Manage languages
set_upload_languages.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { binding.setUploadLanguages.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
updateLanguagesPosition(position); updateLanguagesPosition(position);
@ -451,7 +428,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
} }
}); });
//Manage languages //Manage languages
set_upload_channel.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { binding.setUploadChannel.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
@ -468,11 +445,11 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
Item finalLicenseToSend = licenseToSend; Item finalLicenseToSend = licenseToSend;
ItemStr finalLanguageToSend = languageToSend; ItemStr finalLanguageToSend = languageToSend;
Item finalPrivacyToSend = privacyToSend; Item finalPrivacyToSend = privacyToSend;
set_upload_submit.setOnClickListener(v -> { binding.setUploadSubmit.setOnClickListener(v -> {
String title1 = p_video_title.getText().toString().trim(); String title1 = binding.pVideoTitle.getText().toString().trim();
String description = p_video_description.getText().toString().trim(); String description = binding.pVideoDescription.getText().toString().trim();
boolean isNSFW1 = set_upload_nsfw.isChecked(); boolean isNSFW1 = binding.setUploadNsfw.isChecked();
boolean commentEnabled1 = set_upload_enable_comments.isChecked(); boolean commentEnabled1 = binding.setUploadEnableComments.isChecked();
videoParams = new VideoParams(); videoParams = new VideoParams();
videoParams.setName(title1); videoParams.setName(title1);
videoParams.setDescription(description); videoParams.setDescription(description);
@ -484,25 +461,25 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
videoParams.setChannelId(channelToSendId); videoParams.setChannelId(channelToSendId);
videoParams.setPrivacy(finalPrivacyToSend.getId()); videoParams.setPrivacy(finalPrivacyToSend.getId());
List<String> tags = p_video_tags.getTags(); List<String> tags = binding.pVideoTags.getTags();
videoParams.setTags(tags); videoParams.setTags(tags);
set_upload_submit.setEnabled(false); binding.setUploadSubmit.setEnabled(false);
MyVideoVM myVideoVM = new ViewModelProvider(PeertubeEditUploadActivity.this).get(MyVideoVM.class); MyVideoVM myVideoVM = new ViewModelProvider(PeertubeEditUploadActivity.this).get(MyVideoVM.class);
myVideoVM.updateVideo(videoId, videoParams, null, null).observe(PeertubeEditUploadActivity.this, this::manageUpdate); myVideoVM.updateVideo(videoId, videoParams, null, null).observe(PeertubeEditUploadActivity.this, this::manageUpdate);
}); });
set_upload_privacy.setSelection(privacyPosition, false); binding.setUploadPrivacy.setSelection(privacyPosition, false);
updatePrivacyPosition(privacyPosition); updatePrivacyPosition(privacyPosition);
set_upload_languages.setSelection(languagePosition, false); binding.setUploadLanguages.setSelection(languagePosition, false);
updateLanguagesPosition(languagePosition); updateLanguagesPosition(languagePosition);
set_upload_licenses.setSelection(licensePosition, false); binding.setUploadLicenses.setSelection(licensePosition, false);
updateLicensePosition(licensePosition); updateLicensePosition(licensePosition);
set_upload_categories.setSelection(categoryPosition, false); binding.setUploadCategories.setSelection(categoryPosition, false);
updateCategoryPosition(categoryPosition); updateCategoryPosition(categoryPosition);
List<String> tags = video.getTags(); List<String> tags = video.getTags();
if (tags != null && tags.size() > 0) { if (tags != null && tags.size() > 0) {
p_video_tags.setTags(tags.toArray(new String[0])); binding.pVideoTags.setTags(tags.toArray(new String[0]));
} }
} }
@ -623,7 +600,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
public void onCompleted(Context context, UploadInfo uploadInfo, ServerResponse serverResponse) { public void onCompleted(Context context, UploadInfo uploadInfo, ServerResponse serverResponse) {
Glide.with(PeertubeEditUploadActivity.this) Glide.with(PeertubeEditUploadActivity.this)
.load(uri) .load(uri)
.into(p_video_preview); .into(binding.pVideoPreview);
} }
@Override @Override
@ -672,7 +649,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
} }
ArrayAdapter<String> adapterChannel = new ArrayAdapter<>(PeertubeEditUploadActivity.this, ArrayAdapter<String> adapterChannel = new ArrayAdapter<>(PeertubeEditUploadActivity.this,
android.R.layout.simple_spinner_dropdown_item, channelName); android.R.layout.simple_spinner_dropdown_item, channelName);
set_upload_channel.setAdapter(adapterChannel); binding.setUploadChannel.setAdapter(adapterChannel);
int channelPosition = 0; int channelPosition = 0;
if (channels.containsKey(channel.getName())) { if (channels.containsKey(channel.getName())) {
LinkedHashMap<String, String> channelsIterator = new LinkedHashMap<>(channels); LinkedHashMap<String, String> channelsIterator = new LinkedHashMap<>(channels);
@ -687,9 +664,15 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
channelPosition++; channelPosition++;
} }
} }
set_upload_channel.setSelection(channelPosition, false); binding.setUploadChannel.setSelection(channelPosition, false);
updateUploadChannel(channelPosition); updateUploadChannel(channelPosition);
set_upload_submit.setEnabled(true); binding.setUploadSubmit.setEnabled(true);
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
} }
@SuppressWarnings({"unused", "RedundantSuppression"}) @SuppressWarnings({"unused", "RedundantSuppression"})

View File

@ -26,7 +26,6 @@ import java.util.List;
import app.fedilab.fedilabtube.client.MenuItemVideo; import app.fedilab.fedilabtube.client.MenuItemVideo;
import app.fedilab.fedilabtube.client.entities.MenuItemView; import app.fedilab.fedilabtube.client.entities.MenuItemView;
import app.fedilab.fedilabtube.databinding.DrawerMenuItemBinding; import app.fedilab.fedilabtube.databinding.DrawerMenuItemBinding;
import app.fedilab.fedilabtube.helper.Helper;
public class MenuItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class MenuItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
@ -68,11 +67,8 @@ public class MenuItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
holder.binding.title.setText(item.getLabel()); holder.binding.title.setText(item.getLabel());
holder.binding.radio.setChecked(item.isSelected()); holder.binding.radio.setChecked(item.isSelected());
holder.binding.itemMenuContainer.setOnClickListener(v -> { holder.binding.itemMenuContainer.setOnClickListener(v -> itemAction.which(actionType, item));
itemAction.which(actionType, item); holder.binding.radio.setOnClickListener(v -> itemAction.which(actionType, item));
});
} }
public interface ItemAction { public interface ItemAction {

View File

@ -14,10 +14,12 @@ package app.fedilab.fedilabtube.drawer;
* You should have received a copy of the GNU General Public License along with TubeLab; if not, * You should have received a copy of the GNU General Public License along with TubeLab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -25,17 +27,24 @@ import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu; import androidx.appcompat.widget.PopupMenu;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner; import androidx.lifecycle.ViewModelStoreOwner;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.transition.Transition;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -50,11 +59,13 @@ import app.fedilab.fedilabtube.client.data.PlaylistData;
import app.fedilab.fedilabtube.client.data.VideoData; import app.fedilab.fedilabtube.client.data.VideoData;
import app.fedilab.fedilabtube.client.entities.PlaylistExist; import app.fedilab.fedilabtube.client.entities.PlaylistExist;
import app.fedilab.fedilabtube.client.entities.Report; import app.fedilab.fedilabtube.client.entities.Report;
import app.fedilab.fedilabtube.databinding.DrawerPeertubeBinding;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM; import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
import app.fedilab.fedilabtube.viewmodel.PostActionsVM; import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
import app.fedilab.fedilabtube.viewmodel.TimelineVM; import app.fedilab.fedilabtube.viewmodel.TimelineVM;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;
import jp.wasabeef.glide.transformations.BlurTransformation;
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.FOLLOW; import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.FOLLOW;
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.UNFOLLOW; import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.UNFOLLOW;
@ -87,8 +98,8 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
context = parent.getContext(); context = parent.getContext();
LayoutInflater layoutInflater = LayoutInflater.from(context); DrawerPeertubeBinding itemBinding = DrawerPeertubeBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
return new ViewHolder(layoutInflater.inflate(R.layout.drawer_peertube, parent, false)); return new ViewHolder(itemBinding);
} }
@Override @Override
@ -120,43 +131,43 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
instance = video.getAccount().getHost(); instance = video.getAccount().getHost();
} }
holder.peertube_account_name.setText(video.getChannel().getAcct()); holder.binding.peertubeAccountName.setText(video.getChannel().getAcct());
Helper.loadGiF(context, instance, video.getChannel().getAvatar() != null ? video.getChannel().getAvatar().getPath() : null, holder.peertube_profile); Helper.loadGiF(context, instance, video.getChannel().getAvatar() != null ? video.getChannel().getAvatar().getPath() : null, holder.binding.peertubeProfile);
holder.peertube_title.setText(video.getName()); holder.binding.peertubeTitle.setText(video.getName());
holder.peertube_duration.setText(Helper.secondsToString(video.getDuration())); holder.binding.peertubeDuration.setText(Helper.secondsToString(video.getDuration()));
holder.peertube_date.setText(String.format(" - %s", Helper.dateDiff(context, video.getCreatedAt()))); holder.binding.peertubeDate.setText(String.format(" - %s", Helper.dateDiff(context, video.getCreatedAt())));
holder.peertube_views.setText(context.getString(R.string.number_view_video, Helper.withSuffix(video.getViews()))); holder.binding.peertubeViews.setText(context.getString(R.string.number_view_video, Helper.withSuffix(video.getViews())));
boolean blur = sharedpreferences.getString(context.getString(R.string.set_video_sensitive_choice), Helper.BLUR).compareTo("blur") == 0 && video.isNsfw(); boolean blur = sharedpreferences.getString(context.getString(R.string.set_video_sensitive_choice), Helper.BLUR).compareTo("blur") == 0 && video.isNsfw();
if (videoInList) { if (videoInList) {
Helper.loadGiF(context, instance, video.getThumbnailPath(), holder.peertube_video_image_small, blur); Helper.loadGiF(context, instance, video.getThumbnailPath(), holder.binding.peertubeVideoImageSmall, blur);
holder.peertube_video_image_small.setVisibility(View.VISIBLE); holder.binding.peertubeVideoImageSmall.setVisibility(View.VISIBLE);
holder.preview_container.setVisibility(View.GONE); holder.binding.previewContainer.setVisibility(View.GONE);
} else { } else {
Helper.loadGiF(context, instance, video.getThumbnailPath(), holder.peertube_video_image, blur); loadImage(holder.binding.peertubeVideoImage, instance, video.getPreviewPath(), video.getThumbnailPath(), blur);
holder.peertube_video_image_small.setVisibility(View.GONE); holder.binding.peertubeVideoImageSmall.setVisibility(View.GONE);
holder.preview_container.setVisibility(View.VISIBLE); holder.binding.previewContainer.setVisibility(View.VISIBLE);
} }
//For Overview Videos: boolean values for displaying title is managed in the fragment //For Overview Videos: boolean values for displaying title is managed in the fragment
if (video.isHasTitle()) { if (video.isHasTitle()) {
holder.header_title.setVisibility(View.VISIBLE); holder.binding.headerTitle.setVisibility(View.VISIBLE);
switch (video.getTitleType()) { switch (video.getTitleType()) {
case TAG: case TAG:
holder.header_title.setText(String.format("#%s", video.getTitle())); holder.binding.headerTitle.setText(String.format("#%s", video.getTitle()));
break; break;
case CHANNEL: case CHANNEL:
case CATEGORY: case CATEGORY:
holder.header_title.setText(String.format("%s", video.getTitle())); holder.binding.headerTitle.setText(String.format("%s", video.getTitle()));
break; break;
} }
} else { } else {
holder.header_title.setVisibility(View.GONE); holder.binding.headerTitle.setVisibility(View.GONE);
} }
if (!ownVideos) { if (!ownVideos) {
holder.peertube_profile.setOnClickListener(v -> { holder.binding.peertubeProfile.setOnClickListener(v -> {
Intent intent = new Intent(context, ShowChannelActivity.class); Intent intent = new Intent(context, ShowChannelActivity.class);
Bundle b = new Bundle(); Bundle b = new Bundle();
b.putParcelable("channel", video.getChannel()); b.putParcelable("channel", video.getChannel());
@ -170,8 +181,8 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
} }
holder.more_actions.setOnClickListener(view -> { holder.binding.moreActions.setOnClickListener(view -> {
PopupMenu popup = new PopupMenu(context, holder.more_actions); PopupMenu popup = new PopupMenu(context, holder.binding.moreActions);
popup.getMenuInflater() popup.getMenuInflater()
.inflate(R.menu.video_drawer_menu, popup.getMenu()); .inflate(R.menu.video_drawer_menu, popup.getMenu());
if (timelineType == MY_VIDEOS) { if (timelineType == MY_VIDEOS) {
@ -256,7 +267,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
}); });
popup.show(); popup.show();
}); });
holder.bottom_container.setOnClickListener(v -> { holder.binding.bottomContainer.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.putString("video_id", video.getId()); b.putString("video_id", video.getId());
@ -270,7 +281,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
intent.putExtras(b); intent.putExtras(b);
context.startActivity(intent); context.startActivity(intent);
}); });
holder.peertube_video_image.setOnClickListener(v -> { holder.binding.peertubeVideoImage.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.putString("video_id", video.getId()); b.putString("video_id", video.getId());
@ -385,29 +396,74 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
Map<String, List<PlaylistExist>> getPlaylist(); Map<String, List<PlaylistExist>> getPlaylist();
} }
@SuppressLint("CheckResult")
private void loadImage(ImageView target, String instance, String urlPreview, String thumbnail, boolean blur) {
if (urlPreview == null || urlPreview.startsWith("null")) {
urlPreview = thumbnail;
}
if (instance != null) {
urlPreview = "https://" + instance + urlPreview;
thumbnail = "https://" + instance + thumbnail;
} else {
urlPreview = "https://" + Helper.getLiveInstance(context) + urlPreview;
thumbnail = "https://" + Helper.getLiveInstance(context) + thumbnail;
}
RequestBuilder<Drawable> requestBuilder = Glide.with(context)
.asDrawable();
if (blur) {
requestBuilder.apply(new RequestOptions().transform(new BlurTransformation(50, 3), new CenterCrop(), new RoundedCorners(10)));
} else {
requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)));
}
final Drawable[] initialResource = new Drawable[1];
String finalUrlPreview = urlPreview;
requestBuilder.load(thumbnail).into(
new CustomTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull final Drawable resource, Transition<? super Drawable> transition) {
target.setImageDrawable(resource);
initialResource[0] = resource;
RequestBuilder<Drawable> requestBuilder = Glide.with(context)
.asDrawable();
if (blur) {
requestBuilder.apply(new RequestOptions().transform(new BlurTransformation(50, 3), new CenterCrop(), new RoundedCorners(10)));
} else {
requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)));
}
requestBuilder.load(finalUrlPreview).into(
new CustomTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull final Drawable resource, Transition<? super Drawable> transition) {
target.setImageDrawable(resource);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
@Override
public void onLoadFailed(@Nullable Drawable errorDrawable) {
target.setImageDrawable(initialResource[0]);
}
}
);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
}
);
}
static class ViewHolder extends RecyclerView.ViewHolder { static class ViewHolder extends RecyclerView.ViewHolder {
LinearLayout main_container, bottom_container; DrawerPeertubeBinding binding;
ImageView peertube_profile, peertube_video_image, peertube_video_image_small;
TextView peertube_account_name, peertube_views, peertube_duration;
TextView peertube_title, peertube_date, header_title, more_actions;
ConstraintLayout preview_container;
public ViewHolder(@NonNull View itemView) { ViewHolder(DrawerPeertubeBinding itemView) {
super(itemView); super(itemView.getRoot());
peertube_account_name = itemView.findViewById(R.id.peertube_account_name); binding = itemView;
peertube_video_image_small = itemView.findViewById(R.id.peertube_video_image_small);
peertube_title = itemView.findViewById(R.id.peertube_title);
peertube_video_image = itemView.findViewById(R.id.peertube_video_image);
peertube_profile = itemView.findViewById(R.id.peertube_profile);
peertube_date = itemView.findViewById(R.id.peertube_date);
peertube_views = itemView.findViewById(R.id.peertube_views);
peertube_duration = itemView.findViewById(R.id.peertube_duration);
main_container = itemView.findViewById(R.id.main_container);
header_title = itemView.findViewById(R.id.header_title);
bottom_container = itemView.findViewById(R.id.bottom_container);
more_actions = itemView.findViewById(R.id.more_actions);
preview_container = itemView.findViewById(R.id.preview_container);
} }
} }

View File

@ -41,9 +41,9 @@ public class CommentVM extends AndroidViewModel {
return apiResponseMutableLiveData; return apiResponseMutableLiveData;
} }
public LiveData<APIResponse> getRepliesComment(String videoId, String commentId) { public LiveData<APIResponse> getRepliesComment(String instance, String videoId, String commentId) {
apiResponseMutableLiveData = new MutableLiveData<>(); apiResponseMutableLiveData = new MutableLiveData<>();
getThreadRepliesComments(videoId, commentId); getThreadRepliesComments(instance, videoId, commentId);
return apiResponseMutableLiveData; return apiResponseMutableLiveData;
} }
@ -69,12 +69,17 @@ public class CommentVM extends AndroidViewModel {
} }
private void getThreadRepliesComments(String videoId, String commentId) { private void getThreadRepliesComments(String instance, String videoId, String commentId) {
Context _mContext = getApplication().getApplicationContext(); Context _mContext = getApplication().getApplicationContext();
new Thread(() -> { new Thread(() -> {
try { try {
RetrofitPeertubeAPI api = new RetrofitPeertubeAPI(_mContext); RetrofitPeertubeAPI retrofitPeertubeAPI;
APIResponse apiResponse = api.getComments(action.GET_REPLIES, videoId, commentId, null); if (instance == null) {
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
} else {
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, instance, null);
}
APIResponse apiResponse = retrofitPeertubeAPI.getComments(action.GET_REPLIES, videoId, commentId, null);
Handler mainHandler = new Handler(Looper.getMainLooper()); Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> apiResponseMutableLiveData.setValue(apiResponse); Runnable myRunnable = () -> apiResponseMutableLiveData.setValue(apiResponse);
mainHandler.post(myRunnable); mainHandler.post(myRunnable);

View File

@ -110,146 +110,155 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:orientation="vertical"> android:orientation="vertical">
<TextView <androidx.cardview.widget.CardView
android:id="@+id/peertube_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:layout_marginTop="5dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/pp_channel"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:contentDescription="@string/profile_picture"
/>
<TextView
android:id="@+id/peertube_view_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text="0"
app:drawableTopCompat="@drawable/ic_baseline_visibility_24"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/peertube_like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="20dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text="0"
app:drawableTopCompat="@drawable/ic_baseline_thumb_up_alt_24"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/peertube_dislike_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text="0"
app:drawableTopCompat="@drawable/ic_baseline_thumb_down_alt_24"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/peertube_bookmark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text=""
app:drawableTopCompat="@drawable/ic_baseline_bookmark_border_24" />
<TextView
android:id="@+id/peertube_playlist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text=""
android:visibility="gone"
app:drawableTopCompat="@drawable/ic_baseline_list_24" />
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:orientation="vertical"
tools:ignore="UselessLeaf" /> android:padding="10dp">
<TextView
android:id="@+id/peertube_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/pp_channel"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:contentDescription="@string/profile_picture" />
<TextView
android:id="@+id/peertube_view_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text="0"
app:drawableTopCompat="@drawable/ic_baseline_visibility_24"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/peertube_like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="20dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text="0"
app:drawableTopCompat="@drawable/ic_baseline_thumb_up_alt_24"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/peertube_dislike_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text="0"
app:drawableTopCompat="@drawable/ic_baseline_thumb_down_alt_24"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/peertube_bookmark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text=""
app:drawableTopCompat="@drawable/ic_baseline_bookmark_border_24" />
<TextView
android:id="@+id/peertube_playlist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text=""
android:visibility="gone"
app:drawableTopCompat="@drawable/ic_baseline_list_24" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
tools:ignore="UselessLeaf" />
<TextView <TextView
android:id="@+id/more_actions" android:id="@+id/more_actions"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:text="" android:text=""
app:drawableTopCompat="@drawable/ic_baseline_more_vert_24" /> app:drawableTopCompat="@drawable/ic_baseline_more_vert_24" />
</LinearLayout> </LinearLayout>
<TextView <TextView
android:id="@+id/peertube_description" android:id="@+id/peertube_description"
android:textIsSelectable="true" android:layout_width="match_parent"
android:autoLink="web" android:layout_height="wrap_content"
android:layout_width="match_parent" android:layout_marginTop="10dp"
android:layout_height="wrap_content" android:autoLink="web"
android:layout_marginTop="10dp" /> android:textIsSelectable="true" />
<TextView
android:id="@+id/peertube_description_more" <TextView
android:layout_width="match_parent" android:id="@+id/peertube_description_more"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:text="@string/show_more" android:layout_height="wrap_content"
android:visibility="gone" android:layout_marginTop="2dp"
android:textColor="?attr/colorAccent" android:text="@string/show_more"
android:layout_marginTop="2dp" /> android:textColor="?attr/colorAccent"
android:visibility="gone" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<Button <Button
android:layout_gravity="center" android:layout_gravity="center"
@ -259,6 +268,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/add_public_comment"/> android:text="@string/add_public_comment"/>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:layout_marginStart="10dp"
android:id="@+id/peertube_comments" android:id="@+id/peertube_comments"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
@ -293,17 +303,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:layout_marginStart="20dp" android:layout_margin="10dp"
android:layout_marginLeft="20dp"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:id="@+id/main_container" android:id="@+id/main_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:divider="?android:dividerHorizontal" android:divider="?android:dividerHorizontal"
android:orientation="vertical" android:orientation="vertical"
android:showDividers="end"> android:showDividers="end">
<ImageView <ImageView
android:layout_gravity="end|center_vertical" android:layout_gravity="end|center_vertical"
android:id="@+id/close_reply" android:id="@+id/close_reply"
@ -332,10 +338,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:layout_marginStart="20dp" android:layout_margin="10dp"
android:layout_marginLeft="20dp"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:id="@+id/post_main_container" android:id="@+id/post_main_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -119,6 +119,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="textMultiLine" android:inputType="textMultiLine"
android:gravity="top"
android:lines="5" android:lines="5"
android:maxLines="5" android:maxLines="5"
android:scrollbars="vertical" /> android:scrollbars="vertical" />