Commit b0095744 by Paktalin

Removed fragment_editable_word

parent dc5e6c99
...@@ -10,14 +10,14 @@ import com.paktalin.vocabularynotebook.firestoreitems.WordPojo ...@@ -10,14 +10,14 @@ import com.paktalin.vocabularynotebook.firestoreitems.WordPojo
import com.paktalin.vocabularynotebook.ui.activities.MainActivity import com.paktalin.vocabularynotebook.ui.activities.MainActivity
import com.paktalin.vocabularynotebook.utils.gone import com.paktalin.vocabularynotebook.utils.gone
import com.paktalin.vocabularynotebook.utils.visible import com.paktalin.vocabularynotebook.utils.visible
import kotlinx.android.synthetic.main.fragment_editable_word.*
import kotlinx.android.synthetic.main.submit.* import kotlinx.android.synthetic.main.submit.*
import kotlinx.android.synthetic.main.word_item.*
open class AddWordFragment : Fragment() { open class AddWordFragment : Fragment() {
private lateinit var mainActivity: MainActivity private lateinit var mainActivity: MainActivity
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_editable_word, container, false) return inflater.inflate(R.layout.word_item, container, false)
} }
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
......
...@@ -5,6 +5,7 @@ import android.widget.EditText ...@@ -5,6 +5,7 @@ import android.widget.EditText
import androidx.recyclerview.selection.ItemDetailsLookup import androidx.recyclerview.selection.ItemDetailsLookup
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.paktalin.vocabularynotebook.firestoreitems.WordPojo import com.paktalin.vocabularynotebook.firestoreitems.WordPojo
import com.paktalin.vocabularynotebook.utils.visible
import kotlinx.android.synthetic.main.word_item.view.* import kotlinx.android.synthetic.main.word_item.view.*
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
...@@ -15,6 +16,7 @@ class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { ...@@ -15,6 +16,7 @@ class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
fun bind(wordPojo: WordPojo, position: Int, isActivated: Boolean, showPopupMenu: (View, Int) -> Unit) { fun bind(wordPojo: WordPojo, position: Int, isActivated: Boolean, showPopupMenu: (View, Int) -> Unit) {
tvWord.setText(wordPojo.word) tvWord.setText(wordPojo.word)
tvTranslation.setText(wordPojo.translation) tvTranslation.setText(wordPojo.translation)
visible(itemView.clickable_view)
itemView.clickable_view.setOnClickListener { showPopupMenu(itemView, position) } itemView.clickable_view.setOnClickListener { showPopupMenu(itemView, position) }
itemView.isActivated = isActivated itemView.isActivated = isActivated
} }
......
...@@ -74,10 +74,6 @@ fun visible(view: View) { ...@@ -74,10 +74,6 @@ fun visible(view: View) {
view.visibility = View.VISIBLE view.visibility = View.VISIBLE
} }
fun invisible(view: View) {
view.visibility = View.INVISIBLE
}
fun gone(view: View) { fun gone(view: View) {
view.visibility = View.GONE view.visibility = View.GONE
} }
...@@ -85,9 +81,4 @@ fun gone(view: View) { ...@@ -85,9 +81,4 @@ fun gone(view: View) {
fun showKeyboard(activity: AppCompatActivity) { fun showKeyboard(activity: AppCompatActivity) {
val imm = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager? val imm = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager?
imm!!.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY) imm!!.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY)
}
fun hideKeyboard(activity: AppCompatActivity) {
val imm = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager?
imm!!.toggleSoftInput(InputMethodManager.RESULT_HIDDEN, InputMethodManager.RESULT_HIDDEN)
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/editable_word_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/line"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
tools:ignore="ContentDescription" />
<LinearLayout
android:id="@+id/editable_word"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:orientation="horizontal"
android:paddingStart="16dp"
android:paddingLeft="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingRight="16dp"
android:paddingBottom="8dp"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/word"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:hint="@string/hint_word"
android:inputType="textMultiLine"
android:paddingEnd="@dimen/word_margin"
android:paddingRight="@dimen/word_margin"
android:textColor="@color/text_color"
android:textSize="@dimen/text_size"
app:fontFamily="@font/neucha"
tools:ignore="LabelFor,RtlSymmetry" />
<EditText
android:id="@+id/translation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:hint="@string/hint_translation"
android:inputType="textMultiLine"
android:paddingEnd="16dp"
android:paddingRight="16dp"
android:textColor="@color/text_color"
android:textSize="@dimen/text_size"
app:fontFamily="@font/neucha"
tools:ignore="LabelFor,RtlSymmetry" />
</LinearLayout>
<ImageButton
android:id="@+id/btnClear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:background="@android:color/transparent"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_close_blue"
tools:ignore="ContentDescription" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/word_item_layout" android:id="@+id/word_item_layout"
...@@ -11,69 +10,70 @@ ...@@ -11,69 +10,70 @@
android:id="@+id/line" android:id="@+id/line"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/line" android:layout_gravity="bottom"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:src="@drawable/line"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<FrameLayout <LinearLayout
android:id="@+id/layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"> android:background="@drawable/selector"
android:orientation="horizontal"
android:paddingStart="16dp"
android:paddingLeft="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingRight="16dp"
android:paddingBottom="8dp">
<LinearLayout <EditText
android:id="@+id/layout" android:id="@+id/word"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/selector" android:layout_weight="1"
android:orientation="horizontal" android:background="@android:color/transparent"
android:paddingStart="16dp" android:hint="@string/hint_word"
android:paddingLeft="16dp" android:inputType="textMultiLine"
android:paddingTop="8dp" android:paddingStart="@dimen/small_padding"
android:paddingEnd="16dp" android:paddingLeft="@dimen/small_padding"
android:paddingRight="16dp" android:paddingEnd="@dimen/small_padding"
android:paddingBottom="8dp"> android:paddingRight="@dimen/small_padding"
android:textColor="@color/text_color"
<EditText android:textSize="@dimen/text_size"
android:id="@+id/word" app:fontFamily="@font/neucha"
android:layout_width="0dp" tools:ignore="LabelFor,RtlSymmetry" />
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:paddingEnd="@dimen/word_margin"
android:paddingRight="@dimen/word_margin"
android:textColor="@color/text_color"
android:textSize="@dimen/text_size"
app:fontFamily="@font/neucha"
tools:ignore="LabelFor,RtlSymmetry" />
<EditText
android:id="@+id/translation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:textColor="@color/text_color"
android:textSize="@dimen/text_size"
app:fontFamily="@font/neucha"
tools:ignore="LabelFor" />
</LinearLayout>
<View <EditText
android:id="@+id/clickable_view" android:id="@+id/translation"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:clickable="true" android:hint="@string/hint_translation"
android:focusable="true" /> android:inputType="textMultiLine"
android:paddingStart="@dimen/small_padding"
android:paddingLeft="@dimen/small_padding"
android:paddingEnd="@dimen/small_padding"
android:paddingRight="@dimen/small_padding"
android:textColor="@color/text_color"
android:textSize="@dimen/text_size"
app:fontFamily="@font/neucha"
tools:ignore="LabelFor" />
</FrameLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> <View
\ No newline at end of file android:id="@+id/clickable_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:clickable="true"
android:focusable="true"
android:visibility="gone" />
</FrameLayout>
\ No newline at end of file
<resources> <resources>
<!-- Default screen margins, per the Android Design guidelines. --> <!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="small_margin">8dp</dimen> <dimen name="small_margin">8dp</dimen>
<dimen name="small_padding">8dp</dimen>
<dimen name="button_text_size">24sp</dimen> <dimen name="button_text_size">24sp</dimen>
<dimen name="medium_padding">16dp</dimen> <dimen name="medium_padding">16dp</dimen>
<dimen name="medium_margin">16dp</dimen> <dimen name="medium_margin">16dp</dimen>
<dimen name="text_size">22sp</dimen> <dimen name="text_size">22sp</dimen>
<dimen name="word_margin">8dp</dimen> <dimen name="word_margin">8dp</dimen>
<dimen name="small_padding">4dp</dimen>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment