├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── ygodb-module
├── libs
│ ├── sqliteassethelper-2.0.1.jar
│ └── universal-image-loader-1.9.4.jar
├── src
│ └── main
│ │ ├── res
│ │ ├── drawable
│ │ │ ├── tabs_pattern.png
│ │ │ ├── actionbar_bottom.9.png
│ │ │ ├── no_image_available.png
│ │ │ └── background_tab.xml
│ │ ├── drawable-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── values
│ │ │ ├── dimens.xml
│ │ │ ├── analytics.xml
│ │ │ ├── colors.xml
│ │ │ ├── attrs.xml
│ │ │ ├── styles.xml
│ │ │ └── strings.xml
│ │ ├── layout
│ │ │ ├── fragment_booster_grid.xml
│ │ │ ├── fragment_search_result.xml
│ │ │ ├── fragment_general_linear.xml
│ │ │ ├── fragment_search_card.xml
│ │ │ ├── fragment_booster_info.xml
│ │ │ ├── activity_advanced_search.xml
│ │ │ ├── grid_item_booster.xml
│ │ │ ├── activity_main.xml
│ │ │ ├── list_item_card.xml
│ │ │ ├── activity_card_detail.xml
│ │ │ ├── activity_help.xml
│ │ │ ├── fragment_card_info.xml
│ │ │ └── fragment_advanced_search_criteria.xml
│ │ ├── values-v11
│ │ │ └── styles.xml
│ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ ├── values-v14
│ │ │ └── styles.xml
│ │ └── menu
│ │ │ └── main.xml
│ │ ├── java
│ │ └── com
│ │ │ └── chin
│ │ │ └── ygodb
│ │ │ ├── activity
│ │ │ ├── OcgBoosterActivity.java
│ │ │ ├── TcgBoosterActivity.java
│ │ │ ├── HelpAboutActivity.java
│ │ │ ├── BoosterActivity.java
│ │ │ ├── MainActivity.java
│ │ │ ├── BaseFragmentActivity.java
│ │ │ ├── BoosterDetailActivity.java
│ │ │ └── CardDetailActivity.java
│ │ │ ├── database
│ │ │ ├── YgoSqliteDatabase.java
│ │ │ ├── SearchCriterion.java
│ │ │ └── DatabaseQuerier.java
│ │ │ ├── BoosterViewHolder.java
│ │ │ ├── YgoDbApplication.java
│ │ │ ├── BoosterRecyclerViewAdapter.java
│ │ │ ├── asyncTask
│ │ │ ├── BoosterInfoAsyncTask.java
│ │ │ ├── BoosterCardListAsyncTask.java
│ │ │ ├── AddCardInfoTask.java
│ │ │ └── PopulateBoosterAsyncTask.java
│ │ │ ├── dataSource
│ │ │ ├── BoosterStore.java
│ │ │ └── CardStore.java
│ │ │ ├── html
│ │ │ └── YgoWikiaHtmlCleaner.java
│ │ │ ├── MultiSelectionSpinner.java
│ │ │ ├── CardRegexFilterArrayAdapter.java
│ │ │ └── PagerSlidingTabStrip.java
│ │ └── AndroidManifest.xml
├── google-services.json
└── build.gradle
├── settings.gradle
├── README.md
├── .gitignore
├── gradlew.bat
├── import-summary.txt
└── gradlew
/gradle.properties:
--------------------------------------------------------------------------------
1 | android.enableJetifier=true
2 | android.useAndroidX=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinhodado/ygodb/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/ygodb-module/libs/sqliteassethelper-2.0.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinhodado/ygodb/HEAD/ygodb-module/libs/sqliteassethelper-2.0.1.jar
--------------------------------------------------------------------------------
/ygodb-module/libs/universal-image-loader-1.9.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinhodado/ygodb/HEAD/ygodb-module/libs/universal-image-loader-1.9.4.jar
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/drawable/tabs_pattern.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinhodado/ygodb/HEAD/ygodb-module/src/main/res/drawable/tabs_pattern.png
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinhodado/ygodb/HEAD/ygodb-module/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinhodado/ygodb/HEAD/ygodb-module/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinhodado/ygodb/HEAD/ygodb-module/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinhodado/ygodb/HEAD/ygodb-module/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/drawable/actionbar_bottom.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinhodado/ygodb/HEAD/ygodb-module/src/main/res/drawable/actionbar_bottom.9.png
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/drawable/no_image_available.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinhodado/ygodb/HEAD/ygodb-module/src/main/res/drawable/no_image_available.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':ygodb-module'
2 |
3 | include ':common'
4 | project(':common').projectDir=new File('../android_common/common')
5 |
6 | include ':ygowikitool'
7 | project(':ygowikitool').projectDir=new File('../YgoSqliteDbCreator/ygowikitool')
8 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Oct 13 00:48:45 EDT 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
7 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/java/com/chin/ygodb/activity/OcgBoosterActivity.java:
--------------------------------------------------------------------------------
1 | package com.chin.ygodb.activity;
2 |
3 | /**
4 | * OCG boosters
5 | *
6 | * Created by Chin on 10-Feb-17.
7 | */
8 | public class OcgBoosterActivity extends BoosterActivity {
9 | @Override
10 | public String getType() {
11 | return BoosterActivity.TYPE_OCG;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/java/com/chin/ygodb/activity/TcgBoosterActivity.java:
--------------------------------------------------------------------------------
1 | package com.chin.ygodb.activity;
2 |
3 | /**
4 | * TCG boosters
5 | *
6 | * Created by Chin on 10-Feb-17.
7 | */
8 | public class TcgBoosterActivity extends BoosterActivity {
9 | @Override
10 | public String getType() {
11 | return BoosterActivity.TYPE_TCG;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/layout/fragment_booster_grid.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/values/analytics.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | UA-38672868-8
6 |
7 |
8 | true
9 |
10 |
11 | true
12 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 | 64dp
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6633B5E5
4 | #FFC74B46
5 | #FF96AA39
6 | #FFF4842D
7 | #FF3F9FE0
8 | #FFFFFF
9 | #fff3f3f3
10 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/drawable/background_tab.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/layout/fragment_search_result.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/java/com/chin/ygodb/database/YgoSqliteDatabase.java:
--------------------------------------------------------------------------------
1 | package com.chin.ygodb.database;
2 |
3 | import android.content.Context;
4 |
5 | import com.readystatesoftware.sqliteasset.SQLiteAssetHelper;
6 |
7 | /**
8 | * Helper class for database provisioning
9 | * @author Chin
10 | *
11 | */
12 | public class YgoSqliteDatabase extends SQLiteAssetHelper {
13 | private static final String DATABASE_NAME = "ygo.db";
14 | public static final int DATABASE_VERSION = 20221025;
15 |
16 | public YgoSqliteDatabase(Context context) {
17 | super(context, DATABASE_NAME, null, DATABASE_VERSION);
18 | setForcedUpgrade();
19 | }
20 | }
--------------------------------------------------------------------------------
/ygodb-module/src/main/java/com/chin/ygodb/BoosterViewHolder.java:
--------------------------------------------------------------------------------
1 | package com.chin.ygodb;
2 |
3 | import androidx.recyclerview.widget.RecyclerView;
4 | import android.view.View;
5 | import android.widget.ImageView;
6 | import android.widget.TextView;
7 |
8 | /**
9 | * View holder for booster card
10 | *
11 | * Created by Chin on 11-Feb-17.
12 | */
13 | public class BoosterViewHolder extends RecyclerView.ViewHolder {
14 | public TextView txtView;
15 | public ImageView imgView;
16 |
17 | public BoosterViewHolder(View itemView) {
18 | super(itemView);
19 | txtView = (TextView) itemView.findViewById(R.id.itemRowTextBooster);
20 | imgView = (ImageView) itemView.findViewById(R.id.itemRowImageBooster);
21 | }
22 | }
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
list) {
33 | if (list.isEmpty()) return "";
34 |
35 | String string = list.get(0).toString();
36 | for (int i = 1; i < list.size(); i++) {
37 | string += (" AND " + list.get(i).toString());
38 | }
39 | return string;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/ygodb-module/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 31
5 |
6 | defaultConfig {
7 | applicationId "com.chin.ygodb"
8 | minSdkVersion 19
9 | targetSdkVersion 31
10 | }
11 |
12 | buildTypes {
13 | release {
14 | minifyEnabled false
15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
16 | }
17 | debug {
18 | minifyEnabled false
19 | }
20 | }
21 |
22 |
23 | compileOptions {
24 | sourceCompatibility JavaVersion.VERSION_1_8
25 | targetCompatibility JavaVersion.VERSION_1_8
26 | }
27 | lint {
28 | disable 'ResourceType'
29 | }
30 | }
31 |
32 | dependencies {
33 | implementation 'androidx.appcompat:appcompat:1.4.1'
34 | implementation 'androidx.cardview:cardview:1.0.0'
35 | implementation 'androidx.recyclerview:recyclerview:1.2.1'
36 | implementation 'com.google.firebase:firebase-analytics:21.2.0'
37 | implementation 'com.google.firebase:firebase-crashlytics:18.3.1'
38 | implementation files('libs/sqliteassethelper-2.0.1.jar')
39 | implementation files('libs/universal-image-loader-1.9.4.jar')
40 | implementation project(':common')
41 | implementation project(':ygowikitool')
42 | }
43 |
44 | apply plugin: 'com.google.gms.google-services'
45 | apply plugin: 'com.google.firebase.crashlytics'
46 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/layout/fragment_booster_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
16 |
17 |
22 |
23 |
28 |
29 |
30 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/layout/activity_advanced_search.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
19 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
37 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/layout/grid_item_booster.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
21 |
22 |
26 |
27 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
19 |
20 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
40 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/layout/list_item_card.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
21 |
22 |
31 |
32 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/layout/activity_card_detail.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
13 |
14 |
19 |
20 |
29 |
30 |
31 |
32 |
38 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
21 |
22 |
23 |
28 |
29 |
30 |
35 |
36 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/layout/activity_help.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
15 |
16 |
26 |
27 |
31 |
32 |
33 |
34 |
35 |
36 |
42 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/java/com/chin/ygodb/BoosterRecyclerViewAdapter.java:
--------------------------------------------------------------------------------
1 | package com.chin.ygodb;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import androidx.recyclerview.widget.RecyclerView;
6 | import android.text.Html;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | import com.chin.ygodb.activity.BoosterActivity;
12 | import com.chin.ygodb.activity.BoosterDetailActivity;
13 | import com.chin.ygowikitool.entity.Booster;
14 | import com.nostra13.universalimageloader.core.ImageLoader;
15 |
16 | import java.util.List;
17 |
18 | /**
19 | * Recycler view adapter for booster staggered grid
20 | *
21 | * Created by Chin on 11-Feb-17.
22 | */
23 | public class BoosterRecyclerViewAdapter extends RecyclerView.Adapter {
24 | private final List itemList;
25 | private final Context context;
26 |
27 | public BoosterRecyclerViewAdapter(Context context, List itemList) {
28 | this.itemList = itemList;
29 | this.context = context;
30 | }
31 |
32 | @Override
33 | public BoosterViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
34 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.grid_item_booster, null);
35 | final BoosterViewHolder holder = new BoosterViewHolder(view);
36 | view.setOnClickListener(new View.OnClickListener() {
37 | @Override
38 | public void onClick(View v) {
39 | final int position = holder.getAdapterPosition();
40 | if (position != RecyclerView.NO_POSITION) {
41 | Booster booster = itemList.get(position);
42 | Intent intent = new Intent(v.getContext(), BoosterDetailActivity.class);
43 | intent.putExtra(BoosterActivity.BOOSTER_NAME, booster.getBoosterName());
44 | intent.putExtra(BoosterActivity.BOOSTER_URL, booster.getUrl());
45 | v.getContext().startActivity(intent);
46 | }
47 | }
48 | });
49 | return holder;
50 | }
51 |
52 | @Override
53 | public void onBindViewHolder(BoosterViewHolder holder, int position) {
54 | Booster booster = itemList.get(position);
55 | holder.txtView.setText(Html.fromHtml("" + booster.getBoosterName() + ""));
56 | // reset the imgView initially to avoid flickering (e.g. when the old image is still there and
57 | // the new image has not loaded yet)
58 | holder.imgView.setImageResource(android.R.color.transparent);
59 | ImageLoader.getInstance().displayImage(booster.getFullImgSrc(), holder.imgView);
60 | }
61 |
62 | @Override
63 | public int getItemCount() {
64 | return this.itemList.size();
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | YGO Database
5 | ca-app-pub-8564595162671342/8183570114
6 | Help
7 | Check for update
8 | About
9 | Drawer open
10 | Drawer close
11 |
12 |
13 | General
15 | Q: How often is this app\'s data updated?
16 | A: If you are connected to the internet, this app pulls all data from the Yugipedia in real time, so the data is always up-to-date.
17 | If you are offline, this app uses an offline database, which is updated about once a month.
18 |
19 | Q: I like this app!
20 | A: I\'m glad to hear it. Please star the project on Github :)
21 |
22 | Q: This app sucks!/I found a bug/This is not useful/I have a suggestion...
23 | A: Please create an issue on Github, or drop me a line at chinho.dev@gmail.com and let me know how I can improve it. Thank you :)
24 | ]]>
25 |
26 |
27 |
28 | YGO Database
29 | \nCopyright Chin 2014 - 2020
30 |
31 |
32 |
33 | YGO Database Pro
34 | \nCopyright Chin 2014 - 2020
35 |
36 |
37 |
38 | This app is not authorized or created by the authors or legal representatives of "Yu-Gi-Oh!".
39 | This application complies with US Copyright law guidelines of "fair use". If you feel there is a direct copyright
40 | or trademark violation that doesn\'t follow within the "fair use" guidelines please contact us to discuss.
41 | All characters and their names, places, events and all other aspects concerning the "Yu-Gi-Oh!" are the
42 | property of their respective owners. All trademark and copyright concerning the "Yu-Gi-Oh!" series are the
43 | property of their respective owners. We make no claim to and do not have any rights to any of the foregoing. Image
44 | in this application icon is used only to convey what the application is about. \n\n
45 |
46 | Information used by this app is taken from Yugipedia. This information is freely available under the terms of the Creative Commons CC-BY-SA 3.0 License. \n\n
47 |
48 | This app is not affiliated with the Yugipedia. \n\n
49 |
50 | This app uses the jsoup and Universal Image Loader open source libraries.
51 |
52 |
53 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/java/com/chin/ygodb/activity/HelpAboutActivity.java:
--------------------------------------------------------------------------------
1 | package com.chin.ygodb.activity;
2 |
3 | import com.chin.ygodb.database.YgoSqliteDatabase;
4 | import com.chin.ygodb.R;
5 |
6 | import android.content.Intent;
7 | import android.content.pm.PackageManager.NameNotFoundException;
8 | import android.os.Bundle;
9 | import androidx.core.app.NavUtils;
10 | import android.text.Html;
11 | import android.view.Menu;
12 | import android.view.MenuItem;
13 | import android.widget.TextView;
14 |
15 | /**
16 | * Activity to show the help texts
17 | */
18 | public class HelpAboutActivity extends BaseFragmentActivity {
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 |
24 | // set the help text (default)
25 | TextView tv = (TextView) findViewById(R.id.textView_help);
26 |
27 | // set the about text if specified in intent
28 | Intent intent = getIntent();
29 | if (intent != null) {
30 | String intentStr = intent.getStringExtra("INTENT");
31 | if (intentStr.equals("help")) {
32 | tv.setText(Html.fromHtml(getString(R.string.help_text)));
33 | setTitle("Help");
34 | }
35 | else if (intentStr.equals("about")) {
36 | String aboutText = "";
37 |
38 | try {
39 | String appNameInfo = getString(R.string.about_text);
40 | String version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
41 | aboutText = appNameInfo +
42 | "\nVersion " + version +
43 | "\nOffline database version: " + YgoSqliteDatabase.DATABASE_VERSION + "\n\n" +
44 | getString(R.string.about_text_part2);
45 | } catch (NameNotFoundException e) {
46 | e.printStackTrace();
47 | }
48 | tv.setText(aboutText);
49 | setTitle("About");
50 | }
51 | }
52 | }
53 |
54 | @Override
55 | public boolean onCreateOptionsMenu(Menu menu) {
56 | // don't show any menu
57 | return true;
58 | }
59 |
60 | @Override
61 | public boolean onOptionsItemSelected(MenuItem item) {
62 | // Pass the event to ActionBarDrawerToggle, if it returns
63 | // true, then it has handled the app icon touch event
64 | if (mDrawerToggle.onOptionsItemSelected(item)) {
65 | return true;
66 | }
67 | switch (item.getItemId()) {
68 | case android.R.id.home:
69 | NavUtils.navigateUpFromSameTask(this);
70 | return true;
71 | default:
72 | break;
73 | }
74 | return super.onOptionsItemSelected(item);
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
12 |
13 |
21 |
24 |
25 |
31 |
32 |
33 |
34 |
35 |
36 |
40 |
41 |
44 |
47 |
48 |
51 |
52 |
55 |
56 |
59 |
60 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/java/com/chin/ygodb/asyncTask/BoosterInfoAsyncTask.java:
--------------------------------------------------------------------------------
1 | package com.chin.ygodb.asyncTask;
2 |
3 | import static com.chin.ygowikitool.parser.YugiohWikiUtil.jsoupGet;
4 |
5 | import android.os.AsyncTask;
6 | import android.util.Log;
7 | import android.view.View;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import com.chin.ygodb.R;
12 | import com.chin.ygodb.activity.BoosterDetailActivity;
13 | import com.chin.ygowikitool.entity.Booster;
14 | import com.chin.ygowikitool.parser.YugipediaBoosterParser;
15 | import com.nostra13.universalimageloader.core.ImageLoader;
16 |
17 | import org.jsoup.Jsoup;
18 | import org.jsoup.nodes.Document;
19 |
20 | /**
21 | * Async task for booster info
22 | *
23 | * Created by Chin on 06-Feb-17.
24 | */
25 | public class BoosterInfoAsyncTask extends AsyncTask {
26 | private final String boosterName;
27 | private final String boosterUrl;
28 | private final View view;
29 | private final BoosterDetailActivity activity;
30 | private boolean exceptionOccurred = false;
31 |
32 | public BoosterInfoAsyncTask(String boosterName, String boosterUrl, View view, BoosterDetailActivity activity) {
33 | this.boosterName = boosterName;
34 | this.boosterUrl = boosterUrl;
35 | this.view = view;
36 | this.activity = activity;
37 | }
38 |
39 | @Override
40 | protected Booster doInBackground(String... params) {
41 | try {
42 | String html = jsoupGet("https://yugipedia.com/?curid=" + boosterUrl);
43 | Document dom = Jsoup.parse(html);
44 |
45 | YugipediaBoosterParser parser = new YugipediaBoosterParser(boosterName, dom);
46 | Booster newBooster = parser.parse();
47 |
48 | return newBooster;
49 | } catch (Exception e) {
50 | Log.w("ygodb", "Failed to fetch " + boosterName + "'s info");
51 | e.printStackTrace();
52 | // set the flag so we can do something about this in onPostExecute()
53 | exceptionOccurred = true;
54 | }
55 | return null;
56 | }
57 |
58 | @Override
59 | protected void onPostExecute(Booster booster) {
60 | if (booster == null) return;
61 | String jpReleaseDate = booster.getJpReleaseDate();
62 | if (jpReleaseDate == null) {
63 | jpReleaseDate = "N/A";
64 | }
65 | String enReleaseDate = booster.getEnReleaseDate();
66 | if (enReleaseDate == null) {
67 | enReleaseDate = "N/A";
68 | }
69 | TextView tvQuickInfo = view.findViewById(R.id.textView_booster_quickinfo);
70 | tvQuickInfo.setText(boosterName + "\n\n" +
71 | "Japanese release date:\n" + jpReleaseDate + "\n\n" +
72 | "English release date:\n" + enReleaseDate);
73 |
74 | TextView tv = view.findViewById(R.id.textView_booster_longinfo);
75 | String featureText = booster.getFeatureText();
76 | if (featureText == null) {
77 | featureText = "";
78 | }
79 | tv.setText(booster.getIntroText() + "\n\n" + featureText);
80 |
81 | ImageView imgView = view.findViewById(R.id.imageView_detail_booster);
82 | ImageLoader.getInstance().displayImage(booster.getFullImgSrc(), imgView);
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/java/com/chin/ygodb/asyncTask/BoosterCardListAsyncTask.java:
--------------------------------------------------------------------------------
1 | package com.chin.ygodb.asyncTask;
2 |
3 | import static com.chin.ygowikitool.parser.YugiohWikiUtil.jsoupGet;
4 |
5 | import android.os.AsyncTask;
6 | import android.util.Log;
7 | import android.widget.ListView;
8 |
9 | import com.chin.ygodb.CardRegexFilterArrayAdapter;
10 | import com.chin.ygodb.R;
11 | import com.chin.ygodb.activity.BoosterDetailActivity;
12 | import com.chin.ygodb.dataSource.CardStore;
13 | import com.chin.ygowikitool.entity.Booster;
14 | import com.chin.ygowikitool.entity.Card;
15 | import com.chin.ygowikitool.parser.YugipediaBoosterParser;
16 |
17 | import org.jsoup.Jsoup;
18 | import org.jsoup.nodes.Document;
19 |
20 | import java.util.ArrayList;
21 | import java.util.List;
22 | import java.util.Map;
23 |
24 | /**
25 | * Task for making the booster card list page
26 | *
27 | * Created by Chin on 05-Feb-17.
28 | */
29 | public class BoosterCardListAsyncTask extends AsyncTask> {
30 | private final String boosterName;
31 | private final String boosterUrl;
32 | private final ListView cardListView;
33 | private final BoosterDetailActivity activity;
34 | private boolean exceptionOccurred = false;
35 |
36 | public BoosterCardListAsyncTask(String boosterName, String boosterUrl, ListView cardListView, BoosterDetailActivity activity) {
37 | this.boosterName = boosterName;
38 | this.boosterUrl = boosterUrl;
39 | this.cardListView = cardListView;
40 | this.activity = activity;
41 | }
42 |
43 | @Override
44 | protected List doInBackground(String... params) {
45 | List cards = new ArrayList<>();
46 | try {
47 | String html = jsoupGet("https://yugipedia.com/?curid=" + boosterUrl);
48 | Document dom = Jsoup.parse(html);
49 |
50 | YugipediaBoosterParser parser = new YugipediaBoosterParser(boosterName, dom);
51 | Booster newBooster = parser.parse();
52 |
53 | Map map = newBooster.getCardMap();
54 | CardStore cardStore = CardStore.getInstance(activity);
55 | for (Map.Entry entry : map.entrySet()) {
56 | String cardName = entry.getKey();
57 | Card cardNew = entry.getValue();
58 | if (cardStore.hasCardOffline(cardName)) {
59 | // if we have the card in the offline db then we know all its info already
60 | Card card = cardStore.getCard(cardName);
61 | card.setSetNumber(cardNew.getSetNumber());
62 | card.setRarity(cardNew.getRarity());
63 | cards.add(card);
64 | }
65 | else {
66 | // otherwise, the card is either online and not in our db, or does not exist
67 | cards.add(cardNew);
68 | }
69 | }
70 | }
71 | catch (Exception e) {
72 | Log.w("ygodb", "Failed to fetch " + boosterName + "'s card list");
73 | e.printStackTrace();
74 | // set the flag so we can do something about this in onPostExecute()
75 | exceptionOccurred = true;
76 | }
77 |
78 | return cards;
79 | }
80 |
81 | @Override
82 | protected void onPostExecute(List resultSet) {
83 | cardListView.setAdapter(new CardRegexFilterArrayAdapter(activity, R.layout.list_item_card, R.id.itemRowText, resultSet));
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/import-summary.txt:
--------------------------------------------------------------------------------
1 | ECLIPSE ANDROID PROJECT IMPORT SUMMARY
2 | ======================================
3 |
4 | Manifest Merging:
5 | -----------------
6 | Your project uses libraries that provide manifests, and your Eclipse
7 | project did not explicitly turn on manifest merging. In Android Gradle
8 | projects, manifests are always merged (meaning that contents from your
9 | libraries' manifests will be merged into the app manifest. If you had
10 | manually copied contents from library manifests into your app manifest
11 | you may need to remove these for the app to build correctly.
12 |
13 | Ignored Files:
14 | --------------
15 | The following files were *not* copied into the new Gradle project; you
16 | should evaluate whether these are still needed in your project and if
17 | so manually move them:
18 |
19 | * .gitignore
20 | * README.md
21 | * proguard-project.txt
22 |
23 | Replaced Jars with Dependencies:
24 | --------------------------------
25 | The importer recognized the following .jar files as third party
26 | libraries and replaced them with Gradle dependencies instead. This has
27 | the advantage that more explicit version information is known, and the
28 | libraries can be updated automatically. However, it is possible that
29 | the .jar file in your project was of an older version than the
30 | dependency we picked, which could render the project not compileable.
31 | You can disable the jar replacement in the import wizard and try again:
32 |
33 | android-support-v4.jar => com.android.support:support-v4:23.4.0
34 | android-support-v7-appcompat.jar => com.android.support:appcompat-v7:23.4.0
35 |
36 | Replaced Libraries with Dependencies:
37 | -------------------------------------
38 | The importer recognized the following library projects as third party
39 | libraries and replaced them with Gradle dependencies instead. This has
40 | the advantage that more explicit version information is known, and the
41 | libraries can be updated automatically. However, it is possible that
42 | the source files in your project were of an older version than the
43 | dependency we picked, which could render the project not compileable.
44 | You can disable the library replacement in the import wizard and try
45 | again:
46 |
47 | android-support-v7-appcompat => [com.android.support:appcompat-v7:23.4.0]
48 |
49 | Moved Files:
50 | ------------
51 | Android Gradle projects use a different directory structure than ADT
52 | Eclipse projects. Here's how the projects were restructured:
53 |
54 | In cardview:
55 | * AndroidManifest.xml => cardview\src\main\AndroidManifest.xml
56 | * assets\ => cardview\src\main\assets
57 | * res\ => cardview\src\main\res\
58 | * src\ => cardview\src\main\java
59 | * src\.readme => cardview\src\main\resources\.readme
60 | In ygodb:
61 | * AndroidManifest.xml => ygodb\src\main\AndroidManifest.xml
62 | * assets\ => ygodb\src\main\assets\
63 | * libs\jsoup-1.8.3.jar => ygodb\libs\jsoup-1.8.3.jar
64 | * libs\sqliteassethelper-2.0.1.jar => ygodb\libs\sqliteassethelper-2.0.1.jar
65 | * libs\universal-image-loader-1.9.4.jar => ygodb\libs\universal-image-loader-1.9.4.jar
66 | * res\ => ygodb\src\main\res\
67 | * src\ => ygodb\src\main\java\
68 |
69 | Next Steps:
70 | -----------
71 | You can now build the project. The Gradle project needs network
72 | connectivity to download dependencies.
73 |
74 | Bugs:
75 | -----
76 | If for some reason your project does not build, and you determine that
77 | it is due to a bug or limitation of the Eclipse to Gradle importer,
78 | please file a bug at http://b.android.com with category
79 | Component-Tools.
80 |
81 | (This import summary is for your information only, and can be deleted
82 | after import once you are satisfied with the results.)
83 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/java/com/chin/ygodb/database/DatabaseQuerier.java:
--------------------------------------------------------------------------------
1 | package com.chin.ygodb.database;
2 |
3 | import android.content.Context;
4 | import android.database.Cursor;
5 | import android.database.sqlite.SQLiteDatabase;
6 | import android.util.Log;
7 | import android.widget.Toast;
8 |
9 | import com.chin.ygodb.dataSource.CardStore;
10 | import com.chin.ygowikitool.entity.Card;
11 |
12 | import java.util.ArrayList;
13 | import java.util.List;
14 |
15 | /**
16 | * A class for making queries to our sqlite database
17 | * @author Chin
18 | */
19 | public class DatabaseQuerier {
20 | private static SQLiteDatabase db;
21 | private final Context context;
22 |
23 | public DatabaseQuerier(Context context) {
24 | this.context = context;
25 | }
26 |
27 | public SQLiteDatabase getDatabase() {
28 | if (db == null) {
29 | YgoSqliteDatabase dbHelper = new YgoSqliteDatabase(context);
30 | db = dbHelper.getReadableDatabase();
31 | }
32 | return db;
33 | }
34 |
35 | /**
36 | * Execute a search query and return the result
37 | * @param criteria The where clause that represents the criteria of the search
38 | * @return List of cards that satisfy the criteria
39 | */
40 | public List executeQuery(String criteria) {
41 | Log.i("Search", "Criteria: " + criteria);
42 | List resultSet = new ArrayList<>();
43 | try {
44 | SQLiteDatabase db = getDatabase();
45 |
46 | Cursor cursor = db.rawQuery("Select name, attribute, cardType, types, level, atk, def, link, rank, pendulumScale, property "
47 | + "from card where " + criteria + " order by name", null);
48 | if (cursor.moveToFirst()) {
49 | while (!cursor.isAfterLast()) {
50 | String name = cursor.getString(cursor.getColumnIndexOrThrow("name"));
51 |
52 | // verify that the card really exists in our database
53 | if (CardStore.cardNameList.contains(name)) {
54 | Card card = new Card();
55 | card.setName(name);
56 | // note that we don't need all card info here - just those needed for displaying in the ListView
57 | card.setAttribute(cursor.getString(cursor.getColumnIndexOrThrow("attribute")));
58 | card.setCardType(cursor.getString(cursor.getColumnIndexOrThrow("cardType")));
59 | card.setTypes(cursor.getString(cursor.getColumnIndexOrThrow("types")));
60 | card.setLevel(cursor.getString(cursor.getColumnIndexOrThrow("level")));
61 | card.setAtk(cursor.getString(cursor.getColumnIndexOrThrow("atk")));
62 | card.setDef(cursor.getString(cursor.getColumnIndexOrThrow("def")));
63 | card.setLink(cursor.getString(cursor.getColumnIndexOrThrow("link")));
64 | card.setRank(cursor.getString(cursor.getColumnIndexOrThrow("rank")));
65 | card.setPendulumScale(cursor.getString(cursor.getColumnIndexOrThrow("pendulumScale")));
66 | card.setProperty(cursor.getString(cursor.getColumnIndexOrThrow("property")));
67 | resultSet.add(card);
68 | }
69 | else {
70 | Log.i("Search", "Not found: " + name);
71 | }
72 |
73 | cursor.moveToNext();
74 | }
75 | }
76 | cursor.close();
77 | } catch (Exception e) {
78 | e.printStackTrace();
79 | Toast toast = Toast.makeText(context, "An error occurred while searching.", Toast.LENGTH_SHORT);
80 | toast.show();
81 | }
82 |
83 | return resultSet;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/java/com/chin/ygodb/dataSource/BoosterStore.java:
--------------------------------------------------------------------------------
1 | package com.chin.ygodb.dataSource;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.database.Cursor;
6 | import android.database.sqlite.SQLiteDatabase;
7 | import android.util.Log;
8 |
9 | import com.chin.ygodb.database.DatabaseQuerier;
10 | import com.chin.ygowikitool.entity.Booster;
11 | import com.chin.ygowikitool.parser.YugiohWikiUtil;
12 |
13 | import java.util.HashSet;
14 | import java.util.Map;
15 | import java.util.Set;
16 | import java.util.concurrent.ConcurrentHashMap;
17 |
18 | /**
19 | * Provide access to booster data
20 | *
21 | * Created by Chin on 11-Feb-17.
22 | */
23 | public class BoosterStore {
24 | // we use the application context so don't worry about this
25 | @SuppressLint("StaticFieldLeak")
26 | private static BoosterStore INSTANCE;
27 | private final Context context;
28 | private boolean doneInit;
29 |
30 | // list of boosters in the offline database
31 | private static final Set offlineBoosterSet = new HashSet<>(8192);
32 |
33 | // maps a booster name to its Booster object, for both online and offline
34 | private static final Map allBoosterMap = new ConcurrentHashMap<>(8192);
35 |
36 | private BoosterStore(Context context) {
37 | if (INSTANCE != null) {
38 | throw new IllegalStateException("Already instantiated");
39 | }
40 | this.context = context;
41 | }
42 |
43 | public static synchronized BoosterStore getInstance(Context context) {
44 | if (INSTANCE == null) {
45 | INSTANCE = new BoosterStore(context.getApplicationContext());
46 | }
47 |
48 | return INSTANCE;
49 | }
50 |
51 | /**
52 | * Only call this once! Will do heavy work like accessing the db so call this
53 | * not on the UI thread!
54 | */
55 | public synchronized void init() {
56 | if (doneInit) return;
57 | Log.i("ygodb", "Initializing BoosterStore");
58 |
59 | DatabaseQuerier dbq = new DatabaseQuerier(context);
60 | SQLiteDatabase db = dbq.getDatabase();
61 | Cursor cursor = db.rawQuery("select name, enReleaseDate, jpReleaseDate, imgSrc from booster", null);
62 |
63 | if (cursor.moveToFirst()) {
64 | while (!cursor.isAfterLast()) {
65 | String name = cursor.getString(cursor.getColumnIndexOrThrow("name"));
66 | Booster booster = new Booster();
67 | booster.setBoosterName(name);
68 | booster.setEnReleaseDate(cursor.getString(cursor.getColumnIndexOrThrow("enReleaseDate")));
69 | booster.setJpReleaseDate(cursor.getString(cursor.getColumnIndexOrThrow("jpReleaseDate")));
70 |
71 | String shortenedImgSrc = cursor.getString(cursor.getColumnIndexOrThrow("imgSrc"));
72 | booster.setShortenedImgSrc(shortenedImgSrc);
73 | String fullImgSrc = YugiohWikiUtil.getFullYugipediaImageLink(shortenedImgSrc);
74 | booster.setFullImgSrc(fullImgSrc);
75 |
76 | booster.parseEnReleaseDate();
77 | booster.parseJpReleaseDate();
78 |
79 | offlineBoosterSet.add(name);
80 | allBoosterMap.put(name, booster);
81 | cursor.moveToNext();
82 | }
83 | }
84 |
85 | cursor.close();
86 |
87 | doneInit = true;
88 | }
89 |
90 | public Booster getBooster(String name) {
91 | return allBoosterMap.get(name);
92 | }
93 |
94 | public boolean hasBooster(String name) {
95 | return allBoosterMap.containsKey(name);
96 | }
97 |
98 | public void addBooster(String name, Booster booster) {
99 | allBoosterMap.put(name, booster);
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/res/layout/fragment_card_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
16 |
17 |
23 |
27 |
28 |
29 |
34 |
35 |
36 |
39 |
40 |
47 |
48 |
52 |
53 |
58 |
59 |
60 |
63 |
64 |
65 |
66 |
73 |
74 |
80 |
81 |
82 |
85 |
86 |
94 |
95 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/java/com/chin/ygodb/activity/BoosterActivity.java:
--------------------------------------------------------------------------------
1 | package com.chin.ygodb.activity;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.os.Bundle;
5 | import android.util.TypedValue;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import androidx.fragment.app.Fragment;
11 | import androidx.fragment.app.FragmentManager;
12 | import androidx.fragment.app.FragmentPagerAdapter;
13 | import androidx.recyclerview.widget.RecyclerView;
14 | import androidx.recyclerview.widget.StaggeredGridLayoutManager;
15 | import androidx.viewpager.widget.ViewPager;
16 |
17 | import com.chin.ygodb.BoosterRecyclerViewAdapter;
18 | import com.chin.ygodb.PagerSlidingTabStrip;
19 | import com.chin.ygodb.R;
20 | import com.chin.ygodb.asyncTask.PopulateBoosterAsyncTask;
21 | import com.chin.ygowikitool.entity.Booster;
22 |
23 | import java.util.ArrayList;
24 | import java.util.List;
25 |
26 | public abstract class BoosterActivity extends BaseFragmentActivity {
27 | public static final String BOOSTER_NAME = "BOOSTER_NAME";
28 | public static final String BOOSTER_URL = "BOOSTER_URL";
29 | public static final String TYPE_TCG = "TCG";
30 | public static final String TYPE_OCG = "OCG";
31 | private final List boosters = new ArrayList<>();
32 |
33 | @Override
34 | protected void onCreate(Bundle savedInstanceState) {
35 | super.onCreate(savedInstanceState);
36 |
37 | PagerSlidingTabStrip tabs = findViewById(R.id.tabs);
38 | ViewPager pager = findViewById(R.id.pager);
39 | MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager());
40 |
41 | pager.setAdapter(adapter);
42 |
43 | final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics());
44 | pager.setPageMargin(pageMargin);
45 | tabs.setViewPager(pager);
46 | tabs.setIndicatorColor(getResources().getColor(R.color.red));
47 | }
48 |
49 | /**
50 | * Get the type of this activity
51 | * @return either BoosterActivity.TYPE_TCG or BoosterActivity.TYPE_OCG
52 | */
53 | public abstract String getType();
54 |
55 | public List getBoosterList() {
56 | return boosters;
57 | }
58 |
59 | public static class BoosterListFragment extends Fragment {
60 | PopulateBoosterAsyncTask myTask;
61 |
62 | public static BoosterListFragment newInstance() {
63 | BoosterListFragment f = new BoosterListFragment();
64 | Bundle b = new Bundle();
65 | f.setArguments(b);
66 | return f;
67 | }
68 |
69 | @Override
70 | public void onCreate(Bundle savedInstanceState) {
71 | super.onCreate(savedInstanceState);
72 | setRetainInstance(true);
73 | }
74 |
75 | @SuppressLint("RtlHardcoded")
76 | @Override
77 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
78 | View view = inflater.inflate(R.layout.fragment_booster_grid, container, false);
79 | RecyclerView recyclerView = view.findViewById(R.id.booster_recycler_view);
80 | recyclerView.setHasFixedSize(false);
81 | StaggeredGridLayoutManager gridLayoutManager = new StaggeredGridLayoutManager(4, StaggeredGridLayoutManager.VERTICAL);
82 | recyclerView.setLayoutManager(gridLayoutManager);
83 | List boosters = ((BoosterActivity) getActivity()).getBoosterList();
84 | BoosterRecyclerViewAdapter rcAdapter = new BoosterRecyclerViewAdapter(getContext(), boosters);
85 | recyclerView.setAdapter(rcAdapter);
86 |
87 | myTask = (PopulateBoosterAsyncTask) new PopulateBoosterAsyncTask(recyclerView, (BoosterActivity) getActivity())
88 | .execute();
89 |
90 | return view;
91 | }
92 |
93 | @Override
94 | public void onPause() {
95 | super.onPause();
96 | if (myTask != null) {
97 | myTask.cancel(true);
98 | myTask = null;
99 | }
100 | }
101 | }
102 |
103 | private static class MyPagerAdapter extends FragmentPagerAdapter {
104 | private final String[] TITLES = { "Boosters" };
105 |
106 | private MyPagerAdapter(FragmentManager fm) {
107 | super(fm);
108 | }
109 |
110 | @Override
111 | public CharSequence getPageTitle(int position) {
112 | return TITLES[position];
113 | }
114 |
115 | @Override
116 | public int getCount() {
117 | return TITLES.length;
118 | }
119 |
120 | @Override
121 | public Fragment getItem(int position) {
122 | return BoosterListFragment.newInstance();
123 | }
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/ygodb-module/src/main/java/com/chin/ygodb/html/YgoWikiaHtmlCleaner.java:
--------------------------------------------------------------------------------
1 | package com.chin.ygodb.html;
2 |
3 | import org.jsoup.nodes.Attribute;
4 | import org.jsoup.nodes.Attributes;
5 | import org.jsoup.nodes.Element;
6 | import org.jsoup.nodes.Node;
7 | import org.jsoup.select.Elements;
8 |
9 | import com.chin.ygodb.dataSource.CardStore.CardAdditionalInfoType;
10 |
11 | public class YgoWikiaHtmlCleaner {
12 | public static String getCleanedHtml(Element content, CardAdditionalInfoType type) {
13 | Elements navboxes = content.select("table.navbox");
14 | if (!navboxes.isEmpty()) {navboxes.first().remove();} // remove the navigation box
15 |
16 | content.select("script").remove(); // remove