Skip to content

Commit

Permalink
Merge pull request #104 from shockbytes/inspirations
Browse files Browse the repository at this point in the history
Inspirations Feature
  • Loading branch information
shockbytes authored Dec 3, 2020
2 parents 1111ec6 + 40ea2f3 commit a40edca
Show file tree
Hide file tree
Showing 91 changed files with 1,985 additions and 413 deletions.
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ The backlog is currently empty.
## Outlook & planned features

### Versions 5.x
- [ ] Use Firebase Data for book suggestions
- [ ] Let users suggest favorite books to others
- [ ] Suggesions
- [ ] Use Firebase Data for book suggestions
- [ ] Let users suggest favorite books to others
- [ ] Improved search database (Google Books API) lookup query
- [ ] Shockbytes Backup
- [ ] Shockbytes Firestore Backup
- [ ] Simplify book management
- [ ] Remove local backup
- [ ] Add online Shockbytes backup as only way to backup data
Expand All @@ -49,29 +50,35 @@ The backlog is currently empty.
- [ ] Add web client support
- [ ] Paged request when user clicks on "not my book" in book download view

### Version 4.1
- [ ] Wishlist for books that are not purchased yet

### Version 4.0 - CAMPING WITH FIREBASE
- [ ] Add online sync capability
- [ ] Migrate from local to remote storage
- [ ] Login with Firebase

## Current development

