From 4ae0deef20b2dc693b8baa58ef6d5d47b75083c4 Mon Sep 17 00:00:00 2001 From: Apostolof Date: Sat, 1 Sep 2018 17:44:26 +0300 Subject: [PATCH] Upload button fab and other UI fixes --- .../activities/upload/UploadActivity.java | 13 ++++--- .../drawable/ic_attach_file_white_24dp.xml | 4 +++ app/src/main/res/layout/activity_upload.xml | 35 +++++++++---------- app/src/main/res/values/strings.xml | 2 -- 4 files changed, 30 insertions(+), 24 deletions(-) create mode 100644 app/src/main/res/drawable/ic_attach_file_white_24dp.xml diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java index 41fd9b53..b413fed3 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java @@ -11,16 +11,17 @@ import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.provider.MediaStore; +import android.support.design.widget.FloatingActionButton; import android.support.v7.content.res.AppCompatResources; import android.support.v7.preference.PreferenceManager; import android.support.v7.widget.AppCompatButton; +import android.support.v7.widget.AppCompatTextView; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ProgressBar; -import android.widget.TextView; import android.widget.Toast; import net.gotev.uploadservice.MultipartUploadRequest; @@ -86,7 +87,8 @@ public class UploadActivity extends BaseActivity { private EditText uploadTitle; private EditText uploadDescription; private AppCompatButton titleDescriptionBuilderButton; - private TextView filenameHolder; + private AppCompatTextView filenameHolder; + private FloatingActionButton uploadFAB; @Override protected void onCreate(Bundle savedInstanceState) { @@ -193,6 +195,8 @@ public class UploadActivity extends BaseActivity { uploadDescription = findViewById(R.id.upload_description); filenameHolder = findViewById(R.id.upload_filename); + Drawable filenameDrawable = AppCompatResources.getDrawable(this, R.drawable.ic_attach_file_white_24dp); + filenameHolder.setCompoundDrawablesRelativeWithIntrinsicBounds(filenameDrawable, null, null, null); AppCompatButton selectFileButton = findViewById(R.id.upload_select_file_button); Drawable selectStartDrawable = AppCompatResources.getDrawable(this, R.drawable.ic_insert_drive_file_white_24dp); @@ -227,7 +231,8 @@ public class UploadActivity extends BaseActivity { startActivityForResult(takePhotoIntent, REQUEST_CODE_CAMERA); }); - findViewById(R.id.upload_upload_button).setOnClickListener(view -> { + uploadFAB = findViewById(R.id.upload_fab); + uploadFAB.setOnClickListener(view -> { String uploadTitleText = uploadTitle.getText().toString(); String uploadDescriptionText = uploadDescription.getText().toString(); @@ -302,7 +307,7 @@ public class UploadActivity extends BaseActivity { uploadTitle.setText(null); uploadDescription.setText(null); - filenameHolder.setText(R.string.upload_filename); + filenameHolder.setText(null); } @Override diff --git a/app/src/main/res/drawable/ic_attach_file_white_24dp.xml b/app/src/main/res/drawable/ic_attach_file_white_24dp.xml new file mode 100644 index 00000000..4834305b --- /dev/null +++ b/app/src/main/res/drawable/ic_attach_file_white_24dp.xml @@ -0,0 +1,4 @@ + + + + diff --git a/app/src/main/res/layout/activity_upload.xml b/app/src/main/res/layout/activity_upload.xml index 3cc89d2f..b6ff0f8a 100644 --- a/app/src/main/res/layout/activity_upload.xml +++ b/app/src/main/res/layout/activity_upload.xml @@ -23,7 +23,7 @@ app:popupTheme="@style/ToolbarTheme" /> - + android:inputType="textMultiLine" /> - + android:textColor="@color/primary_text" /> - - - + - + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index acccc404..6a59a209 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -112,10 +112,8 @@ Generate title and description Title Description - Filename Select file Take photo - Upload Select a category