TubeLab-App-Android/app/src/main/java/app/fedilab/fedilabtube/MyVideosActivity.java

80 lines
2.8 KiB
Java

package app.fedilab.fedilabtube;
/* 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>. */
import android.os.Bundle;
import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentTransaction;
import app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask;
import app.fedilab.fedilabtube.client.APIResponse;
import app.fedilab.fedilabtube.fragment.DisplayStatusFragment;
import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsInterface;
public class MyVideosActivity extends AppCompatActivity implements OnRetrieveFeedsInterface {
private RetrieveFeedsAsyncTask.Type type;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search_result);
if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
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);
} else if (type == RetrieveFeedsAsyncTask.Type.PEERTUBE_HISTORY) {
setTitle(R.string.my_history);
}
if (savedInstanceState == null) {
DisplayStatusFragment displayStatusFragment = new DisplayStatusFragment();
Bundle bundle = new Bundle();
bundle.putSerializable("type", type);
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);
}
@Override
public void onRetrieveFeeds(APIResponse apiResponse) {
}
}