From fde0e281647271a5543575f8afd32fc959c473ea Mon Sep 17 00:00:00 2001 From: Yiheng Date: Wed, 14 Mar 2018 21:33:12 +1100 Subject: [PATCH] ToWatch, NewSeason & Fix animelist New ToWatch list NewSeason will be correct AnimeList could work with hide DUB mode on Former-commit-id: 420a3aac54392c689b826a30b28e124c0dbe424d --- AnimeGo/src/app/App.android.js | 6 ++- AnimeGo/src/component/list/AnimeList.js | 7 +-- AnimeGo/src/component/list/EpisodeList.js | 50 +++++++++++++++++++-- AnimeGo/src/global.js | 3 +- AnimeGo/src/helper/DataManager.js | 11 +++-- AnimeGo/src/helper/core/AnimeLoader.js | 9 ++-- AnimeGo/src/screen/AnimeDetail.js | 2 +- AnimeGo/src/screen/NewSeason.js | 28 +++++++++++- AnimeGo/src/screen/ToWatch.js | 54 +++++++++++++++++++++++ AnimeGo/src/screen/ToWatchStyles.js | 21 +++++++++ AnimeGo/src/screen/index.js | 3 +- AnimeGo/src/value.js | 5 ++- 12 files changed, 179 insertions(+), 20 deletions(-) create mode 100644 AnimeGo/src/screen/ToWatch.js create mode 100644 AnimeGo/src/screen/ToWatchStyles.js diff --git a/AnimeGo/src/app/App.android.js b/AnimeGo/src/app/App.android.js index 85085bf..b36cf45 100644 --- a/AnimeGo/src/app/App.android.js +++ b/AnimeGo/src/app/App.android.js @@ -10,7 +10,7 @@ import { Router, Scene, Actions } from 'react-native-router-flux'; import { DrawerCell, SmartTouchable } from '../component'; import { Divider, Button, Icon } from 'react-native-elements'; import { AdMobInterstitial } from 'react-native-admob'; -import { NewRelease, NewSeason, Movie, Popular, Genre, Setting, GenreInfo, WatchAnime, AnimeDetail, SearchAnime, SubCategory } from '../screen'; +import { NewRelease, NewSeason, Movie, Popular, Genre, Setting, GenreInfo, WatchAnime, AnimeDetail, SearchAnime, SubCategory, ToWatch } from '../screen'; import { AnimeGoColour, StatusBarColour, ScreenIndex } from '../value'; import { styles } from './AppStyle'; import { DataManager } from '../helper/'; @@ -46,6 +46,7 @@ export default class App extends Component { + @@ -67,6 +68,7 @@ export default class App extends Component { this.onChangingScreen(ScreenIndex.Popular)}/> this.onChangingScreen(ScreenIndex.Genre)}/> + this.onChangingScreen(ScreenIndex.ToWatch)}/> this.onChangingScreen(ScreenIndex.Setting)}/> this.showAd()}/> @@ -119,6 +121,8 @@ export default class App extends Component { Actions.Genre(); break; case ScreenIndex.Setting: Actions.Setting(); break; + case ScreenIndex.ToWatch: + Actions.ToWatch(); break; } this.refs['Drawer'].closeDrawer(); } diff --git a/AnimeGo/src/component/list/AnimeList.js b/AnimeGo/src/component/list/AnimeList.js index 5f3434f..9592912 100644 --- a/AnimeGo/src/component/list/AnimeList.js +++ b/AnimeGo/src/component/list/AnimeList.js @@ -83,14 +83,15 @@ class AnimeList extends PureComponent { const { hasMorePage, isRefreshing, url, page, data } = this.state; if (!hasMorePage && !isRefreshing) return; let loader = new AnimeLoader(url, page); - loader.loadAnime().then((animeData) => { - if (animeData.length == 0) { + loader.loadAnime().then(([animeData, count]) => { + console.log(count); + if (count == 0) { // No more pages this.setState({ hasMorePage: false, isRefreshing: false, }) - } else if (animeData.length < 20 && !global.hideDub) { + } else if (count < 20) { // Append data this.setState({ data: data.concat(animeData), diff --git a/AnimeGo/src/component/list/EpisodeList.js b/AnimeGo/src/component/list/EpisodeList.js index 66947e8..5ec3d00 100755 --- a/AnimeGo/src/component/list/EpisodeList.js +++ b/AnimeGo/src/component/list/EpisodeList.js @@ -1,12 +1,12 @@ import React, { Component } from 'react'; -import { View, Text, FlatList, Image, Linking, Button } from 'react-native'; +import { View, Text, FlatList, Image, Linking, Button, AsyncStorage, ToastAndroid, Platform, Alert } from 'react-native'; import EpisodeLoader from '../../helper/core/EpisodeLoader'; import EpisodeCell from '../cell/EpisodeCell'; import { LoadingIndicator } from '../../component'; import { Actions } from 'react-native-router-flux'; import { isPortrait } from '../../helper/DeviceDimensions'; import { styles } from './EpisodeListStyles' -import { BlueColour, GreenColour } from '../../value'; +import { BlueColour, GreenColour, RedColour } from '../../value'; class EpisodeList extends React.PureComponent { constructor(props) { @@ -44,7 +44,7 @@ class EpisodeList extends React.PureComponent { renderHeader = () => { const { name, image, plot } = this.state; - const { mainViewStyle, titleStyle, basicTextStyle, plotStyle} = styles; + const { mainViewStyle, titleStyle, basicTextStyle, plotStyle } = styles; return ( {name} @@ -52,15 +52,44 @@ class EpisodeList extends React.PureComponent { {plot}