Skip to content

Commit

Permalink
New Settings
Browse files Browse the repository at this point in the history
Added a functionality to let the users choose which section should open by default... "Manga" or "Comic".
  • Loading branch information
Xonshiz committed Sep 8, 2019
1 parent 41f9726 commit ec46499
Show file tree
Hide file tree
Showing 13 changed files with 6,491 additions and 6,257 deletions.
2 changes: 2 additions & 0 deletions src/comic_dl/comic_dl.Android/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ protected override void OnCreate(Bundle bundle)
ToolbarResource = Resource.Layout.Toolbar;

base.OnCreate(bundle);
Xamarin.Essentials.Platform.Init(this, bundle); // add this line to your code, it may also be called: bundle

global::Xamarin.Forms.Forms.Init(this, bundle);

FormsMaterial.Init(this, bundle);
CardsViewRenderer.Preserve();
ImageCircleRenderer.Init();

MobileAds.Initialize(ApplicationContext, "ca-app-pub-8359860011604747~6496691983");
Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, bundle);
LoadApplication(new App());
Expand Down
12,648 changes: 6,403 additions & 6,245 deletions src/comic_dl/comic_dl.Android/Resources/Resource.designer.cs

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/comic_dl/comic_dl.Android/comic_dl.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<AndroidLinkMode>None</AndroidLinkMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>false</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
Expand All @@ -44,10 +44,12 @@
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<AndroidCreatePackagePerAbi>true</AndroidCreatePackagePerAbi>
<AndroidEnableMultiDex>true</AndroidEnableMultiDex>
<AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<AotAssemblies>false</AotAssemblies>
<EnableLLVM>false</EnableLLVM>
<BundleAssemblies>false</BundleAssemblies>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Android" />
Expand Down Expand Up @@ -75,6 +77,9 @@
<PackageReference Include="sqlite-net-pcl">
<Version>1.5.231</Version>
</PackageReference>
<PackageReference Include="Xamarin.Essentials">
<Version>1.3.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.1.0.618606" />
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.1" />
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.1" />
Expand Down
2 changes: 1 addition & 1 deletion src/comic_dl/comic_dl.Android/comic_dl.Android.csproj.user
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SelectedDevice>Android Google Pixel XL - API 9.0</SelectedDevice>
<SelectedDevice>OnePlus GM1901</SelectedDevice>
<DefaultDevice>nexus_5x</DefaultDevice>
<AndroidDesignerPreferredTheme>Theme.AppCompat.Light.NoActionBar</AndroidDesignerPreferredTheme>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
namespace comic_dl.Droid.customRenderer
{
// Google Test Ad Unit = "ca-app-pub-3940256099942544/6300978111";
// My Ads = "ca-app-pub-8359860011604747/8984707227";
#pragma warning disable CS0618 // Type or member is obsolete
public class MangaAdViewRenderer : ViewRenderer<Controls.MangaDetailAdViewControl, AdView>
{
string adUnitId = "ca-app-pub-8359860011604747/8984707227";
//Note you may want to adjust this, see further down.
AdSize adSize = AdSize.SmartBanner;
AdSize adSize = AdSize.Banner;
AdView adView;
AdView CreateNativeAdControl()
{
Expand Down
3 changes: 3 additions & 0 deletions src/comic_dl/comic_dl.UWP/comic_dl.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@
<PackageReference Include="sqlite-net-pcl">
<Version>1.5.231</Version>
</PackageReference>
<PackageReference Include="Xamarin.Essentials">
<Version>1.3.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.2.0.709249" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.8" />
<PackageReference Include="Xamarin.Forms.Visual.Material">
Expand Down
3 changes: 3 additions & 0 deletions src/comic_dl/comic_dl.iOS/comic_dl.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,9 @@
<PackageReference Include="sqlite-net-pcl">
<Version>1.5.231</Version>
</PackageReference>
<PackageReference Include="Xamarin.Essentials">
<Version>1.3.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.2.0.709249" />
<PackageReference Include="Xamarin.Google.iOS.MobileAds">
<Version>7.38.0</Version>
Expand Down
8 changes: 8 additions & 0 deletions src/comic_dl/comic_dl/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using Xamarin.Forms;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
using Xamarin.Essentials;
using static comic_dl.internalData.CommonInternalData;

namespace comic_dl
{
Expand All @@ -18,6 +20,12 @@ public MainPage()
{
InitializeComponent();
Current = this;
if (Convert.ToBoolean(Preferences.Get(UserSettingkey.HomeResultPreference.ToString(), "false")))
{
//var _CurrentPage = ;
CurrentPage = Children.Where(x => x.Title.Contains("Comic")).First();
}

//var assembly = typeof(EmbeddedImages).GetTypeInfo().Assembly;
//foreach (var res in assembly.GetManifestResourceNames())
//{
Expand Down
23 changes: 18 additions & 5 deletions src/comic_dl/comic_dl/Pages/misc/Settings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="comic_dl.Pages.misc.Settings"
xmlns:Converters="clr-namespace:comic_dl.Converters"
Title="Customize This App"
Visual="Material">
<Grid BackgroundColor="#eceff1"
Expand All @@ -16,19 +17,20 @@
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<Label Grid.Row="0"
Grid.Column="0"
FontSize="Medium"
FontAttributes="Italic"
Margin="5"
Text="CoManga is a cross-platform application to download Comics and Manga easily from a single point. You can search Manga from this tool as well. If you want a CLI, go over to my Github and look for Comic-dl." />

<Label Text="Version : 2019-08-23"
<Label Text="Version : 2019-09-08"
Grid.Row="1"
Grid.Column="0"
FontSize="Medium"
Expand All @@ -48,23 +50,34 @@
FontSize="Medium"
Margin="5"
FontAttributes="Italic"/>

<StackLayout Grid.Column="0" Grid.Row="4">
<StackLayout Orientation="Horizontal">
<Label Text="Comics" />
<Switch x:Name="comicSwitch" IsToggled="False" Toggled="ComicSwitch_Toggled" />
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="Manga" />
<Switch x:Name="mangaSwitch" IsToggled="True" Toggled="MangaSwitch_Toggled"/>
</StackLayout>
</StackLayout>

<Button Text="Github"
Clicked="Github_Clicked"
Grid.Row="4"
Grid.Row="5"
Margin="5"
Grid.Column="0"/>

<Button Text="Report Issue"
Clicked="ReportIssue_Clicked"
Grid.Row="5"
Grid.Row="6"
Margin="5"
Grid.Column="0"/>

<Button Text="Donate"
Clicked="Donate_Clicked"
Margin="5"
Grid.Row="6"
Grid.Row="7"
Grid.Column="0"/>
</Grid>
</ContentPage>
23 changes: 20 additions & 3 deletions src/comic_dl/comic_dl/Pages/misc/Settings.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using comic_dl.commonFunctionalities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Essentials;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using static comic_dl.internalData.CommonInternalData;

namespace comic_dl.Pages.misc
{
Expand All @@ -15,6 +17,9 @@ public partial class Settings : ContentPage
public Settings ()
{
InitializeComponent ();
//comicSwitch.IsToggled = false;
var lul = Preferences.Get(UserSettingkey.HomeResultPreference.ToString(), "false");
comicSwitch.IsToggled = Convert.ToBoolean(Preferences.Get(UserSettingkey.HomeResultPreference.ToString(), "false"));
}

void Github_Clicked(object sender, System.EventArgs e)
Expand All @@ -24,12 +29,24 @@ void Github_Clicked(object sender, System.EventArgs e)

void ReportIssue_Clicked(object sender, System.EventArgs e)
{
Device.OpenUri(new Uri("https://github.com/Xonshiz/comic-dl-cross-platform-app/issues/new"));
Device.OpenUri(new Uri("https://github.com/Xonshiz/CoManga/issues/new"));
}

void Donate_Clicked(object sender, System.EventArgs e)
{
Device.OpenUri(new Uri("https://www.paypal.me/Xonshiz"));
}

private void ComicSwitch_Toggled(object sender, ToggledEventArgs e)
{
mangaSwitch.IsToggled = !e.Value;
UserAppSettings.SaveUserSetting(UserSettingkey.HomeResultPreference.ToString(), comicSwitch.IsToggled.ToString());
}

private void MangaSwitch_Toggled(object sender, ToggledEventArgs e)
{
comicSwitch.IsToggled = !e.Value;
UserAppSettings.SaveUserSetting(UserSettingkey.HomeResultPreference.ToString(), comicSwitch.IsToggled.ToString());
}
}
}
1 change: 1 addition & 0 deletions src/comic_dl/comic_dl/comic_dl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Refit" Version="4.7.51" />
<PackageReference Include="sqlite-net-pcl" Version="1.5.231" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.0" />
<PackageReference Include="Xamarin.Forms" Version="4.2.0.709249" />
<PackageReference Include="Xam.Plugins.Forms.ImageCircle" Version="3.0.0.5" />
<PackageReference Include="Plugin.Permissions" Version="3.0.0.12" />
Expand Down
16 changes: 16 additions & 0 deletions src/comic_dl/comic_dl/commonFunctionalities/UserAppSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Essentials;

namespace comic_dl.commonFunctionalities
{
class UserAppSettings
{
public static bool SaveUserSetting(string key, string value)
{
Preferences.Set(key, value);
return true;
}
}
}
7 changes: 7 additions & 0 deletions src/comic_dl/comic_dl/internalData/CommonInternalData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,12 @@ class CommonInternalData
public static List<string> failedDownloadLinks = new List<string>() { };
public enum DownloadType { MangaRock, RCO }
public enum RefreshType { HotLatestItems, LatestItems}

/*
* HomeResultPreference = Which page does the user want to watch when they open the app, i.e., Manga or Comic.
*/
public enum UserSettingkey { HomeResultPreference }

public string googleMangaAdsId = "";
}
}

0 comments on commit ec46499

Please sign in to comment.