1
0
mirror of https://framagit.org/tom79/fedilab-tube synced 2025-06-05 21:09:11 +02:00

Subscriptions

This commit is contained in:
Thomas
2020-07-03 17:35:28 +02:00
parent c4388fca3e
commit 3447a45e31
6 changed files with 93 additions and 8 deletions

View File

@ -34,6 +34,7 @@ import com.google.android.material.bottomnavigation.BottomNavigationView;
import org.jetbrains.annotations.NotNull;
import app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask;
import app.fedilab.fedilabtube.asynctasks.RetrievePeertubeInformationAsyncTask;
import app.fedilab.fedilabtube.helper.Helper;
@ -92,16 +93,19 @@ public class MainActivity extends AppCompatActivity {
MenuItem uploadItem = menu.findItem(R.id.action_upload);
MenuItem myVideosItem = menu.findItem(R.id.action_myvideos);
MenuItem playslistItem = menu.findItem(R.id.action_playlist);
MenuItem subscriptionItem = menu.findItem(R.id.action_subscription);
if (Helper.isLoggedIn(MainActivity.this)) {
instanceItem.setVisible(false);
uploadItem.setVisible(true);
myVideosItem.setVisible(true);
playslistItem.setVisible(true);
subscriptionItem.setVisible(true);
} else {
instanceItem.setVisible(true);
uploadItem.setVisible(false);
myVideosItem.setVisible(false);
playslistItem.setVisible(false);
subscriptionItem.setVisible(false);
}
return true;
}
@ -121,9 +125,20 @@ public class MainActivity extends AppCompatActivity {
return true;
} else if (item.getItemId() == R.id.action_myvideos) {
Intent intent = new Intent(MainActivity.this, MyVideosActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.MYVIDEOS);
intent.putExtras(bundle);
startActivity(intent);
return true;
} else if (item.getItemId() == R.id.action_playlist) {
} else if (item.getItemId() == R.id.action_subscription) {
Intent intent = new Intent(MainActivity.this, MyVideosActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.PSUBSCRIPTIONS);
intent.putExtras(bundle);
startActivity(intent);
return true;
}
else if (item.getItemId() == R.id.action_playlist) {
Intent intent = new Intent(MainActivity.this, AllPlaylistsActivity.class);
startActivity(intent);
return true;

View File

@ -28,6 +28,7 @@ import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsInterface;
public class MyVideosActivity extends AppCompatActivity implements OnRetrieveFeedsInterface {
private RetrieveFeedsAsyncTask.Type type;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -37,13 +38,21 @@ public class MyVideosActivity extends AppCompatActivity implements OnRetrieveFee
if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setTitle(R.string.my_videos);
Bundle b = getIntent().getExtras();
if(b != null)
type = (RetrieveFeedsAsyncTask.Type) b.get("type");
if( type == RetrieveFeedsAsyncTask.Type.MYVIDEOS) {
setTitle(R.string.my_videos);
}else if (type == RetrieveFeedsAsyncTask.Type.PSUBSCRIPTIONS) {
setTitle(R.string.subscriptions);
}
if (savedInstanceState == null) {
DisplayStatusFragment displayStatusFragment = new DisplayStatusFragment();
Bundle bundle = new Bundle();
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.MYVIDEOS);
bundle.putSerializable("type", type);
displayStatusFragment.setArguments(bundle);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(R.id.container, displayStatusFragment).commit();

View File

@ -90,15 +90,18 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
context = getContext();
Bundle bundle = this.getArguments();
if (getArguments() != null) {
type = DisplayStatusFragmentArgs.fromBundle(getArguments()).getType();
}
if (bundle != null) {
search_peertube = bundle.getString("search_peertube", null);
targetedId = bundle.getString("targetedid", null);
ischannel = bundle.getBoolean("ischannel", false);
type = (RetrieveFeedsAsyncTask.Type) bundle.get("type");
}
if (getArguments() != null && type == null) {
type = DisplayStatusFragmentArgs.fromBundle(getArguments()).getType();
}
if (ischannel) {
type = RetrieveFeedsAsyncTask.Type.CHANNEL;
}