├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── inspectionProfiles
│ ├── Project_Default.xml
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── LICENSE.md
├── Munch.iml
├── README.md
├── app
├── .gitignore
├── app-release.apk
├── app.iml
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── crazyhitty
│ │ └── chdev
│ │ └── ks
│ │ └── munch
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── munch_db.sqlite
│ ├── java
│ │ └── com
│ │ │ └── crazyhitty
│ │ │ └── chdev
│ │ │ └── ks
│ │ │ └── munch
│ │ │ ├── archive
│ │ │ ├── ArchiveInteractor.java
│ │ │ ├── ArchivePresenter.java
│ │ │ ├── IArchiveInteractor.java
│ │ │ ├── IArchivePresenter.java
│ │ │ ├── IArchiveView.java
│ │ │ └── OnArticleRetrievedListener.java
│ │ │ ├── article
│ │ │ ├── ArticleInteractor.java
│ │ │ ├── ArticlePresenter.java
│ │ │ ├── IArticleInteractor.java
│ │ │ ├── IArticlePresenter.java
│ │ │ ├── IArticleView.java
│ │ │ ├── OnArticleArchivedListener.java
│ │ │ ├── OnArticleLoadedListener.java
│ │ │ └── OnArticleRemoveListener.java
│ │ │ ├── curatedfeeds
│ │ │ ├── CuratedFeedsInteractor.java
│ │ │ ├── CuratedFeedsPresenter.java
│ │ │ ├── ICuratedFeedsInteractor.java
│ │ │ ├── ICuratedFeedsPresenter.java
│ │ │ ├── ICuratedFeedsView.java
│ │ │ └── OnCuratedFeedsRetrievedListener.java
│ │ │ ├── feeds
│ │ │ ├── FeedsLoaderInteractor.java
│ │ │ ├── FeedsPresenter.java
│ │ │ ├── IFeedsLoaderInteractor.java
│ │ │ ├── IFeedsPresenter.java
│ │ │ ├── IFeedsView.java
│ │ │ └── OnFeedsLoadedListener.java
│ │ │ ├── importopml
│ │ │ ├── IImportOpmlInteractor.java
│ │ │ ├── IImportOpmlPresenter.java
│ │ │ ├── IImportOpmlView.java
│ │ │ ├── ImportOpmlInteractor.java
│ │ │ ├── ImportOpmlPresenter.java
│ │ │ └── OnOpmlImportListener.java
│ │ │ ├── models
│ │ │ ├── Categories.java
│ │ │ ├── CategoryItem.java
│ │ │ ├── FeedItem.java
│ │ │ ├── LibraryItem.java
│ │ │ ├── SettingsPreferences.java
│ │ │ └── SourceItem.java
│ │ │ ├── receivers
│ │ │ └── SyncArticlesReceiver.java
│ │ │ ├── services
│ │ │ └── SyncArticlesIntentService.java
│ │ │ ├── sources
│ │ │ ├── ISourceInteractor.java
│ │ │ ├── ISourcePresenter.java
│ │ │ ├── ISourceView.java
│ │ │ ├── OnSourceSavedListener.java
│ │ │ ├── OnSourcesLoadedListener.java
│ │ │ ├── OnSourcesModifyListener.java
│ │ │ ├── SourceInteractor.java
│ │ │ └── SourcesPresenter.java
│ │ │ ├── ui
│ │ │ ├── activities
│ │ │ │ ├── AboutActivity.java
│ │ │ │ ├── ArticleActivity.java
│ │ │ │ ├── HomeActivity.java
│ │ │ │ ├── SettingsActivity.java
│ │ │ │ └── SplashActivity.java
│ │ │ ├── adapters
│ │ │ │ ├── CategoryListAdapter.java
│ │ │ │ ├── FeedsRecyclerViewAdapter.java
│ │ │ │ ├── LibrariesRecyclerViewAdapter.java
│ │ │ │ ├── SourcesRecyclerViewAdapter.java
│ │ │ │ └── SplashPagerAdapter.java
│ │ │ ├── fragments
│ │ │ │ ├── ArchiveFragment.java
│ │ │ │ ├── FeedsFragment.java
│ │ │ │ ├── ManageSourcesFragment.java
│ │ │ │ └── SplashFragment.java
│ │ │ └── views
│ │ │ │ ├── CustomCheckBoxListPreferenceDialog.java
│ │ │ │ ├── CustomListPreferenceDialog.java
│ │ │ │ └── CustomPreferenceDialog.java
│ │ │ └── utils
│ │ │ ├── AnimationUtil.java
│ │ │ ├── ColorsUtil.java
│ │ │ ├── DatabaseUtil.java
│ │ │ ├── DateUtil.java
│ │ │ ├── FadeAnimationUtil.java
│ │ │ ├── FadePageTransformerUtil.java
│ │ │ ├── ItemAnimatorUtil.java
│ │ │ ├── ItemDecorationUtil.java
│ │ │ ├── NetworkConnectionUtil.java
│ │ │ ├── UrlUtil.java
│ │ │ ├── WebsiteIntentUtil.java
│ │ │ └── comparator
│ │ │ ├── FeedCategoryComparator.java
│ │ │ ├── FeedPubDateComparator.java
│ │ │ └── FeedTitleComparator.java
│ └── res
│ │ ├── anim
│ │ ├── pull_in_right.xml
│ │ ├── push_out_left.xml
│ │ └── push_out_right.xml
│ │ ├── drawable-hdpi
│ │ ├── ic_info_black_24dp.png
│ │ ├── ic_notifications_black_24dp.png
│ │ └── ic_sync_black_24dp.png
│ │ ├── drawable-mdpi
│ │ ├── ic_info_black_24dp.png
│ │ ├── ic_notifications_black_24dp.png
│ │ ├── ic_sync_black_24dp.png
│ │ └── ic_sync_white_24dp.xml
│ │ ├── drawable-nodpi
│ │ ├── ic_launcher.png
│ │ ├── munch_about.png
│ │ ├── munch_promo.png
│ │ ├── munch_promo_small.png
│ │ ├── splash_1.png
│ │ ├── splash_2.png
│ │ └── splash_3.png
│ │ ├── drawable-v21
│ │ ├── circle_button.xml
│ │ ├── ic_delete_white_24dp.xml
│ │ ├── ic_info_black_24dp.xml
│ │ ├── ic_notifications_black_24dp.xml
│ │ └── ic_sync_black_24dp.xml
│ │ ├── drawable-xhdpi
│ │ ├── ic_info_black_24dp.png
│ │ ├── ic_notifications_black_24dp.png
│ │ └── ic_sync_black_24dp.png
│ │ ├── drawable-xxhdpi
│ │ ├── accent_circle.xml
│ │ ├── ic_info_black_24dp.png
│ │ ├── ic_launcher.png
│ │ ├── ic_notifications_black_24dp.png
│ │ └── ic_sync_black_24dp.png
│ │ ├── drawable-xxxhdpi
│ │ ├── ic_info_black_24dp.png
│ │ ├── ic_notifications_black_24dp.png
│ │ └── ic_sync_black_24dp.png
│ │ ├── drawable
│ │ ├── category_bg.xml
│ │ ├── circle_button.xml
│ │ ├── cyan_circle.xml
│ │ ├── empty_dot.xml
│ │ ├── green_circle.xml
│ │ ├── grey_circle.xml
│ │ ├── ic_about_24dp.xml
│ │ ├── ic_archive_24dp.xml
│ │ ├── ic_archive_done_24dp.xml
│ │ ├── ic_archived_24dp.xml
│ │ ├── ic_arrow_drop_down_circle_24dp.xml
│ │ ├── ic_arrow_forward_24dp.xml
│ │ ├── ic_automobile_24dp.xml
│ │ ├── ic_book_24dp.xml
│ │ ├── ic_business_24dp.xml
│ │ ├── ic_clear_all_24dp.xml
│ │ ├── ic_climate_24dp.xml
│ │ ├── ic_close_24dp.xml
│ │ ├── ic_comics_24dp.xml
│ │ ├── ic_deals_24dp.xml
│ │ ├── ic_delete_24dp.xml
│ │ ├── ic_done_24dp.xml
│ │ ├── ic_done_all_24dp.xml
│ │ ├── ic_economics_24dp.xml
│ │ ├── ic_education_24dp.xml
│ │ ├── ic_entertainment_24dp.xml
│ │ ├── ic_error_24dp.xml
│ │ ├── ic_expand_more_24dp.xml
│ │ ├── ic_fashion_24dp.xml
│ │ ├── ic_feeds_24dp.xml
│ │ ├── ic_finance_24dp.xml
│ │ ├── ic_fitness_24dp.xml
│ │ ├── ic_food_24dp.xml
│ │ ├── ic_gadgets_24dp.xml
│ │ ├── ic_gaming_24dp.xml
│ │ ├── ic_hardware_24dp.xml
│ │ ├── ic_health_24dp.xml
│ │ ├── ic_international_24dp.xml
│ │ ├── ic_launch_24dp.xml
│ │ ├── ic_manage_feeds_24dp.xml
│ │ ├── ic_marketing_24dp.xml
│ │ ├── ic_mood_24dp.xml
│ │ ├── ic_music_24dp.xml
│ │ ├── ic_national_24dp.xml
│ │ ├── ic_nav_archive_24dp.xml
│ │ ├── ic_open_in_browser_24dp.xml
│ │ ├── ic_politics_24dp.xml
│ │ ├── ic_productivity_24dp.xml
│ │ ├── ic_programming_24dp.xml
│ │ ├── ic_refresh_24dp.xml
│ │ ├── ic_reorder_24dp.xml
│ │ ├── ic_research_24dp.xml
│ │ ├── ic_science_24dp.xml
│ │ ├── ic_settings_24dp.xml
│ │ ├── ic_share_24dp.xml
│ │ ├── ic_software_24dp.xml
│ │ ├── ic_space_24dp.xml
│ │ ├── ic_sports_24dp.xml
│ │ ├── ic_sync_24dp.xml
│ │ ├── ic_technology_24dp.xml
│ │ ├── ic_unknown_24dp.xml
│ │ ├── ic_warning_24dp.xml
│ │ ├── lime_circle.xml
│ │ ├── nav_item_bg.xml
│ │ ├── orange_circle.xml
│ │ ├── purple_circle.xml
│ │ ├── red_circle.xml
│ │ ├── sample_circle.xml
│ │ ├── selected_dot.xml
│ │ └── teal_circle.xml
│ │ ├── layout
│ │ ├── activity_about.xml
│ │ ├── activity_article.xml
│ │ ├── activity_home.xml
│ │ ├── activity_settings.xml
│ │ ├── activity_splash.xml
│ │ ├── app_bar_main.xml
│ │ ├── content_about.xml
│ │ ├── content_article.xml
│ │ ├── content_home.xml
│ │ ├── dialog_modify_source.xml
│ │ ├── dialog_ompl_url.xml
│ │ ├── feed_item_card_big.xml
│ │ ├── feed_item_card_small.xml
│ │ ├── feed_item_small.xml
│ │ ├── fragment_archive.xml
│ │ ├── fragment_feeds.xml
│ │ ├── fragment_manage_sources.xml
│ │ ├── fragment_splash.xml
│ │ ├── item_category.xml
│ │ ├── library_item.xml
│ │ ├── nav_header_main.xml
│ │ ├── source_item.xml
│ │ └── spinner_text.xml
│ │ ├── menu
│ │ ├── activity_main_drawer.xml
│ │ ├── menu_about.xml
│ │ ├── menu_article.xml
│ │ ├── menu_feeds.xml
│ │ └── menu_splash.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── transition
│ │ ├── activity_slide.xml
│ │ ├── pull_in_left.xml
│ │ └── push_out_right.xml
│ │ ├── values-v21
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ ├── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── integers.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ │ └── xml
│ │ └── settings.xml
│ └── test
│ └── java
│ └── com
│ └── crazyhitty
│ └── chdev
│ └── ks
│ └── munch
│ └── ExampleUnitTest.java
├── build.gradle
├── change_log.txt
├── curated_feeds.json
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── mindb
├── .gitignore
├── build.gradle
├── mindb.iml
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── crazyhitty
│ │ └── chdev
│ │ └── ks
│ │ └── mindb
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── crazyhitty
│ │ │ └── chdev
│ │ │ └── ks
│ │ │ └── mindb
│ │ │ ├── DatabaseAdapter.java
│ │ │ ├── DatabaseHelper.java
│ │ │ ├── DatabaseOperations.java
│ │ │ └── OnDatabaseListener.java
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── crazyhitty
│ └── chdev
│ └── ks
│ └── mindb
│ └── ExampleUnitTest.java
├── rssmanager
├── .gitignore
├── build.gradle
├── proguard-rules.pro
├── rssmanager.iml
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── crazyhitty
│ │ └── chdev
│ │ └── ks
│ │ └── rssmanager
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── crazyhitty
│ │ │ └── chdev
│ │ │ └── ks
│ │ │ └── rssmanager
│ │ │ ├── OnFeedLoadListener.java
│ │ │ ├── OnRssLoadListener.java
│ │ │ ├── RssItem.java
│ │ │ ├── RssParser.java
│ │ │ └── RssReader.java
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── crazyhitty
│ └── chdev
│ └── ks
│ └── rssmanager
│ └── ExampleUnitTest.java
├── screenshots
├── 1.png
├── 2.png
├── 3.png
├── 4.png
├── 5.png
└── 6.png
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | /captures
8 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | Munch
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Kartik Sharma
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Munch.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #Munch
2 | A minimalistic, easy to use Rss reader application.
3 |
4 |
5 |
7 |
8 | [](http://android-arsenal.com/details/3/2955)
9 |
10 | #What is Munch ?
11 | Munch is an android app which enable the users to manage their Rss feeds. User can add new sources, manage them and view the article associated with the feeds.
12 |
13 | #Permissions:
14 | * Internet
15 | * Access Network State
16 | * Read External Storage
17 |
18 | These permissions are used to grab the data from the web and to know if user’s internet is available or not so that he can be notified regarding that matter. The Read External Storage permissions is used to retrieve the opml files from either SD card or internal storage. Also, this app will never snoop on your personal information.
19 |
20 | #Application features:
21 | * Load Rss feeds quickly
22 | * Add Rss Sources
23 | * Manage Rss Sources
24 | * Archive feeds
25 | * Customizable settings
26 | * Ad free
27 |
28 | #How does Munch work ?
29 | Munch uses jsoup xml parser to parse rss feeds and also load the web articles associated with those feeds. It also uses glide to lazy load article images(if available).
30 |
31 | #Screenshots
32 | 
33 | 
34 | 
35 | 
36 | 
37 | 
38 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/app-release.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/app-release.apk
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | applicationId "com.crazyhitty.chdev.ks.munch"
9 | minSdkVersion 15
10 | targetSdkVersion 23
11 | versionCode 14
12 | versionName "0.44"
13 | vectorDrawables.useSupportLibrary = true
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | }
22 |
23 | repositories {
24 | jcenter()
25 | mavenCentral()
26 | maven { url "https://jitpack.io" }
27 | }
28 |
29 | dependencies {
30 | compile fileTree(dir: 'libs', include: ['*.jar'])
31 | testCompile 'junit:junit:4.12'
32 | compile('com.github.afollestad.material-dialogs:commons:0.8.5.6@aar') {
33 | transitive = true
34 | }
35 | compile('com.github.ozodrukh:CircularReveal:1.1.1@aar') {
36 | transitive = true;
37 | }
38 | compile project(':mindb')
39 | compile project(':rssmanager')
40 | compile 'com.android.support:appcompat-v7:23.2.0'
41 | compile 'com.android.support:support-v4:23.2.0'
42 | compile 'com.android.support:design:23.2.0'
43 | compile 'com.android.support:recyclerview-v7:23.2.0'
44 | compile 'com.android.support:cardview-v7:23.2.0'
45 | compile 'com.jakewharton:butterknife:7.0.1'
46 | compile 'com.github.clans:fab:1.6.1'
47 | compile 'com.rengwuxian.materialedittext:library:2.1.4'
48 | compile 'com.github.bumptech.glide:glide:3.6.1'
49 | compile 'org.jsoup:jsoup:1.7.2'
50 | compile 'com.squareup.okhttp3:okhttp:3.0.0-RC1'
51 | }
52 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\Kartik_ch\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/crazyhitty/chdev/ks/munch/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
33 |
38 |
41 |
42 |
46 |
49 |
50 |
55 |
58 |
59 |
60 |
63 |
64 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/app/src/main/assets/munch_db.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/assets/munch_db.sqlite
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/archive/ArchiveInteractor.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.archive;
2 |
3 | import android.content.Context;
4 |
5 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
6 | import com.crazyhitty.chdev.ks.munch.utils.DatabaseUtil;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Created by Kartik_ch on 12/9/2015.
12 | */
13 | public class ArchiveInteractor implements IArchiveInteractor {
14 | public void retrieveArchiveFromDb(OnArticleRetrievedListener onArticleRetrievedListener, Context context) {
15 | DatabaseUtil databaseUtil = new DatabaseUtil(context);
16 | try {
17 | List feedItems = databaseUtil.getSavedArticles();
18 | onArticleRetrievedListener.onSuccess(feedItems);
19 | } catch (Exception e) {
20 | e.printStackTrace();
21 | onArticleRetrievedListener.onFailure(e.getMessage());
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/archive/ArchivePresenter.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.archive;
2 |
3 | import android.content.Context;
4 |
5 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by Kartik_ch on 12/9/2015.
11 | */
12 | public class ArchivePresenter implements IArchivePresenter, OnArticleRetrievedListener {
13 | private IArchiveView mView;
14 | private ArchiveInteractor mArchiveInteractor;
15 |
16 | public ArchivePresenter(IArchiveView view) {
17 | this.mView = view;
18 | mArchiveInteractor = new ArchiveInteractor();
19 | }
20 |
21 | public void attemptArchiveRetrieval(Context context) {
22 | mArchiveInteractor.retrieveArchiveFromDb(this, context);
23 | }
24 |
25 | @Override
26 | public void onSuccess(List feedItems) {
27 | mView.onArchiveRetrieved(feedItems);
28 | }
29 |
30 | @Override
31 | public void onFailure(String message) {
32 | mView.onArchiveRetrievalFailed(message);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/archive/IArchiveInteractor.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.archive;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * Created by Kartik_ch on 12/9/2015.
7 | */
8 | public interface IArchiveInteractor {
9 | void retrieveArchiveFromDb(OnArticleRetrievedListener onArticleRetrievedListener, Context context);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/archive/IArchivePresenter.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.archive;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * Created by Kartik_ch on 12/9/2015.
7 | */
8 | public interface IArchivePresenter {
9 | void attemptArchiveRetrieval(Context context);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/archive/IArchiveView.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.archive;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by Kartik_ch on 12/9/2015.
9 | */
10 | public interface IArchiveView {
11 | void onArchiveRetrieved(List feedItems);
12 |
13 | void onArchiveRetrievalFailed(String message);
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/archive/OnArticleRetrievedListener.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.archive;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by Kartik_ch on 12/9/2015.
9 | */
10 | public interface OnArticleRetrievedListener {
11 | void onSuccess(List feedItems);
12 |
13 | void onFailure(String message);
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/article/ArticlePresenter.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.article;
2 |
3 | import android.content.Context;
4 |
5 | import com.afollestad.materialdialogs.DialogAction;
6 | import com.afollestad.materialdialogs.MaterialDialog;
7 | import com.crazyhitty.chdev.ks.munch.R;
8 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
9 |
10 | /**
11 | * Created by Kartik_ch on 12/2/2015.
12 | */
13 | public class ArticlePresenter implements IArticlePresenter, OnArticleLoadedListener, OnArticleArchivedListener, OnArticleRemoveListener {
14 | private Context mContext;
15 | private IArticleView mView;
16 | private ArticleInteractor mArticleInteractor;
17 |
18 | public ArticlePresenter(Context context, IArticleView view) {
19 | this.mContext = context;
20 | this.mView = view;
21 | this.mArticleInteractor = new ArticleInteractor();
22 | }
23 |
24 | public void attemptArticleLoading(String url) {
25 | mArticleInteractor.loadArticleAsync(this, mContext, url);
26 | }
27 |
28 | @Override
29 | public void onSuccess(String message, String articleBody) {
30 | mView.onArticleLoaded(articleBody);
31 | }
32 |
33 | @Override
34 | public void onFailure(String message) {
35 | mView.onArticleFailedToLoad(message);
36 | }
37 |
38 | public void archiveArticle(FeedItem feedItem, String article) {
39 | mArticleInteractor.archiveArticleInDb(this, mContext, feedItem, article);
40 | }
41 |
42 | public void removeArticle(FeedItem feedItem) {
43 | final FeedItem feedItemFinal = feedItem;
44 | MaterialDialog removeArticleDialog = new MaterialDialog.Builder(mContext)
45 | .title(R.string.remove_archive)
46 | .content(R.string.remove_archive_content)
47 | .positiveText(R.string.remove)
48 | .negativeText(R.string.cancel)
49 | .onPositive(new MaterialDialog.SingleButtonCallback() {
50 | @Override
51 | public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
52 | //remove this archive from db
53 | mArticleInteractor.deleteArticleInDb(ArticlePresenter.this, mContext, feedItemFinal);
54 | }
55 | }).build();
56 | removeArticleDialog.show();
57 | }
58 |
59 | @Override
60 | public void onArticleSaved(String message) {
61 | mView.onArticleSaved(message);
62 | }
63 |
64 | @Override
65 | public void onArticleSavingFailed(String message) {
66 | mView.onArticleSavingFailed(message);
67 | }
68 |
69 | @Override
70 | public void onArticleDeleted(String message) {
71 | mView.onArticleRemoved(message);
72 | }
73 |
74 | @Override
75 | public void onArticleDeletionFailed(String message) {
76 | mView.onArticleRemovalFailed(message);
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/article/IArticleInteractor.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.article;
2 |
3 | import android.content.Context;
4 |
5 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
6 |
7 | /**
8 | * Created by Kartik_ch on 12/2/2015.
9 | */
10 | public interface IArticleInteractor {
11 | void loadArticleAsync(OnArticleLoadedListener onArticleLoadedListener, Context context, String url);
12 |
13 | void articleLoaded(String articleBody);
14 |
15 | void articleLoadingFailed(String message);
16 |
17 | void archiveArticleInDb(OnArticleArchivedListener onArticleArchivedListener, Context context, FeedItem feedItem, String article);
18 |
19 | void deleteArticleInDb(OnArticleRemoveListener onArticleRemoveListener, Context context, FeedItem feedItem);
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/article/IArticlePresenter.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.article;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
4 |
5 | /**
6 | * Created by Kartik_ch on 12/2/2015.
7 | */
8 | public interface IArticlePresenter {
9 | void attemptArticleLoading(String url);
10 |
11 | void archiveArticle(FeedItem feedItem, String article);
12 |
13 | void removeArticle(FeedItem feedItem);
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/article/IArticleView.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.article;
2 |
3 | /**
4 | * Created by Kartik_ch on 12/2/2015.
5 | */
6 | public interface IArticleView {
7 | void onArticleLoaded(String article);
8 |
9 | void onArticleFailedToLoad(String message);
10 |
11 | void onArticleSaved(String message);
12 |
13 | void onArticleSavingFailed(String message);
14 |
15 | void onArticleRemoved(String message);
16 |
17 | void onArticleRemovalFailed(String message);
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/article/OnArticleArchivedListener.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.article;
2 |
3 | /**
4 | * Created by Kartik_ch on 12/9/2015.
5 | */
6 | public interface OnArticleArchivedListener {
7 | void onArticleSaved(String message);
8 |
9 | void onArticleSavingFailed(String message);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/article/OnArticleLoadedListener.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.article;
2 |
3 | /**
4 | * Created by Kartik_ch on 12/2/2015.
5 | */
6 | public interface OnArticleLoadedListener {
7 | void onSuccess(String message, String articleBody);
8 |
9 | void onFailure(String message);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/article/OnArticleRemoveListener.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.article;
2 |
3 | /**
4 | * Created by Kartik_ch on 12/15/2015.
5 | */
6 | public interface OnArticleRemoveListener {
7 | void onArticleDeleted(String message);
8 |
9 | void onArticleDeletionFailed(String message);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/curatedfeeds/CuratedFeedsPresenter.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.curatedfeeds;
2 |
3 | import android.content.Context;
4 |
5 | import com.crazyhitty.chdev.ks.munch.models.SourceItem;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by Kartik_ch on 1/3/2016.
11 | */
12 | public class CuratedFeedsPresenter implements ICuratedFeedsPresenter, OnCuratedFeedsRetrievedListener {
13 | private ICuratedFeedsView mView;
14 |
15 | public CuratedFeedsPresenter(ICuratedFeedsView mView) {
16 | this.mView = mView;
17 | }
18 |
19 | public void attemptCuratedFeedsLoading(Context context) {
20 | CuratedFeedsInteractor curatedFeedsInteractor = new CuratedFeedsInteractor();
21 | curatedFeedsInteractor.fetchCuratedFeedsFromServer(this, context);
22 | }
23 |
24 | @Override
25 | public void onSuccess(List sourceItems) {
26 | mView.onFeedsLoaded(sourceItems);
27 | }
28 |
29 | @Override
30 | public void onFailure(String message) {
31 | mView.onFeedsLoadingFailure(message);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/curatedfeeds/ICuratedFeedsInteractor.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.curatedfeeds;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * Created by Kartik_ch on 1/3/2016.
7 | */
8 | public interface ICuratedFeedsInteractor {
9 | void fetchCuratedFeedsFromServer(OnCuratedFeedsRetrievedListener onCuratedFeedsRetrievedListener, Context context);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/curatedfeeds/ICuratedFeedsPresenter.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.curatedfeeds;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * Created by Kartik_ch on 1/3/2016.
7 | */
8 | public interface ICuratedFeedsPresenter {
9 | void attemptCuratedFeedsLoading(Context context);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/curatedfeeds/ICuratedFeedsView.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.curatedfeeds;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.SourceItem;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by Kartik_ch on 1/3/2016.
9 | */
10 | public interface ICuratedFeedsView {
11 | void onFeedsLoaded(List sourceItems);
12 |
13 | void onFeedsLoadingFailure(String message);
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/curatedfeeds/OnCuratedFeedsRetrievedListener.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.curatedfeeds;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.SourceItem;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by Kartik_ch on 1/3/2016.
9 | */
10 | public interface OnCuratedFeedsRetrievedListener {
11 | void onSuccess(List sourceItems);
12 |
13 | void onFailure(String message);
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/feeds/IFeedsLoaderInteractor.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.feeds;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.SourceItem;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by Kartik_ch on 11/5/2015.
9 | */
10 | public interface IFeedsLoaderInteractor {
11 | void loadFeedsFromDb(final OnFeedsLoadedListener onFeedsLoadedListener);
12 |
13 | void loadFeedsFromDbBySource(final OnFeedsLoadedListener onFeedsLoadedListener, String source);
14 |
15 | void loadFeedsAsync(OnFeedsLoadedListener onFeedsLoadedListener, List sourceItems);
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/feeds/IFeedsPresenter.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.feeds;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
4 |
5 | /**
6 | * Created by Kartik_ch on 11/4/2015.
7 | */
8 | public interface IFeedsPresenter {
9 | void attemptFeedLoading();
10 |
11 | void attemptFeedLoading(String source);
12 |
13 | void attemptFeedLoadingFromDb();
14 |
15 | void attemptFeedLoadingFromDbBySource(String source);
16 |
17 | void deleteFeeds();
18 |
19 | void deleteSelectedFeed(FeedItem feedItem);
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/feeds/IFeedsView.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.feeds;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by Kartik_ch on 11/4/2015.
9 | */
10 | public interface IFeedsView {
11 | void feedsLoaded(List feedItems);
12 |
13 | void loadingFailed(String message);
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/feeds/OnFeedsLoadedListener.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.feeds;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by Kartik_ch on 11/5/2015.
9 | */
10 | public interface OnFeedsLoadedListener {
11 | void onSuccess(List feedItems, boolean loadedNewFeeds);
12 |
13 | void onFailure(String message);
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/importopml/IImportOpmlInteractor.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.importopml;
2 |
3 | import android.content.Context;
4 |
5 | import java.io.File;
6 |
7 | /**
8 | * Created by Kartik_ch on 1/8/2016.
9 | */
10 | public interface IImportOpmlInteractor {
11 | void retrieveFeed(OnOpmlImportListener onOpmlImportListener, Context context, String url);
12 |
13 | void retrieveFeeds(OnOpmlImportListener onOpmlImportListener, Context context, File file);
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/importopml/IImportOpmlPresenter.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.importopml;
2 |
3 | /**
4 | * Created by Kartik_ch on 1/8/2016.
5 | */
6 | public interface IImportOpmlPresenter {
7 | void attemptFeedsRetrievalFromOpml(boolean isUrl);
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/importopml/IImportOpmlView.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.importopml;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.SourceItem;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by Kartik_ch on 1/9/2016.
9 | */
10 | public interface IImportOpmlView {
11 | void opmlFeedsRetrieved(List sourceItems);
12 |
13 | void opmlFeedsRetrievalFailed(String message);
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/importopml/OnOpmlImportListener.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.importopml;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.SourceItem;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by Kartik_ch on 1/9/2016.
9 | */
10 | public interface OnOpmlImportListener {
11 | void onSuccess(List sourceItems);
12 |
13 | void onFailure(String message);
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/models/CategoryItem.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.models;
2 |
3 | import android.graphics.drawable.Drawable;
4 |
5 | /**
6 | * Created by Kartik_ch on 11/11/2015.
7 | */
8 | public class CategoryItem {
9 | private String categoryName;
10 | private Drawable categoryImg;
11 |
12 | public String getCategoryName() {
13 | return categoryName;
14 | }
15 |
16 | public void setCategoryName(String categoryName) {
17 | this.categoryName = categoryName;
18 | }
19 |
20 | public Drawable getCategoryImg() {
21 | return categoryImg;
22 | }
23 |
24 | public void setCategoryImg(Drawable categoryImg) {
25 | this.categoryImg = categoryImg;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/models/FeedItem.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.models;
2 |
3 | /**
4 | * Created by Kartik_ch on 11/5/2015.
5 | */
6 | public class FeedItem {
7 | private String itemTitle, itemDesc, itemSourceUrl, itemLink, itemImgUrl, itemCategory, itemSource, itemPubDate, itemWebDesc, itemWebDescSync;
8 | private int itemCategoryImgId, itemBgId;
9 |
10 | public String getItemTitle() {
11 | if (itemTitle == null) {
12 | return "";
13 | }
14 | return itemTitle;
15 | }
16 |
17 | public void setItemTitle(String itemTitle) {
18 | this.itemTitle = itemTitle;
19 | }
20 |
21 | public String getItemDesc() {
22 | if (itemDesc == null) {
23 | return "";
24 | }
25 | return itemDesc;
26 | }
27 |
28 | public void setItemDesc(String itemDesc) {
29 | this.itemDesc = itemDesc;
30 | }
31 |
32 | public String getItemSourceUrl() {
33 | if (itemSourceUrl == null) {
34 | return "";
35 | }
36 | return itemSourceUrl;
37 | }
38 |
39 | public void setItemSourceUrl(String itemSourceUrl) {
40 | this.itemSourceUrl = itemSourceUrl;
41 | }
42 |
43 | public String getItemLink() {
44 | if (itemLink == null) {
45 | return "";
46 | }
47 | return itemLink;
48 | }
49 |
50 | public void setItemLink(String itemLink) {
51 | this.itemLink = itemLink;
52 | }
53 |
54 | public String getItemImgUrl() {
55 | if (itemImgUrl == null) {
56 | return "";
57 | }
58 | return itemImgUrl;
59 | }
60 |
61 | public void setItemImgUrl(String itemImgUrl) {
62 | this.itemImgUrl = itemImgUrl;
63 | }
64 |
65 | public String getItemCategory() {
66 | if (itemCategory == null) {
67 | return "";
68 | }
69 | return itemCategory;
70 | }
71 |
72 | public void setItemCategory(String itemCategory) {
73 | this.itemCategory = itemCategory;
74 | }
75 |
76 | public String getItemSource() {
77 | if (itemSource == null) {
78 | return "";
79 | }
80 | return itemSource;
81 | }
82 |
83 | public void setItemSource(String itemSource) {
84 | this.itemSource = itemSource;
85 | }
86 |
87 | public String getItemPubDate() {
88 | if (itemPubDate == null) {
89 | return "";
90 | }
91 | return itemPubDate;
92 | }
93 |
94 | public void setItemPubDate(String itemPubDate) {
95 | this.itemPubDate = itemPubDate;
96 | }
97 |
98 | public int getItemCategoryImgId() {
99 | return itemCategoryImgId;
100 | }
101 |
102 | public void setItemCategoryImgId(int itemCategoryImgId) {
103 | this.itemCategoryImgId = itemCategoryImgId;
104 | }
105 |
106 | public int getItemBgId() {
107 | return itemBgId;
108 | }
109 |
110 | public void setItemBgId(int itemBgId) {
111 | this.itemBgId = itemBgId;
112 | }
113 |
114 | public String getItemWebDesc() {
115 | return itemWebDesc;
116 | }
117 |
118 | public void setItemWebDesc(String itemWebDesc) {
119 | this.itemWebDesc = itemWebDesc;
120 | }
121 |
122 | public String getItemWebDescSync() {
123 | return itemWebDescSync;
124 | }
125 |
126 | public void setItemWebDescSync(String itemWebDescSync) {
127 | this.itemWebDescSync = itemWebDescSync;
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/models/LibraryItem.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.models;
2 |
3 | import android.content.Context;
4 |
5 | import com.crazyhitty.chdev.ks.munch.R;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | /**
11 | * Created by Kartik_ch on 12/20/2015.
12 | */
13 | public class LibraryItem {
14 | private String name, creator, desc, link;
15 |
16 | public List getLibraryItems(Context context) {
17 | List libraryItems = new ArrayList<>();
18 |
19 | String[] libraryNames = context.getResources().getStringArray(R.array.library_names);
20 | String[] libraryCreators = context.getResources().getStringArray(R.array.library_creators);
21 | String[] libraryLinks = context.getResources().getStringArray(R.array.library_links);
22 | String[] libraryDescs = context.getResources().getStringArray(R.array.library_descs);
23 |
24 | for (int i = 0; i < libraryNames.length; i++) {
25 | LibraryItem libraryItem = new LibraryItem();
26 | libraryItem.setName(libraryNames[i]);
27 | libraryItem.setCreator(libraryCreators[i]);
28 | libraryItem.setLink(libraryLinks[i]);
29 | libraryItem.setDesc(libraryDescs[i]);
30 | libraryItems.add(libraryItem);
31 | }
32 |
33 | return libraryItems;
34 | }
35 |
36 | public String getName() {
37 | return name;
38 | }
39 |
40 | public void setName(String name) {
41 | this.name = name;
42 | }
43 |
44 | public String getCreator() {
45 | return creator;
46 | }
47 |
48 | public void setCreator(String creator) {
49 | this.creator = creator;
50 | }
51 |
52 | public String getDesc() {
53 | return desc;
54 | }
55 |
56 | public void setDesc(String desc) {
57 | this.desc = desc;
58 | }
59 |
60 | public String getLink() {
61 | return link;
62 | }
63 |
64 | public void setLink(String link) {
65 | this.link = link;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/models/SourceItem.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.models;
2 |
3 | /**
4 | * Created by Kartik_ch on 11/7/2015.
5 | */
6 | public class SourceItem {
7 | private String sourceName, sourceUrl, sourceCategoryName, sourceDateAdded;
8 | private int sourceCategoryImgId;
9 |
10 | public int getSourceCategoryImgId() {
11 | return sourceCategoryImgId;
12 | }
13 |
14 | public void setSourceCategoryImgId(int sourceCategoryImgId) {
15 | this.sourceCategoryImgId = sourceCategoryImgId;
16 | }
17 |
18 | public String getSourceName() {
19 | return sourceName;
20 | }
21 |
22 | public void setSourceName(String sourceName) {
23 | this.sourceName = sourceName;
24 | }
25 |
26 | public String getSourceUrl() {
27 | return sourceUrl;
28 | }
29 |
30 | public void setSourceUrl(String sourceUrl) {
31 | this.sourceUrl = sourceUrl;
32 | }
33 |
34 | public String getSourceDateAdded() {
35 | return sourceDateAdded;
36 | }
37 |
38 | public void setSourceDateAdded(String sourceDateAdded) {
39 | this.sourceDateAdded = sourceDateAdded;
40 | }
41 |
42 | public String getSourceCategoryName() {
43 | return sourceCategoryName;
44 | }
45 |
46 | public void setSourceCategoryName(String sourceCategoryName) {
47 | this.sourceCategoryName = sourceCategoryName;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/receivers/SyncArticlesReceiver.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.receivers;
2 |
3 | import android.app.NotificationManager;
4 | import android.content.BroadcastReceiver;
5 | import android.content.Context;
6 | import android.content.Intent;
7 |
8 | import com.crazyhitty.chdev.ks.munch.services.SyncArticlesIntentService;
9 |
10 | public class SyncArticlesReceiver extends BroadcastReceiver {
11 | public SyncArticlesReceiver() {
12 | }
13 |
14 | @Override
15 | public void onReceive(Context context, Intent intent) {
16 | int notificationId = intent.getIntExtra("notificationId", 0);
17 |
18 | //Cancel the notification
19 | NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
20 | manager.cancel(notificationId);
21 |
22 | SyncArticlesIntentService.STATUS = false;
23 |
24 | //Stop the service
25 | context.stopService(new Intent(context, SyncArticlesIntentService.class));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/sources/ISourceInteractor.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.sources;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.SourceItem;
4 |
5 | /**
6 | * Created by Kartik_ch on 11/8/2015.
7 | */
8 | public interface ISourceInteractor {
9 | void addSourceToDb(OnSourceSavedListener onSourceSavedListener, SourceItem sourceItem);
10 |
11 | void getSourcesFromDb(OnSourcesLoadedListener onSourcesLoadedListener);
12 |
13 | void getSourceItemsFromDb(OnSourcesLoadedListener onSourcesLoadedListener);
14 |
15 | void editSourceItemInDb(OnSourcesModifyListener onSourcesModifyListener, SourceItem sourceItem, String sourceNameOld);
16 |
17 | void deleteSourceItemFromDb(OnSourcesModifyListener onSourcesModifyListener, SourceItem sourceItem);
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/sources/ISourcePresenter.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.sources;
2 |
3 | import android.content.Context;
4 |
5 | import com.crazyhitty.chdev.ks.munch.models.SourceItem;
6 |
7 | /**
8 | * Created by Kartik_ch on 11/7/2015.
9 | */
10 | public interface ISourcePresenter {
11 | void addSource(SourceItem sourceItem);
12 |
13 | void getSources();
14 |
15 | void getSourceItems();
16 |
17 | void modifySources(Context context, SourceItem sourceItem);
18 |
19 | void deleteSource(SourceItem sourceItem);
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/sources/ISourceView.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.sources;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.SourceItem;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by Kartik_ch on 11/8/2015.
9 | */
10 | public interface ISourceView {
11 | void dataSourceSaved(String message);
12 |
13 | void dataSourceSaveFailed(String message);
14 |
15 | void dataSourceLoaded(List sourceNames);
16 |
17 | void dataSourceItemsLoaded(List sourceItems);
18 |
19 | void dataSourceLoadingFailed(String message);
20 |
21 | void sourceItemModified(SourceItem sourceItem, String oldName);
22 |
23 | void sourceItemModificationFailed(String message);
24 |
25 | void sourceItemDeleted(SourceItem sourceItem);
26 |
27 | void sourceItemDeletionFailed(String message);
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/sources/OnSourceSavedListener.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.sources;
2 |
3 | /**
4 | * Created by Kartik_ch on 11/7/2015.
5 | */
6 | public interface OnSourceSavedListener {
7 | void onSuccess(String message);
8 |
9 | void onFailure(String message);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/sources/OnSourcesLoadedListener.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.sources;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.SourceItem;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by Kartik_ch on 11/18/2015.
9 | */
10 | public interface OnSourcesLoadedListener {
11 | void onSourceLoaded(List sourceNames);
12 |
13 | void onSourceItemsLoaded(List sourceItems);
14 |
15 | void onSourceLoadingFailed(String message);
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/sources/OnSourcesModifyListener.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.sources;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.SourceItem;
4 |
5 | /**
6 | * Created by Kartik_ch on 12/12/2015.
7 | */
8 | public interface OnSourcesModifyListener {
9 | void onSourceModified(SourceItem sourceItem, String oldName);
10 |
11 | void onSourceModifiedFailed(String message);
12 |
13 | void onSourceDeleted(SourceItem sourceItem);
14 |
15 | void onSourceDeletionFailed(String message);
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/ui/activities/SplashActivity.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.ui.activities;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v4.view.ViewPager;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.WindowManager;
8 | import android.widget.ImageButton;
9 |
10 | import com.crazyhitty.chdev.ks.munch.R;
11 | import com.crazyhitty.chdev.ks.munch.models.SettingsPreferences;
12 | import com.crazyhitty.chdev.ks.munch.ui.adapters.SplashPagerAdapter;
13 | import com.crazyhitty.chdev.ks.munch.utils.FadePageTransformerUtil;
14 |
15 | import butterknife.Bind;
16 | import butterknife.ButterKnife;
17 | import butterknife.OnClick;
18 |
19 | public class SplashActivity extends AppCompatActivity implements ViewPager.OnPageChangeListener {
20 |
21 | @Bind(R.id.container)
22 | ViewPager viewPager;
23 | @Bind(R.id.image_button_next)
24 | ImageButton imgBtnNext;
25 |
26 | private SplashPagerAdapter mSplashPagerAdapter;
27 |
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 |
32 | this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
33 |
34 | runOnce();
35 |
36 | setContentView(R.layout.activity_splash);
37 |
38 | ButterKnife.bind(this);
39 |
40 | // Create the adapter that will return a fragment for each of the three
41 | // primary sections of the activity.
42 | mSplashPagerAdapter = new SplashPagerAdapter(getSupportFragmentManager());
43 | viewPager.setAdapter(mSplashPagerAdapter);
44 | viewPager.setOffscreenPageLimit(3);
45 | //set page transformer
46 | viewPager.setPageTransformer(false, new FadePageTransformerUtil());
47 |
48 | viewPager.addOnPageChangeListener(this);
49 | }
50 |
51 | private void runOnce() {
52 | if (!SettingsPreferences.isNewInstall(SplashActivity.this)) {
53 | runIntent(HomeActivity.class);
54 | finish();
55 | }
56 | }
57 |
58 | @Override
59 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
60 |
61 | }
62 |
63 | @Override
64 | public void onPageSelected(int position) {
65 | switch (position) {
66 | case 0:
67 | imgBtnNext.setImageResource(R.drawable.ic_arrow_forward_24dp);
68 | break;
69 | case 1:
70 | imgBtnNext.setImageResource(R.drawable.ic_arrow_forward_24dp);
71 | break;
72 | case 2:
73 | imgBtnNext.setImageResource(R.drawable.ic_done_24dp);
74 | break;
75 | }
76 | }
77 |
78 | @Override
79 | public void onPageScrollStateChanged(int state) {
80 |
81 | }
82 |
83 | @OnClick(R.id.image_button_next)
84 | public void OnNext() {
85 | if (viewPager.getCurrentItem() == 2) {
86 | SettingsPreferences.setNewInstall(SplashActivity.this);
87 | runIntent(HomeActivity.class);
88 | finish();
89 | } else if (viewPager.getCurrentItem() < 2) {
90 | viewPager.setCurrentItem(viewPager.getCurrentItem() + 1, true);
91 | }
92 | }
93 |
94 | private void runIntent(Class resultActivity) {
95 | Intent intent = new Intent(SplashActivity.this, resultActivity);
96 | startActivity(intent);
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/ui/adapters/CategoryListAdapter.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.ui.adapters;
2 |
3 | import android.content.Context;
4 | import android.support.v4.content.ContextCompat;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.BaseAdapter;
9 | import android.widget.ImageView;
10 | import android.widget.TextView;
11 |
12 | import com.crazyhitty.chdev.ks.munch.R;
13 | import com.crazyhitty.chdev.ks.munch.models.CategoryItem;
14 | import com.crazyhitty.chdev.ks.munch.models.SettingsPreferences;
15 |
16 | import java.util.List;
17 |
18 | /**
19 | * Created by Kartik_ch on 11/11/2015.
20 | */
21 | public class CategoryListAdapter extends BaseAdapter {
22 |
23 | private Context mContext;
24 | private List mCategoryItems;
25 |
26 | public CategoryListAdapter(Context mContext, List mCategoryItems) {
27 | this.mContext = mContext;
28 | this.mCategoryItems = mCategoryItems;
29 | }
30 |
31 | @Override
32 | public int getCount() {
33 | return mCategoryItems.size();
34 | }
35 |
36 | @Override
37 | public Object getItem(int i) {
38 | return null;
39 | }
40 |
41 | @Override
42 | public long getItemId(int i) {
43 | return 0;
44 | }
45 |
46 | @Override
47 | public View getView(int i, View view, ViewGroup viewGroup) {
48 | View itemView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_category, viewGroup, false);
49 | TextView txtCategoryName = (TextView) itemView.findViewById(R.id.text_view_category);
50 | ImageView imgCategory = (ImageView) itemView.findViewById(R.id.image_view_category);
51 |
52 | txtCategoryName.setText(mCategoryItems.get(i).getCategoryName());
53 | imgCategory.setImageDrawable(mCategoryItems.get(i).getCategoryImg());
54 |
55 | //add a white color filter to the images if dark theme is selected
56 | if (!SettingsPreferences.THEME) {
57 | txtCategoryName.setTextColor(ContextCompat.getColor(viewGroup.getContext(), R.color.md_grey_100));
58 | imgCategory.setColorFilter(ContextCompat.getColor(viewGroup.getContext(), R.color.md_grey_100));
59 | }
60 |
61 | return itemView;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/ui/adapters/LibrariesRecyclerViewAdapter.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.ui.adapters;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.TextView;
9 |
10 | import com.crazyhitty.chdev.ks.munch.R;
11 | import com.crazyhitty.chdev.ks.munch.models.LibraryItem;
12 | import com.crazyhitty.chdev.ks.munch.models.SettingsPreferences;
13 | import com.crazyhitty.chdev.ks.munch.utils.WebsiteIntentUtil;
14 |
15 | import java.util.List;
16 |
17 | /**
18 | * Created by Kartik_ch on 12/20/2015.
19 | */
20 | public class LibrariesRecyclerViewAdapter extends RecyclerView.Adapter {
21 | private Context mContext;
22 | private List mLibraryItems;
23 |
24 | public LibrariesRecyclerViewAdapter(Context mContext, List mLibraryItems) {
25 | this.mContext = mContext;
26 | this.mLibraryItems = mLibraryItems;
27 | }
28 |
29 | @Override
30 | public LibrariesRecyclerViewAdapter.LibrariesViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
31 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.library_item, parent, false);
32 | LibrariesViewHolder librariesViewHolder = new LibrariesViewHolder(view);
33 | return librariesViewHolder;
34 | }
35 |
36 | @Override
37 | public void onBindViewHolder(LibrariesRecyclerViewAdapter.LibrariesViewHolder holder, int position) {
38 | holder.mTxtLibraryTitle.setText(mLibraryItems.get(position).getName());
39 | holder.mTxtLibraryCreator.setText(mLibraryItems.get(position).getCreator());
40 | holder.mTxtLibraryDesc.setText(mLibraryItems.get(position).getDesc());
41 | }
42 |
43 | @Override
44 | public int getItemCount() {
45 | return mLibraryItems.size();
46 | }
47 |
48 | public class LibrariesViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
49 | private TextView mTxtLibraryTitle, mTxtLibraryCreator, mTxtLibraryDesc;
50 |
51 | public LibrariesViewHolder(View itemView) {
52 | super(itemView);
53 | mTxtLibraryTitle = (TextView) itemView.findViewById(R.id.text_view_library_title);
54 | mTxtLibraryCreator = (TextView) itemView.findViewById(R.id.text_view_library_creator);
55 | mTxtLibraryDesc = (TextView) itemView.findViewById(R.id.text_view_library_desc);
56 | itemView.setOnClickListener(this);
57 | }
58 |
59 | @Override
60 | public void onClick(View view) {
61 | if (SettingsPreferences.IN_APP_BROWSER) {
62 | new WebsiteIntentUtil(mContext).loadCustomChromeTabs(mLibraryItems.get(getAdapterPosition()).getLink());
63 | } else {
64 | new WebsiteIntentUtil(mContext).loadNormalBrowser(mLibraryItems.get(getAdapterPosition()).getLink());
65 | }
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/ui/adapters/SplashPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.ui.adapters;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentManager;
5 | import android.support.v4.app.FragmentPagerAdapter;
6 |
7 | import com.crazyhitty.chdev.ks.munch.ui.fragments.SplashFragment;
8 |
9 | /**
10 | * Created by Kartik_ch on 12/17/2015.
11 | */
12 | public class SplashPagerAdapter extends FragmentPagerAdapter {
13 |
14 | public SplashPagerAdapter(FragmentManager fm) {
15 | super(fm);
16 | }
17 |
18 | @Override
19 | public Fragment getItem(int position) {
20 | // getItem is called to instantiate the fragment for the given page.
21 | // Return a PlaceholderFragment (defined as a static inner class below).
22 | return SplashFragment.newInstance(position + 1);
23 | }
24 |
25 | @Override
26 | public int getCount() {
27 | // Show 3 total pages.
28 | return 3;
29 | }
30 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/ui/fragments/ArchiveFragment.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.ui.fragments;
2 |
3 | import android.os.Bundle;
4 | import android.os.Handler;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.support.v7.widget.LinearLayoutManager;
8 | import android.support.v7.widget.RecyclerView;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.LinearLayout;
13 | import android.widget.Toast;
14 |
15 | import com.crazyhitty.chdev.ks.munch.R;
16 | import com.crazyhitty.chdev.ks.munch.archive.ArchivePresenter;
17 | import com.crazyhitty.chdev.ks.munch.archive.IArchiveView;
18 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
19 | import com.crazyhitty.chdev.ks.munch.ui.adapters.FeedsRecyclerViewAdapter;
20 | import com.crazyhitty.chdev.ks.munch.utils.FadeAnimationUtil;
21 |
22 | import java.util.List;
23 |
24 | import butterknife.Bind;
25 | import butterknife.ButterKnife;
26 |
27 | /**
28 | * Created by Kartik_ch on 12/9/2015.
29 | */
30 | public class ArchiveFragment extends Fragment implements IArchiveView {
31 |
32 | @Bind(R.id.linear_layout_empty_archive)
33 | LinearLayout linearLayoutEmptyArchive;
34 | @Bind(R.id.recycler_view_feeds)
35 | RecyclerView recyclerViewFeeds;
36 |
37 | private ArchivePresenter mArchivePresenter;
38 | private RecyclerView.LayoutManager mLayoutManager;
39 | private FeedsRecyclerViewAdapter mFeedsRecyclerViewAdapter;
40 |
41 | @Nullable
42 | @Override
43 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
44 | View view = inflater.inflate(R.layout.fragment_archive, container, false);
45 | ButterKnife.bind(this, view);
46 | return view;
47 | }
48 |
49 | @Override
50 | public void onActivityCreated(@Nullable Bundle savedInstanceState) {
51 | super.onActivityCreated(savedInstanceState);
52 | if (mArchivePresenter == null) {
53 | mArchivePresenter = new ArchivePresenter(this);
54 | }
55 |
56 | new Handler().postDelayed(new Runnable() {
57 | @Override
58 | public void run() {
59 | mArchivePresenter.attemptArchiveRetrieval(getActivity());
60 | }
61 | }, 500);
62 |
63 | // use this setting to improve performance if you know that changes
64 | // in content do not change the layout size of the RecyclerView
65 | //recyclerViewFeeds.setHasFixedSize(true);
66 |
67 | // use a linear layout manager
68 | mLayoutManager = new LinearLayoutManager(getActivity());
69 | recyclerViewFeeds.setLayoutManager(mLayoutManager);
70 | }
71 |
72 | @Override
73 | public void onArchiveRetrieved(List feedItems) {
74 | if (feedItems.size() == 0) {
75 | new FadeAnimationUtil(getActivity()).fadeInAlpha(linearLayoutEmptyArchive, 500);
76 | } else {
77 | linearLayoutEmptyArchive.setVisibility(View.INVISIBLE);
78 | }
79 |
80 | mFeedsRecyclerViewAdapter = new FeedsRecyclerViewAdapter(getActivity(), feedItems);
81 | recyclerViewFeeds.setAdapter(mFeedsRecyclerViewAdapter);
82 | }
83 |
84 | @Override
85 | public void onArchiveRetrievalFailed(String message) {
86 | Toast.makeText(getActivity(), "Error:\n" + message, Toast.LENGTH_SHORT).show();
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/ui/views/CustomCheckBoxListPreferenceDialog.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.ui.views;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.preference.MultiSelectListPreference;
6 | import android.preference.Preference;
7 | import android.preference.PreferenceManager;
8 | import android.util.AttributeSet;
9 | import android.util.Log;
10 | import android.widget.Toast;
11 |
12 | import com.crazyhitty.chdev.ks.munch.R;
13 | import com.crazyhitty.chdev.ks.munch.curatedfeeds.CuratedFeedsPresenter;
14 | import com.crazyhitty.chdev.ks.munch.curatedfeeds.ICuratedFeedsView;
15 | import com.crazyhitty.chdev.ks.munch.models.SourceItem;
16 |
17 | import java.util.List;
18 | import java.util.Set;
19 |
20 | /**
21 | * Created by Kartik_ch on 12/29/2015.
22 | */
23 | public class CustomCheckBoxListPreferenceDialog extends MultiSelectListPreference implements ICuratedFeedsView, Preference.OnPreferenceClickListener {
24 | private CuratedFeedsPresenter mCuratedFeedsPresenter;
25 |
26 | public CustomCheckBoxListPreferenceDialog(Context context, AttributeSet attrs) {
27 | super(context, attrs);
28 |
29 | setOnPreferenceClickListener(this);
30 | if (mCuratedFeedsPresenter == null) {
31 | mCuratedFeedsPresenter = new CuratedFeedsPresenter(this);
32 | }
33 |
34 | mCuratedFeedsPresenter.attemptCuratedFeedsLoading(getContext());
35 | }
36 |
37 | @Override
38 | public void onFeedsLoaded(List sourceItems) {
39 | Toast.makeText(getContext(), "SourceItem: " + sourceItems.size(), Toast.LENGTH_SHORT).show();
40 |
41 | CharSequence[] sources = new CharSequence[sourceItems.size()];
42 | for (int i = 0; i < sourceItems.size(); i++) {
43 | sources[i] = sourceItems.get(i).getSourceName();
44 | Log.e("Source " + i, String.valueOf(sources[i]));
45 | }
46 |
47 | setEntries(sources);
48 | setEntryValues(sources);
49 | }
50 |
51 | @Override
52 | public void onFeedsLoadingFailure(String message) {
53 | Toast.makeText(getContext(), "Error:\n" + message, Toast.LENGTH_SHORT).show();
54 | }
55 |
56 | @Override
57 | public boolean onPreferenceClick(Preference preference) {
58 | return false;
59 | }
60 |
61 | @Override
62 | public OnPreferenceChangeListener getOnPreferenceChangeListener() {
63 | String curatedFeedsKey = getContext().getResources().getString(R.string.perf_curated_feeds_import_key);
64 | SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
65 | Set selections = sharedPrefs.getStringSet(curatedFeedsKey, null);
66 | for (String selectedVal : selections) {
67 | Log.e("Selected Values", selectedVal);
68 | }
69 | return super.getOnPreferenceChangeListener();
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/ui/views/CustomListPreferenceDialog.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.ui.views;
2 |
3 | import android.content.Context;
4 | import android.content.DialogInterface;
5 | import android.content.Intent;
6 | import android.preference.ListPreference;
7 | import android.util.AttributeSet;
8 |
9 | import com.crazyhitty.chdev.ks.munch.ui.activities.HomeActivity;
10 |
11 | /**
12 | * Created by Kartik_ch on 12/23/2015.
13 | */
14 | public class CustomListPreferenceDialog extends ListPreference {
15 |
16 | public CustomListPreferenceDialog(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | }
19 |
20 | @Override
21 | public void onClick(DialogInterface dialog, int which) {
22 | super.onClick(dialog, which);
23 | Intent intent = new Intent(getContext(), HomeActivity.class);
24 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
25 | getContext().startActivity(intent);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/ui/views/CustomPreferenceDialog.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.ui.views;
2 |
3 | import android.content.Context;
4 | import android.preference.DialogPreference;
5 | import android.util.AttributeSet;
6 | import android.widget.Toast;
7 |
8 | import com.crazyhitty.chdev.ks.munch.utils.DatabaseUtil;
9 |
10 | /**
11 | * Created by Kartik_ch on 12/16/2015.
12 | */
13 | public class CustomPreferenceDialog extends DialogPreference {
14 | public CustomPreferenceDialog(Context context, AttributeSet attrs) {
15 | super(context, attrs);
16 |
17 | setPositiveButtonText(android.R.string.ok);
18 | setNegativeButtonText(android.R.string.cancel);
19 |
20 | setDialogIcon(null);
21 | }
22 |
23 | @Override
24 | protected void onDialogClosed(boolean positiveResult) {
25 | // When the user selects "OK", persist the new value
26 | if (positiveResult) {
27 | // User selected OK
28 | try {
29 | new DatabaseUtil(getContext()).deleteAll();
30 | Toast.makeText(getContext(), "Database reset", Toast.LENGTH_SHORT).show();
31 | } catch (Exception e) {
32 | e.printStackTrace();
33 | Toast.makeText(getContext(), "Error: " + e.getMessage(), Toast.LENGTH_SHORT).show();
34 | }
35 | } else {
36 | // User selected Cancel
37 | }
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/utils/ColorsUtil.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.utils;
2 |
3 | import com.crazyhitty.chdev.ks.munch.R;
4 |
5 | import java.util.ArrayList;
6 | import java.util.List;
7 | import java.util.Random;
8 |
9 | /**
10 | * Created by Kartik_ch on 12/11/2015.
11 | */
12 | public class ColorsUtil {
13 | private List getColors() {
14 | List colors = new ArrayList<>();
15 | colors.add(R.color.md_cyan_500);
16 | colors.add(R.color.md_green_500);
17 | colors.add(R.color.md_red_500);
18 | colors.add(R.color.md_orange_500);
19 | colors.add(R.color.md_lime_500);
20 | colors.add(R.color.md_teal_500);
21 | colors.add(R.color.md_purple_500);
22 | colors.add(R.color.md_grey_500);
23 | return colors;
24 | }
25 |
26 | public int getRandomColor() {
27 | return getColors().get(getRandomIndex(0, getColors().size() - 1));
28 | }
29 |
30 | private int getRandomIndex(int start, int end) {
31 | Random random = new Random();
32 | return random.nextInt(end - start) + start;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/utils/DateUtil.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.utils;
2 |
3 | import java.text.ParseException;
4 | import java.text.SimpleDateFormat;
5 | import java.util.Date;
6 | import java.util.Locale;
7 |
8 | /**
9 | * Created by Kartik_ch on 11/8/2015.
10 | */
11 | public class DateUtil {
12 | String formatRfc2822 = "EEE, dd MMM yyyy HH:mm:ss Z";
13 | String formatLocal = "EEE, d MMM yyyy";
14 | private String date;
15 |
16 | public String getCurrDate() {
17 | date = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").format(new Date());
18 | return date;
19 | }
20 |
21 | //converts rss publish date into a readable format
22 | public String getDate(String pubDate) throws ParseException {
23 | Date date = getDateObj(pubDate);
24 | return new SimpleDateFormat(formatLocal).format(date);
25 | }
26 |
27 | //get Date object from pub date
28 | public Date getDateObj(String pubDate) throws ParseException {
29 | SimpleDateFormat pubDateFormat = new SimpleDateFormat(formatRfc2822, Locale.ENGLISH); //rss spec
30 | Date date = null;
31 | try {
32 | date = pubDateFormat.parse(pubDate);
33 | } catch (ParseException e) {
34 | pubDateFormat = new SimpleDateFormat(formatLocal); //fallback
35 | date = pubDateFormat.parse(pubDate);
36 | }
37 | return date;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/utils/FadeAnimationUtil.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.utils;
2 |
3 | import android.content.Context;
4 | import android.util.Log;
5 | import android.view.View;
6 | import android.view.animation.AlphaAnimation;
7 | import android.view.animation.Animation;
8 | import android.view.animation.AnimationUtils;
9 |
10 | /**
11 | * Created by Kartik_ch on 8/17/2015.
12 | */
13 | public class FadeAnimationUtil {
14 |
15 | private Context mContext;
16 |
17 | public FadeAnimationUtil(Context context) {
18 | this.mContext = context;
19 | }
20 |
21 | public void fadeInLeft(View view) {
22 | view.setVisibility(View.INVISIBLE);
23 | Animation fadeInAnim = AnimationUtils.makeInAnimation(mContext, true);
24 | view.startAnimation(fadeInAnim);
25 | view.setVisibility(View.VISIBLE);
26 | Log.d("fadeIn", "true");
27 | }
28 |
29 | public void fadeOutRight(View view) {
30 | Animation fadeOutAnim = AnimationUtils.makeOutAnimation(mContext, true);
31 | view.startAnimation(fadeOutAnim);
32 | view.setVisibility(View.INVISIBLE);
33 | Log.d("fadeOut", "true");
34 | }
35 |
36 | public void fadeInAlpha(View view, int durationInMillis) {
37 | view.setVisibility(View.INVISIBLE);
38 | AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1.0f);
39 | alphaAnimation.setDuration(durationInMillis);
40 | view.startAnimation(alphaAnimation);
41 | view.setVisibility(View.VISIBLE);
42 | }
43 |
44 | public void fadeOutAlpha(final View view, int durationInMillis) {
45 | view.setVisibility(View.VISIBLE);
46 | AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0f);
47 | alphaAnimation.setDuration(durationInMillis);
48 | view.startAnimation(alphaAnimation);
49 | view.setVisibility(View.INVISIBLE);
50 | /*new Handler().postDelayed(new Runnable() {
51 | @Override
52 | public void run() {
53 | view.setVisibility(View.GONE);
54 | }
55 | }, 1000);*/
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/utils/ItemAnimatorUtil.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.utils;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 |
5 | /**
6 | * Created by Kartik_ch on 11/25/2015.
7 | */
8 | public class ItemAnimatorUtil extends RecyclerView.ItemAnimator {
9 | @Override
10 | public boolean animateDisappearance(RecyclerView.ViewHolder viewHolder, ItemHolderInfo preLayoutInfo, ItemHolderInfo postLayoutInfo) {
11 | return false;
12 | }
13 |
14 | @Override
15 | public boolean animateAppearance(RecyclerView.ViewHolder viewHolder, ItemHolderInfo preLayoutInfo, ItemHolderInfo postLayoutInfo) {
16 | return false;
17 | }
18 |
19 | @Override
20 | public boolean animatePersistence(RecyclerView.ViewHolder viewHolder, ItemHolderInfo preLayoutInfo, ItemHolderInfo postLayoutInfo) {
21 | return false;
22 | }
23 |
24 | @Override
25 | public boolean animateChange(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder, ItemHolderInfo preLayoutInfo, ItemHolderInfo postLayoutInfo) {
26 | return false;
27 | }
28 |
29 | @Override
30 | public void runPendingAnimations() {
31 |
32 | }
33 |
34 | @Override
35 | public void endAnimation(RecyclerView.ViewHolder item) {
36 |
37 | }
38 |
39 | @Override
40 | public void endAnimations() {
41 |
42 | }
43 |
44 | @Override
45 | public boolean isRunning() {
46 | return false;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/utils/ItemDecorationUtil.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.utils;
2 |
3 | import android.graphics.Rect;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.View;
6 |
7 | /**
8 | * Created by Kartik_ch on 12/11/2015.
9 | * Stolen.. err I mean copied from stackoverflow : http://stackoverflow.com/questions/28531996/android-recyclerview-gridlayoutmanager-column-spacing
10 | */
11 | public class ItemDecorationUtil extends RecyclerView.ItemDecoration {
12 | private int mSpanCount;
13 | private int mSpacing;
14 | private boolean mIncludeEdge;
15 |
16 | public ItemDecorationUtil(int mSpanCount, int mSpacing, boolean mIncludeEdge) {
17 | this.mSpanCount = mSpanCount;
18 | this.mSpacing = mSpacing;
19 | this.mIncludeEdge = mIncludeEdge;
20 | }
21 |
22 | @Override
23 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
24 | int position = parent.getChildAdapterPosition(view); // item position
25 | int column = position % mSpanCount; // item column
26 |
27 | if (mIncludeEdge) {
28 | outRect.left = mSpacing - column * mSpacing / mSpanCount; // spacing - column * ((1f / spanCount) * spacing)
29 | outRect.right = (column + 1) * mSpacing / mSpanCount; // (column + 1) * ((1f / spanCount) * spacing)
30 |
31 | if (position < mSpanCount) { // top edge
32 | outRect.top = mSpacing;
33 | }
34 | outRect.bottom = mSpacing; // item bottom
35 | } else {
36 | outRect.left = column * mSpacing / mSpanCount; // column * ((1f / spanCount) * spacing)
37 | outRect.right = mSpacing - (column + 1) * mSpacing / mSpanCount; // spacing - (column + 1) * ((1f / spanCount) * spacing)
38 | if (position >= mSpanCount) {
39 | outRect.top = mSpacing; // item top
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/utils/NetworkConnectionUtil.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.utils;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.net.ConnectivityManager;
6 | import android.net.NetworkInfo;
7 | import android.provider.Settings;
8 |
9 | import com.afollestad.materialdialogs.DialogAction;
10 | import com.afollestad.materialdialogs.MaterialDialog;
11 | import com.crazyhitty.chdev.ks.munch.R;
12 |
13 | /**
14 | * Created by Kartik_ch on 12/17/2015.
15 | */
16 | public class NetworkConnectionUtil {
17 |
18 | public static boolean isNetworkAvailable(Context context) {
19 | ConnectivityManager cm =
20 | (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
21 |
22 | NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
23 | boolean isConnected = activeNetwork != null &&
24 | activeNetwork.isConnectedOrConnecting();
25 | return isConnected;
26 | }
27 |
28 | public static void showNoNetworkDialog(final Context context) {
29 | MaterialDialog noNetworkAvailDialog = new MaterialDialog.Builder(context)
30 | .title(R.string.no_internet_available)
31 | .content(R.string.no_internet_available_extnd)
32 | .iconRes(R.drawable.ic_error_24dp)
33 | .positiveText(R.string.settings)
34 | .negativeText(R.string.dismiss)
35 | .onPositive(new MaterialDialog.SingleButtonCallback() {
36 | @Override
37 | public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
38 | Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS);
39 | context.startActivity(intent);
40 | }
41 | }).build();
42 | noNetworkAvailDialog.show();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/utils/UrlUtil.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.utils;
2 |
3 | import java.net.URI;
4 | import java.net.URISyntaxException;
5 |
6 | /**
7 | * Created by Kartik_ch on 12/11/2015.
8 | */
9 | public class UrlUtil {
10 | public static String REGEX_URL = "^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]";
11 |
12 | public static String getWebsiteName(String url) {
13 | URI uri;
14 | try {
15 | uri = new URI(url);
16 | return uri.getHost();
17 | } catch (URISyntaxException e) {
18 | e.printStackTrace();
19 | }
20 | return url;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/utils/WebsiteIntentUtil.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.utils;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.os.Build;
7 | import android.os.Bundle;
8 |
9 | import com.crazyhitty.chdev.ks.munch.R;
10 |
11 | /**
12 | * Created by Kartik_ch on 12/20/2015.
13 | */
14 | public class WebsiteIntentUtil {
15 | private static final String EXTRA_CUSTOM_TABS_SESSION = "android.support.customtabs.extra.SESSION";
16 | private static final String EXTRA_CUSTOM_TABS_TOOLBAR_COLOR = "android.support.customtabs.extra.TOOLBAR_COLOR";
17 | private Context mContext;
18 |
19 | public WebsiteIntentUtil(Context mContext) {
20 | this.mContext = mContext;
21 | }
22 |
23 | public void loadCustomChromeTabs(String url) {
24 | //ANDROID CHROME CUSTOM TABS IMPLEMENTATION
25 |
26 | // Using a VIEW intent for compatibility with any other browsers on device.
27 | // Caller should not be setting FLAG_ACTIVITY_NEW_TASK or
28 | // FLAG_ACTIVITY_NEW_DOCUMENT.
29 |
30 | Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
31 |
32 | // Must have. Extra used to match the session. Its value is an IBinder passed
33 | // whilst creating a news session. See newSession() below. Even if the service is not
34 | // used and there is no valid session id to be provided, this extra has to be present
35 | // with a null value to launch a custom tab.
36 |
37 | //CustomTabsClient
38 |
39 | Bundle extras = new Bundle();
40 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
41 | extras.putBinder(EXTRA_CUSTOM_TABS_SESSION, null);
42 | }
43 | intent.putExtra(EXTRA_CUSTOM_TABS_TOOLBAR_COLOR, R.color.colorPrimary);
44 | intent.putExtras(extras);
45 | mContext.startActivity(intent);
46 | }
47 |
48 | public void loadNormalBrowser(String url) {
49 | Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
50 | mContext.startActivity(intent);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/utils/comparator/FeedCategoryComparator.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.utils.comparator;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
4 |
5 | import java.util.Comparator;
6 |
7 | /**
8 | * Created by Kartik_ch on 1/6/2016.
9 | */
10 | public class FeedCategoryComparator implements Comparator {
11 | @Override
12 | public int compare(FeedItem feedItem1, FeedItem feedItem2) {
13 | String category1 = feedItem1.getItemCategory().toLowerCase();
14 | String category2 = feedItem2.getItemCategory().toLowerCase();
15 | if (category1 == category2) {
16 | return 0;
17 | }
18 | if (category1 == null) {
19 | return -1;
20 | }
21 | if (category2 == null) {
22 | return 1;
23 | }
24 | return category1.compareTo(category2);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/utils/comparator/FeedPubDateComparator.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.utils.comparator;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
4 | import com.crazyhitty.chdev.ks.munch.utils.DateUtil;
5 |
6 | import java.text.ParseException;
7 | import java.util.Comparator;
8 | import java.util.Date;
9 |
10 | /**
11 | * Created by Kartik_ch on 1/6/2016.
12 | */
13 | public class FeedPubDateComparator implements Comparator {
14 | //Reverse date sorting(latest to oldest)
15 | @Override
16 | public int compare(FeedItem feedItem1, FeedItem feedItem2) {
17 | try {
18 | Date date1 = new DateUtil().getDateObj(feedItem1.getItemPubDate());
19 | Date date2 = new DateUtil().getDateObj(feedItem2.getItemPubDate());
20 | if (date1 == date2) {
21 | return 0;
22 | }
23 | if (date1 == null) {
24 | return 1;
25 | }
26 | if (date2 == null) {
27 | return -1;
28 | }
29 |
30 | if (date1.compareTo(date2) > 0) {
31 | return -1;
32 | } else if (date1.compareTo(date2) < 0) {
33 | return 1;
34 | } else {
35 | return 0;
36 | }
37 | } catch (ParseException e) {
38 | e.printStackTrace();
39 | return 0;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/crazyhitty/chdev/ks/munch/utils/comparator/FeedTitleComparator.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch.utils.comparator;
2 |
3 | import com.crazyhitty.chdev.ks.munch.models.FeedItem;
4 |
5 | import java.util.Comparator;
6 |
7 | /**
8 | * Created by Kartik_ch on 1/6/2016.
9 | */
10 | public class FeedTitleComparator implements Comparator {
11 | @Override
12 | public int compare(FeedItem feedItem1, FeedItem feedItem2) {
13 | String title1 = feedItem1.getItemTitle().toLowerCase();
14 | String title2 = feedItem2.getItemTitle().toLowerCase();
15 | if (title1 == title2) {
16 | return 0;
17 | }
18 | if (title1 == null) {
19 | return -1;
20 | }
21 | if (title2 == null) {
22 | return 1;
23 | }
24 | return title1.compareTo(title2);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/pull_in_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_out_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_out_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-hdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-hdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-hdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-mdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-mdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-mdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_sync_white_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-nodpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/munch_about.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-nodpi/munch_about.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/munch_promo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-nodpi/munch_promo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/munch_promo_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-nodpi/munch_promo_small.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/splash_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-nodpi/splash_1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/splash_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-nodpi/splash_2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/splash_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-nodpi/splash_3.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/circle_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
5 |
6 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_delete_white_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_info_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_notifications_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_sync_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-xhdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-xhdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/accent_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-xxhdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-xxhdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-xxxhdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-xxxhdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/drawable-xxxhdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/category_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/circle_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cyan_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/empty_dot.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/green_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/grey_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_about_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_archive_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_archive_done_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_archived_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_arrow_drop_down_circle_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_arrow_forward_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_automobile_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_book_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_business_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_clear_all_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_climate_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_close_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_comics_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_deals_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_delete_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_done_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_done_all_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_economics_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_education_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_entertainment_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_error_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_expand_more_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_fashion_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_feeds_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_finance_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_fitness_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_food_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_gadgets_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_gaming_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_hardware_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_health_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_international_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launch_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_manage_feeds_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_marketing_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_mood_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_music_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_national_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_nav_archive_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_open_in_browser_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_politics_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_productivity_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_programming_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_refresh_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_reorder_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_research_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_science_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_settings_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_share_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_software_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_space_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_sports_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_sync_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_technology_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_unknown_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_warning_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/lime_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/nav_item_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/orange_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/purple_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/red_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/sample_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selected_dot.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/teal_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_article.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
25 |
26 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
21 |
22 |
31 |
32 |
33 |
34 |
35 |
36 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
23 |
24 |
27 |
28 |
39 |
40 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_article.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
15 |
22 |
23 |
26 |
27 |
34 |
35 |
38 |
39 |
40 |
41 |
44 |
45 |
48 |
49 |
56 |
57 |
64 |
65 |
66 |
67 |
70 |
71 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_modify_source.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
20 |
21 |
24 |
25 |
31 |
32 |
38 |
39 |
42 |
43 |
50 |
51 |
54 |
55 |
63 |
64 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_ompl_url.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/feed_item_card_small.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
19 |
20 |
23 |
24 |
31 |
32 |
40 |
41 |
44 |
45 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_archive.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
20 |
21 |
26 |
27 |
28 |
29 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_feeds.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
20 |
21 |
26 |
27 |
28 |
29 |
33 |
34 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_manage_sources.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
16 |
17 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_category.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
24 |
25 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/library_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
16 |
17 |
20 |
21 |
28 |
29 |
36 |
37 |
38 |
39 |
42 |
43 |
49 |
50 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/source_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
24 |
25 |
28 |
29 |
36 |
37 |
44 |
45 |
46 |
47 |
50 |
51 |
57 |
58 |
64 |
65 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/spinner_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
13 |
17 |
18 |
19 | -
20 |
21 |
25 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_about.xml:
--------------------------------------------------------------------------------
1 |
5 |
10 |
15 |
20 |
25 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_article.xml:
--------------------------------------------------------------------------------
1 |
5 |
11 |
17 |
23 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_feeds.xml:
--------------------------------------------------------------------------------
1 |
5 |
11 |
17 |
23 |
29 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_splash.xml:
--------------------------------------------------------------------------------
1 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/transition/activity_slide.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/transition/pull_in_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/transition/push_out_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 | >
2 |
3 |
9 |
10 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 | 18sp
7 | 10sp
8 | 15sp
9 | 20sp
10 | 25sp
11 | 4dp
12 | 8dp
13 | 16dp
14 | 32dp
15 | 4dp
16 | 8dp
17 | 24dp
18 | 16dp
19 | 32dp
20 | 64dp
21 | 4dp
22 | 8dp
23 | 16dp
24 | 32dp
25 | 16dp
26 | 160dp
27 | 180dp
28 | 16dp
29 | 4dp
30 | 8dp
31 | 37dp
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/values/integers.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/test/java/com/crazyhitty/chdev/ks/munch/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.munch;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.0.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/change_log.txt:
--------------------------------------------------------------------------------
1 | Version 0.44 \n\n
2 | Fixed some issues with feed parsing, thanks to https://github.com/LukeOwncloud\n\n
3 | Version 0.43 \n\n
4 | Minor bug fixes.\n\n
5 | Version 0.42 \n\n
6 | Minor bug fixes.\n\n
7 | Version 0.41 \n\n
8 | Minor bug fixes.\n\n
9 | Version 0.40 \n\n
10 | Added sync feature. Now you can synchronize feeds in background and application will save all of the data for offline reading.\n\n
11 | Version 0.33 \n\n
12 | Added white icons in dark theme(only in category list and sources list) so they are easier to see.\n\n
13 | Removed shadow from toolbars as it was glitching in dark theme.\n\n
14 | Version 0.32 \n\n
15 | Minor bug fixes.\n\n
16 | Added shadow to toolbars.\n\n
17 | Added option to delete the feed from article.\n\n
18 | Version 0.31 \n\n
19 | Minor bug fix, which was making the settings menu crash on some devices.\n\n
20 | Version 0.30 \n\n
21 | Added Opml integration.\n\n
22 | Added Read External Storage permission so that user can import opml feeds via file stored in SD Card or internal storage.\n\n
23 | Added Curated feeds and option to submit your own feeds to the curated list.\n\n
24 | Added Sorting option, now user can sort the feeds by random, title, category and date.\n\n
25 | Minor bug fixes.\n\n
26 | Version 0.22 \n\n
27 | Made circular reveal animation optional, you can disable it in settings.\n\n
28 | Version 0.21 \n\n
29 | Fixed a bug in which white screen was shown on splash screen.\n\n
30 | Added the option to rate, view source code and view licence in About screen.\n\n
31 | Version 0.20 \n\n
32 | Added dark theme.\n\n
33 | Version 0.11 \n\n
34 | Removed duplicate entries in settings menu.\n\n
35 | Version 0.10 \n\n
36 | Released initial version.
--------------------------------------------------------------------------------
/curated_feeds.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 0.13,
3 | "release_date": "2016-01-03",
4 | "last_modified": "2016-02-09",
5 | "curated_feeds": [
6 | {
7 | "source_name": "Arstechnica",
8 | "source_url": "http:\/\/feeds.arstechnica.com\/arstechnica\/index?format=xml",
9 | "source_category": "Gadgets"
10 | },
11 | {
12 | "source_name": "Reuters Top News",
13 | "source_url": "http:\/\/feeds.reuters.com\/reuters\/topNews?format=xml",
14 | "source_category": "International"
15 | },
16 | {
17 | "source_name": "IGN",
18 | "source_url": "http:\/\/feeds.ign.com\/ign\/all?format=xml",
19 | "source_category": "Entertainment"
20 | },
21 | {
22 | "source_name": "vrouwelijk goddelijke",
23 | "source_url": "http:\/\/feeds.feedburner.com\/HetVrouwelijkGoddelijke",
24 | "source_category": "Research"
25 | },
26 | {
27 | "source_name": "Juan Cole",
28 | "source_url": "http:\/\/feeds.feedburner.com\/is\/pudp",
29 | "source_category": "Politics"
30 | },
31 | {
32 | "source_name": "FTM",
33 | "source_url": "http:\/\/feeds.feedburner.com\/ftm\/eddm",
34 | "source_category": "Politics"
35 | },
36 | {
37 | "source_name": "James Petras",
38 | "source_url": "http:\/\/petras.lahaine.org\/?feed=rss2",
39 | "source_category": "Politics"
40 | },
41 | {
42 | "source_name": "Craig Murray",
43 | "source_url": "http:\/\/feeds.feedburner.com\/org\/zMEt",
44 | "source_category": "Politics"
45 | },
46 | {
47 | "source_name": "Leonardo Boff",
48 | "source_url": "http:\/\/feeds.feedburner.com\/wordpress\/Hdbc",
49 | "source_category": "Unknown"
50 | },
51 | {
52 | "source_name": "CMI Watemaal",
53 | "source_url": "http:\/\/feeds.feedburner.com\/CmiGuatemala",
54 | "source_category": "Politics"
55 | },
56 | {
57 | "source_name": "Sprengsatz",
58 | "source_url": "http:\/\/feeds.feedburner.com\/Sprengsatz_dasPolitik-blogAusBerlin",
59 | "source_category": "International"
60 | },
61 | {
62 | "source_name": "Musicke & Food",
63 | "source_url": "http:\/\/feeds.feedburner.com\/blogspot\/wxXcs",
64 | "source_category": "Music"
65 | },
66 | {
67 | "source_name": "cogniarchae",
68 | "source_url": "http:\/\/feeds.feedburner.com\/Cogniarchae",
69 | "source_category": "Research"
70 | },
71 | {
72 | "source_name": "el salm\u00f3n",
73 | "source_url": "http:\/\/feeds.feedburner.com\/ElSalmn",
74 | "source_category": "Politics"
75 | },
76 | {
77 | "source_name": "James Cockcroft",
78 | "source_url": "http:\/\/feeds.feedburner.com\/JamesCockcroftsBlog-WriterProfessorRevolutionary",
79 | "source_category": "Politics"
80 | },
81 | {
82 | "source_name": "BBC news ",
83 | "source_url": "http:\/\/feeds.bbci.co.uk\/news\/rss.xml?edition=uk#",
84 | "source_category": "International"
85 | },
86 | {
87 | "source_name": "Express and star ",
88 | "source_url": "http:\/\/www.expressandstar.com\/news\/feed\/",
89 | "source_category": "International"
90 | }
91 | ]
92 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Nov 02 21:55:31 IST 2015
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-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/mindb/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/mindb/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | minSdkVersion 8
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(dir: 'libs', include: ['*.jar'])
23 | testCompile 'junit:junit:4.12'
24 | compile 'com.android.support:appcompat-v7:23.1.0'
25 | }
26 |
--------------------------------------------------------------------------------
/mindb/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\Kartik_ch\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/mindb/src/androidTest/java/com/crazyhitty/chdev/ks/mindb/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.mindb;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/mindb/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/mindb/src/main/java/com/crazyhitty/chdev/ks/mindb/DatabaseAdapter.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.mindb;
2 |
3 | import android.content.Context;
4 | import android.database.Cursor;
5 | import android.database.SQLException;
6 | import android.database.sqlite.SQLiteDatabase;
7 | import android.util.Log;
8 |
9 | import java.io.IOException;
10 |
11 | /**
12 | * Created by Kartik_ch on 10/4/2015.
13 | */
14 | public class DatabaseAdapter {
15 | private Context mContext;
16 | private SQLiteDatabase mDatabase;
17 | private DatabaseHelper mDatabaseHelper;
18 |
19 | public DatabaseAdapter(Context context, String dataBaseName) {
20 | this.mContext = context;
21 | mDatabaseHelper = new DatabaseHelper(this.mContext, dataBaseName);
22 | }
23 |
24 | public DatabaseAdapter createDatabase() throws SQLException {
25 | try {
26 | mDatabaseHelper.createDataBase();
27 | } catch (IOException mIOException) {
28 | Log.e("Error", mIOException.toString() + " UnableToCreateDatabase");
29 | throw new Error("UnableToCreateDatabase");
30 | }
31 | return this;
32 | }
33 |
34 | public DatabaseAdapter open() throws SQLException {
35 | try {
36 | mDatabaseHelper.openDataBase();
37 | mDatabaseHelper.close();
38 | mDatabase = mDatabaseHelper.getReadableDatabase();
39 | } catch (SQLException mSQLException) {
40 | Log.e("OpenDb", "open >>" + mSQLException.toString());
41 | throw mSQLException;
42 | }
43 | return this;
44 | }
45 |
46 | public void close() {
47 | mDatabaseHelper.close();
48 | }
49 |
50 | //queries that return the cursor data
51 | public Cursor selectQuery(String query) {
52 | Cursor cursor = null;
53 | try {
54 | if (mDatabase.isOpen()) {
55 | mDatabase.close();
56 | }
57 | mDatabase = mDatabaseHelper.getWritableDatabase();
58 | cursor = mDatabase.rawQuery(query, null);
59 | } catch (Exception e) {
60 | System.out.println("DATABASE ERROR " + e);
61 | }
62 | return cursor;
63 | }
64 |
65 | //queries that execute data changes in database
66 | public void executeQuery(String query) {
67 | try {
68 | if (mDatabase.isOpen()) {
69 | mDatabase.close();
70 | }
71 | mDatabase = mDatabaseHelper.getWritableDatabase();
72 | mDatabase.execSQL(query);
73 | } catch (Exception e) {
74 | System.out.println("DATABASE ERROR " + e);
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/mindb/src/main/java/com/crazyhitty/chdev/ks/mindb/DatabaseHelper.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.mindb;
2 |
3 | import android.content.Context;
4 | import android.database.SQLException;
5 | import android.database.sqlite.SQLiteDatabase;
6 | import android.database.sqlite.SQLiteOpenHelper;
7 | import android.util.Log;
8 |
9 | import java.io.File;
10 | import java.io.FileOutputStream;
11 | import java.io.IOException;
12 | import java.io.InputStream;
13 | import java.io.OutputStream;
14 |
15 | /**
16 | * Created by Kartik_ch on 8/29/2015.
17 | * Sources : stackoverflow
18 | */
19 | public class DatabaseHelper extends SQLiteOpenHelper {
20 |
21 | public static String DB_PATH = null, DB_NAME = null;
22 | private Context mContext;
23 | private SQLiteDatabase mDatabase;
24 |
25 | public DatabaseHelper(Context context, String dataBaseName) {
26 | super(context, dataBaseName, null, 1);// 1? its Database Version
27 | DB_NAME = dataBaseName;
28 | DB_PATH = "/data/data/" + context.getPackageName() + "/databases/";
29 | this.mContext = context;
30 | }
31 |
32 | public void createDataBase() throws IOException {
33 | //If database not exists copy it from the assets
34 |
35 | boolean mDataBaseExist = checkDataBase();
36 | if (!mDataBaseExist) {
37 | this.getReadableDatabase();
38 | this.close();
39 | try {
40 | //Copy the database from assests
41 | copyDataBase();
42 | Log.e("DB", "createDatabase database created");
43 | } catch (IOException mIOException) {
44 | throw new Error("ErrorCopyingDataBase");
45 | }
46 | }
47 | }
48 |
49 | //Check that the database exists here: /data/data/your_package/databases/Db_Name
50 | private boolean checkDataBase() {
51 | File dbFile = new File(DB_PATH + DB_NAME);
52 | return dbFile.exists();
53 | }
54 |
55 | //Copy the database from assets
56 | private void copyDataBase() throws IOException {
57 | InputStream mInput = mContext.getAssets().open(DB_NAME);
58 | String outFileName = DB_PATH + DB_NAME;
59 | OutputStream mOutput = new FileOutputStream(outFileName);
60 | byte[] mBuffer = new byte[1024];
61 | int mLength;
62 | while ((mLength = mInput.read(mBuffer)) > 0) {
63 | mOutput.write(mBuffer, 0, mLength);
64 | }
65 | mOutput.flush();
66 | mOutput.close();
67 | mInput.close();
68 | }
69 |
70 | //Open the database, so we can query it
71 | public boolean openDataBase() throws SQLException {
72 | String mPath = DB_PATH + DB_NAME;
73 | mDatabase = SQLiteDatabase.openDatabase(mPath, null, SQLiteDatabase.CREATE_IF_NECESSARY);
74 | return mDatabase != null;
75 | }
76 |
77 | @Override
78 | public synchronized void close() {
79 | if (mDatabase != null)
80 | mDatabase.close();
81 | super.close();
82 | }
83 |
84 | @Override
85 | public void onCreate(SQLiteDatabase database) {
86 | //database.execSQL(DATABASE_CREATE);
87 | }
88 |
89 | @Override
90 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
91 | // TODO Auto-generated method stub
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/mindb/src/main/java/com/crazyhitty/chdev/ks/mindb/OnDatabaseListener.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.mindb;
2 |
3 | import android.database.Cursor;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by Kartik_ch on 11/16/2015.
9 | */
10 | public interface OnDatabaseListener {
11 | void onSuccess(String message, List values, Cursor cursor);
12 |
13 | void onFailure(String message);
14 | }
15 |
--------------------------------------------------------------------------------
/mindb/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MinDB
3 |
4 |
--------------------------------------------------------------------------------
/mindb/src/test/java/com/crazyhitty/chdev/ks/mindb/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.mindb;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/rssmanager/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/rssmanager/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | minSdkVersion 9
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | repositories {
22 | maven { url "https://jitpack.io" }
23 | }
24 |
25 | dependencies {
26 | compile fileTree(dir: 'libs', include: ['*.jar'])
27 | testCompile 'junit:junit:4.12'
28 | compile 'com.android.support:appcompat-v7:23.1.0'
29 | compile 'org.jsoup:jsoup:1.7.2'
30 | compile('com.github.afollestad.material-dialogs:core:0.8.5.6@aar') {
31 | transitive = true
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/rssmanager/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\Kartik_ch\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/rssmanager/src/androidTest/java/com/crazyhitty/chdev/ks/rssmanager/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.rssmanager;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/rssmanager/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/rssmanager/src/main/java/com/crazyhitty/chdev/ks/rssmanager/OnFeedLoadListener.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.rssmanager;
2 |
3 | import org.jsoup.select.Elements;
4 |
5 | /**
6 | * Created by Kartik_ch on 11/15/2015.
7 | */
8 | public interface OnFeedLoadListener {
9 | void onSuccess(Elements elements);
10 |
11 | void onFailure(String message);
12 | }
13 |
--------------------------------------------------------------------------------
/rssmanager/src/main/java/com/crazyhitty/chdev/ks/rssmanager/OnRssLoadListener.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.rssmanager;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by Kartik_ch on 11/15/2015.
7 | */
8 | public interface OnRssLoadListener {
9 | void onSuccess(List rssItems);
10 |
11 | void onFailure(String message);
12 | }
13 |
--------------------------------------------------------------------------------
/rssmanager/src/main/java/com/crazyhitty/chdev/ks/rssmanager/RssItem.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.rssmanager;
2 |
3 | /**
4 | * Created by Kartik_ch on 11/15/2015.
5 | */
6 | public class RssItem {
7 | String title;
8 | String description;
9 | String link;
10 | String sourceName;
11 | String sourceUrl;
12 | String imageUrl;
13 | String category;
14 | String pubDate;
15 | int categoryImgId;
16 |
17 | public String getTitle() {
18 | return title;
19 | }
20 |
21 | public void setTitle(String title) {
22 | this.title = title;
23 | }
24 |
25 | public String getDescription() {
26 | return description;
27 | }
28 |
29 | public void setDescription(String description) {
30 | this.description = description;
31 | }
32 |
33 | public String getLink() {
34 | return link;
35 | }
36 |
37 | public void setLink(String link) {
38 | this.link = link;
39 | }
40 |
41 | public String getSourceName() {
42 | return sourceName;
43 | }
44 |
45 | public void setSourceName(String sourceName) {
46 | this.sourceName = sourceName;
47 | }
48 |
49 | public String getSourceUrl() {
50 | return sourceUrl;
51 | }
52 |
53 | public void setSourceUrl(String sourceUrl) {
54 | this.sourceUrl = sourceUrl;
55 | }
56 |
57 | public String getImageUrl() {
58 | return imageUrl;
59 | }
60 |
61 | public void setImageUrl(String imageUrl) {
62 | this.imageUrl = imageUrl;
63 | }
64 |
65 | public String getCategory() {
66 | return category;
67 | }
68 |
69 | public void setCategory(String category) {
70 | this.category = category;
71 | }
72 |
73 | public String getPubDate() {
74 | return pubDate;
75 | }
76 |
77 | public void setPubDate(String pubDate) {
78 | this.pubDate = pubDate;
79 | }
80 |
81 | public int getCategoryImgId() {
82 | return categoryImgId;
83 | }
84 |
85 | public void setCategoryImgId(int categoryImgId) {
86 | this.categoryImgId = categoryImgId;
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/rssmanager/src/main/java/com/crazyhitty/chdev/ks/rssmanager/RssParser.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.rssmanager;
2 |
3 | import android.os.AsyncTask;
4 |
5 | import org.jsoup.Jsoup;
6 | import org.jsoup.nodes.Document;
7 | import org.jsoup.parser.Parser;
8 | import org.jsoup.select.Elements;
9 |
10 | import java.io.IOException;
11 |
12 | /**
13 | * Created by Kartik_ch on 11/15/2015.
14 | */
15 | public class RssParser extends AsyncTask {
16 |
17 | private Elements mItems;
18 | private String mUrl;
19 | private OnFeedLoadListener mOnFeedLoadListener;
20 |
21 | public RssParser(String url, OnFeedLoadListener onFeedLoadListener) {
22 | this.mUrl = url;
23 | this.mOnFeedLoadListener = onFeedLoadListener;
24 | }
25 |
26 | @Override
27 | protected String doInBackground(String... strings) {
28 | try {
29 | Document rssDocument = Jsoup.connect(mUrl).ignoreContentType(true).parser(Parser.xmlParser()).get();
30 | mItems = rssDocument.select("item");
31 | } catch (IOException e) {
32 | e.printStackTrace();
33 | return "failure";
34 | }
35 | return "success";
36 | }
37 |
38 | @Override
39 | protected void onPostExecute(String s) {
40 | super.onPostExecute(s);
41 | if (s.equals("success")) {
42 | mOnFeedLoadListener.onSuccess(mItems);
43 | } else if (s.equals("failure")) {
44 | mOnFeedLoadListener.onFailure("Failed to parse the url\n" + mUrl);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/rssmanager/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RssManager
3 | Cancel
4 | Loading feeds
5 |
6 |
--------------------------------------------------------------------------------
/rssmanager/src/test/java/com/crazyhitty/chdev/ks/rssmanager/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.crazyhitty.chdev.ks.rssmanager;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/screenshots/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/screenshots/1.png
--------------------------------------------------------------------------------
/screenshots/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/screenshots/2.png
--------------------------------------------------------------------------------
/screenshots/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/screenshots/3.png
--------------------------------------------------------------------------------
/screenshots/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/screenshots/4.png
--------------------------------------------------------------------------------
/screenshots/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/screenshots/5.png
--------------------------------------------------------------------------------
/screenshots/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crazyhitty/Munch/4ab73a49ac20e9a80694a98a8082b59fe07aa532/screenshots/6.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':mindb', ':rssmanager'
2 |
--------------------------------------------------------------------------------