mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 01:39:19 +01:00
Create empty CatalogueListActivity.
Add some changes to view interfaces
This commit is contained in:
parent
13124ee02f
commit
18be01e4c5
@ -22,7 +22,6 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.MangaDetailActivity"
|
android:name=".ui.activity.MangaDetailActivity"
|
||||||
android:label="@string/title_activity_manga_detail"
|
android:label="@string/title_activity_manga_detail"
|
||||||
@ -31,6 +30,15 @@
|
|||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="eu.kanade.mangafeed.ui.activity.MainActivity" />
|
android:value="eu.kanade.mangafeed.ui.activity.MainActivity" />
|
||||||
</activity>
|
</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>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package eu.kanade.mangafeed.presenter;
|
package eu.kanade.mangafeed.presenter;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.App;
|
import eu.kanade.mangafeed.App;
|
||||||
import eu.kanade.mangafeed.data.helpers.SourceManager;
|
import eu.kanade.mangafeed.data.helpers.SourceManager;
|
||||||
import eu.kanade.mangafeed.sources.Source;
|
import eu.kanade.mangafeed.sources.Source;
|
||||||
|
import eu.kanade.mangafeed.ui.activity.CatalogueListActivity;
|
||||||
import eu.kanade.mangafeed.ui.adapter.SourceHolder;
|
import eu.kanade.mangafeed.ui.adapter.SourceHolder;
|
||||||
import eu.kanade.mangafeed.view.CatalogueView;
|
import eu.kanade.mangafeed.view.CatalogueView;
|
||||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||||
@ -24,7 +27,7 @@ public class CataloguePresenter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void initializeSources() {
|
public void initializeSources() {
|
||||||
adapter = new EasyAdapter<Source>(
|
adapter = new EasyAdapter<>(
|
||||||
view.getActivity(),
|
view.getActivity(),
|
||||||
SourceHolder.class,
|
SourceHolder.class,
|
||||||
sourceManager.getSources());
|
sourceManager.getSources());
|
||||||
@ -34,6 +37,8 @@ public class CataloguePresenter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onSourceClick(int position) {
|
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;
|
package eu.kanade.mangafeed.ui.activity;
|
||||||
|
|
||||||
import android.app.FragmentManager;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.MenuItem;
|
|
||||||
|
|
||||||
import eu.kanade.mangafeed.App;
|
import eu.kanade.mangafeed.App;
|
||||||
import eu.kanade.mangafeed.AppComponent;
|
import eu.kanade.mangafeed.AppComponent;
|
||||||
|
|
||||||
public class BaseActivity extends AppCompatActivity {
|
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) {
|
protected void setupToolbar(Toolbar toolbar) {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
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;
|
FrameLayout container;
|
||||||
|
|
||||||
private Drawer drawer;
|
private Drawer drawer;
|
||||||
private CompositeSubscription mSubscriptions;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
mSubscriptions = new CompositeSubscription();
|
|
||||||
|
|
||||||
setupToolbar(toolbar);
|
setupToolbar(toolbar);
|
||||||
|
|
||||||
@ -82,12 +80,6 @@ public class MainActivity extends BaseActivity {
|
|||||||
drawer.setSelection(R.id.nav_drawer_library);
|
drawer.setSelection(R.id.nav_drawer_library);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
mSubscriptions.unsubscribe();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setFragment(Fragment fragment) {
|
private void setFragment(Fragment fragment) {
|
||||||
try {
|
try {
|
||||||
if (fragment != null && getSupportFragmentManager() != null) {
|
if (fragment != null && getSupportFragmentManager() != null) {
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package eu.kanade.mangafeed.view;
|
package eu.kanade.mangafeed.view;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
public interface BaseView {
|
public interface BaseView {
|
||||||
Context getActivity();
|
Context getActivity();
|
||||||
|
void startActivity(Intent intent);
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,6 @@ package eu.kanade.mangafeed.view;
|
|||||||
|
|
||||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by len on 10/10/2015.
|
|
||||||
*/
|
|
||||||
public interface CatalogueView extends BaseView {
|
public interface CatalogueView extends BaseView {
|
||||||
void setAdapter(EasyAdapter adapter);
|
void setAdapter(EasyAdapter adapter);
|
||||||
void setSourceClickListener();
|
void setSourceClickListener();
|
||||||
|
@ -3,7 +3,6 @@ package eu.kanade.mangafeed.view;
|
|||||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||||
|
|
||||||
public interface LibraryView extends BaseView {
|
public interface LibraryView extends BaseView {
|
||||||
|
|
||||||
void setAdapter(EasyAdapter mangas);
|
void setAdapter(EasyAdapter mangas);
|
||||||
void setMangaClickListener();
|
void setMangaClickListener();
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import eu.kanade.mangafeed.data.models.Chapter;
|
|||||||
import eu.kanade.mangafeed.data.models.Manga;
|
import eu.kanade.mangafeed.data.models.Manga;
|
||||||
|
|
||||||
public interface MangaDetailView extends BaseView {
|
public interface MangaDetailView extends BaseView {
|
||||||
|
|
||||||
void loadManga(Manga manga);
|
void loadManga(Manga manga);
|
||||||
void setChapters(List<Chapter> chapters);
|
void setChapters(List<Chapter> chapters);
|
||||||
}
|
}
|
||||||
|
12
app/src/main/res/layout/activity_catalogue_list.xml
Normal file
12
app/src/main/res/layout/activity_catalogue_list.xml
Normal 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>
|
@ -1,11 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<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">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="40dp"
|
||||||
android:text="New Text"
|
tools:text="New Text"
|
||||||
android:id="@+id/source_name" />
|
android:id="@+id/source_name"
|
||||||
|
android:gravity="center_vertical" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -35,5 +35,6 @@
|
|||||||
<string name="library_search_hint">Title or author...</string>
|
<string name="library_search_hint">Title or author...</string>
|
||||||
<string name="action_delete">Delete</string>
|
<string name="action_delete">Delete</string>
|
||||||
<string name="library_selection_title">Selected</string>
|
<string name="library_selection_title">Selected</string>
|
||||||
|
<string name="title_activity_catalogue_list">CatalogueList</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user