Skip to content

Commit

Permalink
Merge branch 'release/0.2.1-alpha' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
ayayk committed Oct 25, 2017
2 parents c2bb1ce + e127c08 commit 47618e2
Show file tree
Hide file tree
Showing 19 changed files with 327 additions and 42 deletions.
22 changes: 19 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ jobs:
JVM_OPTS: -Xmx4G -Dkotlin.incremental=false
steps:
- checkout
# install fastlane
- restore_cache:
key: gems-{{ checksum "Gemfile.lock" }}
- run: bundle install --path vendor/bundle
- save_cache:
key: gems-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
# exec Android test and build
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
Expand All @@ -28,7 +37,6 @@ jobs:
command: |
openssl aes-256-cbc -d -k $SIGNATURE_DECRYPT_KEY -in signature.tar.gz.enc -out signature.tar.gz
tar -zxvf signature.tar.gz
mv google-services.json app/
- run:
name: Run Tests
command: ./gradlew lint test -PdisablePreDex
Expand All @@ -44,5 +52,13 @@ jobs:
name: Deploy to DeployGate
command: |
[ "$CIRCLE_BRANCH" != "master" ] && exit
./gradlew assembleNightlyRelease -PdisablePreDex
./deploy.sh
export ROOT_DIR=`git rev-parse --show-toplevel`
export VERSION=`grep "def VERSION" $ROOT_DIR/app/build.gradle | sed -E 's/.*"(.+)"$/\1/'`
bundle exec fastlane android nightly
- deploy:
name: Deploy to Google Play
command: |
[ "$CIRCLE_BRANCH" != "production" ] && exit
export ROOT_DIR=`git rev-parse --show-toplevel`
export VERSION=`grep "def VERSION" $ROOT_DIR/app/build.gradle | sed -E 's/.*"(.+)"$/\1/'`
bundle exec fastlane android deploy
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
app.release.jks
app/google-services.json
secret.properties
google-play-service.json
signature.tar.gz
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "fastlane"
139 changes: 139 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.5)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
babosa (1.0.2)
claide (1.0.2)
colored (1.2)
colored2 (3.1.2)
commander-fastlane (4.4.5)
highline (~> 1.7.2)
declarative (0.0.10)
declarative-option (0.1.0)
domain_name (0.5.20170404)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.2.1)
excon (0.59.0)
faraday (0.13.1)
multipart-post (>= 1.2, < 3)
faraday-cookie_jar (0.0.6)
faraday (>= 0.7.4)
http-cookie (~> 1.0.0)
faraday_middleware (0.12.2)
faraday (>= 0.7.4, < 1.0)
fastimage (2.1.0)
fastlane (2.62.1)
CFPropertyList (>= 2.3, < 3.0.0)
addressable (>= 2.3, < 3.0.0)
babosa (>= 1.0.2, < 2.0.0)
bundler (>= 1.12.0, < 2.0.0)
colored
commander-fastlane (>= 4.4.5, < 5.0.0)
dotenv (>= 2.1.1, < 3.0.0)
excon (>= 0.45.0, < 1.0.0)
faraday (~> 0.9)
faraday-cookie_jar (~> 0.0.6)
faraday_middleware (~> 0.9)
fastimage (>= 2.1.0, < 3.0.0)
gh_inspector (>= 1.0.1, < 2.0.0)
google-api-client (>= 0.13.1, < 0.14.0)
highline (>= 1.7.2, < 2.0.0)
json (< 3.0.0)
mini_magick (~> 4.5.1)
multi_json
multi_xml (~> 0.5)
multipart-post (~> 2.0.0)
plist (>= 3.1.0, < 4.0.0)
public_suffix (~> 2.0.0)
rubyzip (>= 1.1.0, < 2.0.0)
security (= 0.1.3)
slack-notifier (>= 1.3, < 2.0.0)
terminal-notifier (>= 1.6.2, < 2.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
tty-screen (~> 0.5.0)
word_wrap (~> 1.0.0)
xcodeproj (>= 1.5.0, < 2.0.0)
xcpretty (>= 0.2.4, < 1.0.0)
xcpretty-travis-formatter (>= 0.0.3)
gh_inspector (1.0.3)
google-api-client (0.13.6)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 0.5)
httpclient (>= 2.8.1, < 3.0)
mime-types (~> 3.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
googleauth (0.6.1)
faraday (~> 0.12)
jwt (>= 1.4, < 3.0)
logging (~> 2.0)
memoist (~> 0.12)
multi_json (~> 1.11)
os (~> 0.9)
signet (~> 0.7)
highline (1.7.8)
http-cookie (1.0.3)
domain_name (~> 0.5)
httpclient (2.8.3)
json (2.1.0)
jwt (2.1.0)
little-plugger (1.1.4)
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
memoist (0.16.0)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_magick (4.5.1)
multi_json (1.12.2)
multi_xml (0.6.0)
multipart-post (2.0.0)
nanaimo (0.2.3)
os (0.9.6)
plist (3.3.0)
public_suffix (2.0.5)
representable (3.0.4)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
uber (< 0.2.0)
retriable (3.1.1)
rouge (2.0.7)
rubyzip (1.2.1)
security (0.1.3)
signet (0.8.1)
addressable (~> 2.3)
faraday (~> 0.9)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
slack-notifier (1.5.1)
terminal-notifier (1.8.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
tty-screen (0.5.0)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.4)
unicode-display_width (1.3.0)
word_wrap (1.0.0)
xcodeproj (1.5.2)
CFPropertyList (~> 2.3.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.3)
xcpretty (0.2.8)
rouge (~> 2.0.7)
xcpretty-travis-formatter (0.0.4)
xcpretty (~> 0.2, >= 0.0.7)

PLATFORMS
ruby

DEPENDENCIES
fastlane

BUNDLED WITH
1.15.4
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'io.fabric'

def APP_NAME = "biblio"
def VERSION = "0.2.0-alpha"
def VERSION = "0.2.1-alpha"
def PACKAGE_NAME = "com.ayatk.biblio"

// for debug info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.ayatk.biblio.R
import com.ayatk.biblio.databinding.FragmentNovelInfoBinding
import com.ayatk.biblio.model.Novel
import com.ayatk.biblio.repository.library.LibraryRepository
Expand All @@ -33,35 +31,22 @@ class NovelInfoFragment : BaseFragment() {
Parcels.unwrap<Novel>(arguments.getParcelable(BUNDLE_ARGS_NOVEL))
}

private lateinit var viewModel: NovelInfoViewModel

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
binding = FragmentNovelInfoBinding.inflate(inflater, container, false)
binding.viewModel = NovelInfoViewModel(context, navigator, libraryRepository, novel)

novel.novelTags.map {
val tagItem = this.onGetLayoutInflater(savedInstanceState).inflate(R.layout.view_tag, null)
val textView = tagItem.findViewById<TextView>(R.id.tag)
textView.text = it
binding.tagContainer.addView(textView)
}

libraryRepository.find(novel)
.subscribe(
{
it.tag.map {
val tagItem = this.onGetLayoutInflater(savedInstanceState).inflate(
R.layout.view_tag,
null)
val textView = tagItem.findViewById<TextView>(R.id.tag)
textView.text = it
binding.userTagContainer.addView(textView)
}
}
)
viewModel = NovelInfoViewModel(navigator, libraryRepository, novel)
binding.viewModel = viewModel

return binding.root
}

