Skip to content

Commit 3a10574

Browse files
committed
code cleanup, styling & list editor UI fix
contains code cleanup of layouts fixes missing borders for list editor dialog fixes annoying hint slide for entry editor meanings by disabling it slight change in colors also part of #30 Signed-off-by: Aron Heinecke <aron.heinecke@t-online.de>
1 parent d700421 commit 3a10574

File tree

12 files changed

+96
-29
lines changed

12 files changed

+96
-29
lines changed

app/src/main/java/vocabletrainer/heinecke/aron/vocabletrainer/dialog/TrainerResultDialog.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.app.DialogFragment;
55
import android.content.DialogInterface;
66
import android.os.Bundle;
7+
import android.support.annotation.Nullable;
78
import android.support.v7.app.AlertDialog;
89

910
import java.util.concurrent.Callable;
@@ -33,6 +34,12 @@ public static TrainerResultDialog newInstance(final Trainer trainer, final Calla
3334
return dialog;
3435
}
3536

37+
@Override
38+
public void onCreate(@Nullable Bundle savedInstanceState) {
39+
super.onCreate(savedInstanceState);
40+
setStyle(android.support.v4.app.DialogFragment.STYLE_NORMAL, R.style.CustomDialog);
41+
}
42+
3643
/**
3744
* Set finish action
3845
* @param callable

app/src/main/java/vocabletrainer/heinecke/aron/vocabletrainer/dialog/VEntryEditorDialog.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.content.DialogInterface;
55
import android.os.Bundle;
66
import android.support.annotation.NonNull;
7+
import android.support.annotation.Nullable;
78
import android.support.design.widget.TextInputEditText;
89
import android.support.design.widget.TextInputLayout;
910
import android.support.v4.app.DialogFragment;
@@ -71,9 +72,9 @@ public void setCancelAction(Function<Void,VEntry> cancelAction) {
7172
}
7273

7374
@Override
74-
public void onCreate(Bundle savedInstanceState) {
75+
public void onCreate(@Nullable Bundle savedInstanceState) {
7576
super.onCreate(savedInstanceState);
76-
77+
setStyle(DialogFragment.STYLE_NORMAL, R.style.CustomDialog);
7778
}
7879

7980
@Override

app/src/main/java/vocabletrainer/heinecke/aron/vocabletrainer/dialog/VListEditorDialog.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
import android.content.DialogInterface;
66
import android.os.Bundle;
77
import android.support.annotation.NonNull;
8+
import android.support.annotation.Nullable;
89
import android.support.v4.app.DialogFragment;
910
import android.util.Log;
11+
import android.view.LayoutInflater;
12+
import android.view.View;
13+
import android.view.ViewGroup;
1014
import android.widget.EditText;
1115
import android.widget.LinearLayout;
1216
import android.widget.TableLayout;
@@ -74,6 +78,7 @@ public void onCreate(Bundle savedInstanceState) {
7478
} else if(getArguments() != null){
7579
newList = getArguments().getBoolean(PARAM_NEW);
7680
}
81+
setStyle(DialogFragment.STYLE_NORMAL, R.style.CustomDialog);
7782
}
7883

7984
@Override
@@ -109,16 +114,14 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
109114
Log.d(TAG,"onCreateDialog");
110115
list = getListProvider().getList();
111116
AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
112-
alertDialog.setMessage(newList ? R.string.Editor_Diag_table_Title_New : R.string.Editor_Diag_table_Title_Edit );
113-
iName = new EditText(getActivity());
114-
iColA = new EditText(getActivity());
115-
iColB = new EditText(getActivity());
117+
final View view = View.inflate(getActivity(), R.layout.dialog_list, null);
118+
alertDialog.setTitle(newList ? R.string.Editor_Diag_table_Title_New : R.string.Editor_Diag_table_Title_Edit );
119+
iName = view.findViewById(R.id.tListName);
120+
iColA = view.findViewById(R.id.tListColumnA);
121+
iColB = view.findViewById(R.id.tListColumnB);
116122

117123
iName.setText(list.getName());
118124
iName.setSingleLine();
119-
iName.setHint(R.string.Editor_Hint_List_Name);
120-
iColA.setHint(R.string.Editor_Hint_Column_A);
121-
iColB.setHint(R.string.Editor_Hint_Column_B);
122125
iColA.setText(list.getNameA());
123126
iColA.setSingleLine();
124127
iColB.setSingleLine();
@@ -135,11 +138,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
135138
iColB.setText(savedInstanceState.getString(KEY_COL_B));
136139
}
137140

138-
LinearLayout rl = new TableLayout(getActivity());
139-
rl.addView(iName);
140-
rl.addView(iColA);
141-
rl.addView(iColB);
142-
alertDialog.setView(rl);
141+
alertDialog.setView(view);
143142

144143
alertDialog.setPositiveButton(R.string.Editor_Diag_table_btn_Ok, (dialog, whichButton) -> {
145144
if (iColA.getText().length() == 0 || iColB.length() == 0 || iName.getText().length() == 0) {

app/src/main/res/layout/activity_editor.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
android:id="@+id/listviewEditor"
3131
android:layout_width="0dp"
3232
android:layout_height="0dp"
33-
android:layout_marginLeft="8dp"
34-
android:layout_marginRight="8dp"
3533
app:layout_constraintBottom_toBottomOf="parent"
3634
app:layout_constraintHorizontal_bias="0.0"
3735
app:layout_constraintLeft_toLeftOf="parent"

app/src/main/res/layout/dialog_entry.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
4-
android:layout_height="match_parent">
4+
android:layout_height="match_parent"
5+
xmlns:app="http://schemas.android.com/apk/res-auto">
56

67
<RelativeLayout
78
android:layout_width="match_parent"
@@ -32,6 +33,7 @@
3233
android:id="@+id/wrapper_Hint"
3334
android:layout_width="match_parent"
3435
android:layout_height="wrap_content"
36+
app:hintAnimationEnabled="false"
3537
android:layout_below="@+id/meaningsB">
3638

3739
<android.support.design.widget.TextInputEditText
@@ -47,6 +49,7 @@
4749
android:layout_width="match_parent"
4850
android:layout_height="wrap_content"
4951
android:layout_alignParentEnd="false"
52+
app:hintAnimationEnabled="false"
5053
android:layout_below="@+id/wrapper_Hint"
5154
android:paddingBottom="20dp">
5255

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
xmlns:app="http://schemas.android.com/apk/res-auto">
6+
7+
<LinearLayout
8+
android:layout_width="match_parent"
9+
android:layout_height="wrap_content"
10+
android:layout_margin="20dp"
11+
android:orientation="vertical">
12+
13+
<android.support.design.widget.TextInputLayout
14+
android:layout_width="match_parent"
15+
android:layout_height="wrap_content"
16+
android:layout_marginTop="0dp"
17+
app:hintAnimationEnabled="false">
18+
19+
<android.support.design.widget.TextInputEditText
20+
android:id="@+id/tListName"
21+
android:layout_width="match_parent"
22+
android:layout_height="wrap_content"
23+
android:hint="@string/Editor_Hint_List_Name"
24+
android:saveEnabled="false" />
25+
</android.support.design.widget.TextInputLayout>
26+
27+
<android.support.design.widget.TextInputLayout
28+
android:layout_width="match_parent"
29+
android:layout_height="wrap_content"
30+
app:hintAnimationEnabled="false">
31+
32+
<android.support.design.widget.TextInputEditText
33+
android:id="@+id/tListColumnA"
34+
android:layout_width="match_parent"
35+
android:layout_height="wrap_content"
36+
android:hint="@string/Editor_Hint_Column_A"
37+
android:saveEnabled="false" />
38+
</android.support.design.widget.TextInputLayout>
39+
40+
<android.support.design.widget.TextInputLayout
41+
android:layout_width="match_parent"
42+
android:layout_height="wrap_content"
43+
app:hintAnimationEnabled="false">
44+
45+
<android.support.design.widget.TextInputEditText
46+
android:id="@+id/tListColumnB"
47+
android:layout_width="match_parent"
48+
android:layout_height="wrap_content"
49+
android:hint="@string/Editor_Hint_Column_B"
50+
android:saveEnabled="false" />
51+
</android.support.design.widget.TextInputLayout>
52+
</LinearLayout>
53+
</ScrollView>

app/src/main/res/layout/editor_meaning.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
44
android:layout_width="match_parent"
5-
android:layout_height="wrap_content">
5+
android:layout_height="wrap_content"
6+
android:minHeight="@dimen/high_density"
7+
xmlns:app="http://schemas.android.com/apk/res-auto">
68

79
<!-- saveEnabled=false REQUIRED, because ALL instances will get the same value otherwise! -->
810
<android.support.design.widget.TextInputLayout
@@ -12,6 +14,7 @@
1214
android:layout_alignParentTop="true"
1315
android:layout_toStartOf="@+id/btnMeaning"
1416
android:saveEnabled="false"
17+
app:hintAnimationEnabled="false"
1518
android:orientation="vertical">
1619

1720
<android.support.design.widget.TextInputEditText
@@ -27,7 +30,6 @@
2730
android:layout_height="wrap_content"
2831
android:layout_alignBottom="@+id/wrapper_meaning"
2932
android:layout_alignParentEnd="true"
30-
android:layout_alignParentRight="true"
3133
android:background="@android:color/transparent"
3234
android:contentDescription="placeholder"
3335
tools:ignore="HardcodedText" />

app/src/main/res/layout/entry_list_view.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,30 @@
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
44
android:layout_height="match_parent"
5+
android:padding="@dimen/padd_10"
56
android:orientation="horizontal">
67

78
<TextView
89
android:id="@+id/entryFirstText"
910
android:layout_width="0dp"
1011
android:layout_height="wrap_content"
1112
android:layout_weight="1"
12-
android:text="First"></TextView>
13+
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
14+
android:text="@string/Placeholder" />
1315

1416
<TextView
1517
android:id="@+id/entrySecondText"
1618
android:layout_width="0dp"
1719
android:layout_height="wrap_content"
1820
android:layout_weight="1"
19-
android:text="Second"></TextView>
21+
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
22+
android:text="@string/Placeholder" />
2023

2124
<TextView
2225
android:id="@+id/entryThirdText"
2326
android:layout_width="0dp"
2427
android:layout_height="wrap_content"
2528
android:layout_weight="0.9"
26-
android:text="Third"></TextView>
29+
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
30+
android:text="@string/Placeholder" />
2731
</LinearLayout>

app/src/main/res/layout/fragment_preview.xml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,17 @@
99
<TextView
1010
android:layout_width="wrap_content"
1111
android:layout_height="wrap_content"
12-
android:layout_marginEnd="8dp"
13-
android:layout_marginTop="8dp"
12+
android:layout_marginTop="16dp"
13+
android:layout_marginRight="16dp"
1414
android:text="@string/Import_preview_text"
15+
android:textAppearance="@style/TextAppearance.AppCompat.Small"
1516
app:layout_constraintRight_toRightOf="@+id/lstImportPreview"
1617
app:layout_constraintTop_toTopOf="@+id/lstImportPreview" />
1718

1819
<ListView
1920
android:id="@+id/lstImportPreview"
2021
android:layout_width="0dp"
2122
android:layout_height="0dp"
22-
android:layout_marginBottom="8dp"
23-
android:layout_marginEnd="8dp"
24-
android:layout_marginStart="8dp"
25-
android:layout_marginTop="8dp"
2623
app:layout_constraintBottom_toBottomOf="parent"
2724
app:layout_constraintEnd_toEndOf="parent"
2825
app:layout_constraintStart_toStartOf="parent"

app/src/main/res/values/colors.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
<color name="colorPrimaryDark">#303F9F</color>
55
<color name="colorAccent">#FF4081</color>
66
<color name="primary_text">#212121</color>
7-
<color name="secondary_text">#727272</color>
7+
<color name="secondary_text">#404040</color>
8+
<color name="tertiary_text">#727272</color>
89
<color name="bg_row_background">#fa315b</color>
910
<color name="colorWhite">#fff</color>
1011
</resources>

0 commit comments

Comments
 (0)