Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Commit

Permalink
Release v1.0.0-alpha Refactor and licenced
Browse files Browse the repository at this point in the history
  • Loading branch information
doomsdayrs committed Jun 10, 2019
1 parent c049370 commit 1a020ef
Show file tree
Hide file tree
Showing 22 changed files with 470 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:testOnly="true"
android:theme="@style/AppTheme" >
<activity
android:name="com.github.Doomsdayrs.apps.shosetsu.MainActivity"
Expand All @@ -37,6 +38,10 @@
android:name="com.squareup.picasso.PicassoProvider"
android:authorities="com.github.Doomsdayrs.apps.shosetsu.com.squareup.picasso"
android:exported="false" />
<provider
android:name="com.android.tools.ir.server.InstantRunContentProvider"
android:authorities="com.github.Doomsdayrs.apps.shosetsu.com.android.tools.ir.server.InstantRunContentProvider"
android:multiprocess="true" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:testOnly="true"
android:theme="@style/AppTheme" >
<activity
android:name="com.github.Doomsdayrs.apps.shosetsu.MainActivity"
Expand All @@ -38,6 +39,10 @@
android:name="com.squareup.picasso.PicassoProvider"
android:authorities="com.github.Doomsdayrs.apps.shosetsu.com.squareup.picasso"
android:exported="false" />
<provider
android:name="com.android.tools.ir.server.InstantRunContentProvider"
android:authorities="com.github.Doomsdayrs.apps.shosetsu.com.android.tools.ir.server.InstantRunContentProvider"
android:multiprocess="true" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:testOnly="true"
android:theme="@style/AppTheme" >
<activity
android:name="com.github.Doomsdayrs.apps.shosetsu.MainActivity"
Expand All @@ -37,6 +38,10 @@
android:name="com.squareup.picasso.PicassoProvider"
android:authorities="com.github.Doomsdayrs.apps.shosetsu.com.squareup.picasso"
android:exported="false" />
<provider
android:name="com.android.tools.ir.server.InstantRunContentProvider"
android:authorities="com.github.Doomsdayrs.apps.shosetsu.com.android.tools.ir.server.InstantRunContentProvider"
android:multiprocess="true" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.app.NavUtils;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
Expand All @@ -16,6 +15,24 @@
import com.github.Doomsdayrs.apps.shosetsu.fragment.LibraryFragement;
import com.github.Doomsdayrs.apps.shosetsu.fragment.SettingsFragment;

/**
* This file is part of Shosetsu.
* Shosetsu is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Shosetsu. If not, see https://www.gnu.org/licenses/ .
* ====================================================================
* Shosetsu
* 9 / June / 2019
*
* @author github.com/doomsdayrs
*/
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
private DrawerLayout drawerLayout;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,28 @@

import java.util.ArrayList;

