Skip to content

Commit

Permalink
Bump version 0.0.3 Optimize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
fenimore committed Mar 19, 2021
1 parent ec82f65 commit 72b5068
Show file tree
Hide file tree
Showing 20 changed files with 27 additions and 150 deletions.
36 changes: 0 additions & 36 deletions CONTRIBUTING.md

This file was deleted.

16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ Badreads is very unstable. I recommend backing up with an export before installi
GPLv3
Copyright 2021 Fenimore Love

## Bug:

1. Deleting data directly after exporting, and then importing that same csv will break the CSV.
There seems to be an issue with the first line of the "rows" that are written (after the headers).

## TODO:
## Todo:

1. Move export and import to settings
2. Fix settings action bar color
Expand All @@ -28,10 +23,11 @@ There seems to be an issue with the first line of the "rows" that are written (a
9. OpenLibrary book details button?
8. Add tag/star to books
11. Fetch description **


## TODO: sort
1. Sort a - z
2. Sort z - a
3. Sort page numbers
4. Sort rating

## Known Bug:

1. Deleting data directly after exporting, and then importing that same csv will break the CSV.
There seems to be an issue with the first line of the "rows" that are written (after the headers).
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.timenotclocks.bookcase"
minSdkVersion 29
targetSdkVersion 30
versionCode 2
versionName "0.0.2"
versionCode 3
versionName "0.0.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
25 changes: 2 additions & 23 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.timenotclocks.bookcase">
<!-- for barcode -->
<uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />

<application
android:name=".database.BooksApplication"
Expand All @@ -14,11 +12,6 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">

<!--
Set to true if your app is Standalone, that is, it does not require the handheld
app to run.
-->
<activity
android:name=".MainActivity"
android:label="@string/app_name">
Expand All @@ -31,10 +24,6 @@
<activity
android:name=".OpenLibrarySearchActivity"
android:label="@string/title_search_book_activity" />
<!--
Set to true if your app is Standalone, that is, it does not require the handheld
app to run.
-->
<activity
android:name=".BookViewActivity"
android:label="@string/title_activity_book_view" />
Expand All @@ -55,21 +44,11 @@
android:name="com.journeyapps.barcodescanner.CaptureActivity"
android:screenOrientation="fullSensor"
tools:replace="screenOrientation" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>

</application>
<!-- for barcode -->
<uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />

<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.INTERNET" />

<uses-permission android:name="android.permission.CAMERA" />

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ import android.widget.*
import androidx.activity.viewModels
import androidx.annotation.MenuRes
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.button.MaterialButton
import com.google.android.material.snackbar.Snackbar
import com.squareup.picasso.Picasso
import com.timenotclocks.bookcase.api.OpenLibraryViewModel
import com.timenotclocks.bookcase.database.*
import java.time.LocalDate

Expand Down
5 changes: 0 additions & 5 deletions app/src/main/java/com/timenotclocks/bookcase/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.timenotclocks.bookcase

import android.R.attr
import android.content.DialogInterface
import android.content.Intent
import android.net.Uri
Expand All @@ -27,17 +26,13 @@ import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.widget.EditText
import android.widget.Toast
import androidx.activity.viewModels
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.marginEnd
import androidx.core.view.marginTop
import androidx.preference.PreferenceManager
import androidx.viewpager.widget.ViewPager
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.tabs.TabLayout
import com.google.zxing.integration.android.IntentIntegrator
import com.timenotclocks.bookcase.api.Exporter
import com.timenotclocks.bookcase.api.GoodReadImport
import com.timenotclocks.bookcase.database.BookViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import androidx.activity.viewModels
import androidx.annotation.MenuRes
import androidx.appcompat.app.AppCompatActivity
import androidx.cardview.widget.CardView
import com.beust.klaxon.JsonReader
import com.beust.klaxon.Klaxon
import com.google.android.material.button.MaterialButton
import com.squareup.picasso.Picasso
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.*
import android.widget.ProgressBar
import android.widget.SearchView
import android.widget.TextView
import android.widget.Toast
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.Observer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package com.timenotclocks.bookcase

import android.content.SharedPreferences
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package com.timenotclocks.bookcase.api

import android.util.Log
import com.github.doyaaaaaken.kotlincsv.dsl.csvReader
import com.timenotclocks.bookcase.database.Book
import com.timenotclocks.bookcase.database.csvDateFormatter
import java.io.InputStream
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.util.*
import kotlin.reflect.typeOf


const val LOG_GOOD_READ = "BookGoodRead"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.beust.klaxon.JsonArray
import com.beust.klaxon.JsonObject
import com.beust.klaxon.Klaxon
import com.timenotclocks.bookcase.LOG_SEARCH
import com.timenotclocks.bookcase.api.RequestQueueSingleton
import com.timenotclocks.bookcase.database.Book
import kotlinx.coroutines.launch
import java.io.StringReader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ data class Book( // TODO: can I remove overloads? i'ts for the converter
ShelfType.CurrentShelf -> {
dateStarted = LocalDate.now().toEpochDay()
}
else -> {}
}
if (dateAdded == null) {
dateAdded = LocalDate.now().toEpochDay()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,13 @@
package com.timenotclocks.bookcase.database

import android.content.Context
import androidx.room.*
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.sqlite.db.SupportSQLiteDatabase

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.time.LocalDate
import java.time.format.DateTimeFormatter


class Converters {
var formatter: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")

@TypeConverter
fun fromDateString(value: String?): LocalDate? {
if (value != "null" && value != null) {
return LocalDate.parse(value, formatter)
}
return null // this is dumb
}


@TypeConverter
fun toDateString(date: LocalDate?): String? {
return date.toString()
}
}


/**
Expand All @@ -55,7 +35,6 @@ class Converters {
@Database(entities = [
Book::class, BooksFts::class
], version = 5)
@TypeConverters(Converters::class)
abstract class BookDatabase : RoomDatabase() {

abstract fun bookDao(): BookDao
Expand Down Expand Up @@ -100,17 +79,10 @@ abstract class BookDatabase : RoomDatabase() {
// comment out the following line.
INSTANCE?.let { database ->
scope.launch(Dispatchers.IO) {
populateDatabase(database.bookDao())
// populateDatabase(database.bookDao())
}
}
}
}

/**
* Populate the database in a new coroutine.
* If you want to start with more words, just add them.
*/
suspend fun populateDatabase(bookDao: BookDao) {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ package com.timenotclocks.bookcase.database

import androidx.annotation.WorkerThread
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.asLiveData
import com.timenotclocks.bookcase.database.Book
import com.timenotclocks.bookcase.database.BookDao
import kotlinx.coroutines.flow.Flow

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@

package com.timenotclocks.bookcase.database

import android.util.Log
import androidx.lifecycle.*
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.launch

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
package com.timenotclocks.bookcase.database

import android.app.Application
import com.timenotclocks.bookcase.database.BookDatabase
import com.timenotclocks.bookcase.database.BookRepository
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,22 @@

package com.timenotclocks.bookcase.ui.main

import android.content.Context
import android.content.Intent
import android.content.res.ColorStateList
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.RatingBar
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.beust.klaxon.Klaxon
import com.google.android.material.chip.Chip
import com.squareup.picasso.Picasso
import com.timenotclocks.bookcase.BookViewActivity
import com.timenotclocks.bookcase.EXTRA_ID
import com.timenotclocks.bookcase.LOG_TAG
import com.timenotclocks.bookcase.R
import com.timenotclocks.bookcase.database.*
import java.time.LocalDate
import com.timenotclocks.bookcase.database.Book
import com.timenotclocks.bookcase.database.ShelfType


const val LOG_BOOK_ADAPTER = "BookAdapter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,21 @@

package com.timenotclocks.bookcase.ui.main

import android.content.DialogInterface
import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.beust.klaxon.Klaxon
import com.squareup.picasso.Picasso
import androidx.activity.viewModels
import com.timenotclocks.bookcase.*
import com.timenotclocks.bookcase.ui.main.OpenLibrarySearchAdapter.SearchViewHolder
import com.timenotclocks.bookcase.NewBookActivity
import com.timenotclocks.bookcase.R
import com.timenotclocks.bookcase.database.Book
import com.timenotclocks.bookcase.database.BookViewModel
import com.timenotclocks.bookcase.database.BookViewModelFactory
import com.timenotclocks.bookcase.database.BooksApplication
import com.timenotclocks.bookcase.ui.main.OpenLibrarySearchAdapter.SearchViewHolder


const val EXTRA_OPEN_LIBRARY_SEARCH = "open_library_search_extra"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider

class PageViewModel : ViewModel() {

Expand Down
Loading

0 comments on commit 72b5068

Please sign in to comment.