Skip to content

Commit

Permalink
Switch Zoro to Aniwatch
Browse files Browse the repository at this point in the history
  • Loading branch information
jerry08 committed Jul 20, 2023
1 parent 59c41a6 commit 5b74320
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 24 deletions.
2 changes: 1 addition & 1 deletion AniStream/Adapters/ViewPagerAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ViewPagerAdapter(FragmentManager fm) : base(fm)
Fragments.Add(AnimeFragment.NewInstance(SearchFilter.NewSeason));
Fragments.Add(AnimeFragment.NewInstance(SearchFilter.LastUpdated));
break;
case AnimeSites.Zoro:
case AnimeSites.Aniwatch:
Fragments.Add(AnimeFragment.NewInstance(SearchFilter.Popular));
Fragments.Add(AnimeFragment.NewInstance(SearchFilter.NewSeason));
Fragments.Add(AnimeFragment.NewInstance(SearchFilter.TopAiring));
Expand Down
2 changes: 1 addition & 1 deletion AniStream/Fragments/AnimeFragment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ or AnimeSites.AnimePahe
SearchFilter.LastUpdated => await provider.GetLastUpdatedAsync(Page),
_ => throw new NotImplementedException(),
},
Zoro provider => _searchFilter switch
Aniwatch provider => _searchFilter switch
{
SearchFilter.Popular => await provider.GetPopularAsync(Page),
SearchFilter.NewSeason => await provider.GetRecentlyAddedAsync(Page),
Expand Down
20 changes: 6 additions & 14 deletions AniStream/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,6 @@ protected override async void OnCreate(Bundle? savedInstanceState)
viewPager = FindViewById<ViewPager>(Resource.Id.viewPager)!;
appBarLayout = FindViewById<AppBarLayout>(Resource.Id.appbar)!;

// Migration
var data = await SecureStorage.GetAsync("PlayerSettings");
if (!string.IsNullOrEmpty(data))
{
System.IO.File.WriteAllText(System.IO.Path.Combine(FileSystem.AppDataDirectory, "PlayerSettings.dat"), data);
SecureStorage.Remove("PlayerSettings");
}

if (!WeebUtils.IsOnline())
{
var linearLayout1 = FindViewById<Android.Widget.LinearLayout>(Resource.Id.notvisiblelinearlayout)!;
Expand Down Expand Up @@ -291,7 +283,7 @@ private void SetupViewPager()
case AnimeSites.GogoAnime:
bottomNavigationView.InflateMenu(Resource.Menu.bottommenu2);
break;
case AnimeSites.Zoro:
case AnimeSites.Aniwatch:
bottomNavigationView.InflateMenu(Resource.Menu.bottommenu4);
break;
case AnimeSites.AnimePahe:
Expand Down Expand Up @@ -406,7 +398,7 @@ private async void SetupSources(IMenu menu)
WeebUtils.AnimeSite = (AnimeSites)Convert.ToInt32(animeSiteStr);

var gogoanime = menu.FindItem(Resource.Id.source_gogoanime);
var zoro = menu.FindItem(Resource.Id.source_zoro);
var aniwatch = menu.FindItem(Resource.Id.source_aniwatch);
var animepahe = menu.FindItem(Resource.Id.source_animepahe);
var nineanime = menu.FindItem(Resource.Id.source_nineanime);
var otakudesu = menu.FindItem(Resource.Id.source_otakudesu);
Expand All @@ -416,8 +408,8 @@ private async void SetupSources(IMenu menu)
case AnimeSites.GogoAnime:
gogoanime?.SetChecked(true);
break;
case AnimeSites.Zoro:
zoro?.SetChecked(true);
case AnimeSites.Aniwatch:
aniwatch?.SetChecked(true);
break;
case AnimeSites.AnimePahe:
animepahe?.SetChecked(true);
Expand Down Expand Up @@ -475,8 +467,8 @@ private async void SaveSelectedSource(int id)

if (id == Resource.Id.source_gogoanime)
WeebUtils.AnimeSite = AnimeSites.GogoAnime;
else if (id == Resource.Id.source_zoro)
WeebUtils.AnimeSite = AnimeSites.Zoro;
else if (id == Resource.Id.source_aniwatch)
WeebUtils.AnimeSite = AnimeSites.Aniwatch;
else if (id == Resource.Id.source_animepahe)
WeebUtils.AnimeSite = AnimeSites.AnimePahe;
else if (id == Resource.Id.source_nineanime)
Expand Down
27 changes: 20 additions & 7 deletions AniStream/Resources/menu/drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
android:titleCondensed="Gogoanime"
android:title="Gogoanime"
app:actionViewClass="android.widget.RadioButton" />
<item android:id="@+id/source_zoro"
android:titleCondensed="Zoro"
android:title="Zoro"
<item android:id="@+id/source_aniwatch"
android:titleCondensed="Aniwatch"
android:title="Aniwatch"
app:actionViewClass="android.widget.RadioButton" />
<item android:id="@+id/source_animepahe"
android:titleCondensed="Anime Pahe"
Expand All @@ -20,10 +20,23 @@
android:titleCondensed="9anime"
android:title="9anime"
app:actionViewClass="android.widget.RadioButton" />
<item android:id="@+id/source_otakudesu"
android:titleCondensed="OtakuDesu"
android:title="OtakuDesu (Indonesian)"
app:actionViewClass="android.widget.RadioButton" />
<item
android:checkable="false"
android:titleCondensed="Indonesian"
android:title="Indonesian">
<menu>
<group android:checkableBehavior="single">
<item
android:id="@+id/source_otakudesu"
android:titleCondensed="OtakuDesu"
android:title="OtakuDesu"
app:actionViewClass="android.widget.RadioButton" />
<item
android:title="Actor"
app:actionViewClass="android.widget.RadioButton" />
</group>
</menu>
</item>
</group>

<item
Expand Down
2 changes: 1 addition & 1 deletion AniStream/Utils/WeebUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static IAnimeProvider AnimeClient

return AnimeSite switch
{
AnimeSites.Zoro => new Zoro(() => httpClient),
AnimeSites.Aniwatch => new Aniwatch(() => httpClient),
AnimeSites.AnimePahe => new AnimePahe(() => httpClient),
AnimeSites.NineAnime => new NineAnime(() => httpClient),
AnimeSites.OtakuDesu => new OtakuDesu(() => httpClient),
Expand Down

0 comments on commit 5b74320

Please sign in to comment.