/**
* This file is part of Shosetsu.
* Shosetsu is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Shosetsu. If not, see https://www.gnu.org/licenses/ .
* ====================================================================
* Shosetsu
* 9 / June / 2019
*
* @author github.com/doomsdayrs
*/
public class NovelCardsAdapter extends RecyclerView.Adapter<NovelCardsAdapter.NovelCardsViewHolder> {
private ArrayList<RecycleCard> recycleCards;

static class NovelCardsViewHolder extends RecyclerView.ViewHolder {
ImageView library_card_image;
TextView library_card_title;

NovelCardsViewHolder(@NonNull View itemView) {
super(itemView);
library_card_image = itemView.findViewById(R.id.novel_item_image);
library_card_title = itemView.findViewById(R.id.textView);
}
}

public NovelCardsAdapter(ArrayList<RecycleCard> recycleCards){
public NovelCardsAdapter(ArrayList<RecycleCard> recycleCards) {
this.recycleCards = recycleCards;
}

Expand All @@ -45,9 +52,19 @@ public void onBindViewHolder(@NonNull NovelCardsViewHolder novelCardsViewHolder,
novelCardsViewHolder.library_card_title.setText(recycleCard.libraryText);
}


@Override
public int getItemCount() {
return recycleCards.size();
}

static class NovelCardsViewHolder extends RecyclerView.ViewHolder {
ImageView library_card_image;
TextView library_card_title;

NovelCardsViewHolder(@NonNull View itemView) {
super(itemView);
library_card_image = itemView.findViewById(R.id.novel_item_image);
library_card_title = itemView.findViewById(R.id.textView);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@

import java.util.ArrayList;

/**
* This file is part of Shosetsu.
* Shosetsu is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Shosetsu. If not, see https://www.gnu.org/licenses/ .
* ====================================================================
* Shosetsu
* 9 / June / 2019
*
* @author github.com/doomsdayrs
*/

public class CatalogueCardsAdapter extends RecyclerView.Adapter<CatalogueCardsAdapter.CatalogueHolder> {
private ArrayList<CatalogueCard> recycleCards;
private FragmentManager fragmentManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.Doomsdayrs.apps.shosetsu.adapters.catalogue;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentManager;
import android.support.v7.widget.RecyclerView;
Expand All @@ -20,43 +19,34 @@
import java.net.URISyntaxException;
import java.util.List;

/**
* This file is part of Shosetsu.
* Shosetsu is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Shosetsu. If not, see https://www.gnu.org/licenses/ .
* ====================================================================
* Shosetsu
* 9 / June / 2019
*
* @author github.com/doomsdayrs
*/
public class CatalogueNovelCardsAdapter extends RecyclerView.Adapter<CatalogueNovelCardsAdapter.NovelCardsViewHolder> {
private FragmentManager fragmentManager;
private static List<NovelCard> recycleCards;
private FragmentManager fragmentManager;
private Formatter formatter;

static class NovelCardsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
FragmentManager fragmentManager;
Formatter formatter;
ImageView library_card_image;
TextView library_card_title;
URI uri;

NovelCardsViewHolder(@NonNull View itemView) {
super(itemView);
library_card_image = itemView.findViewById(R.id.novel_item_image);
library_card_title = itemView.findViewById(R.id.textView);
itemView.setOnClickListener(this);
}

@Override
public void onClick(View v) {
NovelFragment novelFragment = new NovelFragment();
novelFragment.setFormatter(formatter);
novelFragment.setURL(uri.getPath());
fragmentManager.beginTransaction()
.addToBackStack("tag")
.replace(R.id.fragment_container, novelFragment)
.commit();
}
}

public CatalogueNovelCardsAdapter(List<NovelCard> recycleCards, FragmentManager fragmentManager, Formatter formatter) {
if (CatalogueNovelCardsAdapter.recycleCards !=null && !CatalogueNovelCardsAdapter.recycleCards.containsAll(recycleCards)){
if (CatalogueNovelCardsAdapter.recycleCards != null && !CatalogueNovelCardsAdapter.recycleCards.containsAll(recycleCards)) {
CatalogueNovelCardsAdapter.recycleCards = null;
CatalogueNovelCardsAdapter.recycleCards = recycleCards;
}
else if (CatalogueNovelCardsAdapter.recycleCards == null)
} else if (CatalogueNovelCardsAdapter.recycleCards == null)
CatalogueNovelCardsAdapter.recycleCards = recycleCards;

this.fragmentManager = fragmentManager;
Expand Down Expand Up @@ -88,9 +78,34 @@ public void onBindViewHolder(@NonNull NovelCardsViewHolder novelCardsViewHolder,

}


@Override
public int getItemCount() {
return recycleCards.size();
}

static class NovelCardsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
FragmentManager fragmentManager;
Formatter formatter;
ImageView library_card_image;
TextView library_card_title;
URI uri;

NovelCardsViewHolder(@NonNull View itemView) {
super(itemView);
library_card_image = itemView.findViewById(R.id.novel_item_image);
library_card_title = itemView.findViewById(R.id.textView);
itemView.setOnClickListener(this);
}

@Override
public void onClick(View v) {
NovelFragment novelFragment = new NovelFragment();
novelFragment.setFormatter(formatter);
novelFragment.setURL(uri.getPath());
fragmentManager.beginTransaction()
.addToBackStack("tag")
.replace(R.id.fragment_container, novelFragment)
.commit();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,41 @@
import android.widget.TextView;

import com.github.Doomsdayrs.api.novelreader_core.services.core.dep.Formatter;
import com.github.Doomsdayrs.api.novelreader_core.services.core.objects.Novel;
import com.github.Doomsdayrs.api.novelreader_core.services.core.objects.NovelChapter;
import com.github.Doomsdayrs.apps.shosetsu.R;
import com.github.Doomsdayrs.apps.shosetsu.fragment.novel.NovelFragmentChapterView;

import java.io.IOException;
import java.util.List;
import java.util.concurrent.ExecutionException;

/**
* This file is part of Shosetsu.
* Shosetsu is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Shosetsu. If not, see https://www.gnu.org/licenses/ .
* ====================================================================
* Shosetsu
* 9 / June / 2019
*
* @author github.com/doomsdayrs
*/
public class NovelChaptersAdapter extends RecyclerView.Adapter<NovelChaptersAdapter.ChaptersViewHolder> {
private static Formatter formatter;
private FragmentManager fragmentManager;
private List<NovelChapter> novelChapters;
private static Formatter formatter;


public NovelChaptersAdapter(List<NovelChapter> novels, FragmentManager fragmentManager, Formatter formatter) {
this.novelChapters = novels;
this.fragmentManager = fragmentManager;
this.formatter = formatter;
NovelChaptersAdapter.formatter = formatter;
}


Expand All @@ -53,6 +69,18 @@ public int getItemCount() {
return novelChapters.size();
}

static class getNovel extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
try {
return formatter.getNovelPassage(urls[0]);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}

class ChaptersViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
NovelChapter novelChapter;
FragmentManager fragmentManager;
Expand All @@ -74,7 +102,7 @@ public void onClick(View v) {
dialog.setContentView(R.layout.fragment_novel_chapter_view);
TextView textView = dialog.findViewById(R.id.fragment_novel_chapter_view_text);
try {
textView.setText(new getNovel().execute(novelChapter.link).get().replaceAll("\n","\n\n"));
textView.setText(new getNovel().execute(novelChapter.link).get().replaceAll("\n", "\n\n"));
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
Expand All @@ -85,16 +113,4 @@ public void onClick(View v) {
//fragmentManager.beginTransaction().addToBackStack("tag").replace(R.id.fragment_container, novelFragmentChapterView).commit();
}
}

static class getNovel extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
try {
return formatter.getNovelPassage(urls[0]);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
}
Loading

0 comments on commit 1a020ef

Please sign in to comment.