Skip to content

Commit 8effd41

Browse files
committed
fix #987:Enhancing the document upload dialog
1 parent 6f677a1 commit 8effd41

File tree

3 files changed

+114
-75
lines changed

3 files changed

+114
-75
lines changed

mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/documentdialog/DocumentDialogFragment.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ public class DocumentDialogFragment extends DialogFragment implements DocumentDi
6767
@BindView(R.id.tv_choose_file)
6868
TextView tv_choose_file;
6969

70+
@BindView(R.id.btn_browse_document)
71+
Button bt_browse;
72+
7073
@BindView(R.id.bt_upload)
7174
Button bt_upload;
7275

@@ -124,10 +127,8 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
124127
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
125128
savedInstanceState) {
126129
rootView = inflater.inflate(R.layout.dialog_fragment_document, container, false);
127-
128130
ButterKnife.bind(this, rootView);
129131
mDocumentDialogPresenter.attachView(this);
130-
131132
if (getResources().getString(R.string.update_document).equals(documentAction)) {
132133
tv_document_action.setText(R.string.update_document);
133134
et_document_name.setText(document.getName());
@@ -149,7 +150,7 @@ public void beginUpload() {
149150
}
150151
}
151152

152-
@OnClick(R.id.tv_choose_file)
153+
@OnClick(R.id.btn_browse_document)
153154
public void openFilePicker() {
154155
checkPermissionAndRequest();
155156
}
@@ -338,4 +339,5 @@ public void onDestroyView() {
338339
public interface OnDialogFragmentInteractionListener {
339340
void initiateFileUpload(String name, String description);
340341
}
342+
341343
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24.0"
5+
android:viewportHeight="24.0">
6+
<path
7+
android:fillColor="@color/white"
8+
android:pathData="M10,4H4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V8c0,-1.1 -0.9,-2 -2,-2h-8l-2,-2z"/>
9+
</vector>

mifosng-android/src/main/res/layout/dialog_fragment_document.xml

Lines changed: 100 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -5,93 +5,121 @@
55
~ See https://github.com/openMF/android-client/blob/master/LICENSE.md
66
-->
77

8-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
9-
android:layout_width="match_parent" android:layout_height="match_parent">
10-
11-
<TableLayout
12-
android:layout_width="match_parent"
8+
<LinearLayout android:layout_height="wrap_content"
9+
android:layout_width="match_parent"
10+
android:orientation="vertical"
11+
android:paddingBottom="24dp"
12+
android:layout_centerHorizontal="true"
13+
android:minWidth="300dp"
14+
android:minHeight="300dp"
15+
xmlns:android="http://schemas.android.com/apk/res/android">
16+
17+
<LinearLayout
1318
android:layout_height="wrap_content"
14-
android:layout_alignParentTop="true"
15-
android:layout_centerHorizontal="true"
16-
android:padding="8dp"
17-
android:id="@+id/tableLayout">
19+
android:layout_width="match_parent"
20+
android:orientation="vertical">
1821

1922
<TextView
23+
style="@style/Base.TextAppearance.AppCompat.Large"
2024
android:id="@+id/tv_document_action"
21-
android:layout_width="wrap_content"
22-
android:layout_height="wrap_content"
25+
android:layout_height="match_parent"
26+
android:layout_width="match_parent"
27+
android:paddingBottom="@dimen/layout_padding_30dp"
28+
android:paddingLeft="24dp"
29+
android:paddingRight="24dp"
30+
android:paddingStart="24dp"
31+
android:paddingTop="24dp"
2332
android:gravity="center"
24-
android:padding="10dp"
2533
android:text="@string/upload_document"
26-
/>
34+
android:textColor="@color/primary"
35+
android:textStyle="bold"/>
2736

28-
<TableRow
29-
android:layout_width="fill_parent"
30-
android:layout_height="fill_parent"
31-
android:id="@+id/tableRow1">
32-
33-
<TextView
34-
android:layout_width="0dp"
35-
android:layout_weight="1"
36-
android:layout_height="wrap_content"
37-
android:textAppearance="?android:attr/textAppearanceMedium"
38-
android:text="@string/name"
39-
android:id="@+id/textView2" />
37+
<android.support.design.widget.TextInputLayout
38+
android:layout_height="match_parent"
39+
android:layout_width="match_parent"
40+
android:paddingLeft="24dp"
41+
android:paddingRight="24dp">
4042

4143
<EditText
42-
android:layout_width="0dp"
43-
android:layout_weight="1"
44-
android:layout_height="wrap_content"
44+
android:hint="Name"
4545
android:id="@+id/et_document_name"
46-
android:maxLines="3"
47-
android:scrollbars="vertical"/>
48-
</TableRow>
49-
50-
<TableRow
51-
android:layout_width="fill_parent"
52-
android:layout_height="fill_parent"
53-
android:id="@+id/tableRow2"
54-
android:layout_marginTop="16dp">
55-
56-
<TextView
57-
android:layout_width="0dp"
58-
android:layout_weight="1"
59-
android:layout_height="wrap_content"
60-
android:textAppearance="?android:attr/textAppearanceMedium"
61-
android:text="@string/description"
62-
android:id="@+id/textView3" />
46+
android:inputType="text"
47+
android:layout_height="match_parent"
48+
android:layout_width="match_parent"/>
49+
</android.support.design.widget.TextInputLayout>
50+
51+
<android.support.design.widget.TextInputLayout
52+
android:id="@+id/til_description"
53+
android:layout_height="match_parent"
54+
android:layout_width="match_parent"
55+
android:paddingLeft="24dp"
56+
android:paddingRight="24dp"
57+
android:paddingTop="16dp">
6358

6459
<EditText
65-
android:layout_width="0dp"
66-
android:layout_weight="1"
67-
android:layout_height="wrap_content"
60+
android:hint="@string/description"
6861
android:id="@+id/et_document_description"
69-
android:maxLines="3"
62+
android:inputType="textMultiLine"
63+
android:layout_height="match_parent"
64+
android:layout_width="match_parent"
65+
android:scrollHorizontally="false"
7066
android:scrollbars="vertical"/>
71-
</TableRow>
72-
73-
</TableLayout>
67+
</android.support.design.widget.TextInputLayout>
68+
69+
70+
<android.support.design.widget.TextInputLayout
71+
android:id="@+id/til_selected_file"
72+
android:gravity="center"
73+
android:layout_height="match_parent"
74+
android:layout_weight=".7"
75+
android:layout_width="match_parent"
76+
android:paddingEnd="8dp"
77+
android:paddingLeft="24dp"
78+
android:paddingRight="24dp"
79+
android:paddingTop="16dp">
80+
<EditText
81+
android:hint="Selected file"
82+
android:id="@+id/tv_choose_file"
83+
android:inputType="text"
84+
android:lines="1"
85+
android:layout_height="match_parent"
86+
android:layout_width="match_parent"
87+
android:scrollHorizontally="false"
88+
android:enabled="false"
89+
android:scrollbars="vertical"/>
90+
</android.support.design.widget.TextInputLayout>
91+
92+
93+
94+
</LinearLayout>
95+
96+
<LinearLayout
97+
android:layout_width="match_parent"
98+
android:layout_height="match_parent"
99+
android:gravity="center">
74100

101+
<Button
102+
android:drawableLeft="@drawable/ic_folder_black_24dp"
103+
android:drawableStart="@drawable/ic_folder_black_24dp"
104+
android:id="@+id/btn_browse_document"
105+
android:layout_height="wrap_content"
106+
android:layout_width="match_parent"
107+
android:gravity="center"
108+
android:layout_weight="0.5"
109+
android:text="Browse"
110+
android:backgroundTint="@color/primary"
111+
android:textAllCaps="true" />
75112

76-
<TextView
77-
android:layout_width="wrap_content"
78-
android:layout_height="wrap_content"
79-
android:textAppearance="?android:attr/textAppearanceMedium"
80-
android:text="@string/choose_file"
81-
android:id="@+id/tv_choose_file"
82-
android:layout_marginTop="16dp"
83-
android:layout_below="@+id/tableLayout"
84-
android:layout_centerHorizontal="true" />
85-
86-
<Button
87-
android:layout_width="match_parent"
88-
android:layout_height="wrap_content"
89-
android:text="@string/upload"
90-
android:id="@+id/bt_upload"
91-
android:enabled="false"
92-
android:layout_below="@+id/tv_choose_file"
93-
android:layout_centerHorizontal="true"
94-
android:layout_marginTop="26dp" />
113+
<Button
114+
android:id="@+id/bt_upload"
115+
android:layout_height="wrap_content"
116+
android:layout_width="match_parent"
117+
android:gravity="center"
118+
android:text="@string/upload"
119+
android:layout_weight="0.5"
120+
android:textAllCaps="true"
121+
android:backgroundTint="@color/primary" />
95122

123+
</LinearLayout>
96124

97-
</RelativeLayout>
125+
</LinearLayout>

0 commit comments

Comments
 (0)