Several design changes

This commit is contained in:
tom5079
2019-05-17 10:18:11 +09:00
parent 234f9b069a
commit 369fa679a6
11 changed files with 60 additions and 27 deletions

2
.idea/misc.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>

View File

@@ -40,7 +40,6 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "ru.noties.markwon:core:${markwonVersion}"
implementation 'com.shawnlin:number-picker:2.4.8'
implementation 'com.github.clans:fab:1.6.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'

View File

@@ -1,6 +1,7 @@
package xyz.quaver.pupil
import android.os.Bundle
import android.util.Log
import android.view.*
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
@@ -255,7 +256,7 @@ class ReaderActivity : AppCompatActivity() {
menu?.findItem(R.id.reader_menu_page_indicator)?.title = "$currentPage/$gallerySize"
}
reader.chunked(8).forEach { chunked ->
reader.chunked(4).forEach { chunked ->
chunked.map {
async(Dispatchers.IO) {
val url = if (it.galleryInfo?.haswebp == 1) webpUrlFromUrl(it.url) else it.url

View File

@@ -6,6 +6,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import androidx.cardview.widget.CardView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.chip.Chip
import kotlinx.android.synthetic.main.item_galleryblock.view.*
@@ -14,8 +15,8 @@ import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import xyz.quaver.hitomi.GalleryBlock
import xyz.quaver.hitomi.toTag
import xyz.quaver.pupil.R
import xyz.quaver.pupil.types.Tag
class GalleryBlockAdapter(private val galleries: List<Pair<GalleryBlock, Deferred<String>>>) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
@@ -110,11 +111,29 @@ class GalleryBlockAdapter(private val galleries: List<Pair<GalleryBlock, Deferre
galleryblock_tag_group.removeAllViews()
gallery.relatedTags.forEach {
galleryblock_tag_group.addView(
Chip(context).apply {
text = it.toTag().wordCapitalize()
val tag = Tag.parse(it)
val chip = LayoutInflater
.from(context)
.inflate(R.layout.tag_chip, holder.view, false) as Chip
val icon = when(tag.area) {
"male" -> {
chip.setChipBackgroundColorResource(R.color.material_blue_100)
chip.setTextColor(ContextCompat.getColor(context, android.R.color.white))
ContextCompat.getDrawable(context, R.drawable.ic_gender_male_white)
}
)
"female" -> {
chip.setChipBackgroundColorResource(R.color.material_pink_100)
chip.setTextColor(ContextCompat.getColor(context, android.R.color.white))
ContextCompat.getDrawable(context, R.drawable.ic_gender_female_white)
}
else -> null
}
chip.chipIcon = icon
chip.text = Tag.parse(it).tag.wordCapitalize()
galleryblock_tag_group.addView(chip)
}
}
}

View File

@@ -2,7 +2,7 @@ package xyz.quaver.pupil.types
data class Tag(val area: String?, val tag: String, val isNegative: Boolean = false) {
companion object {
fun parseTag(tag: String) : Tag {
fun parse(tag: String) : Tag {
if (tag.first() == '-') {
tag.substring(1).split(Regex(":"), 2).let {
return when(it.size) {
@@ -49,7 +49,7 @@ class Tags(tag: List<Tag?>?) : ArrayList<Tag>() {
return Tags(
tags.split(' ').map {
if (it.isNotEmpty())
Tag.parseTag(it)
Tag.parse(it)
else
null
}
@@ -74,7 +74,7 @@ class Tags(tag: List<Tag?>?) : ArrayList<Tag>() {
}
fun add(element: String): Boolean {
return super.add(Tag.parseTag(element))
return super.add(Tag.parse(element))
}
fun remove(element: String) {

View File

@@ -0,0 +1,8 @@
<!-- drawable/gender_female.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#fff" android:pathData="M12,4A6,6 0 0,1 18,10C18,12.97 15.84,15.44 13,15.92V18H15V20H13V22H11V20H9V18H11V15.92C8.16,15.44 6,12.97 6,10A6,6 0 0,1 12,4M12,6A4,4 0 0,0 8,10A4,4 0 0,0 12,14A4,4 0 0,0 16,10A4,4 0 0,0 12,6Z" />
</vector>

View File

@@ -0,0 +1,8 @@
<!-- drawable/gender-male.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#fff" android:pathData="M9,9C10.29,9 11.5,9.41 12.47,10.11L17.58,5H13V3H21V11H19V6.41L13.89,11.5C14.59,12.5 15,13.7 15,15A6,6 0 0,1 9,21A6,6 0 0,1 3,15A6,6 0 0,1 9,9M9,11A4,4 0 0,0 5,15A4,4 0 0,0 9,19A4,4 0 0,0 13,15A4,4 0 0,0 9,11Z" />
</vector>

View File

@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dark_gray"
tools:context=".ReaderActivity">
<LinearLayout

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.chip.Chip xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="24dp"
app:chipIconSize="16dp"
app:chipStartPadding="8dp"
app:chipCornerRadius="100dp">
</com.google.android.material.chip.Chip>

View File

@@ -4,4 +4,7 @@
<color name="colorPrimaryDark">#0093c4</color>
<color name="colorAccent">#D81B60</color>
<color name="appbar">#FFFFFF</color>
<color name="material_pink_100">#d81b60</color>
<color name="material_blue_100">#1976d2</color>
</resources>

View File

@@ -2,22 +2,6 @@ package xyz.quaver.hitomi
const val protocol = "https:"
fun String.toTag() : String {
if (this.indexOf(':') > -1) {
val split = this.split(':')
val field = split[0]
val term = split[1]
when(field) {
"male" -> return "$term"
"female" -> return "$term"
}
}
return this
}
//common.js
var adapose = false
const val numberOfFrontends = 2