### Version 3.17
- [ ] Move actions into Book item (https://github.com/florent37/ExpansionPanel)
### Version 3.19
- [ ] Experimental remote storage Firestore implementation (for test account)
- [ ] Add Onboarding + optional Login

### Version 3.18
- [ ] Move actions into Book item (https://github.com/florent37/ExpansionPanel)
- [ ] Backup file improvements
- [ ] Show path to local backup files
- [ ] Open file with FileProvider
- [ ] Experimental remote storage Firestore implementation (for test account)
- [ ] Fix bug with local book covers
- [ ] In MultiBareBoneBookView (not showing up)
- [ ] In the label overview (too big)
- [ ] Smooth loading animator when uploading local images
- [ ] Upgrade to Kotlin 1.4.20 -> Use ViewBinding

## Changelog

### Version 3.17 - INNOVATIVE INSPIRATIONS
* Inspirations Feature
* Wishlist for books that are not purchased yetst
* Suggestions
* Fix bug with local book covers
* In MultiBareBoneBookView (not showing up)
* In the label overview (too big)

### Version 3.16 - BRING BACK BACKUP
* Google Drive REST Backup
* Add DriveRestClient
Expand Down
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "at.shockbytes.dante"
minSdkVersion 21
targetSdkVersion 30
versionCode 38
versionName "3.16"
versionCode 39
versionName "3.17"

multiDexEnabled true
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -105,6 +105,7 @@ dependencies {
implementation "com.google.firebase:firebase-auth:$firebaseVersionAuth"
implementation "com.google.firebase:firebase-ml-vision:$firebaseMLVision"

implementation 'com.google.firebase:firebase-storage-ktx:19.2.0'

implementation ('com.google.http-client:google-http-client-gson:1.36.0') {
exclude group: 'org.apache.httpcomponents'
Expand Down
8 changes: 8 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@
<methods>;
}

# Suggestions feature
-keep class at.shockbytes.dante.suggestions.** {*;}
-keepclassmembers class at.shockbytes.dante.suggestion.* {
<fields>;
<init>();
<methods>;
}

-keepclassmembers class * extends java.lang.Enum {
<fields>;
public static **[] values();
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,19 @@
android:name=".ui.activity.ManualAddActivity"
android:label=""
android:windowSoftInputMode="adjustResize" />

<activity
android:name=".ui.activity.StatisticsActivity"
android:label="@string/label_stats" />

<activity
android:name=".ui.activity.LoginActivity"
android:exported="true" />

<activity
android:name=".ui.activity.InspirationsActivity"
android:label="@string/inspirations" />

<activity android:name=".camera.BarcodeCaptureActivity"
android:screenOrientation="portrait" />
<activity
Expand Down
109 changes: 109 additions & 0 deletions app/src/main/assets/suggestions-v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"suggestions": [
{
"suggestionId": "1",
"suggestion": {
"title": "Stillness is the Key",
"subTitle": "An Ancient Strategy for Modern Life",
"author": "Ryan Holiday",
"pageCount": 262,
"publishedDate": "2019-10-01",
"isbn": "9781782835271",
"thumbnailAddress": "http://books.google.com/books/content?id=916TDwAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api",
"googleBooksLink": "http://books.google.at/books?id=916TDwAAQBAJ&dq=9781788162050&hl=&source=gbs_api",
"language": "en",
"summary": "'Whether you are an athlete, an investor, a writer or an entrepreneur, this little but soulful book will open the door to a healthier, less anxious and more productive life and career.' - Arianna Huffington 'Ryan's trilogy of The Obstacle is the Way, Ego is the Enemy and Stillness is the Key are for sure must-reads.' Manu Ginobili, 4x NBA champion and Olympic Gold Medalist Throughout history, there's been one indelible quality that great leaders, makers, artists and fighters have shared. The Zen Buddhists described it as inner peace, the Stoics called it ataraxia and Ryan Holiday calls it stillness: the ability to be steady, focussed and calm in a constantly busy world. This quality, valued by every major school of thought from Buddha to Seneca, John Stuart Mill to Nietzsche, is urgently necessary today. And, Holiday shows, it is entirely attainable. Just as Winston Churchill used bricklaying as a time to recharge and reflect, or Oprah Winfrey learned deep empathy from her quiet childhood, we can all benefit from stillness to feed into our greater ambitions - whether winning a battle, building a business, or simply finding happiness, peace and self-direction. Filled with wisdom and examples from historical and contemporary figures, this book shows how to cultivate this quality in your own life. Because stillness is not merely inactivity, but the doorway to the self-mastery, discipline and focus necessary to succeed in this competitive, noisy world.",
"state": "WISHLIST"
},
"suggester": {
"name": "Martin",
"photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPzi9I0oWnggqmVR5fL9Be88VNOChcDom8QgQ1fA=s96-c"
},
"recommendation": "How can one be still in such a fast-paced world? How can one stay on the own path? Ryan Holiday is such an amazing author, this is one of his best books!"
},
{
"suggestionId": "2",
"suggestion": {
"title": "The Design of Everyday Things",
"subTitle": "",
"author": "Donald A. Norman",
"pageCount": 368,
"publishedDate": "2013",
"isbn": "9780262525671",
"thumbnailAddress": "http://books.google.com/books/content?id=heCtnQEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api",
"googleBooksLink": "http://books.google.at/books?id=heCtnQEACAAJ&dq=9780262525671&hl=&source=gbs_api",
"language": "en",
"summary": "Even the smartest among us can feel inept as we fail to figure out which light switch or oven burner to turn on, or whether to push, pull, or slide a door. The fault, argues this ingenious-even liberating-book, lies not in ourselves, but in product design that ignores the needs of users and the principles of cognitive psychology. The problems range from ambiguous and hidden controls to arbitrary relationships between controls and functions, coupled with a lack of feedback or other assistance and unreasonable demands on memorization. The Design of Everyday Things shows that good, usable design is possible. The rules are simple: make things visible, exploit natural relationships that couple function and control, and make intelligent use of constraints. The goal: guide the user effortlessly to the right action on the right control at the right time. In this entertaining and insightful analysis, cognitive scientist Don Norman hails excellence of design as the most important key to regaining the competitive edge in influencing consumer behavior. Now fully expanded and updated, with a new introduction by the author, The Design of Everyday Things is a powerful primer on how-and why-some products satisfy customers while others only frustrate them.",
"state": "WISHLIST"
},
"suggester": {
"name": "Martin",
"photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPzi9I0oWnggqmVR5fL9Be88VNOChcDom8QgQ1fA=s96-c"
},
"recommendation": "Anyone who works in the digital space needs to read this book. Honestly, there is no way around Donald Norman's classic."
},
{
"suggestionId": "3",
"suggestion": {
"title": "Their Darkest Hour",
"subTitle": "People Tested to the Extreme in WWII",
"author": "Laurence Rees",
"pageCount": 336,
"publishedDate": "2011-10-31",
"isbn": "9781448116287",
"thumbnailAddress": "http://books.google.com/books/content?id=49Q2WWodc2QC&printsec=frontcover&img=1&zoom=1&source=gbs_api",
"googleBooksLink": "http://books.google.at/books?id=49Q2WWodc2QC&dq=9780091917593&hl=&source=gbs_api",
"language": "en",
"summary": "How could Nazi killers shoot Jewish women and children at close range? Why did Japanese soldiers rape and murder on such a horrendous scale? How was it possible to endure the torment of a Nazi concentration camp? Award-winning documentary maker and historian Laurence Rees has spent nearly 20 years wrestling with these questions in the course of filming hundreds of interviews with people tested to the extreme during World War II. He has come face-to-face with rapists, mass murderers, even cannibals, but he has also met courageous individuals who are an inspiration to us all. In Their Darkest Hour he presents 35 of his most electrifying encounters.",
"state": "WISHLIST"
},
"suggester": {
"name": "Martin",
"photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPzi9I0oWnggqmVR5fL9Be88VNOChcDom8QgQ1fA=s96-c"
},
"recommendation": "This is a must-read for everyone. It's unbelievable what humans were capable just 80 years ago. Definitely an eye-opener."
},
{
"suggestionId": "4",
"suggestion": {
"title": "All Quiet on the Western Front",
"subTitle": "A Novel",
"author": "Erich Maria Remarque",
"pageCount": 240,
"publishedDate": "2013-09-03",
"isbn": "9780812985535",
"thumbnailAddress": "http://books.google.com/books/content?id=pgvqsaYvgacC&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api",
"googleBooksLink": "http://books.google.at/books?id=pgvqsaYvgacC&dq=Nothing%2Bnew%2Bon%2Bthe%2Bwestern%2Bfront&hl=&source=gbs_api",
"language": "en",
"summary": "Considered by many the greatest war novel of all time, All Quiet on the Western Front is Erich Maria Remarque’s masterpiece of the German experience during World War I. I am young, I am twenty years old; yet I know nothing of life but despair, death, fear, and fatuous superficiality cast over an abyss of sorrow. . . . This is the testament of Paul Bäumer, who enlists with his classmates in the German army during World War I. They become soldiers with youthful enthusiasm. But the world of duty, culture, and progress they had been taught breaks in pieces under the first bombardment in the trenches. Through years of vivid horror, Paul holds fast to a single vow: to fight against the principle of hate that meaninglessly pits young men of the same generation but different uniforms against one another . . . if only he can come out of the war alive. “The world has a great writer in Erich Maria Remarque. He is a craftsman of unquestionably first rank, a man who can bend language to his will. Whether he writes of men or of inanimate nature, his touch is sensitive, firm, and sure.”—The New York Times Book Review",
"state": "WISHLIST"
},
"suggester": {
"name": "Martin",
"photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPzi9I0oWnggqmVR5fL9Be88VNOChcDom8QgQ1fA=s96-c"
},
"recommendation": "Another great read about the catastrophes of war. Various pages that will leave you speechless."
},
{
"suggestionId": "5",
"suggestion": {
"title": "Thinking, Fast and Slow",
"subTitle": "",
"author": "Daniel Kahneman",
"pageCount": 512,
"publishedDate": "2011-10-25",
"isbn": "9781429969352",
"thumbnailAddress": "http://books.google.com/books/content?id=ZuKTvERuPG8C&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api",
"googleBooksLink": "https://play.google.com/store/books/details?id=ZuKTvERuPG8C&source=gbs_api",
"language": "en",
"summary": "Major New York Times bestseller Winner of the National Academy of Sciences Best Book Award in 2012 Selected by the New York Times Book Review as one of the ten best books of 2011 A Globe and Mail Best Books of the Year 2011 Title One of The Economist's 2011 Books of the Year One of The Wall Street Journal's Best Nonfiction Books of the Year 2011 2013 Presidential Medal of Freedom Recipient Kahneman's work with Amos Tversky is the subject of Michael Lewis's The Undoing Project: A Friendship That Changed Our Minds In the international bestseller, Thinking, Fast and Slow, Daniel Kahneman, the renowned psychologist and winner of the Nobel Prize in Economics, takes us on a groundbreaking tour of the mind and explains the two systems that drive the way we think. System 1 is fast, intuitive, and emotional; System 2 is slower, more deliberative, and more logical. The impact of overconfidence on corporate strategies, the difficulties of predicting what will make us happy in the future, the profound effect of cognitive biases on everything from playing the stock market to planning our next vacation—each of these can be understood only by knowing how the two systems shape our judgments and decisions. Engaging the reader in a lively conversation about how we think, Kahneman reveals where we can and cannot trust our intuitions and how we can tap into the benefits of slow thinking. He offers practical and enlightening insights into how choices are made in both our business and our personal lives—and how we can use different techniques to guard against the mental glitches that often get us into trouble. Winner of the National Academy of Sciences Best Book Award and the Los Angeles Times Book Prize and selected by The New York Times Book Review as one of the ten best books of 2011, Thinking, Fast and Slow is destined to be a classic.",
"state": "WISHLIST"
},
"suggester": {
"name": "Martin",
"photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mAPzi9I0oWnggqmVR5fL9Be88VNOChcDom8QgQ1fA=s96-c"
},
"recommendation": "Ever wondered how your brain rationalizes your irrational behavior? Then you will love this one. 2-3 pages a day are enough to challenge your brain, I guarantee."
}
]
}
5 changes: 2 additions & 3 deletions app/src/main/java/at/shockbytes/dante/flagging/FeatureFlag.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package at.shockbytes.dante.flagging

enum class FeatureFlag(val key: String, val displayName: String, val defaultValue: Boolean) {

BOOK_SUGGESTIONS("book_suggestions", "Suggestions", false);
Unused("", "", false);

companion object {

fun activeFlags(): List<FeatureFlag> {
return listOf(BOOK_SUGGESTIONS)
return listOf()
}
}
}
16 changes: 16 additions & 0 deletions app/src/main/java/at/shockbytes/dante/injection/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ import at.shockbytes.dante.util.settings.DanteSettings
import at.shockbytes.dante.flagging.FeatureFlagging
import at.shockbytes.dante.flagging.FirebaseFeatureFlagging
import at.shockbytes.dante.flagging.SharedPreferencesFeatureFlagging
import at.shockbytes.dante.suggestions.AssetsSuggestionsRepository
import at.shockbytes.dante.suggestions.SuggestionsRepository
import at.shockbytes.dante.util.explanations.Explanations
import at.shockbytes.dante.util.explanations.SharedPrefsExplanations
import at.shockbytes.dante.util.permission.AndroidPermissionManager
import at.shockbytes.dante.util.permission.PermissionManager
import at.shockbytes.dante.util.scheduler.SchedulerFacade
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import com.google.gson.Gson
import dagger.Module
import dagger.Provides

Expand Down Expand Up @@ -68,4 +73,15 @@ class AppModule(private val app: Application) {
val prefs = app.getSharedPreferences("announcements", Context.MODE_PRIVATE)
return SharedPrefsAnnouncementProvider(prefs)
}

@Provides
fun provideSuggestionsRepository(): SuggestionsRepository {
return AssetsSuggestionsRepository(app.applicationContext, Gson())
}

@Provides
fun provideExplanations(): Explanations {
val sharedPreferences = app.getSharedPreferences("preferences_explanations", Context.MODE_PRIVATE)
return SharedPrefsExplanations(sharedPreferences)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package at.shockbytes.dante.injection
import android.content.Context
import at.shockbytes.dante.BuildConfig
import at.shockbytes.dante.R
import at.shockbytes.dante.storage.FirebaseImageUploadStorage
import at.shockbytes.dante.storage.ImageUploadStorage
import at.shockbytes.tracking.DebugTracker
import at.shockbytes.tracking.FirebaseTracker
import at.shockbytes.tracking.Tracker
Expand Down Expand Up @@ -42,4 +44,9 @@ class FirebaseModule(private val context: Context) {
FirebaseTracker(context)
}
}

@Provides
fun provideImageUploadStorage(): ImageUploadStorage {
return FirebaseImageUploadStorage()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import at.shockbytes.dante.ui.viewmodel.OnlineStorageViewModel
import at.shockbytes.dante.ui.viewmodel.PageRecordsDetailViewModel
import at.shockbytes.dante.ui.viewmodel.SearchViewModel
import at.shockbytes.dante.ui.viewmodel.StatisticsViewModel
import at.shockbytes.dante.ui.viewmodel.SuggestionsViewModel
import at.shockbytes.dante.ui.viewmodel.TimelineViewModel
import dagger.Binds
import dagger.MapKey
Expand Down Expand Up @@ -133,4 +134,9 @@ abstract class ViewModelModule {
@IntoMap
@ViewModelKey(PageRecordsDetailViewModel::class)
internal abstract fun pageRecordsDetailViewModel(viewModel: PageRecordsDetailViewModel): ViewModel

@Binds
@IntoMap
@ViewModelKey(SuggestionsViewModel::class)
internal abstract fun suggestionsViewModel(viewModel: SuggestionsViewModel): ViewModel
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import at.shockbytes.dante.core.book.BookEntity
import at.shockbytes.dante.core.createSharingIntent
import at.shockbytes.dante.ui.activity.BookStorageActivity
import at.shockbytes.dante.ui.activity.DetailActivity
import at.shockbytes.dante.ui.activity.InspirationsActivity
import at.shockbytes.dante.ui.activity.MainActivity
import at.shockbytes.dante.ui.activity.ManualAddActivity
import at.shockbytes.dante.ui.activity.NotesActivity
Expand Down Expand Up @@ -110,4 +111,10 @@ sealed class Destination {
return NotesActivity.newIntent(context, notesBundle)
}
}

object Inspirations : Destination() {
override fun provideIntent(context: Context): Intent {
return InspirationsActivity.newIntent(context)
}
}
}
Loading

0 comments on commit a40edca

Please sign in to comment.