Browse Source

Upload button fab and other UI fixes

pull/50/head
Apostolos Fanakis 6 years ago
parent
commit
4ae0deef20
  1. 13
      app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java
  2. 4
      app/src/main/res/drawable/ic_attach_file_white_24dp.xml
  3. 35
      app/src/main/res/layout/activity_upload.xml
  4. 2
      app/src/main/res/values/strings.xml

13
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

4
app/src/main/res/drawable/ic_attach_file_white_24dp.xml

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="24dp">
<path android:fillColor="#FFFFFF" android:pathData="M16.5,6v11.5c0,2.21 -1.79,4 -4,4s-4,-1.79 -4,-4V5c0,-1.38 1.12,-2.5 2.5,-2.5s2.5,1.12 2.5,2.5v10.5c0,0.55 -0.45,1 -1,1s-1,-0.45 -1,-1V6H10v9.5c0,1.38 1.12,2.5 2.5,2.5s2.5,-1.12 2.5,-2.5V5c0,-2.21 -1.79,-4 -4,-4S7,2.79 7,5v12.5c0,3.04 2.46,5.5 5.5,5.5s5.5,-2.46 5.5,-5.5V6h-1.5z"/>
</vector>

35
app/src/main/res/layout/activity_upload.xml

@ -23,7 +23,7 @@
app:popupTheme="@style/ToolbarTheme" />
</android.support.design.widget.AppBarLayout>
<ScrollView
<android.support.v4.widget.NestedScrollView
android:id="@+id/upload_outer_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -84,8 +84,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/upload_description_hint"
android:inputType="textMultiLine"
android:maxLines="3" />
android:inputType="textMultiLine" />
</android.support.design.widget.TextInputLayout>
<android.support.v7.widget.AppCompatButton
@ -98,16 +97,16 @@
android:textAlignment="center"
android:textColor="@color/accent" />
<TextView
<android.support.v7.widget.AppCompatTextView
android:id="@+id/upload_filename"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:layout_marginTop="6dp"
android:drawablePadding="5dp"
android:ellipsize="marquee"
android:singleLine="true"
android:textColor="@color/primary_text"
android:text="@string/upload_filename"/>
android:textColor="@color/primary_text" />
<LinearLayout
android:layout_width="match_parent"
@ -142,20 +141,11 @@
android:layout_marginEnd="16dp"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:text="@string/upload_select_file"
android:text="@string/upload_take_photo"
android:textColor="@color/primary_text" />
</LinearLayout>
<android.support.v7.widget.AppCompatButton
android:id="@+id/upload_upload_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="@string/upload_upload_button"
android:textAlignment="center"
android:textColor="@color/accent" />
</LinearLayout>
</ScrollView>
</android.support.v4.widget.NestedScrollView>
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar"
@ -168,6 +158,15 @@
app:layout_anchorGravity="bottom|center"
app:mpb_indeterminateTint="@color/accent"
app:mpb_progressStyle="horizontal" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/upload_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="@dimen/fab_margins"
android:layout_marginEnd="@dimen/fab_margins"
app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_file_upload_white_24dp" />
</android.support.design.widget.CoordinatorLayout>

2
app/src/main/res/values/strings.xml

@ -112,10 +112,8 @@
<string name="upload_title_description_builder">Generate title and description</string>
<string name="upload_title_hint">Title</string>
<string name="upload_description_hint">Description</string>
<string name="upload_filename">Filename</string>
<string name="upload_select_file">Select file</string>
<string name="upload_take_photo">Take photo</string>
<string name="upload_upload_button">Upload</string>
<string name="upload_spinners_hint">Select a category</string>
<!--Upload Fields Builder Activity-->

Loading…
Cancel
Save