mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-06-05 21:09:11 +02:00
Release 1.5.1
This commit is contained in:
@ -11,8 +11,8 @@ android {
|
|||||||
|
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 19
|
versionCode 20
|
||||||
versionName "1.5.0"
|
versionName "1.5.1"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,4 @@ public class FedilabTube extends MultiDexApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -94,6 +94,11 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
login_passwd = findViewById(R.id.login_passwd);
|
login_passwd = findViewById(R.id.login_passwd);
|
||||||
|
|
||||||
if (Helper.isTablet(LoginActivity.this)) {
|
if (Helper.isTablet(LoginActivity.this)) {
|
||||||
|
|
||||||
|
ViewGroup.LayoutParams layoutParamsI = login_instance_container.getLayoutParams();
|
||||||
|
layoutParamsI.width = (int) Helper.convertDpToPixel(300, LoginActivity.this);
|
||||||
|
login_instance_container.setLayoutParams(layoutParamsI);
|
||||||
|
|
||||||
TextInputLayout login_uid_container = findViewById(R.id.login_uid_container);
|
TextInputLayout login_uid_container = findViewById(R.id.login_uid_container);
|
||||||
ViewGroup.LayoutParams layoutParamsU = login_uid_container.getLayoutParams();
|
ViewGroup.LayoutParams layoutParamsU = login_uid_container.getLayoutParams();
|
||||||
layoutParamsU.width = (int) Helper.convertDpToPixel(300, LoginActivity.this);
|
layoutParamsU.width = (int) Helper.convertDpToPixel(300, LoginActivity.this);
|
||||||
|
@ -121,19 +121,19 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
navView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
navView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||||
|
|
||||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag("5");
|
Fragment fragment = getSupportFragmentManager().findFragmentByTag("5");
|
||||||
if(fragment != null)
|
if (fragment != null)
|
||||||
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
||||||
fragment = getSupportFragmentManager().findFragmentByTag("4");
|
fragment = getSupportFragmentManager().findFragmentByTag("4");
|
||||||
if(fragment != null)
|
if (fragment != null)
|
||||||
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
||||||
fragment = getSupportFragmentManager().findFragmentByTag("3");
|
fragment = getSupportFragmentManager().findFragmentByTag("3");
|
||||||
if(fragment != null)
|
if (fragment != null)
|
||||||
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
||||||
fragment = getSupportFragmentManager().findFragmentByTag("2");
|
fragment = getSupportFragmentManager().findFragmentByTag("2");
|
||||||
if(fragment != null)
|
if (fragment != null)
|
||||||
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
||||||
fragment = getSupportFragmentManager().findFragmentByTag("1");
|
fragment = getSupportFragmentManager().findFragmentByTag("1");
|
||||||
if(fragment != null)
|
if (fragment != null)
|
||||||
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
||||||
|
|
||||||
recentFragment = new DisplayVideosFragment();
|
recentFragment = new DisplayVideosFragment();
|
||||||
@ -163,7 +163,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
overviewFragment = new DisplayOverviewFragment();
|
overviewFragment = new DisplayOverviewFragment();
|
||||||
|
|
||||||
if( active == null) {
|
if (active == null) {
|
||||||
active = overviewFragment;
|
active = overviewFragment;
|
||||||
}
|
}
|
||||||
fm.beginTransaction().add(R.id.nav_host_fragment, locaFragment, "5").hide(locaFragment).commit();
|
fm.beginTransaction().add(R.id.nav_host_fragment, locaFragment, "5").hide(locaFragment).commit();
|
||||||
@ -174,10 +174,10 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
fm.beginTransaction().add(R.id.nav_host_fragment, trendingFragment, "2").hide(trendingFragment).commit();
|
fm.beginTransaction().add(R.id.nav_host_fragment, trendingFragment, "2").hide(trendingFragment).commit();
|
||||||
fm.beginTransaction().add(R.id.nav_host_fragment, overviewFragment, "1").commit();
|
fm.beginTransaction().add(R.id.nav_host_fragment, overviewFragment, "1").commit();
|
||||||
}
|
}
|
||||||
toolbar.setOnClickListener(v->{
|
toolbar.setOnClickListener(v -> {
|
||||||
if(active instanceof DisplayVideosFragment) {
|
if (active instanceof DisplayVideosFragment) {
|
||||||
((DisplayVideosFragment) active).scrollToTop();
|
((DisplayVideosFragment) active).scrollToTop();
|
||||||
}else if(active instanceof DisplayOverviewFragment) {
|
} else if (active instanceof DisplayOverviewFragment) {
|
||||||
((DisplayOverviewFragment) active).scrollToTop();
|
((DisplayOverviewFragment) active).scrollToTop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -225,7 +225,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
editor.putString(Helper.PREF_KEY_NAME, account.getUsername());
|
editor.putString(Helper.PREF_KEY_NAME, account.getUsername());
|
||||||
//Sync languages from server
|
//Sync languages from server
|
||||||
List<String> videoLanguageServer = userMe.getVideoLanguages();
|
List<String> videoLanguageServer = userMe.getVideoLanguages();
|
||||||
if( videoLanguageServer != null) {
|
if (videoLanguageServer != null) {
|
||||||
Set<String> videoLanguageServerSet = new TreeSet<>(videoLanguageServer);
|
Set<String> videoLanguageServerSet = new TreeSet<>(videoLanguageServer);
|
||||||
videoLanguageServerSet.addAll(videoLanguageServer);
|
videoLanguageServerSet.addAll(videoLanguageServer);
|
||||||
Set<String> videoLanguageLocal = sharedpreferences.getStringSet(getString(R.string.set_video_language_choice), null);
|
Set<String> videoLanguageLocal = sharedpreferences.getStringSet(getString(R.string.set_video_language_choice), null);
|
||||||
@ -237,6 +237,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Error error) {
|
} catch (Error error) {
|
||||||
|
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, account));
|
||||||
error.printStackTrace();
|
error.printStackTrace();
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
@ -247,7 +248,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
startInForeground();
|
startInForeground();
|
||||||
|
|
||||||
if(BuildConfig.google_restriction && BuildConfig.full_instances) {
|
if (BuildConfig.google_restriction && BuildConfig.full_instances) {
|
||||||
RateThisApp.onCreate(this);
|
RateThisApp.onCreate(this);
|
||||||
RateThisApp.showRateDialogIfNeeded(this);
|
RateThisApp.showRateDialogIfNeeded(this);
|
||||||
}
|
}
|
||||||
@ -315,7 +316,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
settingsItem.setVisible(true);
|
settingsItem.setVisible(true);
|
||||||
mostLikedItem.setVisible(false);
|
mostLikedItem.setVisible(false);
|
||||||
}
|
}
|
||||||
if( !BuildConfig.full_instances) {
|
if (!BuildConfig.full_instances) {
|
||||||
sepiaSearchItem.setVisible(false);
|
sepiaSearchItem.setVisible(false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -372,11 +373,11 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
Intent intent = new Intent(MainActivity.this, AllPlaylistsActivity.class);
|
Intent intent = new Intent(MainActivity.this, AllPlaylistsActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}else if(item.getItemId() == R.id.action_sepia_search) {
|
} else if (item.getItemId() == R.id.action_sepia_search) {
|
||||||
Intent intent = new Intent(MainActivity.this, SepiaSearchActivity.class);
|
Intent intent = new Intent(MainActivity.this, SepiaSearchActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}else if (item.getItemId() == R.id.action_about) {
|
} else if (item.getItemId() == R.id.action_about) {
|
||||||
Intent intent = new Intent(MainActivity.this, AboutActivity.class);
|
Intent intent = new Intent(MainActivity.this, AboutActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
@ -384,7 +385,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActive(DisplayVideosFragment displayVideosFragment){
|
public void setActive(DisplayVideosFragment displayVideosFragment) {
|
||||||
this.active = displayVideosFragment;
|
this.active = displayVideosFragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +158,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
private ActivityPeertubeBinding binding;
|
private ActivityPeertubeBinding binding;
|
||||||
private List<Comment> commentsThread;
|
private List<Comment> commentsThread;
|
||||||
private BroadcastReceiver mPowerKeyReceiver = null;
|
private BroadcastReceiver mPowerKeyReceiver = null;
|
||||||
|
private boolean isPlayInMinimized;
|
||||||
|
|
||||||
public static void hideKeyboard(Activity activity) {
|
public static void hideKeyboard(Activity activity) {
|
||||||
if (activity != null && activity.getWindow() != null) {
|
if (activity != null && activity.getWindow() != null) {
|
||||||
@ -167,7 +168,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
imm.hideSoftInputFromWindow(activity.getWindow().getDecorView().getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(activity.getWindow().getDecorView().getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private boolean isPlayInMinimized;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -215,7 +215,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( !Helper.isLoggedIn(PeertubeActivity.this) || sepiaSearch) {
|
if (!Helper.isLoggedIn(PeertubeActivity.this) || sepiaSearch) {
|
||||||
binding.writeCommentContainerReply.setVisibility(View.GONE);
|
binding.writeCommentContainerReply.setVisibility(View.GONE);
|
||||||
binding.writeCommentContainer.setVisibility(View.GONE);
|
binding.writeCommentContainer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
@ -274,7 +274,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
comments = new ArrayList<>();
|
comments = new ArrayList<>();
|
||||||
|
|
||||||
binding.closeReply.setOnClickListener(v->closeCommentThread());
|
binding.closeReply.setOnClickListener(v -> closeCommentThread());
|
||||||
|
|
||||||
commentListAdapter = new CommentListAdapter(comments, isMyVideo || Helper.isVideoOwner(PeertubeActivity.this, peertube));
|
commentListAdapter = new CommentListAdapter(comments, isMyVideo || Helper.isVideoOwner(PeertubeActivity.this, peertube));
|
||||||
commentListAdapter.allCommentRemoved = PeertubeActivity.this;
|
commentListAdapter.allCommentRemoved = PeertubeActivity.this;
|
||||||
@ -291,25 +291,24 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
if (firstVisibleItem + visibleItemCount == totalItemCount) {
|
if (firstVisibleItem + visibleItemCount == totalItemCount) {
|
||||||
if (!flag_loading) {
|
if (!flag_loading) {
|
||||||
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, apiresponse -> manageVIewComment(apiresponse));
|
commentViewModel.getThread(sepiaSearch ? peertubeInstance : null, videoUuid, max_id).observe(PeertubeActivity.this, apiresponse -> manageVIewComment(apiresponse));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if( peertube != null && sepiaSearch && peertube.getEmbedUrl() != null && Helper.isLoggedIn(PeertubeActivity.this)) {
|
if (peertube != null && sepiaSearch && peertube.getEmbedUrl() != null && Helper.isLoggedIn(PeertubeActivity.this)) {
|
||||||
SearchVM viewModelSearch = new ViewModelProvider(PeertubeActivity.this).get(SearchVM.class);
|
SearchVM viewModelSearch = new ViewModelProvider(PeertubeActivity.this).get(SearchVM.class);
|
||||||
viewModelSearch.getVideos("0", peertube.getEmbedUrl()).observe(PeertubeActivity.this, this::manageVIewVideos);
|
viewModelSearch.getVideos("0", peertube.getEmbedUrl()).observe(PeertubeActivity.this, this::manageVIewVideos);
|
||||||
}else {
|
} else {
|
||||||
playVideo();
|
playVideo();
|
||||||
}
|
}
|
||||||
registBroadcastReceiver();
|
registBroadcastReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void manageVIewVideos(APIResponse apiResponse) {
|
private void manageVIewVideos(APIResponse apiResponse) {
|
||||||
if( apiResponse == null || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
if (apiResponse == null || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
||||||
playVideo();
|
playVideo();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -369,7 +368,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
commentThreadData.getComment().setReply(true);
|
commentThreadData.getComment().setReply(true);
|
||||||
comments.add(commentThreadData.getComment());
|
comments.add(commentThreadData.getComment());
|
||||||
}
|
}
|
||||||
if( commentThreadData.getChildren() != null && commentThreadData.getChildren().size() >0) {
|
if (commentThreadData.getChildren() != null && commentThreadData.getChildren().size() > 0) {
|
||||||
generateCommentReply(commentThreadData.getChildren(), comments);
|
generateCommentReply(commentThreadData.getChildren(), comments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -404,9 +403,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.peertubePlaylist.setVisibility(View.VISIBLE);
|
binding.peertubePlaylist.setVisibility(View.VISIBLE);
|
||||||
binding.peertubeBookmark.setVisibility(View.GONE);
|
binding.peertubeBookmark.setVisibility(View.GONE);
|
||||||
TimelineVM feedsViewModel = new ViewModelProvider(PeertubeActivity.this).get(TimelineVM.class);
|
TimelineVM feedsViewModel = new ViewModelProvider(PeertubeActivity.this).get(TimelineVM.class);
|
||||||
feedsViewModel.getVideo(sepiaSearch?peertubeInstance:null, videoUuid, isMyVideo).observe(PeertubeActivity.this, this::manageVIewVideo);
|
feedsViewModel.getVideo(sepiaSearch ? peertubeInstance : null, videoUuid, isMyVideo).observe(PeertubeActivity.this, this::manageVIewVideo);
|
||||||
CaptionsVM captionsViewModel = new ViewModelProvider(PeertubeActivity.this).get(CaptionsVM.class);
|
CaptionsVM captionsViewModel = new ViewModelProvider(PeertubeActivity.this).get(CaptionsVM.class);
|
||||||
captionsViewModel.getCaptions(sepiaSearch?peertubeInstance:null, videoUuid).observe(PeertubeActivity.this, this::manageCaptions);
|
captionsViewModel.getCaptions(sepiaSearch ? peertubeInstance : null, videoUuid).observe(PeertubeActivity.this, this::manageCaptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void change() {
|
public void change() {
|
||||||
@ -455,7 +454,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
videoReport.setId(peertube.getId());
|
videoReport.setId(peertube.getId());
|
||||||
report.setVideo(videoReport);
|
report.setVideo(videoReport);
|
||||||
report.setReason(report_content.getText().toString());
|
report.setReason(report_content.getText().toString());
|
||||||
viewModel.report(report).observe(PeertubeActivity.this, apiResponse -> manageVIewPostActions(RetrofitPeertubeAPI.ActionType.REPORT_VIDEO,0, apiResponse));
|
viewModel.report(report).observe(PeertubeActivity.this, apiResponse -> manageVIewPostActions(RetrofitPeertubeAPI.ActionType.REPORT_VIDEO, 0, apiResponse));
|
||||||
alertDialog.dismiss();
|
alertDialog.dismiss();
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
} else if (type == RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT) {
|
} else if (type == RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT) {
|
||||||
@ -464,7 +463,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
accountReport.setId(peertube.getAccount().getId());
|
accountReport.setId(peertube.getAccount().getId());
|
||||||
report.setAccount(accountReport);
|
report.setAccount(accountReport);
|
||||||
report.setReason(report_content.getText().toString());
|
report.setReason(report_content.getText().toString());
|
||||||
viewModel.report(report).observe(PeertubeActivity.this, apiResponse -> manageVIewPostActions(RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT, 0,apiResponse));
|
viewModel.report(report).observe(PeertubeActivity.this, apiResponse -> manageVIewPostActions(RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT, 0, apiResponse));
|
||||||
alertDialog.dismiss();
|
alertDialog.dismiss();
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
@ -507,7 +506,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
|
|
||||||
|
|
||||||
peertube = apiResponse.getPeertubes().get(0);
|
peertube = apiResponse.getPeertubes().get(0);
|
||||||
if( sepiaSearch) {
|
if (sepiaSearch) {
|
||||||
peertubeInstance = peertube.getAccount().getHost();
|
peertubeInstance = peertube.getAccount().getHost();
|
||||||
}
|
}
|
||||||
List<String> videoIds = new ArrayList<>();
|
List<String> videoIds = new ArrayList<>();
|
||||||
@ -515,7 +514,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
PlaylistsVM viewModel = new ViewModelProvider(this).get(PlaylistsVM.class);
|
PlaylistsVM viewModel = new ViewModelProvider(this).get(PlaylistsVM.class);
|
||||||
viewModel.videoExists(videoIds).observe(this, this::manageVIewPlaylist);
|
viewModel.videoExists(videoIds).observe(this, this::manageVIewPlaylist);
|
||||||
|
|
||||||
if( !Helper.isLoggedIn(PeertubeActivity.this) || sepiaSearch) {
|
if (!Helper.isLoggedIn(PeertubeActivity.this) || sepiaSearch) {
|
||||||
binding.writeCommentContainer.setVisibility(View.GONE);
|
binding.writeCommentContainer.setVisibility(View.GONE);
|
||||||
binding.writeCommentContainerReply.setVisibility(View.GONE);
|
binding.writeCommentContainerReply.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
@ -528,9 +527,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.addCommentWrite.setText("");
|
binding.addCommentWrite.setText("");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if( sepiaSearch) {
|
if (sepiaSearch) {
|
||||||
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
||||||
}else {
|
} else {
|
||||||
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -543,8 +542,8 @@ 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);
|
||||||
if( Helper.isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
if (Helper.isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
||||||
binding.writeCommentContainerReply.setVisibility(View.VISIBLE);
|
binding.writeCommentContainerReply.setVisibility(View.VISIBLE);
|
||||||
binding.writeCommentContainer.setVisibility(View.VISIBLE);
|
binding.writeCommentContainer.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
@ -589,9 +588,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.peertubeLikeCount.setText(String.valueOf(count));
|
binding.peertubeLikeCount.setText(String.valueOf(count));
|
||||||
changeColor();
|
changeColor();
|
||||||
} else {
|
} else {
|
||||||
if( sepiaSearch) {
|
if (sepiaSearch) {
|
||||||
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
||||||
}else {
|
} else {
|
||||||
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -600,7 +599,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
if (isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
if (isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
|
||||||
String newState = peertube.getMyRating().equals("dislike") ? "none" : "dislike";
|
String newState = peertube.getMyRating().equals("dislike") ? "none" : "dislike";
|
||||||
PostActionsVM viewModelLike = new ViewModelProvider(PeertubeActivity.this).get(PostActionsVM.class);
|
PostActionsVM viewModelLike = new ViewModelProvider(PeertubeActivity.this).get(PostActionsVM.class);
|
||||||
viewModelLike.post(RATEVIDEO, peertube.getId(), newState).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(RATEVIDEO,0, apiResponse1));
|
viewModelLike.post(RATEVIDEO, peertube.getId(), newState).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(RATEVIDEO, 0, apiResponse1));
|
||||||
peertube.setMyRating(newState);
|
peertube.setMyRating(newState);
|
||||||
int count = Integer.parseInt(binding.peertubeDislikeCount.getText().toString());
|
int count = Integer.parseInt(binding.peertubeDislikeCount.getText().toString());
|
||||||
if (newState.compareTo("none") == 0) {
|
if (newState.compareTo("none") == 0) {
|
||||||
@ -614,9 +613,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.peertubeDislikeCount.setText(String.valueOf(count));
|
binding.peertubeDislikeCount.setText(String.valueOf(count));
|
||||||
changeColor();
|
changeColor();
|
||||||
} else {
|
} else {
|
||||||
if( sepiaSearch) {
|
if (sepiaSearch) {
|
||||||
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
||||||
}else {
|
} else {
|
||||||
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -661,6 +660,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
if (captions == null) {
|
if (captions == null) {
|
||||||
popup.getMenu().findItem(R.id.action_captions).setEnabled(false);
|
popup.getMenu().findItem(R.id.action_captions).setEnabled(false);
|
||||||
}
|
}
|
||||||
|
if (!isMyVideo) {
|
||||||
|
popup.getMenu().findItem(R.id.action_edit).setVisible(false);
|
||||||
|
}
|
||||||
popup.setOnMenuItemClickListener(item -> {
|
popup.setOnMenuItemClickListener(item -> {
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
if (itemId == R.id.action_download) {
|
if (itemId == R.id.action_download) {
|
||||||
@ -700,7 +702,17 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
sendIntent.putExtra(Intent.EXTRA_TEXT, extra_text);
|
sendIntent.putExtra(Intent.EXTRA_TEXT, extra_text);
|
||||||
sendIntent.setType("text/plain");
|
sendIntent.setType("text/plain");
|
||||||
|
try {
|
||||||
startActivity(Intent.createChooser(sendIntent, getString(R.string.share_with)));
|
startActivity(Intent.createChooser(sendIntent, getString(R.string.share_with)));
|
||||||
|
} catch (Exception e) {
|
||||||
|
Toasty.error(PeertubeActivity.this, getString(R.string.toast_error), Toasty.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
} else if (itemId == R.id.action_edit) {
|
||||||
|
Intent intent = new Intent(PeertubeActivity.this, PeertubeEditUploadActivity.class);
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
b.putString("video_id", peertube.getUuid());
|
||||||
|
intent.putExtras(b);
|
||||||
|
startActivity(intent);
|
||||||
} else if (itemId == R.id.action_captions) {
|
} else if (itemId == R.id.action_captions) {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PeertubeActivity.this);
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PeertubeActivity.this);
|
||||||
if (captions == null) {
|
if (captions == null) {
|
||||||
@ -876,12 +888,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
if (apiLevel >= 7) {
|
if (apiLevel >= 7) {
|
||||||
try {
|
try {
|
||||||
getApplicationContext().unregisterReceiver(mPowerKeyReceiver);
|
getApplicationContext().unregisterReceiver(mPowerKeyReceiver);
|
||||||
}
|
} catch (IllegalArgumentException e) {
|
||||||
catch (IllegalArgumentException e) {
|
|
||||||
mPowerKeyReceiver = null;
|
mPowerKeyReceiver = null;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
getApplicationContext().unregisterReceiver(mPowerKeyReceiver);
|
getApplicationContext().unregisterReceiver(mPowerKeyReceiver);
|
||||||
mPowerKeyReceiver = null;
|
mPowerKeyReceiver = null;
|
||||||
}
|
}
|
||||||
@ -911,9 +921,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if( binding.replyThread.getVisibility() == View.VISIBLE) {
|
if (binding.replyThread.getVisibility() == View.VISIBLE) {
|
||||||
closeCommentThread();
|
closeCommentThread();
|
||||||
}else {
|
} else {
|
||||||
if (playInMinimized && player != null) {
|
if (playInMinimized && player != null) {
|
||||||
enterVideoMode();
|
enterVideoMode();
|
||||||
} else {
|
} else {
|
||||||
@ -1003,7 +1013,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void initFullscreenDialog() {
|
private void initFullscreenDialog() {
|
||||||
|
|
||||||
fullScreenDialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen) {
|
fullScreenDialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen) {
|
||||||
@ -1026,7 +1035,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
fullScreenDialog.show();
|
fullScreenDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openCommentThread(Comment comment, int position){
|
public void openCommentThread(Comment comment, int position) {
|
||||||
|
|
||||||
|
|
||||||
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
|
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
|
||||||
@ -1052,13 +1061,17 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
0);
|
0);
|
||||||
animate.setAnimationListener(new Animation.AnimationListener() {
|
animate.setAnimationListener(new Animation.AnimationListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(Animation animation) {}
|
public void onAnimationStart(Animation animation) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animation animation) {
|
public void onAnimationEnd(Animation animation) {
|
||||||
binding.peertubeInformationContainer.setVisibility(View.GONE);
|
binding.peertubeInformationContainer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationRepeat(Animation animation) {}
|
public void onAnimationRepeat(Animation animation) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
animate.setDuration(500);
|
animate.setDuration(500);
|
||||||
binding.addCommentWriteReply.setText(String.format("@%s ", comment.getAccount().getAcct()));
|
binding.addCommentWriteReply.setText(String.format("@%s ", comment.getAccount().getAcct()));
|
||||||
@ -1074,16 +1087,16 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.addCommentWriteReply.setText("");
|
binding.addCommentWriteReply.setText("");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if( sepiaSearch) {
|
if (sepiaSearch) {
|
||||||
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
Toasty.info(PeertubeActivity.this, getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
||||||
}else {
|
} else {
|
||||||
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeCommentThread(){
|
private void closeCommentThread() {
|
||||||
binding.peertubeInformationContainer.setVisibility(View.VISIBLE);
|
binding.peertubeInformationContainer.setVisibility(View.VISIBLE);
|
||||||
TranslateAnimation animate = new TranslateAnimation(
|
TranslateAnimation animate = new TranslateAnimation(
|
||||||
0,
|
0,
|
||||||
@ -1092,13 +1105,17 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
0);
|
0);
|
||||||
animate.setAnimationListener(new Animation.AnimationListener() {
|
animate.setAnimationListener(new Animation.AnimationListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(Animation animation) {}
|
public void onAnimationStart(Animation animation) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animation animation) {
|
public void onAnimationEnd(Animation animation) {
|
||||||
binding.replyThread.setVisibility(View.GONE);
|
binding.replyThread.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationRepeat(Animation animation) {}
|
public void onAnimationRepeat(Animation animation) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
animate.setDuration(500);
|
animate.setDuration(500);
|
||||||
binding.replyThread.startAnimation(animate);
|
binding.replyThread.startAnimation(animate);
|
||||||
@ -1108,12 +1125,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
public void manageVIewPostActions(RetrofitPeertubeAPI.ActionType statusAction, int position, APIResponse apiResponse) {
|
public void manageVIewPostActions(RetrofitPeertubeAPI.ActionType statusAction, int position, APIResponse apiResponse) {
|
||||||
|
|
||||||
if (peertube.isCommentsEnabled() && statusAction == ADD_COMMENT) {
|
if (peertube.isCommentsEnabled() && statusAction == ADD_COMMENT) {
|
||||||
if( apiResponse.getComments() != null && apiResponse.getComments().size() > 0 ) {
|
if (apiResponse.getComments() != null && apiResponse.getComments().size() > 0) {
|
||||||
comments.add(0, apiResponse.getComments().get(0));
|
comments.add(0, apiResponse.getComments().get(0));
|
||||||
commentListAdapter.notifyItemInserted(0);
|
commentListAdapter.notifyItemInserted(0);
|
||||||
}
|
}
|
||||||
} else if (peertube.isCommentsEnabled() && statusAction == REPLY) {
|
} else if (peertube.isCommentsEnabled() && statusAction == REPLY) {
|
||||||
if( apiResponse.getComments() != null && apiResponse.getComments().size() > 0 ) {
|
if (apiResponse.getComments() != null && apiResponse.getComments().size() > 0) {
|
||||||
commentsThread.add(position, apiResponse.getComments().get(0));
|
commentsThread.add(position, apiResponse.getComments().get(0));
|
||||||
commentReplyListAdapter.notifyItemInserted(position);
|
commentReplyListAdapter.notifyItemInserted(position);
|
||||||
}
|
}
|
||||||
@ -1201,7 +1218,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
builder.setTitle(R.string.modify_playlists);
|
builder.setTitle(R.string.modify_playlists);
|
||||||
|
|
||||||
List<PlaylistData.Playlist> ownerPlaylists = apiResponse.getPlaylists();
|
List<PlaylistData.Playlist> ownerPlaylists = apiResponse.getPlaylists();
|
||||||
if( ownerPlaylists == null){
|
if (ownerPlaylists == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String[] label = new String[ownerPlaylists.size()];
|
String[] label = new String[ownerPlaylists.size()];
|
||||||
@ -1244,6 +1261,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void manageVIewPlaylist(APIResponse apiResponse) {
|
public void manageVIewPlaylist(APIResponse apiResponse) {
|
||||||
if (apiResponse.getError() != null || apiResponse.getVideoExistPlaylist() == null) {
|
if (apiResponse.getError() != null || apiResponse.getVideoExistPlaylist() == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -177,6 +177,9 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
|||||||
String host = emailArray[1];
|
String host = emailArray[1];
|
||||||
instance = Helper.getPeertubeUrl(host);
|
instance = Helper.getPeertubeUrl(host);
|
||||||
}
|
}
|
||||||
|
if (instance != null) {
|
||||||
|
instance = instance.toLowerCase().trim();
|
||||||
|
}
|
||||||
|
|
||||||
AccountCreation accountCreation = new AccountCreation();
|
AccountCreation accountCreation = new AccountCreation();
|
||||||
accountCreation.setEmail(email.getText().toString().trim());
|
accountCreation.setEmail(email.getText().toString().trim());
|
||||||
|
@ -79,9 +79,9 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
|||||||
Button filter = findViewById(R.id.filter);
|
Button filter = findViewById(R.id.filter);
|
||||||
filter_elements = findViewById(R.id.filter_elements);
|
filter_elements = findViewById(R.id.filter_elements);
|
||||||
filter.setOnClickListener(view -> {
|
filter.setOnClickListener(view -> {
|
||||||
if( filter_elements.getVisibility() == View.VISIBLE) {
|
if (filter_elements.getVisibility() == View.VISIBLE) {
|
||||||
filter_elements.setVisibility(View.GONE);
|
filter_elements.setVisibility(View.GONE);
|
||||||
}else{
|
} else {
|
||||||
filter_elements.setVisibility(View.VISIBLE);
|
filter_elements.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -140,7 +140,6 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Spinner sort_by = findViewById(R.id.sort_by);
|
Spinner sort_by = findViewById(R.id.sort_by);
|
||||||
ArrayAdapter<String> adapterSortBy = new ArrayAdapter<>(SepiaSearchActivity.this,
|
ArrayAdapter<String> adapterSortBy = new ArrayAdapter<>(SepiaSearchActivity.this,
|
||||||
android.R.layout.simple_spinner_dropdown_item, getResources().getStringArray(R.array.sort_by_array));
|
android.R.layout.simple_spinner_dropdown_item, getResources().getStringArray(R.array.sort_by_array));
|
||||||
@ -149,7 +148,7 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
String orderby, channelOrderBy;
|
String orderby, channelOrderBy;
|
||||||
switch (position){
|
switch (position) {
|
||||||
case 1:
|
case 1:
|
||||||
orderby = "-publishedAt";
|
orderby = "-publishedAt";
|
||||||
channelOrderBy = "-createdAt";
|
channelOrderBy = "-createdAt";
|
||||||
@ -184,12 +183,12 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
|||||||
LinkedHashMap<String, String> languages = new LinkedHashMap<>(peertubeInformation.getLanguages());
|
LinkedHashMap<String, String> languages = new LinkedHashMap<>(peertubeInformation.getLanguages());
|
||||||
LinkedHashMap<String, String> translations = null;
|
LinkedHashMap<String, String> translations = null;
|
||||||
|
|
||||||
if( peertubeInformation.getTranslations() != null) {
|
if (peertubeInformation.getTranslations() != null) {
|
||||||
translations = new LinkedHashMap<>(peertubeInformation.getTranslations());
|
translations = new LinkedHashMap<>(peertubeInformation.getTranslations());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Populate catgories
|
//Populate catgories
|
||||||
String[] categoriesA = new String[categories.size()+1];
|
String[] categoriesA = new String[categories.size() + 1];
|
||||||
categoriesA[0] = getString(R.string.display_all_categories);
|
categoriesA[0] = getString(R.string.display_all_categories);
|
||||||
Iterator<Map.Entry<Integer, String>> it = categories.entrySet().iterator();
|
Iterator<Map.Entry<Integer, String>> it = categories.entrySet().iterator();
|
||||||
int i = 1;
|
int i = 1;
|
||||||
@ -208,7 +207,7 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
//Populate licenses
|
//Populate licenses
|
||||||
String[] licensesA = new String[licences.size()+1];
|
String[] licensesA = new String[licences.size() + 1];
|
||||||
licensesA[0] = getString(R.string.display_all_licenses);
|
licensesA[0] = getString(R.string.display_all_licenses);
|
||||||
it = licences.entrySet().iterator();
|
it = licences.entrySet().iterator();
|
||||||
i = 1;
|
i = 1;
|
||||||
@ -226,7 +225,7 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
|||||||
sepia_element_license.setAdapter(adapterLicenses);
|
sepia_element_license.setAdapter(adapterLicenses);
|
||||||
|
|
||||||
//Populate languages
|
//Populate languages
|
||||||
String[] languagesA = new String[languages.size()+1];
|
String[] languagesA = new String[languages.size() + 1];
|
||||||
languagesA[0] = getString(R.string.display_all_languages);
|
languagesA[0] = getString(R.string.display_all_languages);
|
||||||
Iterator<Map.Entry<String, String>> itl = languages.entrySet().iterator();
|
Iterator<Map.Entry<String, String>> itl = languages.entrySet().iterator();
|
||||||
i = 1;
|
i = 1;
|
||||||
@ -282,7 +281,6 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
searchBar = findViewById(R.id.searchBar);
|
searchBar = findViewById(R.id.searchBar);
|
||||||
|
|
||||||
searchBar.setOnSearchActionListener(new MaterialSearchBar.OnSearchActionListener() {
|
searchBar.setOnSearchActionListener(new MaterialSearchBar.OnSearchActionListener() {
|
||||||
@ -302,27 +300,27 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
Button apply_filter = findViewById(R.id.apply_filter);
|
Button apply_filter = findViewById(R.id.apply_filter);
|
||||||
apply_filter.setOnClickListener(v-> makeSearch());
|
apply_filter.setOnClickListener(v -> makeSearch());
|
||||||
|
|
||||||
searchBar.openSearch();
|
searchBar.openSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makeSearch(){
|
private void makeSearch() {
|
||||||
hideKeyboard(SepiaSearchActivity.this);
|
hideKeyboard(SepiaSearchActivity.this);
|
||||||
sepiaSearchVideo.setStart("0");
|
sepiaSearchVideo.setStart("0");
|
||||||
if( sepia_element_one_of_tags.getTags().size() > 0 ) {
|
if (sepia_element_one_of_tags.getTags().size() > 0) {
|
||||||
sepiaSearchVideo.setTagsOneOf(sepia_element_one_of_tags.getTags());
|
sepiaSearchVideo.setTagsOneOf(sepia_element_one_of_tags.getTags());
|
||||||
}else{
|
} else {
|
||||||
sepiaSearchVideo.setTagsOneOf(null);
|
sepiaSearchVideo.setTagsOneOf(null);
|
||||||
}
|
}
|
||||||
if( sepia_element_all_of_tags.getTags().size() > 0 ) {
|
if (sepia_element_all_of_tags.getTags().size() > 0) {
|
||||||
sepiaSearchVideo.setTagsAllOf(sepia_element_all_of_tags.getTags());
|
sepiaSearchVideo.setTagsAllOf(sepia_element_all_of_tags.getTags());
|
||||||
}else{
|
} else {
|
||||||
sepiaSearchVideo.setTagsAllOf(null);
|
sepiaSearchVideo.setTagsAllOf(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag("SEPIA_SEARCH");
|
Fragment fragment = getSupportFragmentManager().findFragmentByTag("SEPIA_SEARCH");
|
||||||
if(fragment != null)
|
if (fragment != null)
|
||||||
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
||||||
filter_elements.setVisibility(View.GONE);
|
filter_elements.setVisibility(View.GONE);
|
||||||
sepiaSearchVideo.setSearch(searchBar.getText());
|
sepiaSearchVideo.setSearch(searchBar.getText());
|
||||||
@ -331,7 +329,7 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
|||||||
bundle.putParcelable("sepiaSearchVideo", sepiaSearchVideo);
|
bundle.putParcelable("sepiaSearchVideo", sepiaSearchVideo);
|
||||||
displaySepiaSearchFragment.setArguments(bundle);
|
displaySepiaSearchFragment.setArguments(bundle);
|
||||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
ft.add(R.id.container, displaySepiaSearchFragment,"SEPIA_SEARCH").commit();
|
ft.add(R.id.container, displaySepiaSearchFragment, "SEPIA_SEARCH").commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -354,7 +352,7 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
|||||||
languages.add(pair.getKey());
|
languages.add(pair.getKey());
|
||||||
sepiaSearchVideo.setBoostLanguages(languages);
|
sepiaSearchVideo.setBoostLanguages(languages);
|
||||||
break;
|
break;
|
||||||
}else {
|
} else {
|
||||||
sepiaSearchVideo.setBoostLanguages(null);
|
sepiaSearchVideo.setBoostLanguages(null);
|
||||||
}
|
}
|
||||||
it.remove();
|
it.remove();
|
||||||
@ -368,12 +366,12 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<Integer, String> pair = it.next();
|
Map.Entry<Integer, String> pair = it.next();
|
||||||
if (i == position && position > 0 ) {
|
if (i == position && position > 0) {
|
||||||
List<Integer> categories = new ArrayList<>();
|
List<Integer> categories = new ArrayList<>();
|
||||||
categories.add(pair.getKey());
|
categories.add(pair.getKey());
|
||||||
sepiaSearchVideo.setCategoryOneOf(categories);
|
sepiaSearchVideo.setCategoryOneOf(categories);
|
||||||
break;
|
break;
|
||||||
}else {
|
} else {
|
||||||
sepiaSearchVideo.setCategoryOneOf(null);
|
sepiaSearchVideo.setCategoryOneOf(null);
|
||||||
}
|
}
|
||||||
it.remove();
|
it.remove();
|
||||||
@ -392,7 +390,7 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
|||||||
licenses.add(pair.getKey());
|
licenses.add(pair.getKey());
|
||||||
sepiaSearchVideo.setLicenceOneOf(licenses);
|
sepiaSearchVideo.setLicenceOneOf(licenses);
|
||||||
break;
|
break;
|
||||||
}else {
|
} else {
|
||||||
sepiaSearchVideo.setLicenceOneOf(null);
|
sepiaSearchVideo.setLicenceOneOf(null);
|
||||||
}
|
}
|
||||||
it.remove();
|
it.remove();
|
||||||
|
@ -42,11 +42,9 @@ import com.google.android.material.tabs.TabLayout;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData;
|
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
|
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
@ -120,7 +120,7 @@ public class ShowChannelActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
ChannelsVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(ChannelsVM.class);
|
ChannelsVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(ChannelsVM.class);
|
||||||
viewModel.get(sepiaSearch?peertubeInstance:null, CHANNEL, channelAcct == null ? channel.getAcct() : channelAcct).observe(ShowChannelActivity.this, this::manageViewAccounts);
|
viewModel.get(sepiaSearch ? peertubeInstance : null, CHANNEL, channelAcct == null ? channel.getAcct() : channelAcct).observe(ShowChannelActivity.this, this::manageViewAccounts);
|
||||||
manageChannel();
|
manageChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ public class ShowChannelActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
manageNotes(channel);
|
manageNotes(channel);
|
||||||
Helper.loadGiF(ShowChannelActivity.this, sepiaSearch?peertubeInstance:null, channel.getAvatar() != null ? channel.getAvatar().getPath() : null, account_pp);
|
Helper.loadGiF(ShowChannelActivity.this, sepiaSearch ? peertubeInstance : null, channel.getAvatar() != null ? channel.getAvatar().getPath() : null, account_pp);
|
||||||
//Follow button
|
//Follow button
|
||||||
String target = channel.getAcct();
|
String target = channel.getAcct();
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ package app.fedilab.fedilabtube.client;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData;
|
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||||
import app.fedilab.fedilabtube.client.data.BlockData;
|
import app.fedilab.fedilabtube.client.data.BlockData;
|
||||||
import app.fedilab.fedilabtube.client.data.CaptionData;
|
import app.fedilab.fedilabtube.client.data.CaptionData;
|
||||||
|
@ -85,9 +85,9 @@ public class RetrofitPeertubeAPI {
|
|||||||
private final String finalUrl;
|
private final String finalUrl;
|
||||||
private final Context _context;
|
private final Context _context;
|
||||||
private final String instance;
|
private final String instance;
|
||||||
|
private final String count;
|
||||||
private String token;
|
private String token;
|
||||||
private Set<String> selection;
|
private Set<String> selection;
|
||||||
private final String count;
|
|
||||||
|
|
||||||
public RetrofitPeertubeAPI(Context context) {
|
public RetrofitPeertubeAPI(Context context) {
|
||||||
_context = context;
|
_context = context;
|
||||||
@ -565,7 +565,7 @@ public class RetrofitPeertubeAPI {
|
|||||||
lang = lang.split("-")[0] + "-" + lang.split("-")[1].toUpperCase();
|
lang = lang.split("-")[0] + "-" + lang.split("-")[1].toUpperCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( lang == null || lang.trim().length() == 0) {
|
if (lang == null || lang.trim().length() == 0) {
|
||||||
lang = "en";
|
lang = "en";
|
||||||
}
|
}
|
||||||
Call<Map<String, String>> translations = initTranslation().getTranslations(lang);
|
Call<Map<String, String>> translations = initTranslation().getTranslations(lang);
|
||||||
|
@ -21,7 +21,6 @@ import java.util.Locale;
|
|||||||
|
|
||||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||||
import app.fedilab.fedilabtube.client.entities.SepiaSearch;
|
import app.fedilab.fedilabtube.client.entities.SepiaSearch;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
@ -30,7 +29,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
|||||||
public class RetrofitSepiaSearchAPI {
|
public class RetrofitSepiaSearchAPI {
|
||||||
|
|
||||||
|
|
||||||
private String finalUrl;
|
private final String finalUrl;
|
||||||
|
|
||||||
|
|
||||||
public RetrofitSepiaSearchAPI() {
|
public RetrofitSepiaSearchAPI() {
|
||||||
@ -47,6 +46,7 @@ public class RetrofitSepiaSearchAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return videos for a sepia search
|
* Return videos for a sepia search
|
||||||
|
*
|
||||||
* @param sepiaSearch SepiaSearch
|
* @param sepiaSearch SepiaSearch
|
||||||
* @return VideoData
|
* @return VideoData
|
||||||
*/
|
*/
|
||||||
@ -54,7 +54,7 @@ public class RetrofitSepiaSearchAPI {
|
|||||||
SepiaSearchService sepiaSearchService = init();
|
SepiaSearchService sepiaSearchService = init();
|
||||||
SimpleDateFormat fmtOut = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH);
|
SimpleDateFormat fmtOut = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH);
|
||||||
String startDate = null;
|
String startDate = null;
|
||||||
if(sepiaSearch.getStartDate() != null) {
|
if (sepiaSearch.getStartDate() != null) {
|
||||||
startDate = fmtOut.format(sepiaSearch.getStartDate());
|
startDate = fmtOut.format(sepiaSearch.getStartDate());
|
||||||
}
|
}
|
||||||
Call<VideoData> videoDataCall = sepiaSearchService.getVideos(
|
Call<VideoData> videoDataCall = sepiaSearchService.getVideos(
|
||||||
|
@ -14,7 +14,6 @@ package app.fedilab.fedilabtube.client;
|
|||||||
* 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 java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.client.data.ChannelData;
|
import app.fedilab.fedilabtube.client.data.ChannelData;
|
||||||
|
@ -206,7 +206,7 @@ public class CommentData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CommentPosted{
|
public static class CommentPosted {
|
||||||
@SerializedName("comment")
|
@SerializedName("comment")
|
||||||
private Comment comment;
|
private Comment comment;
|
||||||
|
|
||||||
|
@ -26,6 +26,17 @@ import java.util.List;
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class SepiaSearch implements Parcelable {
|
public class SepiaSearch implements Parcelable {
|
||||||
|
|
||||||
|
public static final Creator<SepiaSearch> CREATOR = new Creator<SepiaSearch>() {
|
||||||
|
@Override
|
||||||
|
public SepiaSearch createFromParcel(Parcel source) {
|
||||||
|
return new SepiaSearch(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SepiaSearch[] newArray(int size) {
|
||||||
|
return new SepiaSearch[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
@SerializedName("start")
|
@SerializedName("start")
|
||||||
private String start;
|
private String start;
|
||||||
@SerializedName("count")
|
@SerializedName("count")
|
||||||
@ -53,7 +64,27 @@ public class SepiaSearch implements Parcelable {
|
|||||||
@SerializedName("sort")
|
@SerializedName("sort")
|
||||||
private String sort;
|
private String sort;
|
||||||
|
|
||||||
|
public SepiaSearch() {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SepiaSearch(Parcel in) {
|
||||||
|
this.start = in.readString();
|
||||||
|
this.count = in.readString();
|
||||||
|
this.search = in.readString();
|
||||||
|
this.durationMax = in.readInt();
|
||||||
|
this.durationMin = in.readInt();
|
||||||
|
long tmpStartDate = in.readLong();
|
||||||
|
this.startDate = tmpStartDate == -1 ? null : new Date(tmpStartDate);
|
||||||
|
this.boostLanguages = in.createStringArrayList();
|
||||||
|
this.categoryOneOf = new ArrayList<>();
|
||||||
|
in.readList(this.categoryOneOf, Integer.class.getClassLoader());
|
||||||
|
this.licenceOneOf = new ArrayList<>();
|
||||||
|
in.readList(this.licenceOneOf, Integer.class.getClassLoader());
|
||||||
|
this.tagsOneOf = in.createStringArrayList();
|
||||||
|
this.tagsAllOf = in.createStringArrayList();
|
||||||
|
this.nsfw = in.readByte() != 0;
|
||||||
|
this.sort = in.readString();
|
||||||
|
}
|
||||||
|
|
||||||
public String getStart() {
|
public String getStart() {
|
||||||
return start;
|
return start;
|
||||||
@ -180,38 +211,4 @@ public class SepiaSearch implements Parcelable {
|
|||||||
dest.writeByte(this.nsfw ? (byte) 1 : (byte) 0);
|
dest.writeByte(this.nsfw ? (byte) 1 : (byte) 0);
|
||||||
dest.writeString(this.sort);
|
dest.writeString(this.sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SepiaSearch() {
|
|
||||||
}
|
|
||||||
|
|
||||||
protected SepiaSearch(Parcel in) {
|
|
||||||
this.start = in.readString();
|
|
||||||
this.count = in.readString();
|
|
||||||
this.search = in.readString();
|
|
||||||
this.durationMax = in.readInt();
|
|
||||||
this.durationMin = in.readInt();
|
|
||||||
long tmpStartDate = in.readLong();
|
|
||||||
this.startDate = tmpStartDate == -1 ? null : new Date(tmpStartDate);
|
|
||||||
this.boostLanguages = in.createStringArrayList();
|
|
||||||
this.categoryOneOf = new ArrayList<>();
|
|
||||||
in.readList(this.categoryOneOf, Integer.class.getClassLoader());
|
|
||||||
this.licenceOneOf = new ArrayList<>();
|
|
||||||
in.readList(this.licenceOneOf, Integer.class.getClassLoader());
|
|
||||||
this.tagsOneOf = in.createStringArrayList();
|
|
||||||
this.tagsAllOf = in.createStringArrayList();
|
|
||||||
this.nsfw = in.readByte() != 0;
|
|
||||||
this.sort = in.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<SepiaSearch> CREATOR = new Creator<SepiaSearch>() {
|
|
||||||
@Override
|
|
||||||
public SepiaSearch createFromParcel(Parcel source) {
|
|
||||||
return new SepiaSearch(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SepiaSearch[] newArray(int size) {
|
|
||||||
return new SepiaSearch[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class VideoAbuse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Abuse{
|
public static class Abuse {
|
||||||
@SerializedName("comment")
|
@SerializedName("comment")
|
||||||
private CommentData.Comment comment;
|
private CommentData.Comment comment;
|
||||||
@SerializedName("threadId")
|
@SerializedName("threadId")
|
||||||
|
@ -37,8 +37,8 @@ import app.fedilab.fedilabtube.helper.Helper;
|
|||||||
|
|
||||||
public class AccountsHorizontalListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class AccountsHorizontalListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
private final List<ChannelData.Channel> channels;
|
||||||
EventListener listener;
|
EventListener listener;
|
||||||
private List<ChannelData.Channel> channels;
|
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
public AccountsHorizontalListAdapter(List<ChannelData.Channel> channels, EventListener listener) {
|
public AccountsHorizontalListAdapter(List<ChannelData.Channel> channels, EventListener listener) {
|
||||||
@ -109,11 +109,7 @@ public class AccountsHorizontalListAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
ChannelData.Channel channel = channels.get(getAdapterPosition());
|
ChannelData.Channel channel = channels.get(getAdapterPosition());
|
||||||
listener.click(channel.getAcct());
|
listener.click(channel.getAcct());
|
||||||
for (ChannelData.Channel acc : channels) {
|
for (ChannelData.Channel acc : channels) {
|
||||||
if (acc.getId().compareTo(channel.getId()) == 0) {
|
acc.setSelected(acc.getId().compareTo(channel.getId()) == 0);
|
||||||
acc.setSelected(true);
|
|
||||||
} else {
|
|
||||||
acc.setSelected(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
notifyItemRangeChanged(0, channels.size());
|
notifyItemRangeChanged(0, channels.size());
|
||||||
}
|
}
|
||||||
|
@ -47,11 +47,11 @@ import es.dmoral.toasty.Toasty;
|
|||||||
|
|
||||||
public class AccountsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class AccountsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
public AllAccountsRemoved allAccountsRemoved;
|
|
||||||
private final List<Account> accounts;
|
private final List<Account> accounts;
|
||||||
private Context context;
|
|
||||||
private final AccountsListAdapter accountsListAdapter;
|
private final AccountsListAdapter accountsListAdapter;
|
||||||
private final RetrofitPeertubeAPI.DataType type;
|
private final RetrofitPeertubeAPI.DataType type;
|
||||||
|
public AllAccountsRemoved allAccountsRemoved;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
public AccountsListAdapter(RetrofitPeertubeAPI.DataType type, List<Account> accounts) {
|
public AccountsListAdapter(RetrofitPeertubeAPI.DataType type, List<Account> accounts) {
|
||||||
this.accounts = accounts;
|
this.accounts = accounts;
|
||||||
|
@ -44,11 +44,11 @@ import app.fedilab.fedilabtube.helper.Helper;
|
|||||||
|
|
||||||
public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
private final List<Channel> channels;
|
||||||
|
private final boolean myChannel;
|
||||||
public AllChannelRemoved allChannelRemoved;
|
public AllChannelRemoved allChannelRemoved;
|
||||||
public EditAlertDialog editAlertDialog;
|
public EditAlertDialog editAlertDialog;
|
||||||
private final List<Channel> channels;
|
|
||||||
private Context context;
|
private Context context;
|
||||||
private final boolean myChannel;
|
|
||||||
|
|
||||||
|
|
||||||
public ChannelListAdapter(List<Channel> channels, boolean myChannel) {
|
public ChannelListAdapter(List<Channel> channels, boolean myChannel) {
|
||||||
@ -77,7 +77,7 @@ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
//Profile picture
|
//Profile picture
|
||||||
Helper.loadGiF(context, channel.getAvatar() != null ? channel.getAvatar().getPath() : null, holder.account_pp);
|
Helper.loadGiF(context, channel.getAvatar() != null ? channel.getAvatar().getPath() : null, holder.account_pp);
|
||||||
|
|
||||||
if( !this.myChannel) {
|
if (!this.myChannel) {
|
||||||
holder.more_actions.setVisibility(View.GONE);
|
holder.more_actions.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
holder.more_actions.setOnClickListener(view -> {
|
holder.more_actions.setOnClickListener(view -> {
|
||||||
|
@ -55,7 +55,6 @@ import java.util.regex.Pattern;
|
|||||||
import app.fedilab.fedilabtube.PeertubeActivity;
|
import app.fedilab.fedilabtube.PeertubeActivity;
|
||||||
import app.fedilab.fedilabtube.R;
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.ShowAccountActivity;
|
import app.fedilab.fedilabtube.ShowAccountActivity;
|
||||||
import app.fedilab.fedilabtube.ShowChannelActivity;
|
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.CommentData.Comment;
|
import app.fedilab.fedilabtube.client.data.CommentData.Comment;
|
||||||
@ -74,11 +73,11 @@ import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
|||||||
public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
|
||||||
public AllCommentRemoved allCommentRemoved;
|
|
||||||
private Context context;
|
|
||||||
private final List<Comment> comments;
|
private final List<Comment> comments;
|
||||||
private final CommentListAdapter commentListAdapter;
|
private final CommentListAdapter commentListAdapter;
|
||||||
|
public AllCommentRemoved allCommentRemoved;
|
||||||
boolean isVideoOwner;
|
boolean isVideoOwner;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
public CommentListAdapter(List<Comment> comments, boolean isVideoOwner) {
|
public CommentListAdapter(List<Comment> comments, boolean isVideoOwner) {
|
||||||
this.comments = comments;
|
this.comments = comments;
|
||||||
@ -127,15 +126,15 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
.inflate(R.menu.comment_menu, popup.getMenu());
|
.inflate(R.menu.comment_menu, popup.getMenu());
|
||||||
if (!Helper.isOwner(context, comment.getAccount())) {
|
if (!Helper.isOwner(context, comment.getAccount())) {
|
||||||
popup.getMenu().findItem(R.id.action_delete).setVisible(false);
|
popup.getMenu().findItem(R.id.action_delete).setVisible(false);
|
||||||
}else {
|
} else {
|
||||||
popup.getMenu().findItem(R.id.action_mute).setVisible(false);
|
popup.getMenu().findItem(R.id.action_mute).setVisible(false);
|
||||||
popup.getMenu().findItem(R.id.action_remove_comments).setVisible(false);
|
popup.getMenu().findItem(R.id.action_remove_comments).setVisible(false);
|
||||||
popup.getMenu().findItem(R.id.action_report).setVisible(false);
|
popup.getMenu().findItem(R.id.action_report).setVisible(false);
|
||||||
}
|
}
|
||||||
if( !isVideoOwner) {
|
if (!isVideoOwner) {
|
||||||
popup.getMenu().findItem(R.id.action_remove_comments).setVisible(false);
|
popup.getMenu().findItem(R.id.action_remove_comments).setVisible(false);
|
||||||
}
|
}
|
||||||
if( !Helper.isLoggedIn(context)) {
|
if (!Helper.isLoggedIn(context)) {
|
||||||
popup.getMenu().findItem(R.id.action_mute).setVisible(false);
|
popup.getMenu().findItem(R.id.action_mute).setVisible(false);
|
||||||
popup.getMenu().findItem(R.id.action_remove_comments).setVisible(false);
|
popup.getMenu().findItem(R.id.action_remove_comments).setVisible(false);
|
||||||
popup.getMenu().findItem(R.id.action_delete).setVisible(false);
|
popup.getMenu().findItem(R.id.action_delete).setVisible(false);
|
||||||
@ -225,11 +224,11 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
|
|
||||||
holder.comment_account_displayname.setText(comment.getAccount().getDisplayName());
|
holder.comment_account_displayname.setText(comment.getAccount().getDisplayName());
|
||||||
|
|
||||||
if( context instanceof PeertubeActivity && !comment.isReply()) {
|
if (context instanceof PeertubeActivity && !comment.isReply()) {
|
||||||
holder.main_container.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment, i));
|
holder.main_container.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment, i));
|
||||||
holder.comment_content.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment, i));
|
holder.comment_content.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment, i));
|
||||||
}
|
}
|
||||||
if( comment.getTotalReplies() > 0) {
|
if (comment.getTotalReplies() > 0) {
|
||||||
holder.number_of_replies.setVisibility(View.VISIBLE);
|
holder.number_of_replies.setVisibility(View.VISIBLE);
|
||||||
holder.number_of_replies.setText(context.getResources().getQuantityString(R.plurals.number_of_replies, comment.getTotalReplies(), comment.getTotalReplies()));
|
holder.number_of_replies.setText(context.getResources().getQuantityString(R.plurals.number_of_replies, comment.getTotalReplies(), comment.getTotalReplies()));
|
||||||
} else {
|
} else {
|
||||||
@ -257,7 +256,7 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
|
|
||||||
Helper.loadGiF(context, comment.getAccount().getAvatar() != null ? comment.getAccount().getAvatar().getPath() : null, holder.comment_account_profile);
|
Helper.loadGiF(context, comment.getAccount().getAvatar() != null ? comment.getAccount().getAvatar().getPath() : null, holder.comment_account_profile);
|
||||||
|
|
||||||
holder.comment_account_profile.setOnClickListener(v->{
|
holder.comment_account_profile.setOnClickListener(v -> {
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
Intent intent = new Intent(context, ShowAccountActivity.class);
|
Intent intent = new Intent(context, ShowAccountActivity.class);
|
||||||
b.putParcelable("account", comment.getAccount());
|
b.putParcelable("account", comment.getAccount());
|
||||||
@ -265,21 +264,21 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
intent.putExtras(b);
|
intent.putExtras(b);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
});
|
});
|
||||||
if(comment.isReply()) {
|
if (comment.isReply()) {
|
||||||
holder.replyButton.setVisibility(View.VISIBLE);
|
holder.replyButton.setVisibility(View.VISIBLE);
|
||||||
}else{
|
} else {
|
||||||
holder.replyButton.setVisibility(View.GONE);
|
holder.replyButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
if( comment.isReply() && comment.isReplyViewOpen()) {
|
if (comment.isReply() && comment.isReplyViewOpen()) {
|
||||||
holder.write_comment_container_reply.setVisibility(View.VISIBLE);
|
holder.write_comment_container_reply.setVisibility(View.VISIBLE);
|
||||||
}else{
|
} else {
|
||||||
holder.write_comment_container_reply.setVisibility(View.GONE);
|
holder.write_comment_container_reply.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
if( holder.add_comment_write_reply.getText() == null || holder.add_comment_write_reply.getText().toString().trim().length() == 0) {
|
if (holder.add_comment_write_reply.getText() == null || holder.add_comment_write_reply.getText().toString().trim().length() == 0) {
|
||||||
holder.add_comment_write_reply.setText(String.format("@%s ", comment.getAccount().getAcct()));
|
holder.add_comment_write_reply.setText(String.format("@%s ", comment.getAccount().getAcct()));
|
||||||
holder.add_comment_write_reply.setSelection(holder.add_comment_write_reply.getText().length());
|
holder.add_comment_write_reply.setSelection(holder.add_comment_write_reply.getText().length());
|
||||||
}
|
}
|
||||||
holder.replyButton.setOnClickListener(v->{
|
holder.replyButton.setOnClickListener(v -> {
|
||||||
comment.setReplyViewOpen(!comment.isReplyViewOpen());
|
comment.setReplyViewOpen(!comment.isReplyViewOpen());
|
||||||
notifyItemChanged(i);
|
notifyItemChanged(i);
|
||||||
});
|
});
|
||||||
@ -290,7 +289,7 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
String commentView = holder.add_comment_write_reply.getText().toString();
|
String commentView = holder.add_comment_write_reply.getText().toString();
|
||||||
if (commentView.trim().length() > 0) {
|
if (commentView.trim().length() > 0) {
|
||||||
PostActionsVM viewModelComment = new ViewModelProvider((ViewModelStoreOwner) context).get(PostActionsVM.class);
|
PostActionsVM viewModelComment = new ViewModelProvider((ViewModelStoreOwner) context).get(PostActionsVM.class);
|
||||||
viewModelComment.comment(REPLY, comment.getVideoId(), comment.getId(), commentView).observe((LifecycleOwner) context, apiResponse1 -> manageVIewPostActions(REPLY, (int)holder.main_container.getTag(), apiResponse1));
|
viewModelComment.comment(REPLY, comment.getVideoId(), comment.getId(), commentView).observe((LifecycleOwner) context, apiResponse1 -> manageVIewPostActions(REPLY, (int) holder.main_container.getTag(), apiResponse1));
|
||||||
holder.add_comment_write_reply.setText("");
|
holder.add_comment_write_reply.setText("");
|
||||||
comment.setReplyViewOpen(false);
|
comment.setReplyViewOpen(false);
|
||||||
notifyItemChanged(i);
|
notifyItemChanged(i);
|
||||||
@ -316,13 +315,13 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
position++;
|
position++;
|
||||||
}
|
}
|
||||||
} else if (statusAction == REPLY) {
|
} else if (statusAction == REPLY) {
|
||||||
if( apiResponse.getComments() != null && apiResponse.getComments().size() > 0 ) {
|
if (apiResponse.getComments() != null && apiResponse.getComments().size() > 0) {
|
||||||
comments.add(i+1, apiResponse.getComments().get(0));
|
comments.add(i + 1, apiResponse.getComments().get(0));
|
||||||
notifyItemInserted(i+1);
|
notifyItemInserted(i + 1);
|
||||||
}
|
}
|
||||||
}else if (statusAction == RetrofitPeertubeAPI.ActionType.REPORT_COMMENT) {
|
} else if (statusAction == RetrofitPeertubeAPI.ActionType.REPORT_COMMENT) {
|
||||||
Toasty.success(context, context.getString(R.string.successful_report_comment), Toasty.LENGTH_LONG).show();
|
Toasty.success(context, context.getString(R.string.successful_report_comment), Toasty.LENGTH_LONG).show();
|
||||||
}else if (statusAction == MUTE) {
|
} else if (statusAction == MUTE) {
|
||||||
Toasty.info(context, context.getString(R.string.muted_done), Toast.LENGTH_LONG).show();
|
Toasty.info(context, context.getString(R.string.muted_done), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ import static app.fedilab.fedilabtube.MainActivity.peertubeInformation;
|
|||||||
|
|
||||||
public class InstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class InstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
private List<Instance> instances;
|
private final List<Instance> instances;
|
||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ import app.fedilab.fedilabtube.helper.Helper;
|
|||||||
|
|
||||||
public class OwnAccountsAdapter extends ArrayAdapter<Account> {
|
public class OwnAccountsAdapter extends ArrayAdapter<Account> {
|
||||||
|
|
||||||
private List<Account> accounts;
|
private final List<Account> accounts;
|
||||||
private LayoutInflater layoutInflater;
|
private final LayoutInflater layoutInflater;
|
||||||
|
|
||||||
public OwnAccountsAdapter(Context context, List<Account> accounts) {
|
public OwnAccountsAdapter(Context context, List<Account> accounts) {
|
||||||
super(context, android.R.layout.simple_list_item_1, accounts);
|
super(context, android.R.layout.simple_list_item_1, accounts);
|
||||||
|
@ -63,9 +63,9 @@ import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.SEPIA_SE
|
|||||||
|
|
||||||
public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
private final List<VideoData.Video> videos;
|
||||||
public RelationShipListener relationShipListener;
|
public RelationShipListener relationShipListener;
|
||||||
public PlaylistListener playlistListener;
|
public PlaylistListener playlistListener;
|
||||||
private List<VideoData.Video> videos;
|
|
||||||
private Context context;
|
private Context context;
|
||||||
private TimelineVM.TimelineType timelineType;
|
private TimelineVM.TimelineType timelineType;
|
||||||
private boolean sepiaSearch;
|
private boolean sepiaSearch;
|
||||||
@ -78,7 +78,6 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public PeertubeAdapter(List<VideoData.Video> videos) {
|
public PeertubeAdapter(List<VideoData.Video> videos) {
|
||||||
this.videos = videos;
|
this.videos = videos;
|
||||||
}
|
}
|
||||||
@ -98,7 +97,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
final PeertubeAdapter.ViewHolder holder = (PeertubeAdapter.ViewHolder) viewHolder;
|
final PeertubeAdapter.ViewHolder holder = (PeertubeAdapter.ViewHolder) viewHolder;
|
||||||
final VideoData.Video video = videos.get(position);
|
final VideoData.Video video = videos.get(position);
|
||||||
|
|
||||||
if( video == null) {
|
if (video == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
@ -115,7 +114,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
}
|
}
|
||||||
|
|
||||||
String instance = null;
|
String instance = null;
|
||||||
if( sepiaSearch) {
|
if (sepiaSearch) {
|
||||||
instance = video.getAccount().getHost();
|
instance = video.getAccount().getHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +150,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
b.putParcelable("channel", video.getChannel());
|
b.putParcelable("channel", video.getChannel());
|
||||||
b.putBoolean("sepia_search", sepiaSearch);
|
b.putBoolean("sepia_search", sepiaSearch);
|
||||||
if( sepiaSearch) {
|
if (sepiaSearch) {
|
||||||
b.putString("peertube_instance", video.getAccount().getHost());
|
b.putString("peertube_instance", video.getAccount().getHost());
|
||||||
}
|
}
|
||||||
intent.putExtras(b);
|
intent.putExtras(b);
|
||||||
@ -180,15 +179,10 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (playlistListener == null || playlistListener.getPlaylist() == null || playlistListener.getPlaylist().size() == 0) {
|
popup.getMenu().findItem(R.id.action_playlist).setVisible(playlistListener != null && playlistListener.getPlaylist() != null && playlistListener.getPlaylist().size() != 0);
|
||||||
popup.getMenu().findItem(R.id.action_playlist).setVisible(false);
|
|
||||||
} else {
|
|
||||||
popup.getMenu().findItem(R.id.action_playlist).setVisible(true);
|
|
||||||
}
|
|
||||||
popup.setOnMenuItemClickListener(item -> {
|
popup.setOnMenuItemClickListener(item -> {
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
|
if (itemId == R.id.action_follow) {
|
||||||
case R.id.action_follow:
|
|
||||||
if (relationShipListener.getRelationShip().containsKey(video.getChannel().getAcct()) && relationShipListener.getRelationShip().get(video.getChannel().getAcct())) {
|
if (relationShipListener.getRelationShip().containsKey(video.getChannel().getAcct()) && relationShipListener.getRelationShip().get(video.getChannel().getAcct())) {
|
||||||
relationShipListener.getRelationShip().put(video.getChannel().getAcct(), false);
|
relationShipListener.getRelationShip().put(video.getChannel().getAcct(), false);
|
||||||
popup.getMenu().findItem(R.id.action_follow).setTitle(context.getString(R.string.action_follow));
|
popup.getMenu().findItem(R.id.action_follow).setTitle(context.getString(R.string.action_follow));
|
||||||
@ -214,20 +208,17 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
PostActionsVM viewModel = new ViewModelProvider((ViewModelStoreOwner) context).get(PostActionsVM.class);
|
PostActionsVM viewModel = new ViewModelProvider((ViewModelStoreOwner) context).get(PostActionsVM.class);
|
||||||
viewModel.post(FOLLOW, video.getChannel().getAcct(), null).observe((LifecycleOwner) context, apiResponse -> manageVIewPostActions(FOLLOW, apiResponse));
|
viewModel.post(FOLLOW, video.getChannel().getAcct(), null).observe((LifecycleOwner) context, apiResponse -> manageVIewPostActions(FOLLOW, apiResponse));
|
||||||
}
|
}
|
||||||
break;
|
} else if (itemId == R.id.action_playlist) {
|
||||||
case R.id.action_playlist:
|
|
||||||
PlaylistsVM viewModelOwnerPlaylist = new ViewModelProvider((ViewModelStoreOwner) context).get(PlaylistsVM.class);
|
PlaylistsVM viewModelOwnerPlaylist = new ViewModelProvider((ViewModelStoreOwner) context).get(PlaylistsVM.class);
|
||||||
viewModelOwnerPlaylist.manage(PlaylistsVM.action.GET_PLAYLISTS, null, null).observe((LifecycleOwner) context, apiResponse -> manageVIewPlaylists(video, apiResponse));
|
viewModelOwnerPlaylist.manage(PlaylistsVM.action.GET_PLAYLISTS, null, null).observe((LifecycleOwner) context, apiResponse -> manageVIewPlaylists(video, apiResponse));
|
||||||
break;
|
} else if (itemId == R.id.action_edit) {
|
||||||
case R.id.action_edit:
|
|
||||||
Intent intent = new Intent(context, PeertubeEditUploadActivity.class);
|
Intent intent = new Intent(context, PeertubeEditUploadActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
b.putString("video_id", video.getUuid());
|
b.putString("video_id", video.getUuid());
|
||||||
intent.putExtras(b);
|
intent.putExtras(b);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
break;
|
} else if (itemId == R.id.action_report) {
|
||||||
case R.id.action_report:
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
|
||||||
androidx.appcompat.app.AlertDialog.Builder dialogBuilder = new androidx.appcompat.app.AlertDialog.Builder(context);
|
|
||||||
LayoutInflater inflater1 = ((Activity) context).getLayoutInflater();
|
LayoutInflater inflater1 = ((Activity) context).getLayoutInflater();
|
||||||
View dialogView = inflater1.inflate(R.layout.popup_report, new LinearLayout(context), false);
|
View dialogView = inflater1.inflate(R.layout.popup_report, new LinearLayout(context), false);
|
||||||
dialogBuilder.setView(dialogView);
|
dialogBuilder.setView(dialogView);
|
||||||
@ -247,9 +238,8 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
dialog2.dismiss();
|
dialog2.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
androidx.appcompat.app.AlertDialog alertDialog2 = dialogBuilder.create();
|
AlertDialog alertDialog2 = dialogBuilder.create();
|
||||||
alertDialog2.show();
|
alertDialog2.show();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@ -263,7 +253,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
b.putBoolean("isMyVideo", ownVideos);
|
b.putBoolean("isMyVideo", ownVideos);
|
||||||
b.putBoolean("sepia_search", sepiaSearch);
|
b.putBoolean("sepia_search", sepiaSearch);
|
||||||
b.putParcelable("video", video);
|
b.putParcelable("video", video);
|
||||||
if( sepiaSearch) {
|
if (sepiaSearch) {
|
||||||
b.putString("peertube_instance", video.getAccount().getHost());
|
b.putString("peertube_instance", video.getAccount().getHost());
|
||||||
}
|
}
|
||||||
intent.putExtras(b);
|
intent.putExtras(b);
|
||||||
@ -277,7 +267,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
b.putString("video_uuid", video.getUuid());
|
b.putString("video_uuid", video.getUuid());
|
||||||
b.putBoolean("isMyVideo", ownVideos);
|
b.putBoolean("isMyVideo", ownVideos);
|
||||||
b.putBoolean("sepia_search", sepiaSearch);
|
b.putBoolean("sepia_search", sepiaSearch);
|
||||||
if( sepiaSearch) {
|
if (sepiaSearch) {
|
||||||
b.putString("peertube_instance", video.getAccount().getHost());
|
b.putString("peertube_instance", video.getAccount().getHost());
|
||||||
}
|
}
|
||||||
intent.putExtras(b);
|
intent.putExtras(b);
|
||||||
@ -296,7 +286,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
builder.setTitle(R.string.modify_playlists);
|
builder.setTitle(R.string.modify_playlists);
|
||||||
|
|
||||||
List<PlaylistData.Playlist> ownerPlaylists = apiResponse.getPlaylists();
|
List<PlaylistData.Playlist> ownerPlaylists = apiResponse.getPlaylists();
|
||||||
if( ownerPlaylists == null){
|
if (ownerPlaylists == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String[] label = new String[ownerPlaylists.size()];
|
String[] label = new String[ownerPlaylists.size()];
|
||||||
@ -385,7 +375,6 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
LinearLayout main_container, bottom_container;
|
LinearLayout main_container, bottom_container;
|
||||||
ImageView peertube_profile, peertube_video_image;
|
ImageView peertube_profile, peertube_video_image;
|
||||||
|
@ -45,8 +45,8 @@ import app.fedilab.fedilabtube.helper.Helper;
|
|||||||
|
|
||||||
public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
private Context context;
|
|
||||||
private final List<Notification> notifications;
|
private final List<Notification> notifications;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
public PeertubeNotificationsListAdapter(List<Notification> notifications) {
|
public PeertubeNotificationsListAdapter(List<Notification> notifications) {
|
||||||
this.notifications = notifications;
|
this.notifications = notifications;
|
||||||
@ -161,7 +161,7 @@ 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));
|
||||||
}else if (notification.getAbuse() != null){
|
} else if (notification.getAbuse() != null) {
|
||||||
if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_REPPORT_SUCCESS) {
|
if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_REPPORT_SUCCESS) {
|
||||||
message = context.getString(R.string.peertube_video_report_success, notification.getAbuse().getId());
|
message = context.getString(R.string.peertube_video_report_success, notification.getAbuse().getId());
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
|||||||
if (finalAccountAction != null) {
|
if (finalAccountAction != null) {
|
||||||
intent = new Intent(context, ShowAccountActivity.class);
|
intent = new Intent(context, ShowAccountActivity.class);
|
||||||
b.putParcelable("account", finalAccountAction);
|
b.putParcelable("account", finalAccountAction);
|
||||||
b.putString("accountAcct", finalAccountAction.getUsername()+"@"+finalAccountAction.getHost());
|
b.putString("accountAcct", finalAccountAction.getUsername() + "@" + finalAccountAction.getHost());
|
||||||
} else if (finalChannelAction != null) {
|
} else if (finalChannelAction != null) {
|
||||||
intent = new Intent(context, ShowChannelActivity.class);
|
intent = new Intent(context, ShowChannelActivity.class);
|
||||||
b.putParcelable("channel", finalChannelAction);
|
b.putParcelable("channel", finalChannelAction);
|
||||||
|
@ -46,10 +46,10 @@ import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
|||||||
|
|
||||||
public class PlaylistAdapter extends BaseAdapter {
|
public class PlaylistAdapter extends BaseAdapter {
|
||||||
|
|
||||||
private List<Playlist> playlists;
|
private final List<Playlist> playlists;
|
||||||
private LayoutInflater layoutInflater;
|
private final LayoutInflater layoutInflater;
|
||||||
private Context context;
|
private final Context context;
|
||||||
private RelativeLayout textviewNoAction;
|
private final RelativeLayout textviewNoAction;
|
||||||
|
|
||||||
public PlaylistAdapter(Context context, List<Playlist> lists, RelativeLayout textviewNoAction) {
|
public PlaylistAdapter(Context context, List<Playlist> lists, RelativeLayout textviewNoAction) {
|
||||||
this.playlists = lists;
|
this.playlists = lists;
|
||||||
@ -123,8 +123,8 @@ public class PlaylistAdapter extends BaseAdapter {
|
|||||||
popup.getMenuInflater()
|
popup.getMenuInflater()
|
||||||
.inflate(R.menu.playlist_menu, popup.getMenu());
|
.inflate(R.menu.playlist_menu, popup.getMenu());
|
||||||
popup.setOnMenuItemClickListener(item -> {
|
popup.setOnMenuItemClickListener(item -> {
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case R.id.action_delete:
|
if (itemId == R.id.action_delete) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setTitle(context.getString(R.string.action_lists_delete) + ": " + playlist.getDisplayName());
|
builder.setTitle(context.getString(R.string.action_lists_delete) + ": " + playlist.getDisplayName());
|
||||||
builder.setMessage(context.getString(R.string.action_lists_confirm_delete));
|
builder.setMessage(context.getString(R.string.action_lists_confirm_delete));
|
||||||
@ -141,12 +141,10 @@ public class PlaylistAdapter extends BaseAdapter {
|
|||||||
})
|
})
|
||||||
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
||||||
.show();
|
.show();
|
||||||
break;
|
} else if (itemId == R.id.action_edit) {
|
||||||
case R.id.action_edit:
|
|
||||||
if (context instanceof AllPlaylistsActivity) {
|
if (context instanceof AllPlaylistsActivity) {
|
||||||
((AllPlaylistsActivity) context).manageAlert(playlist);
|
((AllPlaylistsActivity) context).manageAlert(playlist);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -89,7 +89,7 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
|
|||||||
|
|
||||||
if (getActivity() != null) {
|
if (getActivity() != null) {
|
||||||
action_button = getActivity().findViewById(R.id.action_button);
|
action_button = getActivity().findViewById(R.id.action_button);
|
||||||
if( action_button != null) {
|
if (action_button != null) {
|
||||||
action_button.setVisibility(View.VISIBLE);
|
action_button.setVisibility(View.VISIBLE);
|
||||||
action_button.setOnClickListener(view -> manageAlert(null));
|
action_button.setOnClickListener(view -> manageAlert(null));
|
||||||
}
|
}
|
||||||
@ -272,14 +272,14 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
|
|||||||
}
|
}
|
||||||
channelListAdapter.notifyItemChanged(position);
|
channelListAdapter.notifyItemChanged(position);
|
||||||
}
|
}
|
||||||
if( action_button != null) {
|
if (action_button != null) {
|
||||||
action_button.setEnabled(true);
|
action_button.setEnabled(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mainHandler.post(myRunnable);
|
mainHandler.post(myRunnable);
|
||||||
}).start();
|
}).start();
|
||||||
alertDialog.dismiss();
|
alertDialog.dismiss();
|
||||||
if( action_button != null) {
|
if (action_button != null) {
|
||||||
action_button.setEnabled(false);
|
action_button.setEnabled(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -38,7 +38,6 @@ import app.fedilab.fedilabtube.R;
|
|||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.data.NotificationData.Notification;
|
import app.fedilab.fedilabtube.client.data.NotificationData.Notification;
|
||||||
import app.fedilab.fedilabtube.drawer.PeertubeNotificationsListAdapter;
|
import app.fedilab.fedilabtube.drawer.PeertubeNotificationsListAdapter;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
|
||||||
import app.fedilab.fedilabtube.viewmodel.NotificationsVM;
|
import app.fedilab.fedilabtube.viewmodel.NotificationsVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
@ -370,11 +370,45 @@ public class DisplayOverviewFragment extends Fragment implements PeertubeAdapter
|
|||||||
viewModelFeeds.getOverviewVideos(String.valueOf(page)).observe(DisplayOverviewFragment.this.requireActivity(), this::manageVIewVideos);
|
viewModelFeeds.getOverviewVideos(String.valueOf(page)).observe(DisplayOverviewFragment.this.requireActivity(), this::manageVIewVideos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void manageVIewPlaylist(APIResponse apiResponse) {
|
||||||
|
if (apiResponse.getError() != null || apiResponse.getVideoExistPlaylist() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (playlists == null) {
|
||||||
|
playlists = new HashMap<>();
|
||||||
|
}
|
||||||
|
playlists.putAll(apiResponse.getVideoExistPlaylist());
|
||||||
|
for (VideoData.Video video : peertubes) {
|
||||||
|
video.setPlaylistExists(playlists.get(video.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void manageVIewRelationship(APIResponse apiResponse) {
|
||||||
|
if (apiResponse.getError() != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (relationship == null) {
|
||||||
|
relationship = new HashMap<>();
|
||||||
|
}
|
||||||
|
relationship.putAll(apiResponse.getRelationships());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Boolean> getRelationShip() {
|
||||||
|
return relationship;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<PlaylistExist>> getPlaylist() {
|
||||||
|
return playlists;
|
||||||
|
}
|
||||||
|
|
||||||
static class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
|
static class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
|
||||||
|
|
||||||
private int spanCount;
|
private final int spanCount;
|
||||||
private int spacing;
|
private final int spacing;
|
||||||
private boolean includeEdge;
|
private final boolean includeEdge;
|
||||||
|
|
||||||
public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
|
public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
|
||||||
this.spanCount = spanCount;
|
this.spanCount = spanCount;
|
||||||
@ -405,40 +439,4 @@ public class DisplayOverviewFragment extends Fragment implements PeertubeAdapter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void manageVIewPlaylist(APIResponse apiResponse) {
|
|
||||||
if (apiResponse.getError() != null || apiResponse.getVideoExistPlaylist() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (playlists == null) {
|
|
||||||
playlists = new HashMap<>();
|
|
||||||
}
|
|
||||||
playlists.putAll(apiResponse.getVideoExistPlaylist());
|
|
||||||
for (VideoData.Video video : peertubes) {
|
|
||||||
video.setPlaylistExists(playlists.get(video.getId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void manageVIewRelationship(APIResponse apiResponse) {
|
|
||||||
if (apiResponse.getError() != null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (relationship == null) {
|
|
||||||
relationship = new HashMap<>();
|
|
||||||
}
|
|
||||||
relationship.putAll(apiResponse.getRelationships());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Boolean> getRelationShip() {
|
|
||||||
return relationship;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, List<PlaylistExist>> getPlaylist() {
|
|
||||||
return playlists;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,12 +69,11 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
|
|||||||
private View rootView;
|
private View rootView;
|
||||||
private RecyclerView lv_status;
|
private RecyclerView lv_status;
|
||||||
private SepiaSearchVM viewModelSearch;
|
private SepiaSearchVM viewModelSearch;
|
||||||
|
private SepiaSearch sepiaSearchVideo;
|
||||||
|
|
||||||
public DisplaySepiaSearchFragment() {
|
public DisplaySepiaSearchFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private SepiaSearch sepiaSearchVideo;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
rootView = inflater.inflate(R.layout.fragment_video, container, false);
|
rootView = inflater.inflate(R.layout.fragment_video, container, false);
|
||||||
@ -119,7 +118,6 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
|
|||||||
swipeRefreshLayout.setOnRefreshListener(this::pullToRefresh);
|
swipeRefreshLayout.setOnRefreshListener(this::pullToRefresh);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
if (mLayoutManager != null) {
|
if (mLayoutManager != null) {
|
||||||
@ -160,7 +158,6 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
@ -215,13 +212,13 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
|
|||||||
}
|
}
|
||||||
int previousPosition = this.peertubes.size();
|
int previousPosition = this.peertubes.size();
|
||||||
int videoPerPage = sharedpreferences.getInt(Helper.SET_VIDEOS_PER_PAGE, Helper.VIDEOS_PER_PAGE);
|
int videoPerPage = sharedpreferences.getInt(Helper.SET_VIDEOS_PER_PAGE, Helper.VIDEOS_PER_PAGE);
|
||||||
sepiaSearchVideo.setStart(String.valueOf(Integer.parseInt(sepiaSearchVideo.getStart())+ videoPerPage));
|
sepiaSearchVideo.setStart(String.valueOf(Integer.parseInt(sepiaSearchVideo.getStart()) + videoPerPage));
|
||||||
|
|
||||||
if(!BuildConfig.google_restriction) {
|
if (!BuildConfig.google_restriction) {
|
||||||
this.peertubes.addAll(videoData.data);
|
this.peertubes.addAll(videoData.data);
|
||||||
}else{
|
} else {
|
||||||
for(VideoData.Video video: videoData.data) {
|
for (VideoData.Video video : videoData.data) {
|
||||||
if ( video.getName() == null || !video.getName().toLowerCase().contains("youtube") || !video.getName().toLowerCase().contains("download")) {
|
if (video.getName() == null || !video.getName().toLowerCase().contains("youtube") || !video.getName().toLowerCase().contains("download")) {
|
||||||
this.peertubes.add(video);
|
this.peertubes.add(video);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,7 +234,7 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
|
|||||||
//remove handlers
|
//remove handlers
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
textviewNoAction.setVisibility(View.GONE);
|
textviewNoAction.setVisibility(View.GONE);
|
||||||
if (firstLoad && (videoData.data== null || videoData.data.size() == 0)) {
|
if (firstLoad && (videoData.data == null || videoData.data.size() == 0)) {
|
||||||
textviewNoActionText.setText(R.string.no_video_to_display);
|
textviewNoActionText.setText(R.string.no_video_to_display);
|
||||||
textviewNoAction.setVisibility(View.VISIBLE);
|
textviewNoAction.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
@ -291,12 +288,11 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
|
static class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
|
||||||
|
|
||||||
private int spanCount;
|
private final int spanCount;
|
||||||
private int spacing;
|
private final int spacing;
|
||||||
private boolean includeEdge;
|
private final boolean includeEdge;
|
||||||
|
|
||||||
public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
|
public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
|
||||||
this.spanCount = spanCount;
|
this.spanCount = spanCount;
|
||||||
|
@ -99,6 +99,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
private String playlistId;
|
private String playlistId;
|
||||||
private String remoteInstance;
|
private String remoteInstance;
|
||||||
private boolean sepiaSearch;
|
private boolean sepiaSearch;
|
||||||
|
|
||||||
public DisplayVideosFragment() {
|
public DisplayVideosFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +122,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
playlistId = bundle.getString("playlistId", null);
|
playlistId = bundle.getString("playlistId", null);
|
||||||
}
|
}
|
||||||
max_id = "0";
|
max_id = "0";
|
||||||
forAccount = type== TimelineVM.TimelineType.ACCOUNT_VIDEOS?channelId: null;
|
forAccount = type == TimelineVM.TimelineType.ACCOUNT_VIDEOS ? channelId : null;
|
||||||
lv_status = rootView.findViewById(R.id.lv_status);
|
lv_status = rootView.findViewById(R.id.lv_status);
|
||||||
RecyclerView lv_accounts = rootView.findViewById(R.id.lv_accounts);
|
RecyclerView lv_accounts = rootView.findViewById(R.id.lv_accounts);
|
||||||
Button display_all = rootView.findViewById(R.id.display_all);
|
Button display_all = rootView.findViewById(R.id.display_all);
|
||||||
@ -245,7 +246,6 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
@ -335,11 +335,11 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
apiResponse.getPeertubes().add(v.getVideo());
|
apiResponse.getPeertubes().add(v.getVideo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!BuildConfig.google_restriction) {
|
if (!BuildConfig.google_restriction) {
|
||||||
this.peertubes.addAll(apiResponse.getPeertubes());
|
this.peertubes.addAll(apiResponse.getPeertubes());
|
||||||
}else{
|
} else {
|
||||||
for(VideoData.Video video: apiResponse.getPeertubes()) {
|
for (VideoData.Video video : apiResponse.getPeertubes()) {
|
||||||
if ( video.getName() == null || !video.getName().toLowerCase().contains("youtube") || !video.getName().toLowerCase().contains("download")) {
|
if (video.getName() == null || !video.getName().toLowerCase().contains("youtube") || !video.getName().toLowerCase().contains("download")) {
|
||||||
this.peertubes.add(video);
|
this.peertubes.add(video);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -367,7 +367,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
if (Helper.isLoggedIn(context)) {
|
if (Helper.isLoggedIn(context)) {
|
||||||
List<String> uids = new ArrayList<>();
|
List<String> uids = new ArrayList<>();
|
||||||
for (VideoData.Video video : apiResponse.getPeertubes()) {
|
for (VideoData.Video video : apiResponse.getPeertubes()) {
|
||||||
if( video != null) {
|
if (video != null) {
|
||||||
uids.add(video.getChannel().getName() + "@" + video.getChannel().getHost());
|
uids.add(video.getChannel().getName() + "@" + video.getChannel().getHost());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -381,7 +381,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
|
|
||||||
List<String> videoIds = new ArrayList<>();
|
List<String> videoIds = new ArrayList<>();
|
||||||
for (VideoData.Video video : apiResponse.getPeertubes()) {
|
for (VideoData.Video video : apiResponse.getPeertubes()) {
|
||||||
if( video != null) {
|
if (video != null) {
|
||||||
videoIds.add(video.getId());
|
videoIds.add(video.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -405,7 +405,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
}
|
}
|
||||||
playlists.putAll(apiResponse.getVideoExistPlaylist());
|
playlists.putAll(apiResponse.getVideoExistPlaylist());
|
||||||
for (VideoData.Video video : peertubes) {
|
for (VideoData.Video video : peertubes) {
|
||||||
if( video != null) {
|
if (video != null) {
|
||||||
video.setPlaylistExists(playlists.get(video.getId()));
|
video.setPlaylistExists(playlists.get(video.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -451,10 +451,10 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
|
|
||||||
|
|
||||||
public void pullToRefresh(boolean reload) {
|
public void pullToRefresh(boolean reload) {
|
||||||
if( type == TimelineVM.TimelineType.SUBSCRIBTIONS && reload) {
|
if (type == TimelineVM.TimelineType.SUBSCRIBTIONS && reload) {
|
||||||
Fragment fragment = ((AppCompatActivity)context).getSupportFragmentManager().findFragmentByTag("2");
|
Fragment fragment = ((AppCompatActivity) context).getSupportFragmentManager().findFragmentByTag("2");
|
||||||
if(fragment != null) {
|
if (fragment != null) {
|
||||||
if( context instanceof MainActivity) {
|
if (context instanceof MainActivity) {
|
||||||
FragmentManager fm = ((MainActivity) context).getSupportFragmentManager();
|
FragmentManager fm = ((MainActivity) context).getSupportFragmentManager();
|
||||||
fm.beginTransaction().remove(fragment).commit();
|
fm.beginTransaction().remove(fragment).commit();
|
||||||
DisplayVideosFragment subscriptionFragment = new DisplayVideosFragment();
|
DisplayVideosFragment subscriptionFragment = new DisplayVideosFragment();
|
||||||
@ -467,7 +467,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
int size = peertubes.size();
|
int size = peertubes.size();
|
||||||
peertubes.clear();
|
peertubes.clear();
|
||||||
peertubes = new ArrayList<>();
|
peertubes = new ArrayList<>();
|
||||||
@ -498,7 +498,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
private void loadTimeline(String max_id) {
|
private void loadTimeline(String max_id) {
|
||||||
if (search_peertube == null) { //Not a Peertube search
|
if (search_peertube == null) { //Not a Peertube search
|
||||||
if (type == TimelineVM.TimelineType.CHANNEL_VIDEOS) {
|
if (type == TimelineVM.TimelineType.CHANNEL_VIDEOS) {
|
||||||
viewModelFeeds.getVideosInChannel(sepiaSearch?remoteInstance:null, channelId, max_id).observe(this.requireActivity(), this::manageVIewVideos);
|
viewModelFeeds.getVideosInChannel(sepiaSearch ? remoteInstance : null, channelId, max_id).observe(this.requireActivity(), this::manageVIewVideos);
|
||||||
} else if (type == TimelineVM.TimelineType.VIDEOS_IN_PLAYLIST) {
|
} else if (type == TimelineVM.TimelineType.VIDEOS_IN_PLAYLIST) {
|
||||||
viewModelFeeds.loadVideosInPlaylist(playlistId, max_id).observe(this.requireActivity(), this::manageVIewVideos);
|
viewModelFeeds.loadVideosInPlaylist(playlistId, max_id).observe(this.requireActivity(), this::manageVIewVideos);
|
||||||
} else {
|
} else {
|
||||||
|
@ -13,7 +13,9 @@ package app.fedilab.fedilabtube.helper;
|
|||||||
*
|
*
|
||||||
* 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.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
@ -31,6 +33,7 @@ public class EmojiHelper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts emojis in input to unicode
|
* Converts emojis in input to unicode
|
||||||
|
*
|
||||||
* @param input String
|
* @param input String
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
@ -51,27 +54,27 @@ public class EmojiHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void fillMapEmoji(Context context) {
|
public static void fillMapEmoji(Context context) {
|
||||||
try {
|
try {
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(context.getAssets().open("emoji.csv")));
|
BufferedReader br = new BufferedReader(new InputStreamReader(context.getAssets().open("emoji.csv")));
|
||||||
String line;
|
String line;
|
||||||
while( (line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
String[] str = line.split(",");
|
String[] str = line.split(",");
|
||||||
String unicode = null;
|
String unicode = null;
|
||||||
if(str.length == 2)
|
if (str.length == 2)
|
||||||
unicode = new String(new int[] {Integer.parseInt(str[1].replace("0x","").trim(), 16)}, 0, 1);
|
unicode = new String(new int[]{Integer.parseInt(str[1].replace("0x", "").trim(), 16)}, 0, 1);
|
||||||
else if(str.length == 3)
|
else if (str.length == 3)
|
||||||
unicode = new String(new int[] {Integer.parseInt(str[1].replace("0x","").trim(), 16), Integer.parseInt(str[2].replace("0x","").trim(), 16)}, 0, 2);
|
unicode = new String(new int[]{Integer.parseInt(str[1].replace("0x", "").trim(), 16), Integer.parseInt(str[2].replace("0x", "").trim(), 16)}, 0, 2);
|
||||||
else if(str.length == 4)
|
else if (str.length == 4)
|
||||||
unicode = new String(new int[] {Integer.parseInt(str[1].replace("0x","").trim(), 16), Integer.parseInt(str[2].replace("0x","").trim(), 16), Integer.parseInt(str[3].replace("0x","").trim(), 16)}, 0, 3);
|
unicode = new String(new int[]{Integer.parseInt(str[1].replace("0x", "").trim(), 16), Integer.parseInt(str[2].replace("0x", "").trim(), 16), Integer.parseInt(str[3].replace("0x", "").trim(), 16)}, 0, 3);
|
||||||
else if(str.length == 5)
|
else if (str.length == 5)
|
||||||
unicode = new String(new int[] {Integer.parseInt(str[1].replace("0x","").trim(), 16), Integer.parseInt(str[2].replace("0x","").trim(), 16), Integer.parseInt(str[3].replace("0x","").trim(), 16), Integer.parseInt(str[4].replace("0x","").trim(), 16)}, 0, 4);
|
unicode = new String(new int[]{Integer.parseInt(str[1].replace("0x", "").trim(), 16), Integer.parseInt(str[2].replace("0x", "").trim(), 16), Integer.parseInt(str[3].replace("0x", "").trim(), 16), Integer.parseInt(str[4].replace("0x", "").trim(), 16)}, 0, 4);
|
||||||
if( unicode != null)
|
if (unicode != null)
|
||||||
emoji.put(str[0],unicode);
|
emoji.put(str[0], unicode);
|
||||||
}
|
}
|
||||||
br.close();
|
br.close();
|
||||||
} catch (IOException ignored) {ignored.printStackTrace();}
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,9 +36,9 @@ import app.fedilab.fedilabtube.client.data.VideoData.Video;
|
|||||||
*/
|
*/
|
||||||
public class FullScreenMediaController extends MediaController {
|
public class FullScreenMediaController extends MediaController {
|
||||||
|
|
||||||
|
private final Context context;
|
||||||
private ImageButton fullScreen;
|
private ImageButton fullScreen;
|
||||||
private Button resolution;
|
private Button resolution;
|
||||||
private final Context context;
|
|
||||||
private Video peertube;
|
private Video peertube;
|
||||||
private String resolutionVal;
|
private String resolutionVal;
|
||||||
|
|
||||||
|
@ -256,6 +256,7 @@ public class Helper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a default instance host name depending of the device locale
|
* Get a default instance host name depending of the device locale
|
||||||
|
*
|
||||||
* @return peertube host String
|
* @return peertube host String
|
||||||
*/
|
*/
|
||||||
private static String getDefaultInstance() {
|
private static String getDefaultInstance() {
|
||||||
@ -263,17 +264,16 @@ public class Helper {
|
|||||||
if (lang.contains("-")) {
|
if (lang.contains("-")) {
|
||||||
if (!lang.split("-")[0].trim().toLowerCase().startsWith("zh")) {
|
if (!lang.split("-")[0].trim().toLowerCase().startsWith("zh")) {
|
||||||
lang = lang.split("-")[0];
|
lang = lang.split("-")[0];
|
||||||
if(lang.split("-")[1].toLowerCase().contains("be")){
|
if (lang.split("-")[1].toLowerCase().contains("be")) {
|
||||||
lang = "be";
|
lang = "be";
|
||||||
}
|
} else if (lang.split("-")[1].toLowerCase().contains("gb")) {
|
||||||
else if(lang.split("-")[1].toLowerCase().contains("gb")){
|
|
||||||
lang = "gb";
|
lang = "gb";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lang = lang.split("-")[0] + "-" + lang.split("-")[1].toUpperCase();
|
lang = lang.split("-")[0] + "-" + lang.split("-")[1].toUpperCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (lang){
|
switch (lang) {
|
||||||
case "it":
|
case "it":
|
||||||
return "peertube.uno";
|
return "peertube.uno";
|
||||||
case "be":
|
case "be":
|
||||||
@ -338,6 +338,7 @@ public class Helper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert second to String formated date
|
* Convert second to String formated date
|
||||||
|
*
|
||||||
* @param pTime timestamp
|
* @param pTime timestamp
|
||||||
* @return String formatted value
|
* @return String formatted value
|
||||||
*/
|
*/
|
||||||
@ -403,6 +404,7 @@ public class Helper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return rounded numbers depending of the value
|
* Return rounded numbers depending of the value
|
||||||
|
*
|
||||||
* @param count long
|
* @param count long
|
||||||
* @return String rounded value to be displayed
|
* @return String rounded value to be displayed
|
||||||
*/
|
*/
|
||||||
@ -448,7 +450,7 @@ public class Helper {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (url.startsWith("/")) {
|
if (url.startsWith("/")) {
|
||||||
url = instance!=null?instance+ url:Helper.getLiveInstance(context) + url;
|
url = instance != null ? instance + url : Helper.getLiveInstance(context) + url;
|
||||||
}
|
}
|
||||||
if (!url.startsWith("http")) {
|
if (!url.startsWith("http")) {
|
||||||
url = "https://" + url;
|
url = "https://" + url;
|
||||||
@ -475,6 +477,7 @@ public class Helper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the webview
|
* Initialize the webview
|
||||||
|
*
|
||||||
* @param activity Current Activity
|
* @param activity Current Activity
|
||||||
* @param webviewId int id of the webview layout
|
* @param webviewId int id of the webview layout
|
||||||
* @param rootView View the root view
|
* @param rootView View the root view
|
||||||
|
@ -33,8 +33,8 @@ import app.fedilab.fedilabtube.helper.Helper;
|
|||||||
@SuppressWarnings("UnusedReturnValue")
|
@SuppressWarnings("UnusedReturnValue")
|
||||||
public class AccountDAO {
|
public class AccountDAO {
|
||||||
|
|
||||||
public Context context;
|
|
||||||
private final SQLiteDatabase db;
|
private final SQLiteDatabase db;
|
||||||
|
public Context context;
|
||||||
|
|
||||||
|
|
||||||
public AccountDAO(Context context, SQLiteDatabase db) {
|
public AccountDAO(Context context, SQLiteDatabase db) {
|
||||||
|
@ -46,9 +46,9 @@ public class CaptionsVM extends AndroidViewModel {
|
|||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
RetrofitPeertubeAPI retrofitPeertubeAPI;
|
RetrofitPeertubeAPI retrofitPeertubeAPI;
|
||||||
if( instance == null) {
|
if (instance == null) {
|
||||||
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
||||||
}else{
|
} else {
|
||||||
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, instance, null);
|
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, instance, null);
|
||||||
}
|
}
|
||||||
APIResponse apiResponse = retrofitPeertubeAPI.getCaptions(videoId);
|
APIResponse apiResponse = retrofitPeertubeAPI.getCaptions(videoId);
|
||||||
|
@ -68,7 +68,7 @@ public class ChannelsVM extends AndroidViewModel {
|
|||||||
finalElement = account.getUsername() + "@" + account.getHost();
|
finalElement = account.getUsername() + "@" + account.getHost();
|
||||||
}
|
}
|
||||||
RetrofitPeertubeAPI retrofitPeertubeAPI;
|
RetrofitPeertubeAPI retrofitPeertubeAPI;
|
||||||
if( instance == null ) {
|
if (instance == null) {
|
||||||
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
||||||
} else {
|
} else {
|
||||||
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, instance, null);
|
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, instance, null);
|
||||||
|
@ -53,9 +53,9 @@ public class CommentVM extends AndroidViewModel {
|
|||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
RetrofitPeertubeAPI retrofitPeertubeAPI;
|
RetrofitPeertubeAPI retrofitPeertubeAPI;
|
||||||
if( instance == null) {
|
if (instance == null) {
|
||||||
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
||||||
}else{
|
} else {
|
||||||
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, instance, null);
|
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, instance, null);
|
||||||
}
|
}
|
||||||
APIResponse apiResponse = retrofitPeertubeAPI.getComments(CommentVM.action.GET_THREAD, videoId, null, max_id);
|
APIResponse apiResponse = retrofitPeertubeAPI.getComments(CommentVM.action.GET_THREAD, videoId, null, max_id);
|
||||||
|
@ -22,6 +22,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.lifecycle.AndroidViewModel;
|
import androidx.lifecycle.AndroidViewModel;
|
||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.client.RetrofitSepiaSearchAPI;
|
import app.fedilab.fedilabtube.client.RetrofitSepiaSearchAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||||
import app.fedilab.fedilabtube.client.entities.SepiaSearch;
|
import app.fedilab.fedilabtube.client.entities.SepiaSearch;
|
||||||
|
@ -69,13 +69,6 @@ public class TimelineVM extends AndroidViewModel {
|
|||||||
return apiResponseMutableLiveData;
|
return apiResponseMutableLiveData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<APIResponse> getVideosInChannel(String channelId, String max_id) {
|
|
||||||
apiResponseMutableLiveData = new MutableLiveData<>();
|
|
||||||
loadVideosForChannel(null, channelId, max_id);
|
|
||||||
return apiResponseMutableLiveData;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public LiveData<APIResponse> getVideosInChannel(String instance, String channelId, String max_id) {
|
public LiveData<APIResponse> getVideosInChannel(String instance, String channelId, String max_id) {
|
||||||
apiResponseMutableLiveData = new MutableLiveData<>();
|
apiResponseMutableLiveData = new MutableLiveData<>();
|
||||||
loadVideosForChannel(instance, channelId, max_id);
|
loadVideosForChannel(instance, channelId, max_id);
|
||||||
@ -87,9 +80,9 @@ public class TimelineVM extends AndroidViewModel {
|
|||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
RetrofitPeertubeAPI retrofitPeertubeAPI;
|
RetrofitPeertubeAPI retrofitPeertubeAPI;
|
||||||
if( instance == null) {
|
if (instance == null) {
|
||||||
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
||||||
}else {
|
} else {
|
||||||
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, instance, null);
|
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, instance, null);
|
||||||
}
|
}
|
||||||
APIResponse apiResponse = retrofitPeertubeAPI.getVideosForChannel(channelId, max_id);
|
APIResponse apiResponse = retrofitPeertubeAPI.getVideosForChannel(channelId, max_id);
|
||||||
@ -107,9 +100,9 @@ public class TimelineVM extends AndroidViewModel {
|
|||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
RetrofitPeertubeAPI retrofitPeertubeAPI;
|
RetrofitPeertubeAPI retrofitPeertubeAPI;
|
||||||
if( instance == null) {
|
if (instance == null) {
|
||||||
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
||||||
}else{
|
} else {
|
||||||
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, instance, null);
|
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, instance, null);
|
||||||
}
|
}
|
||||||
APIResponse apiResponse = retrofitPeertubeAPI.getVideos(videoId, myVideo);
|
APIResponse apiResponse = retrofitPeertubeAPI.getVideos(videoId, myVideo);
|
||||||
|
@ -42,12 +42,12 @@ public class MastalabWebChromeClient extends WebChromeClient implements MediaPla
|
|||||||
|
|
||||||
private ToggledFullscreenCallback toggledFullscreenCallback;
|
private ToggledFullscreenCallback toggledFullscreenCallback;
|
||||||
|
|
||||||
private CustomWebview webView;
|
private final CustomWebview webView;
|
||||||
private View activityNonVideoView;
|
private final View activityNonVideoView;
|
||||||
private ViewGroup activityVideoView;
|
private final ViewGroup activityVideoView;
|
||||||
private ProgressBar pbar;
|
private final ProgressBar pbar;
|
||||||
private boolean isVideoFullscreen;
|
private boolean isVideoFullscreen;
|
||||||
private Activity activity;
|
private final Activity activity;
|
||||||
|
|
||||||
|
|
||||||
public MastalabWebChromeClient(Activity activity, CustomWebview webView, FrameLayout activityNonVideoView, ViewGroup activityVideoView) {
|
public MastalabWebChromeClient(Activity activity, CustomWebview webView, FrameLayout activityNonVideoView, ViewGroup activityVideoView) {
|
||||||
|
@ -32,7 +32,7 @@ import app.fedilab.fedilabtube.R;
|
|||||||
|
|
||||||
public class MastalabWebViewClient extends WebViewClient {
|
public class MastalabWebViewClient extends WebViewClient {
|
||||||
|
|
||||||
private Activity activity;
|
private final Activity activity;
|
||||||
|
|
||||||
|
|
||||||
public MastalabWebViewClient(Activity activity) {
|
public MastalabWebViewClient(Activity activity) {
|
||||||
|
@ -16,6 +16,11 @@
|
|||||||
android:icon="@drawable/ic_baseline_subtitles_24"
|
android:icon="@drawable/ic_baseline_subtitles_24"
|
||||||
android:title="@string/captions"
|
android:title="@string/captions"
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="ifRoom" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_edit"
|
||||||
|
android:icon="@drawable/ic_baseline_edit_24"
|
||||||
|
android:title="@string/edit"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_report"
|
android:id="@+id/action_report"
|
||||||
android:icon="@drawable/ic_baseline_report_24"
|
android:icon="@drawable/ic_baseline_report_24"
|
||||||
|
Reference in New Issue
Block a user