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;
}

View File

@ -0,0 +1,53 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,10m-3,0a3,3 0,1 1,6 0a3,3 0,1 1,-6 0"
android:strokeWidth="1"
android:fillColor="#000000"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
<path
android:pathData="M16.3851,13.8501C17.4222,12.6992 18,11.4167 18,10C18,6.7409 15.2591,4 12,4C8.7409,4 6,6.7409 6,10C6,11.4186 6.5792,12.7028 7.6184,13.854C7.8034,14.059 8.1196,14.0752 8.3246,13.8902C8.5295,13.7051 8.5457,13.389 8.3607,13.184C7.4762,12.2041 7,11.1483 7,10C7,7.2932 9.2932,5 12,5C14.7068,5 17,7.2932 17,10C17,11.1467 16.525,12.201 15.6422,13.1807C15.4574,13.3859 15.4738,13.702 15.679,13.8869C15.8841,14.0717 16.2003,14.0553 16.3851,13.8501Z"
android:strokeWidth="1"
android:fillType="nonZero"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:startY="4"
android:startX="12"
android:endY="13.806534"
android:endX="12"
android:type="linear">
<item android:offset="0" android:color="#FF000000"/>
<item android:offset="1" android:color="#3F000000"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M17.5678,18.3077C20.316,16.4626 22,13.3733 22,10C22,4.4772 17.5228,0 12,0C6.4772,0 2,4.4772 2,10C2,13.3762 3.687,16.4679 6.439,18.3123C6.8978,18.6198 7.519,18.4971 7.8264,18.0383C8.1339,17.5796 8.0113,16.9584 7.5525,16.6509C5.3488,15.174 4,12.7021 4,10C4,5.5817 7.5817,2 12,2C16.4183,2 20,5.5817 20,10C20,12.6998 18.6536,15.1698 16.453,16.6472C15.9945,16.9551 15.8723,17.5764 16.1802,18.0349C16.488,18.4934 17.1093,18.6156 17.5678,18.3077Z"
android:strokeWidth="1"
android:fillType="nonZero"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:startY="0"
android:startX="12"
android:endY="18.221992"
android:endX="12"
android:type="linear">
<item android:offset="0" android:color="#FF000000"/>
<item android:offset="1" android:color="#3F000000"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M9.3292,15.9751C9.1474,14.8843 9.8983,14 10.9979,14L13.0021,14C14.1055,14 14.8534,14.8793 14.6708,15.9751L13.6634,22.0197C13.5731,22.5611 13.0573,23 12.501,23L11.499,23C10.9472,23 10.4277,22.5659 10.3366,22.0197L9.3292,15.9751Z"
android:strokeWidth="1"
android:fillColor="#000000"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
</vector>

View File

@ -35,5 +35,9 @@
android:icon="@drawable/ic_baseline_personal_video_24"
android:title="@string/my_videos"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_subscription"
android:icon="@drawable/ic_subscription"
android:title="@string/subscriptions"
app:showAsAction="ifRoom" />
</menu>

View File

@ -166,4 +166,5 @@
<string name="peertube_video_blacklist"><![CDATA[Votre vidéo <b>%1$s</b> a été blacklisté]]></string>
<string name="peertube_video_unblacklist"><![CDATA[Votre vidéo <b>%1$s</b> nest plus blacklisté]]></string>
<string name="toast_code_error">Une erreur sest produite! Linstance na retourné aucun code d\autorisation!</string>
<string name="subscriptions">Abonnements</string>
</resources>