override fun onResume() {
super.onResume()
viewModel.start()
}

override fun onAttach(context: Context?) {
super.onAttach(context)
component().inject(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,31 @@

package com.ayatk.biblio.view.helper

import android.content.Context
import android.databinding.BindingAdapter
import android.databinding.BindingConversion
import android.graphics.drawable.ColorDrawable
import android.view.LayoutInflater
import android.widget.TextView
import com.ayatk.biblio.R
import com.google.android.flexbox.FlexboxLayout

object DataBindingHelper {

@JvmStatic
@BindingConversion
fun convertColorToDrawable(color: Int): ColorDrawable = ColorDrawable(color)

@JvmStatic
@BindingAdapter("tags")
fun FlexboxLayout.setTags(tags: List<String>) {
this.removeAllViews()
val inflater = this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
tags.map {
val tagItem = inflater.inflate(R.layout.view_tag, null)
val textView = tagItem.findViewById<TextView>(R.id.tag)
textView.text = it
this.addView(textView)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ package com.ayatk.biblio.viewmodel
import android.app.AlertDialog
import android.content.Context
import android.databinding.BaseObservable
import android.databinding.Bindable
import android.view.View
import android.view.inputmethod.InputMethodManager
import com.ayatk.biblio.BR
import com.ayatk.biblio.model.Library
import com.ayatk.biblio.model.Novel
import com.ayatk.biblio.repository.library.LibraryRepository
Expand All @@ -17,8 +19,7 @@ import com.ayatk.biblio.view.helper.Navigator
import mabbas007.tagsedittext.TagsEditText

class NovelInfoViewModel
constructor(private val context: Context,
private val navigator: Navigator,
constructor(private val navigator: Navigator,
private val libraryRepository: LibraryRepository,
val novel: Novel) : BaseObservable(), ViewModel {

Expand Down Expand Up @@ -48,10 +49,21 @@ constructor(private val context: Context,
// }
// }

@Bindable
var tags = listOf<String>()

fun lastUpdate(): String = FORMAT_yyyyMMdd_kkmm_JP.format(novel.lastUpdateDate)

fun url(): String = novel.publisher.url + novel.code.toLowerCase()

fun start() {
libraryRepository.find(novel)
.subscribe({ library ->
tags = library.tag
notifyPropertyChanged(BR.tags)
})
}

fun onClickWriter(@Suppress("UNUSED_PARAMETER") view: View) {
navigator.navigateToWebPage("http://mypage.syosetu.com/" + novel.writerId)
}
Expand All @@ -60,7 +72,7 @@ constructor(private val context: Context,
navigator.navigateToWebPage("http://ncode.syosetu.com/" + novel.code.toLowerCase())
}

fun onClickUserTag(@Suppress("UNUSED_PARAMETER") view: View) {
fun onClickUserTag(context: Context) {
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager

val editView = TagsEditText(context)
Expand All @@ -71,8 +83,9 @@ constructor(private val context: Context,
.setTitle("タグの追加")
.setView(editView)
.setPositiveButton("OK") { _, _ ->
libraryRepository.save(Library(novel = novel, tag = editView.tags))
.subscribe()
libraryRepository.save(Library(novel = novel, tag = editView.tags)).subscribe()
tags = editView.tags
notifyPropertyChanged(BR.tags)
imm.hideSoftInputFromWindow(editView.windowToken, 0)
}
.setNegativeButton("キャンセル") { _, _ ->
Expand All @@ -82,11 +95,7 @@ constructor(private val context: Context,


libraryRepository.find(novel)
.subscribe(
{ library ->
editView.setTags(*library.tag.toTypedArray())
}
)
.subscribe({ library -> editView.setTags(*library.tag.toTypedArray()) })

dialog.show()
editView.requestFocus()
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/res/layout/fragment_novel_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,16 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/img_tag"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
app:layout_constraintTop_toTopOf="parent"
app:tags="@{viewModel.novel.novelTags}"/>

</android.support.constraint.ConstraintLayout>

<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:onClick="@{viewModel::onClickUserTag}"
android:onClick="@{() -> viewModel.onClickUserTag(context)}"
android:padding="@dimen/space_16dp">

<ImageView
Expand All @@ -181,7 +182,8 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/img_user_tag"
app:layout_constraintTop_toTopOf="parent"/>
app:layout_constraintTop_toTopOf="parent"
app:tags="@{viewModel.tags}"/>

</android.support.constraint.ConstraintLayout>

Expand Down
Loading

0 comments on commit 47618e2

Please sign in to comment.