diff --git a/README.md b/README.md index 5ecbc27..d422e82 100644 --- a/README.md +++ b/README.md @@ -1 +1,4 @@ # tokkiz + + +resource from : https://www.flaticon.com/search/2?word=rotate&color=black&shape=fill diff --git a/app/src/main/java/com/mime/dualscreenview/activity/Base.kt b/app/src/main/java/com/mime/dualscreenview/activity/Base.kt index 10e1328..02dc36e 100644 --- a/app/src/main/java/com/mime/dualscreenview/activity/Base.kt +++ b/app/src/main/java/com/mime/dualscreenview/activity/Base.kt @@ -1,5 +1,6 @@ package com.mime.dualscreenview.activity +import android.content.res.Configuration import android.os.Handler import android.os.Looper import android.os.Message @@ -18,6 +19,12 @@ import android.view.KeyEvent.KEYCODE_VOLUME_UP import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import com.mime.dualscreenview.common.Blog +import com.mime.dualscreenview.dto.HistoryItem +import com.mime.dualscreenview.dto.LastInfo +import io.realm.kotlin.Realm +import io.realm.kotlin.RealmConfiguration +import io.realm.kotlin.types.BaseRealmObject +import kotlin.reflect.KClass open class Base : AppCompatActivity() { @@ -26,18 +33,6 @@ open class Base : AppCompatActivity() { override fun handleMessage(msg: Message) { super.handleMessage(msg) } -// -// override fun dispatchMessage(msg: Message) { -// super.dispatchMessage(msg) -// } -// -// override fun getMessageName(message: Message): String { -// return super.getMessageName(message) -// } -// -// override fun sendMessageAtTime(msg: Message, uptimeMillis: Long): Boolean { -// return super.sendMessageAtTime(msg, uptimeMillis) -// } } val baseHandler = BaseHandler() var didBackPress = false @@ -131,5 +126,12 @@ open class Base : AppCompatActivity() { return false } + fun openRealm() : Realm { + val clazz : Set> = setOf(LastInfo::class, HistoryItem::class) + val config = RealmConfiguration.Builder(clazz) + .schemaVersion(1) + .build() + return Realm.open(config) + } } \ No newline at end of file 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 aaa6178..c3ad83e 100644 --- a/app/src/main/java/com/mime/dualscreenview/activity/Intro.kt +++ b/app/src/main/java/com/mime/dualscreenview/activity/Intro.kt @@ -6,8 +6,8 @@ import android.content.DialogInterface import android.content.Intent import android.content.pm.ActivityInfo import android.content.res.Configuration -import android.graphics.Color import android.hardware.display.DisplayManager +import android.net.Uri import android.os.Build import android.os.Bundle import android.util.Log @@ -16,21 +16,21 @@ import android.view.View import android.view.View.* import android.webkit.WebView import android.widget.ArrayAdapter -import android.widget.Button import android.widget.ImageButton -import android.widget.LinearLayout import android.widget.ProgressBar import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AlertDialog import androidx.appcompat.widget.AppCompatButton -import androidx.constraintlayout.widget.ConstraintLayout -import androidx.core.view.updateLayoutParams import com.google.gson.Gson import com.lge.display.DisplayManagerHelper import com.mime.dualscreenview.R import com.mime.dualscreenview.common.Blog +import com.mime.dualscreenview.dialog.StyleSelectInterface +import com.mime.dualscreenview.dialog.Stylez +import com.mime.dualscreenview.dto.BookPageInfo import com.mime.dualscreenview.dto.BookPageInfos +import com.mime.dualscreenview.dto.HistoryItem import com.mime.dualscreenview.dto.LastInfo import com.mime.dualscreenview.view.PagedTextLayout import com.mime.dualscreenview.view.PagedTextViewInterface @@ -41,8 +41,13 @@ import com.mime.dualscreenview.webcontents.contentsinfo.Booktoki import com.mime.dualscreenview.webcontents.contentsinfo.GotoSomeWhere import io.realm.kotlin.Realm import io.realm.kotlin.RealmConfiguration +import io.realm.kotlin.UpdatePolicy import io.realm.kotlin.ext.copyFromRealm import io.realm.kotlin.ext.query +import java.lang.System.currentTimeMillis +import java.net.URI +import java.text.SimpleDateFormat +import java.util.Date class Intro : Base() , MainControllInterface, PagedTextViewInterface { @@ -60,18 +65,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { private lateinit var mBaseWebContentsViewer : BaseWebContentsViewer var lastInfo : LastInfo? = null - val colors = arrayOf>( - arrayOf("#E1F5FE", "#263238"), - arrayOf("#F0F4C3", "#37474F"), - arrayOf("#ECEFF1", "#455A64"), - arrayOf("#E0F7FA", "#263238"), - arrayOf("#F5F5F5", "#263238"), - arrayOf("#ECEFF1", "#263238"), - arrayOf("#F8BBD0", "#263238"), - arrayOf("#E6EE9C", "#455A64"), - arrayOf("#CFD8DC", "#455A64"), - arrayOf("#FFF59D", "#37474F") - ) + override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) @@ -80,10 +74,9 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - Blog.LOGD(log= "onCreate ${this::class.java.name} >> savedInstanceState ${savedInstanceState}") - setContentView(R.layout.intro) + mBaseWebContentsViewer = BaseWebContentsViewer(findViewById(R.id.menu_web),this) try { // Try to construct the DisplayMangerHelper. @@ -106,8 +99,15 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { findViewById(R.id.btn_list).setOnClickListener { v -> mBaseWebContentsViewer?.findListItem {result -> - var infos = Gson().fromJson(result, BookPageInfos::class.java) - showList(infos) + if (result != null && "null".equals(result) == false && result?.length ?: 0 > 10) { + try { + Gson().fromJson(result, BookPageInfos::class.java)?.let{ + showList(it) + } + } catch (e : Exception) { + + } + } } } @@ -117,32 +117,46 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { findViewById(R.id.btn_setting).setOnClickListener { v-> showStyleList() } + findViewById(R.id.btn_history).setOnClickListener { v-> + var realm = openRealm() + realm.query()?.find()?.let { + showHistory(realm.copyFromRealm(it)) + } + realm.close() + } findViewById(R.id.btn_home).setOnClickListener { v-> + pagedTextLayout?.visibility = GONE mBaseWebContentsViewer.loadContents(Booktoki()) } - val config = RealmConfiguration.Builder(setOf(LastInfo::class)).schemaVersion(1) - .build() - val realm = Realm.open(config) + } - try { - lastInfo = realm?.query()?.find()?.last()?.copyFromRealm() - } catch (e : Exception) { - + fun reloadLastInfo() { + val realm = openRealm() + try { lastInfo = realm?.query()?.find()?.last()?.copyFromRealm() } catch (e : Exception) { } + val configuration: Configuration = getResources().getConfiguration() + if(lastInfo != null && lastInfo?.displayOrientation != configuration.orientation) { + findViewById(R.id.btn_rotate).performClick() } - if (lastInfo != null) { - setRequestedOrientation(lastInfo!!.displayOrientation); - mBaseWebContentsViewer.loadLastInfo(lastInfo!!) - } else { - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - mBaseWebContentsViewer.loadContents(Booktoki()) - } - Blog.LOGD(log ="Successfully opened realm: ${realm.configuration.name}") realm.close() } + + fun reloadTo(lastInfo: LastInfo?) { + findViewById(R.id.menu_web)?.postDelayed({ + if (lastInfo != null) { + mBaseWebContentsViewer.loadLastInfo(lastInfo!!) + } else { + mBaseWebContentsViewer.loadContents(Booktoki()) + } + },200L) + } + override fun onResume() { + super.onResume() + reloadLastInfo() + reloadTo(lastInfo) + } fun switcvhOrient(){ - val windowManager = getSystemService(WINDOW_SERVICE) val configuration: Configuration = getResources().getConfiguration() setRequestedOrientation( if(configuration.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE } @@ -150,9 +164,65 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { ) } + fun showHistory(infos: List) { + val builderSingle: AlertDialog.Builder = AlertDialog.Builder(this@Intro) + builderSingle.setTitle("${currentTitle} : ${currentChapter} -> Select One ") + val arrayAdapter = + ArrayAdapter(this@Intro, android.R.layout.select_dialog_singlechoice) + for (item in infos) { + arrayAdapter.addAll(item.title) + } + + + + builderSingle.setNegativeButton("cancel", + DialogInterface.OnClickListener { dialog, which -> dialog.dismiss() }) + + builderSingle.setAdapter(arrayAdapter, + DialogInterface.OnClickListener { dialog, which -> + val strName = arrayAdapter.getItem(which) + val item = infos.get(which) + val builderInner: AlertDialog.Builder = AlertDialog.Builder(this@Intro) + builderInner.setMessage(strName) + builderInner.setTitle("${infos.get(which).title}로 이동 고고!?") + builderInner.setPositiveButton("Ok", + DialogInterface.OnClickListener { + dialog, which -> + reloadTo(item.makeLastInfo()) + dialog.dismiss() + }) + builderInner.setNeutralButton("삭제", + DialogInterface.OnClickListener { + dialog, which -> + var realm = openRealm() + realm?.writeBlocking { + this.query().query("title == '${item.title}'", ).find()?.last()?.let{ + this.delete(it) + } + } + realm.close() + dialog.dismiss() + }) + builderInner.setNegativeButton("취소", + DialogInterface.OnClickListener { + dialog, which -> + dialog.dismiss() + }) + builderInner.show() + }) + var ddddd= builderSingle.create() + ddddd.setOnShowListener { d-> + (d as? AlertDialog)?.let{ + it.listView?.setSelection(currentChapter) + } + } + + ddddd.show() + } + fun showList(infos: BookPageInfos) { val builderSingle: AlertDialog.Builder = AlertDialog.Builder(this@Intro) - builderSingle.setTitle("Select One Name:-") + builderSingle.setTitle("${currentTitle} : ${currentChapter} -> Select One ") val arrayAdapter = ArrayAdapter(this@Intro, android.R.layout.select_dialog_singlechoice) arrayAdapter.addAll(infos.getTitleArray()) @@ -164,60 +234,51 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { builderSingle.setAdapter(arrayAdapter, DialogInterface.OnClickListener { dialog, which -> val strName = arrayAdapter.getItem(which) + val item = infos.list?.get(which) val builderInner: AlertDialog.Builder = AlertDialog.Builder(this@Intro) builderInner.setMessage(strName) builderInner.setTitle("Your Selected Item is") builderInner.setPositiveButton("Ok", - DialogInterface.OnClickListener { dialog, which -> dialog.dismiss() }) + DialogInterface.OnClickListener { dialog, which -> +// mBaseWebContentsViewer?.webview?.loadUrl() + moveTo(item) + dialog.dismiss() + } + ) builderInner.show() }) var ddddd= builderSingle.create() ddddd.setOnShowListener { d-> (d as? AlertDialog)?.let{ - it.listView?.smoothScrollToPosition(currentChapter) + it.listView?.setSelection(currentChapter) } } ddddd.show() } - fun showStyleList() { - val builderSingle: AlertDialog.Builder = AlertDialog.Builder(this@Intro) - builderSingle.setTitle("Select One Name:-") - val arrayAdapter = - ArrayAdapter(this@Intro, android.R.layout.select_dialog_singlechoice) - var styleNum = 1; - for (a in colors) { - arrayAdapter.add("스타일 ${styleNum}") - styleNum = styleNum.inc() - } - - - builderSingle.setNegativeButton("cancel", - DialogInterface.OnClickListener { dialog, which -> dialog.dismiss() }) - - builderSingle.setAdapter(arrayAdapter, - DialogInterface.OnClickListener { dialog, which -> - val color = colors.get(which) - val builderInner: AlertDialog.Builder = AlertDialog.Builder(this@Intro) - builderInner.setMessage("스타일 ${which + 1}") - - builderInner.setTitle("Your Selected Item is") - builderInner.setPositiveButton("Ok", - DialogInterface.OnClickListener { dialog, which -> dialog.dismiss() - pg?.setColorStyle(color) - findViewById(R.id.intro_bg).setBackgroundColor(Color.parseColor(color.get(1))) - }) - builderInner.show() - }) - var ddddd= builderSingle.create() - ddddd.setOnShowListener { d-> - (d as? AlertDialog)?.let{ - it.listView?.smoothScrollToPosition(currentChapter) + private fun moveTo(item: BookPageInfo?) { + item?.link?.let {newPath -> + mBaseWebContentsViewer?.webview?.url?.let{currentUrl -> + Uri.parse(currentUrl)?.lastPathSegment?.let { + currentUrl.replace(it,newPath)?.let { + mBaseWebContentsViewer?.webview?.loadUrl(it) + } + } } } - ddddd.show() + + } + + fun showStyleList() { + var mStylez = Stylez(this@Intro) + mStylez.styleSelectInterface = object : StyleSelectInterface { + override fun onSelectStyle(bgColor: String, textColor: String) { + pagedTextLayout?.setColorStyle(arrayOf(textColor,bgColor)) + } + } + mStylez.show() } @@ -339,7 +400,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { } } } - var pg : PagedTextLayout? = null; + var pagedTextLayout : PagedTextLayout? = null; var onNextClickAction: GotoSomeWhere? = null override fun showNextBtn(find : Boolean , onClickAction: GotoSomeWhere) { @@ -354,9 +415,9 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { } fun actionNextEvent() { - if (pg != null && pg!!.visibility == View.VISIBLE && pg!!.size() > 0 && (pg!!.current() < pg!!.size() - 1) ) { - pg!!.doNext() - updateLastInfo(pg!!) + if (pagedTextLayout != null && pagedTextLayout!!.visibility == View.VISIBLE && pagedTextLayout!!.size() > 0 && (pagedTextLayout!!.current() < pagedTextLayout!!.size() - 1) ) { + pagedTextLayout!!.doNext() + updateLastInfo(pagedTextLayout!!) }else { onNextClickAction?.let { it() } } @@ -375,9 +436,9 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { fun actionPrevEvent() { - if (pg != null && pg!!.visibility == View.VISIBLE && pg!!.size() > 0 && pg!!.current() > 0 ) { - pg!!.doPrev() - updateLastInfo(pg!!) + if (pagedTextLayout != null && pagedTextLayout!!.visibility == View.VISIBLE && pagedTextLayout!!.size() > 0 && pagedTextLayout!!.current() > 0 ) { + pagedTextLayout!!.doPrev() + updateLastInfo(pagedTextLayout!!) } else { onPrevClickAction?.let{ it() } } @@ -407,10 +468,8 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { firstBackPress() return } - + finish() didBackPress = false - - super.onBackPressed() } @@ -419,19 +478,19 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { } override fun onLoadedContents(contents: String) { - pg = null; + pagedTextLayout = null; findViewById(R.id.paged_layer).apply { if (contents != null) { - pg = this + pagedTextLayout = this visibility = VISIBLE mPagedTextViewInterface = this@Intro setText(contents.replace("\\n", System.getProperty("line.separator"))) setTextSize(22f) if(lastInfo != null && lastInfo!!.pageUrl.equals(mBaseWebContentsViewer.webview.url)) { this@Intro.findViewById(R.id.progress)?.visibility = VISIBLE - pg?.postDelayed({ + pagedTextLayout?.postDelayed({ next(lastInfo!!.pageIndex) - pg?.post { + pagedTextLayout?.post { this@Intro.findViewById(R.id.progress)?.visibility = GONE } },1000) @@ -452,10 +511,21 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { Blog.LOGI(TAG,"onFindTitle >> " + contents + " ::: ${testRegex.replace(contents,"")}") if(contents.contains("-")) { currentTitle = contents.split("-")[0] - currentChapter = testRegex.replace(contents.split("-")[1],"").toInt() + try { + currentChapter = testRegex.replace(contents.split("-")[1],"").toInt() + } catch (e : Exception) { + currentChapter = 0 + } + } else if(testRegex.replace(contents,"").length > 0){ + currentChapter = testRegex.replace(contents,"").toInt() + currentTitle = contents.split(testRegex.replace(contents,""))[0] + } else { + val dateFormat = "yyyyMMdd-HH" + val date = Date(currentTimeMillis()) + val simpleDateFormat = SimpleDateFormat(dateFormat) + currentTitle = simpleDateFormat.format(date) } - } override fun onStartLoad() { @@ -463,39 +533,54 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { } override fun completePageLoad(lastInfo: LastInfo) { - if(this.lastInfo == null || !(this.lastInfo?.pageUrl.equals(lastInfo?.pageUrl))) { + val configuration: Configuration = getResources().getConfiguration() + + if(this.lastInfo == null || !(this.lastInfo?.pageUrl.equals(lastInfo?.pageUrl)) || this.lastInfo?.displayOrientation != configuration?.orientation) { + lastInfo.displayOrientation = configuration?.orientation ?: ActivityInfo.SCREEN_ORIENTATION_PORTRAIT saveLastInfo(lastInfo) } findViewById(R.id.progress).visibility = GONE } fun saveLastInfo(lastInfo: LastInfo) { - val windowManager = getSystemService(WINDOW_SERVICE) - val configuration: Configuration = getResources().getConfiguration() - val config = RealmConfiguration.Builder(setOf(LastInfo::class)) - .schemaVersion(1) - .build() - val realm = Realm.open(config) - realm.writeBlocking { - lastInfo.displayOrientation = configuration.orientation - copyToRealm(lastInfo) + val realm = openRealm() + if((realm.query()?.count()?.find() ?: 0) > 0) { + realm.writeBlocking { + this.query()?.find()?.last()?.let{ + it.pageUrl = lastInfo.pageUrl + it.title = currentTitle + it.chapter = currentChapter + it.pageIndex = lastInfo.pageIndex + it.contentsName = lastInfo.contentsName + it.displayOrientation = lastInfo.displayOrientation + this@Intro.lastInfo = copyFromRealm(it) + } + } + } else { + realm.writeBlocking { + copyToRealm(lastInfo) + } } Blog.LOGD(log ="Successfully opened realm: ${realm.configuration.name}") realm.close() } fun updateLastInfo(pagedTextLayout: PagedTextLayout) { - val windowManager = getSystemService(WINDOW_SERVICE) val configuration: Configuration = getResources().getConfiguration() - val config = RealmConfiguration.Builder(setOf(LastInfo::class)) - .schemaVersion(1) - .build() - val realm = Realm.open(config) - + val realm = openRealm() realm.writeBlocking { - var info = this.query()?.find()?.last() - info?.pageIndex = pagedTextLayout.current() - info?.displayOrientation = configuration.orientation + this.query()?.find()?.last()?.let{ + it.displayOrientation = configuration.orientation + it.title = currentTitle + it.chapter = currentChapter + it.pageIndex = pagedTextLayout.current() + this@Intro.lastInfo = copyFromRealm(it) + } + if (currentTitle.length > 0 && currentChapter > 0) { + this@Intro.lastInfo?.makeHistoryItem()?.let{ + copyToRealm(it, UpdatePolicy.ALL) + } + } } Blog.LOGD(log ="Successfully opened realm: ${realm.configuration.name}") @@ -522,7 +607,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { findViewById(R.id.textView).visibility = VISIBLE findViewById(R.id.btn_home).visibility = VISIBLE findViewById(R.id.btn_list).visibility = VISIBLE - findViewById(R.id.btn_menu).visibility = VISIBLE + findViewById(R.id.btn_history).visibility = VISIBLE findViewById(R.id.btn_rotate).visibility = VISIBLE } @@ -561,7 +646,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface { findViewById(R.id.textView).visibility = GONE findViewById(R.id.btn_home).visibility = GONE findViewById(R.id.btn_list).visibility = GONE - findViewById(R.id.btn_menu).visibility = GONE + findViewById(R.id.btn_history).visibility = GONE findViewById(R.id.btn_rotate).visibility = GONE } diff --git a/app/src/main/java/com/mime/dualscreenview/common/Definez.kt b/app/src/main/java/com/mime/dualscreenview/common/Definez.kt new file mode 100644 index 0000000..812d0ad --- /dev/null +++ b/app/src/main/java/com/mime/dualscreenview/common/Definez.kt @@ -0,0 +1,15 @@ +package com.mime.dualscreenview.common + + +val colorz = arrayOf>( + arrayOf("#E1F5FE", "#263238"), + arrayOf("#F0F4C3", "#37474F"), + arrayOf("#ECEFF1", "#455A64"), + arrayOf("#E0F7FA", "#263238"), + arrayOf("#F5F5F5", "#263238"), + arrayOf("#ECEFF1", "#263238"), + arrayOf("#F8BBD0", "#263238"), + arrayOf("#E6EE9C", "#455A64"), + arrayOf("#CFD8DC", "#455A64"), + arrayOf("#FFF59D", "#37474F") +) \ No newline at end of file diff --git a/app/src/main/java/com/mime/dualscreenview/dialog/Stylez.kt b/app/src/main/java/com/mime/dualscreenview/dialog/Stylez.kt new file mode 100644 index 0000000..7bad35b --- /dev/null +++ b/app/src/main/java/com/mime/dualscreenview/dialog/Stylez.kt @@ -0,0 +1,99 @@ +package com.mime.dualscreenview.dialog + +import android.app.Dialog +import android.content.Context +import android.content.DialogInterface +import android.graphics.Color +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.view.Window +import android.widget.TextView +import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.mime.dualscreenview.R +import com.mime.dualscreenview.common.colorz +import kotlin.random.Random + +interface StyleSelectInterface { + fun onSelectStyle(bgColor : String, textColor : String) +} +class Stylez : Dialog { + constructor(context: Context) : super(context) {initView(context)} + constructor(context: Context, themeResId: Int) : super(context, themeResId) {initView(context)} + constructor( + context: Context, + cancelable: Boolean, + cancelListener: DialogInterface.OnCancelListener? + ) : super(context, cancelable, cancelListener) {initView(context)} + + var styleSelectInterface : StyleSelectInterface? = null + + fun initView(context: Context) { + + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + this.requestWindowFeature(Window.FEATURE_NO_TITLE); + setCancelable(true) + setContentView(R.layout.dialog_stylesz) + val recyclerView: RecyclerView = findViewById(R.id.stylez_recyclerview) + val adapterRe = AdapterRe(context, colorz) + recyclerView.adapter = adapterRe + recyclerView.layoutManager = + GridLayoutManager(context, 2, GridLayoutManager.VERTICAL, false) + } + + inner class AdapterRe(ctx: Context, myImageNameList: Array>) : + RecyclerView.Adapter() { + private val inflater: LayoutInflater + private val myImageNameList: Array> + private val ctx : Context + init { + inflater = LayoutInflater.from(ctx) + this.ctx = ctx + this.myImageNameList = myImageNameList + } + + override fun onCreateViewHolder ( + parent: ViewGroup, + viewType: Int + ): StylezViewHolder { + val view: View = inflater.inflate(R.layout.item_colorz, parent, false) + return StylezViewHolder(view) + } + + override fun onBindViewHolder(holder: StylezViewHolder, position: Int) { + var colorz = myImageNameList.get(position) + var sampleTextz = ctx.resources.getStringArray(R.array.sample_textz) + holder?.setStyle(bgColor = colorz.get(1), textColor = colorz.get(0),sampleTextz.get(Random.nextInt(9876) % sampleTextz.size)) + } + + + override fun getItemCount(): Int { + return myImageNameList.size + } + + } + + inner class StylezViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + var textView: TextView + var bg : View + init { + textView = itemView.findViewById(R.id.textview_sample) + bg = itemView.findViewById(R.id.bg_sample) + } + fun setStyle(bgColor : String, textColor : String, sampleText : String ) { + bg.setBackgroundColor(Color.parseColor(bgColor)) + textView.setTextColor(Color.parseColor(textColor)) + textView.text = sampleText + itemView?.setOnClickListener { v -> + styleSelectInterface?.onSelectStyle(bgColor,textColor) + dismiss() + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/mime/dualscreenview/dto/BookPageInfo.kt b/app/src/main/java/com/mime/dualscreenview/dto/BookPageInfo.kt index 9d538c9..e44fb4d 100644 --- a/app/src/main/java/com/mime/dualscreenview/dto/BookPageInfo.kt +++ b/app/src/main/java/com/mime/dualscreenview/dto/BookPageInfo.kt @@ -11,5 +11,5 @@ var list : ArrayList? = null } class BookPageInfo { var title : String? = "" - var lastPath : String? = "" + var link : String? = "" } \ No newline at end of file diff --git a/app/src/main/java/com/mime/dualscreenview/dto/PageInfo.kt b/app/src/main/java/com/mime/dualscreenview/dto/PageInfo.kt index d2c8024..709e96b 100644 --- a/app/src/main/java/com/mime/dualscreenview/dto/PageInfo.kt +++ b/app/src/main/java/com/mime/dualscreenview/dto/PageInfo.kt @@ -7,15 +7,43 @@ import org.mongodb.kbson.ObjectId class LastInfo() : RealmObject { + @PrimaryKey var _id : String = "UniqLastId" var pageUrl : String = "" var title : String = "" - var contentsData : String = "" + var chapter : Int = 0 var pageIndex : Int = 0 var contentsName : String = "" var displayOrientation : Int = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT -} + fun makeHistoryItem() : HistoryItem = HistoryItem().apply { + title = this@LastInfo.title + pageUrl = this@LastInfo.pageUrl + chapter = this@LastInfo.chapter + pageIndex = this@LastInfo.pageIndex + contentsName = this@LastInfo.contentsName + displayOrientation = this@LastInfo.displayOrientation + } +} +class HistoryItem() : RealmObject { + @PrimaryKey + var title : String = "" + var pageUrl : String = "" + var chapter : Int = 0 + var pageIndex : Int = 0 + var contentsName : String = "" + var displayOrientation : Int = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + + fun makeLastInfo() = LastInfo().apply{ + _id = "UniqLastId" + title = this@HistoryItem.title + pageUrl = this@HistoryItem.pageUrl + chapter = this@HistoryItem.chapter + pageIndex = this@HistoryItem.pageIndex + contentsName = this@HistoryItem.contentsName + displayOrientation = this@HistoryItem.displayOrientation + } +} class Bookmark() : RealmObject { @PrimaryKey var pageUrl : String = "" diff --git a/app/src/main/java/com/mime/dualscreenview/view/PagedTextLayout.kt b/app/src/main/java/com/mime/dualscreenview/view/PagedTextLayout.kt index ed1b8c6..36e1eae 100644 --- a/app/src/main/java/com/mime/dualscreenview/view/PagedTextLayout.kt +++ b/app/src/main/java/com/mime/dualscreenview/view/PagedTextLayout.kt @@ -66,7 +66,9 @@ class PagedTextLayout : ConstraintLayout , PagedTextGenerateInterface { var isCenterTouch = TouchArea.Center.equals(touchArea) hanler.removeCallbacks(touchTimeover) mPagedTextViewInterface?.onTouch(touchArea) - hanler?.postDelayed(touchTimeover, 3000L) + if(isCenterTouch) { + hanler?.postDelayed(touchTimeover, 3000L) + } } }) } diff --git a/app/src/main/java/com/mime/dualscreenview/webcontents/BaseWebContents.kt b/app/src/main/java/com/mime/dualscreenview/webcontents/BaseWebContents.kt index 5f93fb0..f0e45b9 100644 --- a/app/src/main/java/com/mime/dualscreenview/webcontents/BaseWebContents.kt +++ b/app/src/main/java/com/mime/dualscreenview/webcontents/BaseWebContents.kt @@ -8,7 +8,7 @@ import com.mime.dualscreenview.webcontents.contentsinfo.DidFindContents abstract class BaseWebContents : ContentsInfoInterface { - var lastNumber : Int = 221 + open var lastNumber : Int = 221 var completeAction : ActionByBool? = null val definedActionCount = 5 var completeActionCount = 0 diff --git a/app/src/main/java/com/mime/dualscreenview/webcontents/BaseWebContentsViewer.kt b/app/src/main/java/com/mime/dualscreenview/webcontents/BaseWebContentsViewer.kt index e11a676..9ce9a99 100644 --- a/app/src/main/java/com/mime/dualscreenview/webcontents/BaseWebContentsViewer.kt +++ b/app/src/main/java/com/mime/dualscreenview/webcontents/BaseWebContentsViewer.kt @@ -143,7 +143,7 @@ open class BaseWebContentsViewer { currentContentsProvider?.doOnloaded(it , { result -> result?.let { mainControllInterface.onLoadedContents(it) } } , { - it?.let { mainControllInterface.onFindTitle(it) } + it?.let { mainControllInterface.onFindTitle(it.replace("\"","")) } }, {btn -> mainControllInterface?.showNextBtn (btn != null){ webview?.evaluateJavascript("if(document.getElementById('${currentContentsProvider!!.getNextButtonJs()}') != null) document.getElementById('${currentContentsProvider!!.getNextButtonJs()}').click()") { diff --git a/app/src/main/java/com/mime/dualscreenview/webcontents/contentsinfo/Booktoki.kt b/app/src/main/java/com/mime/dualscreenview/webcontents/contentsinfo/Booktoki.kt index b1fa5c3..d3446df 100644 --- a/app/src/main/java/com/mime/dualscreenview/webcontents/contentsinfo/Booktoki.kt +++ b/app/src/main/java/com/mime/dualscreenview/webcontents/contentsinfo/Booktoki.kt @@ -4,7 +4,7 @@ import com.mime.dualscreenview.webcontents.BaseWebContents class Booktoki : BaseWebContents() { - + override var lastNumber : Int = 222 override fun getWebcontentsName(): String { return "Booktoki" diff --git a/app/src/main/res/drawable/history.png b/app/src/main/res/drawable/history.png new file mode 100644 index 0000000..15fb4f7 Binary files /dev/null and b/app/src/main/res/drawable/history.png differ diff --git a/app/src/main/res/layout/dialog_stylesz.xml b/app/src/main/res/layout/dialog_stylesz.xml new file mode 100644 index 0000000..c22644f --- /dev/null +++ b/app/src/main/res/layout/dialog_stylesz.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/intro.xml b/app/src/main/res/layout/intro.xml index 6f0b89d..d7cc571 100644 --- a/app/src/main/res/layout/intro.xml +++ b/app/src/main/res/layout/intro.xml @@ -80,18 +80,18 @@ android:background="#8FFF" app:layout_constraintTop_toTopOf="parent" app:layout_constraintLeft_toRightOf="@id/btn_list" - app:layout_constraintRight_toLeftOf="@+id/btn_menu" + app:layout_constraintRight_toLeftOf="@+id/btn_history" app:layout_constraintHorizontal_chainStyle="spread_inside" /> + + + \ 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 443bce2..feb9060 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2,4 +2,70 @@ DualScreenView 화면 옮 기 기 it\'s 두번째화면 + + + 여섯글자마다 방점을찍어놔 + 가사관찰하다 반쯤놓치거나 + 해석잘안되면 몇번돌리든가 + 이건이를테면 덤비는리듬과 + 손묶인채붙는 일종의노름판 + 신도구제불능 내가물오른밤 + 감방에날가둬 내가패를까도 + 가난한니네가 판돈잃지않게 + 나하고니네가 의견일치한게 + 아마처음일걸 그마저운일걸 + 존나좋음이퀄 내중저음일걸 + 이배열어쩌면 너에대한배려 + 너에겐어쩌면 언어적배리어 + 그럼넌글렀어 지망생여기에 + 잠들다글로써 훗날니묘비에 + For sale my rhymes never used + For sale my rhymes never used + 판매자바로너 니가씨발오너 + For sale my rhymes never used + 노예처럼일해서왕처럼지배 + 성탄처럼지내설탕뿌려위에 + 성공을말했기에난그길위에 + 선딱그어이젠자봐주의깊게 + 멈칫할시간도없는듯써내려 + 활자로활짝갠곳에돈비내려 + 초라한핀조명과낮은무대위 + 목표를조준하기에충분했지 + 시인의신이될준비는치밀해 + 흘러군침이계속이기기위해 + 처음시작했던이유따윈잊어 + 맨발맨손으로역사들을빚어 + 미안해난비션갖고와내기적 + 자음모음이어리듬위에띄어 + 금은보화이쁜걸로손에끼워 + 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 diff --git a/gradlew b/gradlew index 4f906e0..1b6c787 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 107acd3..ac1b06f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,89 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega