2020-06-30 13:33:43 +02:00
|
|
|
package app.fedilab.fedilabtube;
|
2020-07-01 16:36:08 +02:00
|
|
|
/* Copyright 2020 Thomas Schneider
|
|
|
|
*
|
|
|
|
* This file is a part of TubeLab
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
|
|
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
|
|
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
|
|
* Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
|
|
|
* see <http://www.gnu.org/licenses>. */
|
2020-06-30 13:33:43 +02:00
|
|
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
import androidx.fragment.app.FragmentTransaction;
|
|
|
|
|
|
|
|
import app.fedilab.fedilabtube.fragment.DisplayStatusFragment;
|
2020-09-07 11:15:43 +02:00
|
|
|
import app.fedilab.fedilabtube.viewmodel.FeedsVM;
|
2020-06-30 13:33:43 +02:00
|
|
|
|
|
|
|
|
2020-09-08 10:11:11 +02:00
|
|
|
public class MyVideosActivity extends AppCompatActivity {
|
2020-06-30 13:33:43 +02:00
|
|
|
|
2020-09-07 11:15:43 +02:00
|
|
|
private FeedsVM.Type type;
|
2020-06-30 13:33:43 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
|
|
setContentView(R.layout.activity_search_result);
|
|
|
|
|
|
|
|
if (getSupportActionBar() != null)
|
|
|
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
|
|
|
2020-07-03 17:35:28 +02:00
|
|
|
Bundle b = getIntent().getExtras();
|
2020-07-09 17:57:01 +02:00
|
|
|
if (b != null)
|
2020-09-07 11:15:43 +02:00
|
|
|
type = (FeedsVM.Type) b.get("type");
|
2020-07-03 17:35:28 +02:00
|
|
|
|
2020-09-07 11:15:43 +02:00
|
|
|
if (type == FeedsVM.Type.MYVIDEOS) {
|
2020-07-03 17:35:28 +02:00
|
|
|
setTitle(R.string.my_videos);
|
2020-09-07 11:15:43 +02:00
|
|
|
} else if (type == FeedsVM.Type.PSUBSCRIPTIONS) {
|
2020-07-03 17:35:28 +02:00
|
|
|
setTitle(R.string.subscriptions);
|
2020-09-07 11:15:43 +02:00
|
|
|
} else if (type == FeedsVM.Type.PEERTUBE_HISTORY) {
|
2020-09-03 19:08:53 +02:00
|
|
|
setTitle(R.string.my_history);
|
2020-07-03 17:35:28 +02:00
|
|
|
}
|
2020-06-30 13:33:43 +02:00
|
|
|
|
|
|
|
if (savedInstanceState == null) {
|
|
|
|
DisplayStatusFragment displayStatusFragment = new DisplayStatusFragment();
|
|
|
|
Bundle bundle = new Bundle();
|
2020-07-03 17:35:28 +02:00
|
|
|
bundle.putSerializable("type", type);
|
2020-06-30 13:33:43 +02:00
|
|
|
displayStatusFragment.setArguments(bundle);
|
|
|
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
|
|
|
ft.add(R.id.container, displayStatusFragment).commit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
if (item.getItemId() == android.R.id.home) {
|
|
|
|
finish();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|