1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

Refact | Module dependencies (#1046)

This commit is contained in:
Evgenii Kozlov 2020-11-04 15:13:14 +02:00 committed by GitHub
parent 3d2ddd78c9
commit 212a9f801a
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
220 changed files with 907 additions and 2008 deletions

View file

@ -50,6 +50,7 @@ dependencies {
implementation project(':core-utils')
implementation project(':core-ui')
implementation project(':presentation')
implementation applicationDependencies.timber

View file

@ -1,22 +0,0 @@
package com.anytypeio.anytype.sample
import android.os.Bundle
import android.view.View
import com.anytypeio.anytype.core_ui.widgets.dialog.AboveDialog
import kotlinx.android.synthetic.main.above_dialog_fragment.view.*
class AboveDialogFragment : AboveDialog() {
override fun layout(): Int = R.layout.above_dialog_fragment
override fun title(): String? = "Тестовый заголовок"
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.button4.setOnClickListener {
(requireActivity() as UpdateValues).update1()
dismiss()
}
view.button5.setOnClickListener { (requireActivity() as UpdateValues).update2() }
view.button6.setOnClickListener { (requireActivity() as UpdateValues).update3() }
}
}

View file

@ -1,116 +0,0 @@
package com.anytypeio.anytype.sample
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.anytypeio.anytype.core_ui.widgets.BlockActionBarItem
import com.anytypeio.anytype.core_ui.widgets.ActionItemType
import com.anytypeio.anytype.core_ui.widgets.dialog.AboveDialog
import kotlinx.android.synthetic.main.above_fragment.*
import kotlinx.android.synthetic.main.activity_keyboard.*
import timber.log.Timber
class KeyboardActivity : AppCompatActivity(), UpdateValues {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_keyboard)
tvFirst.text = "111"
tvSecond.text = "222"
tvThree.text = "333"
btnTest.setOnClickListener {
AboveDialogFragment().apply {
//setStyle(DialogFragment.STYLE_NORMAL, R.style.AppBottomSheetDialogTheme)
}
.show(supportFragmentManager, null)
}
edtTest.setOnFocusChangeListener { v, hasFocus ->
Timber.d("EditText1 hasFocus:$hasFocus")
}
edtTest.setOnClickListener {
Timber.d("EditText1 : OnClick, hasFocus:${it.hasFocus()}")
}
edtTest.setOnLongClickListener {
Timber.d("EditText1 : OnLongClick, hasFocus: ${it.hasFocus()} , hasOtherBlocksInFocus : ${it.hasWindowFocus()}")
val focus = it.hasFocus()
if (!focus) {
TestDialog().show(supportFragmentManager, "TAG")
}
return@setOnLongClickListener !it.hasFocus()
}
with(edtTest2) {
setOnLongClickListener {
Timber.d("EditText2 : OnLongClick, hasFocus: ${it.hasFocus()}, hasOtherBlocksInFocus : ${it.hasWindowFocus()}")
val focus = it.hasFocus()
if (!focus) {
TestDialog().show(supportFragmentManager, "TAG")
}
return@setOnLongClickListener !it.hasFocus()
}
}
}
override fun update1() {
tvFirst.text = incText(tvFirst.text.toString())
}
override fun update2() {
tvSecond.text = incText(tvSecond.text.toString())
}
override fun update3() {
tvThree.text = incText(tvThree.text.toString())
}
fun incText(value: String): String =
value.toInt().inc().toString()
}
interface UpdateValues {
fun update1()
fun update2()
fun update3()
}
class TestDialog : AboveDialog() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
with(action_container) {
addView(BlockActionBarItem(context = requireContext()).apply {
setTypeAndClick(
ActionItemType.Replace,
{})
})
addView(BlockActionBarItem(context = requireContext()).apply {
setTypeAndClick(
ActionItemType.TurnInto,
{})
})
addView(BlockActionBarItem(context = requireContext()).apply {
setTypeAndClick(
ActionItemType.Delete,
{})
})
}
}
override fun layout(): Int {
return R.layout.above_fragment
}
override fun title(): String? {
return null
}
}

View file

@ -3,11 +3,10 @@ package com.anytypeio.anytype.sample
import android.os.Bundle
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import com.anytypeio.anytype.core_ui.common.Alignment
import com.anytypeio.anytype.core_ui.common.Markup
import com.anytypeio.anytype.core_ui.features.page.styling.StylingType
import com.anytypeio.anytype.core_ui.model.StyleConfig
import com.anytypeio.anytype.core_ui.state.ControlPanelState
import com.anytypeio.anytype.presentation.page.editor.Markup
import com.anytypeio.anytype.presentation.page.editor.model.Alignment
import com.anytypeio.anytype.presentation.page.editor.styling.StyleConfig
import com.anytypeio.anytype.presentation.page.editor.styling.StylingType
import kotlinx.android.synthetic.main.activity_style.*
class StyleActivity: AppCompatActivity() {
@ -35,9 +34,12 @@ class StyleActivity: AppCompatActivity() {
Markup.Type.KEYBOARD,
Markup.Type.LINK
),
enabledAlignment = listOf(Alignment.START, Alignment.END)
enabledAlignment = listOf(
Alignment.START,
Alignment.END
)
),
props = ControlPanelState.Toolbar.Styling.Props(
props = com.anytypeio.anytype.presentation.page.editor.control.ControlPanelState.Toolbar.Styling.Props(
isBold = false,
isItalic = false,
isStrikethrough = true,