diff --git a/app/build.gradle b/app/build.gradle index 045bacd..91d00be 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -36,6 +36,9 @@ android { kotlinOptions { jvmTarget = '1.8' } + buildFeatures { + dataBinding true + } } dependencies { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 403880d..83a28de 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -18,8 +18,7 @@ diff --git a/app/src/main/java/com/mime/dualscreenview/activity/Intro.kt b/app/src/main/java/com/mime/dualscreenview/activity/Intro.kt index e3b1e9d..423dba9 100644 --- a/app/src/main/java/com/mime/dualscreenview/activity/Intro.kt +++ b/app/src/main/java/com/mime/dualscreenview/activity/Intro.kt @@ -1,6 +1,7 @@ package com.mime.dualscreenview.activity import android.content.DialogInterface +import android.content.Intent import android.content.pm.ActivityInfo import android.content.res.Configuration import android.graphics.Bitmap @@ -10,7 +11,10 @@ import android.os.Bundle import android.os.Handler import android.os.Message import android.text.InputType +import android.text.SpannableStringBuilder +import android.text.style.RelativeSizeSpan import android.util.Log +import android.view.Gravity import android.view.KeyEvent import android.view.View import android.view.View.* @@ -22,9 +26,11 @@ import android.widget.EditText import android.widget.ImageButton import android.widget.ProgressBar import android.widget.TextView +import android.widget.Toast import androidx.annotation.RequiresApi import androidx.appcompat.app.AlertDialog import androidx.appcompat.widget.AppCompatButton +import androidx.constraintlayout.utils.widget.ImageFilterButton import com.google.gson.Gson import com.mime.dualscreenview.R import com.mime.dualscreenview.common.Blog @@ -125,12 +131,12 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { contentsSaver?.clearSslPreferences(); } - findViewById(R.id.btn_rotate).setOnClickListener { v-> - switcvhOrient() - } +// findViewById(R.id.btn_rotate).setOnClickListener { v-> +// switcvhOrient() +// } findViewById(R.id.btn_setting).setOnClickListener { v-> -// startActivity(Intent(this@Intro, Settings::class.java)) + startActivity(Intent(this@Intro, Settings::class.java)) } findViewById(R.id.btn_history).setOnClickListener { v-> var realm = openRealm() @@ -158,7 +164,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { fun reloadLastInfo() { val configuration: Configuration = getResources().getConfiguration() if(lastInfo != null && lastInfo?.displayOrientation != configuration.orientation) { - findViewById(R.id.btn_rotate).performClick() +// findViewById(R.id.btn_rotate).performClick() } } @@ -247,11 +253,11 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { reloadTo(lastInfo) } fun switcvhOrient(){ - val configuration: Configuration = getResources().getConfiguration() - setRequestedOrientation( - if(configuration.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE } - else {ActivityInfo.SCREEN_ORIENTATION_PORTRAIT} - ) +// val configuration: Configuration = getResources().getConfiguration() +// setRequestedOrientation( +// if(configuration.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE } +// else {ActivityInfo.SCREEN_ORIENTATION_PORTRAIT} +// ) } fun showHistory(infos: List) { @@ -343,7 +349,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { override fun onPageFinished(webView: WebView?, url: String?) { super.onPageFinished(webView, url) isLoading = false - var ramdomTimeSec = 1000L + Random(System.currentTimeMillis()).nextLong().rem(1999) + var ramdomTimeSec = 1500L + Random(System.currentTimeMillis()).nextLong().rem(2999) Blog.LOGE("ramdomTime >>> ${ramdomTimeSec}") webView?.postDelayed( { Blog.LOGE("saveClient >>> ${isLoading} ${url}") @@ -353,13 +359,13 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { webView?.evaluateJavascript(findContents){ result: String? -> Blog.LOGE("saveClient result >>> ${result}") result?.let { string: String -> - Blog.LOGE("saveClient contents >>> ${string}") + Blog.LOGE("saveClient contents >>> ${string.length}") if (string.length > 10) { Blog.LOGE("saveClient it.length >>> ${string.length}") var contents = string.replace("\\\"", "\"") contents = (contents.replace("\\n", System.getProperty("line.separator"))) - Blog.LOGE("saveClient contents >>> ${contents}") + Blog.LOGE("saveClient contents >>> ${contents.length}") Uri.parse(url)?.let { it.path?.let { HistoryManager.getBooPageInfo(it) { @@ -371,11 +377,21 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { } } }.close() + runOnUiThread { + it?.let { + var origin = it.getTitleItem() + val biggerText = SpannableStringBuilder(origin) + biggerText.setSpan(RelativeSizeSpan(1.6f), 0, origin.length, 0) + Toast.makeText(baseContext,biggerText, Toast.LENGTH_LONG).apply { + setGravity(Gravity.CENTER, 0, 0) + }.show() + } + } } } } } - var ramdomTime = 10000L + Random(System.currentTimeMillis()).nextLong().rem(3999) + var ramdomTime = 10000L + Random(System.currentTimeMillis()).nextLong().rem(9999) Blog.LOGE("ramdomTime >>> ${ramdomTime}") contentsSaver?.postDelayed( { saveItem(null) }, ramdomTime) } @@ -454,8 +470,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { var onNextClickAction: GotoSomeWhere? = null override fun showNextBtn(find : Boolean , onClickAction: GotoSomeWhere) { onNextClickAction = onClickAction - findViewById(R.id.btn_right)?.let{ - it.text = "다음 페이지" + findViewById(R.id.btn_right)?.let{ it.setOnClickListener { actionNextEvent() } @@ -505,8 +520,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { var onPrevClickAction: GotoSomeWhere? = null override fun showPrevBtn(find : Boolean, onClickAction: GotoSomeWhere) { onPrevClickAction = onClickAction - findViewById(R.id.btn_left)?.let{ - it.text = "이전 페이지" + findViewById(R.id.btn_left)?.let{ it.setOnClickListener { actionPrevEvent() } @@ -584,26 +598,28 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { paged_layer.apply { if (aContents != null) { var contents = aContents.replace("\\\"","\"") - text = (contents.replace("\\n", System.getProperty("line.separator"))) - visibility = VISIBLE + contents = (contents.replace("\\n", System.getProperty("line.separator"))) + mPagedTextViewInterface = this@Intro var realm = HistoryManager.openRealm() realm.query()?.find()?.let { if (it.size > 0) { realm.copyFromRealm(it.first())?.let { - paged_layer?.setTextSize(it.textSize?.toFloat()?: 14f) - paged_layer?.setLineSpacing(it.lineSpace?.toFloat() ?: 1f) - paged_layer?.setLetterSpacing(it.letterSpace?.toFloat() ?: 1f) - paged_layer?.setPadding( - it.padding ?: 1, - it.padding ?: 1, - it.padding ?: 1, - it.padding ?: 1) + runOnUiThread { + paged_layer?.setTextSize(it.textSize?.toFloat()?: 14f) + paged_layer?.setLineSpacing(it.lineSpace?.toFloat() ?: 1f) + paged_layer?.setLetterSpacing(it.letterSpace?.toFloat() ?: 1f) + paged_layer?.setPadding( + it.padding ?: 1, + it.padding ?: 1, + it.padding ?: 1, + it.padding ?: 1) - var typeface = typesfacez.get(getIndex(typesfacez as PairArray,it.font ?: "")) - paged_layer?.setTypeface(resources.getFont(typeface.second)) - val color = colorz.get(it.style ?: 0) - paged_layer?.setColorStyle(color.second) + var typeface = typesfacez.get(getIndex(typesfacez as PairArray,it.font ?: "")) + paged_layer?.setTypeface(resources.getFont(typeface.second)) + val color = colorz.get(it.style ?: 0) + paged_layer?.setColorStyle(color.second) + } } } } @@ -616,12 +632,13 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { if(lastInfo != null && mBaseWebContentsViewer.webview.url?.endsWith(lastInfo!!.pageUrl) ?: false) { this@Intro.findViewById(R.id.progress)?.visibility = VISIBLE paged_layer?.postDelayed({ - next(lastInfo!!.pageIndex) - paged_layer?.post { - this@Intro.findViewById(R.id.progress)?.visibility = GONE - } + this@Intro.findViewById(R.id.progress)?.visibility = GONE },1000) } + runOnUiThread { + text = (contents.replace("\\n", System.getProperty("line.separator"))) + visibility = VISIBLE + } forceUpdateUI() mBaseWebContentsViewer.webview.url?.let { Uri.parse(it)?.let { @@ -776,7 +793,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { findViewById(R.id.btn_home).visibility = VISIBLE findViewById(R.id.btn_list).visibility = VISIBLE findViewById(R.id.btn_history).visibility = VISIBLE - findViewById(R.id.btn_rotate).visibility = VISIBLE +// findViewById(R.id.btn_rotate).visibility = VISIBLE } TouchArea.Right -> { @@ -830,7 +847,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { findViewById(R.id.btn_home).visibility = VISIBLE findViewById(R.id.btn_list).visibility = VISIBLE findViewById(R.id.btn_history).visibility = VISIBLE - findViewById(R.id.btn_rotate).visibility = VISIBLE +// findViewById(R.id.btn_rotate).visibility = VISIBLE } } } @@ -846,7 +863,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { findViewById(R.id.btn_home).visibility = GONE findViewById(R.id.btn_list).visibility = GONE findViewById(R.id.btn_history).visibility = GONE - findViewById(R.id.btn_rotate).visibility = GONE +// findViewById(R.id.btn_rotate).visibility = GONE } diff --git a/app/src/main/java/com/mime/dualscreenview/activity/Settings.kt b/app/src/main/java/com/mime/dualscreenview/activity/Settings.kt index d746f73..ba3117e 100644 --- a/app/src/main/java/com/mime/dualscreenview/activity/Settings.kt +++ b/app/src/main/java/com/mime/dualscreenview/activity/Settings.kt @@ -1,128 +1,125 @@ -//package com.mime.dualscreenview.activity -// -//import android.graphics.Color -//import android.os.Build -//import android.os.Bundle -//import androidx.annotation.RequiresApi -//import com.mime.dualscreenview.R -//import com.mime.dualscreenview.common.PairArray -//import com.mime.dualscreenview.common.colorz -//import com.mime.dualscreenview.common.getIndex -//import com.mime.dualscreenview.common.typesfacez -//import com.mime.dualscreenview.data.HistoryManager -//import com.mime.dualscreenview.data.model.ReaderConfig -//import io.realm.kotlin.UpdatePolicy -//import io.realm.kotlin.ext.query -//import kotlinx.android.synthetic.main.settings.letter_space -//import kotlinx.android.synthetic.main.settings.line_space -//import kotlinx.android.synthetic.main.settings.page_padding -//import kotlinx.android.synthetic.main.settings.page_style -//import kotlinx.android.synthetic.main.settings.page_typesface -//import kotlinx.android.synthetic.main.settings.preview -//import kotlinx.android.synthetic.main.settings.text_size -// -//class Settings : Base() { -// -// var readerConfig : ReaderConfig? = null -// override fun onCreate(savedInstanceState: Bundle?) { -// super.onCreate(savedInstanceState) +package com.mime.dualscreenview.activity + +import android.graphics.Color +import android.os.Build +import android.os.Bundle +import androidx.annotation.RequiresApi +import androidx.databinding.DataBindingUtil +import com.mime.dualscreenview.R +import com.mime.dualscreenview.common.PairArray +import com.mime.dualscreenview.common.colorz +import com.mime.dualscreenview.common.getIndex +import com.mime.dualscreenview.common.typesfacez +import com.mime.dualscreenview.data.HistoryManager +import com.mime.dualscreenview.data.model.ReaderConfig +import com.mime.dualscreenview.databinding.SettingsBinding +import io.realm.kotlin.UpdatePolicy +import io.realm.kotlin.ext.query + +class Settings : Base() { + + lateinit var binding : SettingsBinding + var readerConfig : ReaderConfig? = null + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = DataBindingUtil.setContentView(this, R.layout.settings) // setContentView(R.layout.settings) -// var realm = HistoryManager.openRealm() -// realm.writeBlocking { -// this.query()?.find()?.let { -// if (it.size > 0) { -// readerConfig = copyFromRealm(it.first()) -// } else { -// readerConfig = ReaderConfig() -// } -// } -// -// } -// realm.close() -// } -// -// @RequiresApi(Build.VERSION_CODES.O) -// override fun onResume() { -// super.onResume() -// text_size.displayFormat = "글자 크기 : %d" -// text_size.value = readerConfig?.textSize ?: 14 -// text_size.mValueChange = { -// preview.textSize = it.toFloat() ; -// if (readerConfig?.textSize != it) { -// readerConfig?.textSize = it -// configSave() -// } -// } -// -// -// page_padding.displayFormat = "페이지 여백 : %d" -// page_padding.value = readerConfig?.padding ?: 5 -// page_padding.mValueChange = { -// preview.setPadding(it,it,it,it) ; -// if (readerConfig?.padding != it) { -// readerConfig?.padding = it -// configSave() -// } -// } -// -// -// letter_space.displayFormat = "자간 : %d" -// letter_space.value = readerConfig?.letterSpace ?: 1 -// letter_space.mValueChange = { -// preview.letterSpacing = it.times(0.01).toFloat() ; -// if (readerConfig?.letterSpace != it) { -// readerConfig?.letterSpace = it -// configSave() -// } -// } -// -// -// line_space.displayFormat = "행간 : %d" -// line_space.value = readerConfig?.lineSpace ?: 1 -// line_space.mValueChange = { -// preview.setLineSpacing(1f, 1f.plus(it.times(0.01f))) ; -// if (readerConfig?.lineSpace != it) { -// readerConfig?.lineSpace = it -// configSave() -// } -// } -// -// -// -// page_typesface.displayFormat = "폰트 : %s" -// page_typesface.titleArray = typesfacez.map { it.first }.toTypedArray() -// page_typesface.value = getIndex(typesfacez as PairArray,readerConfig?.font ?: "") -// page_typesface.mValueChange = { -// val pair = typesfacez.get(it) -// preview.setTypeface(resources.getFont(pair.second)) -// if (readerConfig?.font != pair.first) { -// readerConfig?.font = pair.first ?: "" -// configSave() -// } -// } -// -// page_style.displayFormat = "스타일 : %s" -// page_style.titleArray = colorz.map { it.first }.toTypedArray() -// page_style.value = readerConfig?.style ?: 0 -// page_style.mValueChange = { -// val pair = colorz.get(it) -// preview.setBackgroundColor(Color.parseColor(pair.second.last())) -// preview.setTextColor(Color.parseColor(pair.second.first())) -// if (readerConfig?.style != it) { -// readerConfig?.style = it ?: 0 -// configSave() -// } -// } -// -// } -// -// -// -// fun configSave() { -// var realm = HistoryManager.openRealm() -// realm.writeBlocking { -// copyToRealm(readerConfig!!, UpdatePolicy.ALL) -// } -// realm.close() -// } -//} \ No newline at end of file + var realm = HistoryManager.openRealm() + realm.writeBlocking { + this.query()?.find()?.let { + if (it.size > 0) { + readerConfig = copyFromRealm(it.first()) + } else { + readerConfig = ReaderConfig() + } + } + + } + realm.close() + } + + @RequiresApi(Build.VERSION_CODES.O) + override fun onResume() { + super.onResume() + binding.textSize.displayFormat = "글자 크기 : %d" + binding.textSize.value = readerConfig?.textSize ?: 14 + binding.textSize.mValueChange = { + binding.preview.textSize = it.toFloat() ; + if (readerConfig?.textSize != it) { + readerConfig?.textSize = it + configSave() + } + } + + + binding.pagePadding.displayFormat = "페이지 여백 : %d" + binding.pagePadding.value = readerConfig?.padding ?: 5 + binding.pagePadding.mValueChange = { + binding.preview.setPadding(it,it,it,it) ; + if (readerConfig?.padding != it) { + readerConfig?.padding = it + configSave() + } + } + + + binding.letterSpace.displayFormat = "자간 : %d" + binding.letterSpace.value = readerConfig?.letterSpace ?: 1 + binding.letterSpace.mValueChange = { + binding.preview.letterSpacing = it.times(0.01).toFloat() ; + if (readerConfig?.letterSpace != it) { + readerConfig?.letterSpace = it + configSave() + } + } + + + binding.lineSpace.displayFormat = "행간 : %d" + binding.lineSpace.value = readerConfig?.lineSpace ?: 1 + binding.lineSpace.mValueChange = { + binding.preview.setLineSpacing(1f, 1f.plus(it.times(0.01f))) ; + if (readerConfig?.lineSpace != it) { + readerConfig?.lineSpace = it + configSave() + } + } + + + + binding.pageTypesface.displayFormat = "폰트 : %s" + binding.pageTypesface.titleArray = typesfacez.map { it.first }.toTypedArray() + binding.pageTypesface.value = getIndex(typesfacez as PairArray,readerConfig?.font ?: "") + binding.pageTypesface.mValueChange = { + val pair = typesfacez.get(it) + binding.preview.setTypeface(resources.getFont(pair.second)) + if (readerConfig?.font != pair.first) { + readerConfig?.font = pair.first ?: "" + configSave() + } + } + + binding.pageStyle.displayFormat = "스타일 : %s" + binding.pageStyle.titleArray = colorz.map { it.first }.toTypedArray() + binding.pageStyle.value = readerConfig?.style ?: 0 + binding.pageStyle.mValueChange = { + val pair = colorz.get(it) + binding.preview.setBackgroundColor(Color.parseColor(pair.second.last())) + binding.preview.setTextColor(Color.parseColor(pair.second.first())) + if (readerConfig?.style != it) { + readerConfig?.style = it ?: 0 + configSave() + } + } + + } + + + + fun configSave() { + var realm = HistoryManager.openRealm() + realm.writeBlocking { + copyToRealm(readerConfig!!, UpdatePolicy.ALL) + } + realm.close() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/mime/dualscreenview/view/ScopeEditor.kt b/app/src/main/java/com/mime/dualscreenview/view/ScopeEditor.kt index e10fe39..50747ea 100644 --- a/app/src/main/java/com/mime/dualscreenview/view/ScopeEditor.kt +++ b/app/src/main/java/com/mime/dualscreenview/view/ScopeEditor.kt @@ -1,62 +1,64 @@ -//package com.mime.dualscreenview.view -// -//import android.content.Context -//import android.util.AttributeSet -//import com.mime.dualscreenview.R -//import kotlinx.android.synthetic.main.layout_steps_editor.view.btn_decrement -//import kotlinx.android.synthetic.main.layout_steps_editor.view.btn_increment -//import kotlinx.android.synthetic.main.layout_steps_editor.view.text_value -// -//class ScopeEditor: SideButtonTextView { -// constructor(context: Context) : super(context) -// constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) -// constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( -// context, -// attrs, -// defStyleAttr -// ) -// var titleArray : Array? = null -// set(value) { -// if(value != null && value.size < 1) { -// Error("titleArray는 최소 한개 이상이여야됨.") -// return -// } -// field = value -// maxValue = field!!.size -// } -// -// var maxValue : Int = 1 -// set(value) { -// if (value < 1) { -// Error("maxValue는 무조건 0보다 커야하눈뎅....") -// return -// } -// field = value -// } -// -// override var value : Int = 14 -// set(newValue) { -// field = newValue -// text_value.text = displayFormat.format(titleArray?.get(field) ?:"defulat") -// mValueChange?.invoke(field) -// } -// -// -// constructor( -// context: Context, -// attrs: AttributeSet?, -// defStyleAttr: Int, -// defStyleRes: Int -// ) : super(context, attrs, defStyleAttr, defStyleRes) -// -// init { +package com.mime.dualscreenview.view + +import android.content.Context +import android.util.AttributeSet +import android.widget.Button +import androidx.appcompat.widget.AppCompatButton +import com.mime.dualscreenview.R + +class ScopeEditor: SideButtonTextView { + constructor(context: Context) : super(context) + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( + context, + attrs, + defStyleAttr + ) + var titleArray : Array? = null + set(value) { + if(value != null && value.size < 1) { + Error("titleArray는 최소 한개 이상이여야됨.") + return + } + field = value + maxValue = field!!.size + } + + var maxValue : Int = 1 + set(value) { + if (value < 1) { + Error("maxValue는 무조건 0보다 커야하눈뎅....") + return + } + field = value + } + + override var value : Int = 14 + set(newValue) { + field = newValue + text_value?.text = displayFormat.format(titleArray?.get(field) ?:"defulat") + mValueChange?.invoke(field) + } + + + constructor( + context: Context, + attrs: AttributeSet?, + defStyleAttr: Int, + defStyleRes: Int + ) : super(context, attrs, defStyleAttr, defStyleRes) + + + + init { +// super.i // inflate(context, R.layout.layout_steps_editor,this) -// btn_decrement.setOnClickListener { value = Math.abs(value.dec()).rem(maxValue) } -// btn_increment.setOnClickListener { value = value.inc().rem(maxValue) } -// leftButtonTitle = "<" -// rightButtonTitle = ">" -// } -// -// -// -//} \ No newline at end of file + btn_decrement?.setOnClickListener { value = Math.abs(value.dec()).rem(maxValue) } + btn_increment?.setOnClickListener { value = value.inc().rem(maxValue) } + leftButtonTitle = "<" + rightButtonTitle = ">" + } + + + +} \ No newline at end of file diff --git a/app/src/main/java/com/mime/dualscreenview/view/SideButtonTextView.kt b/app/src/main/java/com/mime/dualscreenview/view/SideButtonTextView.kt index 93da39c..8048fff 100644 --- a/app/src/main/java/com/mime/dualscreenview/view/SideButtonTextView.kt +++ b/app/src/main/java/com/mime/dualscreenview/view/SideButtonTextView.kt @@ -1,70 +1,78 @@ -//package com.mime.dualscreenview.view -// -//import android.content.Context -//import android.util.AttributeSet -//import androidx.constraintlayout.widget.ConstraintLayout -//import com.mime.dualscreenview.R -//import kotlinx.android.synthetic.main.layout_steps_editor.view.btn_decrement -//import kotlinx.android.synthetic.main.layout_steps_editor.view.btn_increment -//import kotlinx.android.synthetic.main.layout_steps_editor.view.text_value -//import java.lang.Exception -// -//open class SideButtonTextView : ConstraintLayout { -// constructor(context: Context) : super(context) -// constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) -// constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( -// context, -// attrs, -// defStyleAttr -// ) -// -// constructor( -// context: Context, -// attrs: AttributeSet?, -// defStyleAttr: Int, -// defStyleRes: Int -// ) : super(context, attrs, defStyleAttr, defStyleRes) -// -// var leftButtonTitle : String = "" -// set(value) { -// field = value -// btn_decrement.text = field -// } -// -// var rightButtonTitle : String = "" -// set(value) { -// field = value -// btn_increment.text = field -// } -// -// open var value : Int = 14 -// set(newValue) { -// field = newValue -// text_value.text = displayFormat.format(field) -// mValueChange?.invoke(field) -// } -// -// var displayFormat = "글자 크기 : %d" -// set(newValue) { -// field = newValue -// try { -// text_value.text = displayFormat.format(value) -// } catch (e : Exception) { -// -// } -// } -// -// var mValueChange : ValueChange? = null -// set(newValue) { -// field = newValue -// if (newValue != null) { -// newValue(value) -// } -// } -// -// init { -//// inflate(context, R.layout.layout_steps_editor,this) -//// btn_decrement.setOnClickListener { value = value.dec() } -//// btn_increment.setOnClickListener { value = value.inc() } -// } -//} \ No newline at end of file +package com.mime.dualscreenview.view + +import android.content.Context +import android.util.AttributeSet +import android.widget.Button +import android.widget.TextView +import androidx.appcompat.widget.AppCompatButton +import androidx.constraintlayout.widget.ConstraintLayout +import com.mime.dualscreenview.R + +import java.lang.Exception + +open class SideButtonTextView : ConstraintLayout { + constructor(context: Context) : super(context) + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( + context, + attrs, + defStyleAttr + ) + + constructor( + context: Context, + attrs: AttributeSet?, + defStyleAttr: Int, + defStyleRes: Int + ) : super(context, attrs, defStyleAttr, defStyleRes) + + var leftButtonTitle : String = "" + set(value) { + field = value + btn_decrement?.text = field + } + + var rightButtonTitle : String = "" + set(value) { + field = value + btn_increment?.text = field + } + + open var value : Int = 14 + set(newValue) { + field = newValue + text_value?.text = displayFormat.format(field) + mValueChange?.invoke(field) + } + + var displayFormat = "글자 크기 : %d" + set(newValue) { + field = newValue + try { + text_value?.text = displayFormat.format(value) + } catch (e : Exception) { + + } + } + + var mValueChange : ValueChange? = null + set(newValue) { + field = newValue + if (newValue != null) { + newValue(value) + } + } + + var btn_decrement : AppCompatButton? = null + var btn_increment : AppCompatButton? = null + var text_value : TextView? = null + + init { + inflate(context, R.layout.layout_steps_editor,this) + btn_increment = findViewById(R.id.btn_increment) + btn_decrement = findViewById(R.id.btn_decrement) + text_value = findViewById(R.id.text_value) + btn_decrement?.setOnClickListener { value = value.dec() } + btn_increment?.setOnClickListener { value = value.inc() } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/mime/dualscreenview/view/StepsEditor.kt b/app/src/main/java/com/mime/dualscreenview/view/StepsEditor.kt index a4cb129..9a3f925 100644 --- a/app/src/main/java/com/mime/dualscreenview/view/StepsEditor.kt +++ b/app/src/main/java/com/mime/dualscreenview/view/StepsEditor.kt @@ -1,37 +1,32 @@ -//package com.mime.dualscreenview.view -// -//import android.content.Context -//import android.util.AttributeSet -//import androidx.constraintlayout.widget.ConstraintLayout -//import com.mime.dualscreenview.R -//import kotlinx.android.synthetic.main.layout_steps_editor.view.btn_decrement -//import kotlinx.android.synthetic.main.layout_steps_editor.view.btn_increment -//import kotlinx.android.synthetic.main.layout_steps_editor.view.text_value -//import java.lang.Exception -// -//typealias ValueChange = (Int)->Unit -// -//class StepsEditor : SideButtonTextView { -// constructor(context: Context) : super(context) -// constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) -// constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( -// context, -// attrs, -// defStyleAttr -// ) -// -// constructor( -// context: Context, -// attrs: AttributeSet?, -// defStyleAttr: Int, -// defStyleRes: Int -// ) : super(context, attrs, defStyleAttr, defStyleRes) -// -// init { +package com.mime.dualscreenview.view + +import android.content.Context +import android.util.AttributeSet +import com.mime.dualscreenview.R + +typealias ValueChange = (Int)->Unit + +class StepsEditor : SideButtonTextView { + constructor(context: Context) : super(context) + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( + context, + attrs, + defStyleAttr + ) + + constructor( + context: Context, + attrs: AttributeSet?, + defStyleAttr: Int, + defStyleRes: Int + ) : super(context, attrs, defStyleAttr, defStyleRes) + + init { // inflate(context, R.layout.layout_steps_editor,this) -// btn_decrement.setOnClickListener { value = value.dec() } -// btn_increment.setOnClickListener { value = value.inc() } -// leftButtonTitle = "-" -// rightButtonTitle = "+" -// } -//} \ No newline at end of file + btn_decrement?.setOnClickListener { value = value.dec() } + btn_increment?.setOnClickListener { value = value.inc() } + leftButtonTitle = "-" + rightButtonTitle = "+" + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/angle_left.xml b/app/src/main/res/drawable/angle_left.xml new file mode 100644 index 0000000..ba9bad4 --- /dev/null +++ b/app/src/main/res/drawable/angle_left.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/angle_right.xml b/app/src/main/res/drawable/angle_right.xml new file mode 100644 index 0000000..aebb5dd --- /dev/null +++ b/app/src/main/res/drawable/angle_right.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/bookmark.png b/app/src/main/res/drawable/bookmark.png deleted file mode 100644 index 94b5801..0000000 Binary files a/app/src/main/res/drawable/bookmark.png and /dev/null differ diff --git a/app/src/main/res/drawable/bookmark.xml b/app/src/main/res/drawable/bookmark.xml new file mode 100644 index 0000000..0d108ef --- /dev/null +++ b/app/src/main/res/drawable/bookmark.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/home.png b/app/src/main/res/drawable/home.png deleted file mode 100644 index d6fb946..0000000 Binary files a/app/src/main/res/drawable/home.png and /dev/null differ diff --git a/app/src/main/res/drawable/home.xml b/app/src/main/res/drawable/home.xml new file mode 100644 index 0000000..b906b99 --- /dev/null +++ b/app/src/main/res/drawable/home.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/main/res/drawable/saved.xml b/app/src/main/res/drawable/saved.xml new file mode 100644 index 0000000..34d2c6d --- /dev/null +++ b/app/src/main/res/drawable/saved.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/main/res/drawable/settings.xml b/app/src/main/res/drawable/settings.xml new file mode 100644 index 0000000..8a7da8a --- /dev/null +++ b/app/src/main/res/drawable/settings.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/intro.xml b/app/src/main/res/layout/intro.xml index bc6c1c6..71afd37 100644 --- a/app/src/main/res/layout/intro.xml +++ b/app/src/main/res/layout/intro.xml @@ -17,6 +17,8 @@ app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent"/> + + @@ -49,86 +50,95 @@ android:layout_width="0dp" android:layout_height="@dimen/main_top_height" android:text="@string/app_name" - android:background="@color/black" android:gravity="center" android:textSize="24sp" app:layout_constraintRight_toLeftOf="@id/btn_list" app:layout_constraintLeft_toRightOf="@id/btn_home" app:layout_constraintTop_toTopOf="parent" /> - - - - + + + + + + + + + + + + + + + - - + /> - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_textviewer.xml b/app/src/main/res/layout/layout_textviewer.xml index 7ed74c3..1a017dc 100644 --- a/app/src/main/res/layout/layout_textviewer.xml +++ b/app/src/main/res/layout/layout_textviewer.xml @@ -1,5 +1,5 @@ - @@ -42,7 +41,6 @@ android:layout_height="match_parent"> - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/settings.xml b/app/src/main/res/layout/settings.xml index bd1bdc7..843e9ed 100644 --- a/app/src/main/res/layout/settings.xml +++ b/app/src/main/res/layout/settings.xml @@ -1,55 +1,63 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 5ac04f8..b4919e2 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -1,6 +1,6 @@ - 35dp + 40dp 15dp 45dp \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9de98ef..e834b46 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,29 +1,29 @@ - DualScreenView + Bum\'s App 화면 옮 기 기 it\'s 두번째화면 - + - 여섯글자마다 방점을찍어놔 - 가사관찰하다 반쯤놓치거나 - 해석잘안되면 몇번돌리든가 - 이건이를테면 덤비는리듬과 - 손묶인채붙는 일종의노름판 - 신도구제불능 내가물오른밤 - 감방에날가둬 내가패를까도 - 가난한니네가 판돈잃지않게 - 나하고니네가 의견일치한게 - 아마처음일걸 그마저운일걸 - 존나좋음이퀄 내중저음일걸 - 이배열어쩌면 너에대한배려 - 너에겐어쩌면 언어적배리어 - 그럼넌글렀어 지망생여기에 - 잠들다글로써 훗날니묘비에 - For sale my rhymes never used - For sale my rhymes never used - 판매자바로너 니가씨발오너 - For sale my rhymes never used + 여섯글자마다 방점을찍어놔 + 가사관찰하다 반쯤놓치거나 + 해석잘안되면 몇번돌리든가 + 이건이를테면 덤비는리듬과 + 손묶인채붙는 일종의노름판 + 신도구제불능 내가물오른밤 + 감방에날가둬 내가패를까도 + 가난한니네가 판돈잃지않게 + 나하고니네가 의견일치한게 + 아마처음일걸 그마저운일걸 + 존나좋음이퀄 내중저음일걸 + 이배열어쩌면 너에대한배려 + 너에겐어쩌면 언어적배리어 + 그럼넌글렀어 지망생여기에 + 잠들다글로써 훗날니묘비에 + For sale my rhymes never used + For sale my rhymes never used + 판매자바로너 니가씨발오너 + For sale my rhymes never used 노예처럼일해서왕처럼지배 성탄처럼지내설탕뿌려위에 성공을말했기에난그길위에 @@ -39,34 +39,34 @@ 미안해난비션갖고와내기적 자음모음이어리듬위에띄어 금은보화이쁜걸로손에끼워 - Uh she suckin\' my soul like - De La to the Soul - I shout out to the Rhonda - But before I\'m sober - 변태는 변태인데 underground 모범생 - 맨날 난 오덕 돼 활자에 꼬여 - 내 팔자도 고쳐낼 하나의 초월체를 - 만들려 고쳐댄 rhyme들만 몇 truck 돼 - 그러다 깨어나 여기에 - 빼어난 묘기에 없네 기본기 - 내 눈엔 수명이 대본처럼 읽히네 - 뭐처럼 비치네 뭐처럼 비치네 - Fuck all of ya list man - If it ain\'t Forbes list mayne - Your wristwatch cheaper than - My profile picture damn - Picture the future and - 믿어 like it\'s happend - Big ass house foreign cars have several - 미녀 fine ass apple hip 내 옆에 같이 태우고 - Top of the top으로 가 죽어야 들어 잠은 - 넌 안 죽었다는 척 - 갖은 폼 잡으면 뭐하냐 - 좆밥들 또 반년만 가면 쏙 - 다 들어가는 거 다 보여 - 내 눈엔 너가 금방 죽어 - 다음 무덤 안 들어갈 주검 - 한 우물 파는 넌 밟고서 - 땅을 쳐봐 내 발자국을 + Uh she suckin\' my soul like + De La to the Soul + I shout out to the Rhonda + But before I\'m sober + 변태는 변태인데 underground 모범생 + 맨날 난 오덕 돼 활자에 꼬여 + 내 팔자도 고쳐낼 하나의 초월체를 + 만들려 고쳐댄 rhyme들만 몇 truck 돼 + 그러다 깨어나 여기에 + 빼어난 묘기에 없네 기본기 + 내 눈엔 수명이 대본처럼 읽히네 + 뭐처럼 비치네 뭐처럼 비치네 + Fuck all of ya list man + If it ain\'t Forbes list mayne + Your wristwatch cheaper than + My profile picture damn + Picture the future and + 믿어 like it\'s happend + Big ass house foreign cars have several + 미녀 fine ass apple hip 내 옆에 같이 태우고 + Top of the top으로 가 죽어야 들어 잠은 + 넌 안 죽었다는 척 + 갖은 폼 잡으면 뭐하냐 + 좆밥들 또 반년만 가면 쏙 + 다 들어가는 거 다 보여 + 내 눈엔 너가 금방 죽어 + 다음 무덤 안 들어갈 주검 + 한 우물 파는 넌 밟고서 + 땅을 쳐봐 내 발자국을 \ No newline at end of file