Create empty CatalogueListActivity.

Add some changes to view interfaces
This commit is contained in:
inorichi 2015-10-11 15:01:26 +02:00
parent 13124ee02f
commit 18be01e4c5
12 changed files with 70 additions and 39 deletions

View File

@ -22,7 +22,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.activity.MangaDetailActivity"
android:label="@string/title_activity_manga_detail"
@ -31,6 +30,15 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="eu.kanade.mangafeed.ui.activity.MainActivity" />
</activity>
<activity
android:name=".ui.activity.CatalogueListActivity"
android:label="@string/title_activity_catalogue_list"
android:parentActivityName=".ui.activity.MainActivity"
android:theme="@style/AppTheme" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="eu.kanade.mangafeed.ui.activity.MainActivity" />
</activity>
</application>
</manifest>

View File

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

View File

@ -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);

View File

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

View File

@ -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) {

View File

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

View File

@ -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();

View File

@ -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();
}

View File

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

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:fitsSystemWindows="true"
tools:context="eu.kanade.mangafeed.ui.activity.CatalogueListActivity">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"/>
</LinearLayout>

View File

@ -1,11 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/source_name" />
android:layout_width="match_parent"
android:layout_height="40dp"
tools:text="New Text"
android:id="@+id/source_name"
android:gravity="center_vertical" />
</LinearLayout>

View File

@ -35,5 +35,6 @@
<string name="library_search_hint">Title or author...</string>
<string name="action_delete">Delete</string>
<string name="library_selection_title">Selected</string>
<string name="title_activity_catalogue_list">CatalogueList</string>
</resources>