Commit b0095744 by Paktalin

Removed fragment_editable_word

parent dc5e6c99
......@@ -10,14 +10,14 @@ import com.paktalin.vocabularynotebook.firestoreitems.WordPojo
import com.paktalin.vocabularynotebook.ui.activities.MainActivity
import com.paktalin.vocabularynotebook.utils.gone
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.word_item.*
open class AddWordFragment : Fragment() {
private lateinit var mainActivity: MainActivity
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?) {
......
......@@ -5,6 +5,7 @@ import android.widget.EditText
import androidx.recyclerview.selection.ItemDetailsLookup
import androidx.recyclerview.widget.RecyclerView
import com.paktalin.vocabularynotebook.firestoreitems.WordPojo
import com.paktalin.vocabularynotebook.utils.visible
import kotlinx.android.synthetic.main.word_item.view.*
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) {
tvWord.setText(wordPojo.word)
tvTranslation.setText(wordPojo.translation)
visible(itemView.clickable_view)
itemView.clickable_view.setOnClickListener { showPopupMenu(itemView, position) }
itemView.isActivated = isActivated
}
......
......@@ -74,10 +74,6 @@ fun visible(view: View) {
view.visibility = View.VISIBLE
}
fun invisible(view: View) {
view.visibility = View.INVISIBLE
}
fun gone(view: View) {
view.visibility = View.GONE
}
......@@ -86,8 +82,3 @@ fun showKeyboard(activity: AppCompatActivity) {
val imm = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager?
imm!!.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY)
}
\ No newline at end of file
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"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout 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/word_item_layout"
......@@ -11,22 +10,15 @@
android:id="@+id/line"
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_gravity="bottom"
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" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:id="@+id/layout"
android:layout_width="match_parent"
......@@ -46,8 +38,12 @@
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:hint="@string/hint_word"
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"
......@@ -59,6 +55,12 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:hint="@string/hint_translation"
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"
......@@ -72,8 +74,6 @@
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:clickable="true"
android:focusable="true" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
android:focusable="true"
android:visibility="gone" />
</FrameLayout>
\ No newline at end of file
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="small_margin">8dp</dimen>
<dimen name="small_padding">8dp</dimen>
<dimen name="button_text_size">24sp</dimen>
<dimen name="medium_padding">16dp</dimen>
<dimen name="medium_margin">16dp</dimen>
<dimen name="text_size">22sp</dimen>
<dimen name="word_margin">8dp</dimen>
<dimen name="small_padding">4dp</dimen>
</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