mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-25 18:47:51 +02:00
Create empty CatalogueListActivity.
Add some changes to view interfaces
This commit is contained in:
@ -1,10 +1,13 @@
|
||||
package eu.kanade.mangafeed.presenter;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import eu.kanade.mangafeed.App;
|
||||
import eu.kanade.mangafeed.data.helpers.SourceManager;
|
||||
import eu.kanade.mangafeed.sources.Source;
|
||||
import eu.kanade.mangafeed.ui.activity.CatalogueListActivity;
|
||||
import eu.kanade.mangafeed.ui.adapter.SourceHolder;
|
||||
import eu.kanade.mangafeed.view.CatalogueView;
|
||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||
@ -24,7 +27,7 @@ public class CataloguePresenter {
|
||||
}
|
||||
|
||||
public void initializeSources() {
|
||||
adapter = new EasyAdapter<Source>(
|
||||
adapter = new EasyAdapter<>(
|
||||
view.getActivity(),
|
||||
SourceHolder.class,
|
||||
sourceManager.getSources());
|
||||
@ -34,6 +37,8 @@ public class CataloguePresenter {
|
||||
}
|
||||
|
||||
public void onSourceClick(int position) {
|
||||
|
||||
Intent intent = new Intent(view.getActivity(), CatalogueListActivity.class);
|
||||
intent.putExtra(Intent.EXTRA_UID, adapter.getItem(position).getSource());
|
||||
view.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +1,14 @@
|
||||
package eu.kanade.mangafeed.ui.activity;
|
||||
|
||||
import android.app.FragmentManager;
|
||||
import android.content.Context;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import eu.kanade.mangafeed.App;
|
||||
import eu.kanade.mangafeed.AppComponent;
|
||||
|
||||
public class BaseActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
FragmentManager fm = getFragmentManager();
|
||||
if (fm.getBackStackEntryCount() > 0) {
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setupToolbar(Toolbar toolbar) {
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
@ -0,0 +1,30 @@
|
||||
package eu.kanade.mangafeed.ui.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
|
||||
import butterknife.Bind;
|
||||
import butterknife.ButterKnife;
|
||||
import eu.kanade.mangafeed.R;
|
||||
import eu.kanade.mangafeed.sources.Source;
|
||||
|
||||
public class CatalogueListActivity extends BaseActivity {
|
||||
|
||||
@Bind(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_catalogue_list);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
setupToolbar(toolbar);
|
||||
}
|
||||
|
||||
}
|
@ -26,14 +26,12 @@ public class MainActivity extends BaseActivity {
|
||||
FrameLayout container;
|
||||
|
||||
private Drawer drawer;
|
||||
private CompositeSubscription mSubscriptions;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
ButterKnife.bind(this);
|
||||
mSubscriptions = new CompositeSubscription();
|
||||
|
||||
setupToolbar(toolbar);
|
||||
|
||||
@ -82,12 +80,6 @@ public class MainActivity extends BaseActivity {
|
||||
drawer.setSelection(R.id.nav_drawer_library);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mSubscriptions.unsubscribe();
|
||||
}
|
||||
|
||||
private void setFragment(Fragment fragment) {
|
||||
try {
|
||||
if (fragment != null && getSupportFragmentManager() != null) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package eu.kanade.mangafeed.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public interface BaseView {
|
||||
Context getActivity();
|
||||
void startActivity(Intent intent);
|
||||
}
|
||||
|
@ -2,9 +2,6 @@ package eu.kanade.mangafeed.view;
|
||||
|
||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||
|
||||
/**
|
||||
* Created by len on 10/10/2015.
|
||||
*/
|
||||
public interface CatalogueView extends BaseView {
|
||||
void setAdapter(EasyAdapter adapter);
|
||||
void setSourceClickListener();
|
||||
|
@ -3,7 +3,6 @@ package eu.kanade.mangafeed.view;
|
||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||
|
||||
public interface LibraryView extends BaseView {
|
||||
|
||||
void setAdapter(EasyAdapter mangas);
|
||||
void setMangaClickListener();
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import eu.kanade.mangafeed.data.models.Chapter;
|
||||
import eu.kanade.mangafeed.data.models.Manga;
|
||||
|
||||
public interface MangaDetailView extends BaseView {
|
||||
|
||||
void loadManga(Manga manga);
|
||||
void setChapters(List<Chapter> chapters);
|
||||
}
|
||||
|
Reference in New Issue
Block a user