Browse Source

Move file zipping to AsyncTask, Init notification actions

uploads
Apostolos Fanakis 6 years ago
parent
commit
c5e1d14374
  1. 306
      app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java
  2. 12
      app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadsHelper.java
  3. 63
      app/src/main/java/gr/thmmy/mthmmy/services/UploadsReceiver.java
  4. 4
      app/src/main/res/drawable/ic_cached_accent_24dp.xml
  5. 4
      app/src/main/res/drawable/ic_cancel_accent_24dp.xml
  6. 38
      app/src/main/res/layout/dialog_upload_progress.xml
  7. 9
      app/src/main/res/values/strings.xml
  8. 4
      app/src/main/res/values/styles.xml

306
app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java

@ -1,6 +1,7 @@
package gr.thmmy.mthmmy.activities.upload;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -35,6 +36,7 @@ import android.widget.TextView;
import android.widget.Toast;
import net.gotev.uploadservice.MultipartUploadRequest;
import net.gotev.uploadservice.UploadNotificationAction;
import net.gotev.uploadservice.UploadNotificationConfig;
import org.jsoup.nodes.Document;
@ -42,8 +44,12 @@ import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.File;
import java.lang.ref.WeakReference;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.base.BaseActivity;
@ -87,7 +93,7 @@ public class UploadActivity extends BaseActivity {
private static final int MAX_FILE_SIZE_SUPPORTED = 45000000;
private UploadsReceiver uploadsReceiver = new UploadsReceiver();
//private UploadsReceiver uploadsReceiver = new UploadsReceiver();
private ArrayList<UploadCategory> uploadRootCategories = new ArrayList<>();
private ParseUploadPageTask parseUploadPageTask;
private ArrayList<String> bundleCategory;
@ -110,58 +116,6 @@ public class UploadActivity extends BaseActivity {
private EditText uploadDescription;
private AppCompatButton titleDescriptionBuilderButton;
private LinearLayout filesListView;
private AlertDialog uploadProgressDialog;
private MaterialProgressBar dialogProgressBar;
private TextView dialogProgressText;
private UploadsReceiver.Delegate uploadDelegate = new UploadsReceiver.Delegate() {
@Override
public void onProgress(long uploadedBytes, long totalBytes, int progress, double uploadRate) {
if (uploadProgressDialog != null) {
dialogProgressBar.setProgress(progress);
dialogProgressText.setText(getResources().getString(
R.string.upload_progress_dialog_bytes_uploaded, (float) uploadRate,
(int) uploadedBytes / 1000, (int) totalBytes / 1000));
if (uploadedBytes == totalBytes) {
uploadProgressDialog.dismiss();
}
}
}
@Override
public void onError(Exception exception) {
Toast.makeText(getApplicationContext(), "Upload failed", Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.GONE);
}
@Override
public void onCompleted(int serverResponseCode, byte[] serverResponseBody) {
Toast.makeText(getApplicationContext(), "Upload completed successfully", Toast.LENGTH_SHORT).show();
uploadTitle.setText(null);
textWatcher.setFileExtension("");
uploadFilename.setText(null);
hasModifiedFilename = false;
uploadDescription.setText(null);
filesList.clear();
filesListView.removeAllViews();
photoFileCreated = null;
progressBar.setVisibility(View.GONE);
if (uploadProgressDialog != null) {
uploadProgressDialog.dismiss();
}
}
@Override
public void onCancelled() {
Toast.makeText(getApplicationContext(), "Upload canceled", Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.GONE);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -199,8 +153,8 @@ public class UploadActivity extends BaseActivity {
progressBar = findViewById(R.id.progressBar);
uploadsReceiver.setDelegate(uploadDelegate);
uploadsReceiver.provideStorage(storage);
/*uploadsReceiver.setDelegate(uploadDelegate);
uploadsReceiver.provideStorage(storage);*/
findViewById(R.id.upload_outer_scrollview).setVerticalScrollBarEnabled(false);
categoriesSpinners = findViewById(R.id.upload_spinners);
@ -379,32 +333,18 @@ public class UploadActivity extends BaseActivity {
builder.setTitle("Upload to thmmy");
builder.setMessage("Are you sure?");
builder.setPositiveButton("YES, FIRE AWAY", (dialog, which) -> {
AlertDialog.Builder progressDialogBuilder = new AlertDialog.Builder(this);
LayoutInflater inflater = this.getLayoutInflater();
LinearLayout progressDialogLayout = (LinearLayout) inflater.inflate(R.layout.dialog_upload_progress, null);
dialogProgressBar = progressDialogLayout.findViewById(R.id.dialogProgressBar);
dialogProgressBar.setMax(100);
dialogProgressText = progressDialogLayout.findViewById(R.id.dialog_bytes_uploaded);
progressDialogBuilder.setView(progressDialogLayout);
progressDialogBuilder.setNeutralButton("Resume on background", (progressDialog, progressWhich) -> {
uploadProgressDialog.dismiss();
finish();
});
uploadProgressDialog = progressDialogBuilder.create();
uploadProgressDialog.setCancelable(false);
dialog.dismiss();
uploadProgressDialog.show();
//Checks settings and possibly adds "Uploaded from mTHMMY" string to description
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(view.getContext());
if (sharedPrefs.getBoolean(UPLOADING_APP_SIGNATURE_ENABLE_KEY, true)) {
uploadDescriptionText[0] += uploadedFromThmmyPromptHtml;
}
for (UploadFile file : filesList) {
if (file.isCameraPhoto()) {
TakePhoto.galleryAddPic(this, file.getPhotoFile());
}
}
Uri tempFileUri = null;
if (filesList.size() == 1) {
//Checks if the file needs renaming
@ -444,22 +384,18 @@ public class UploadActivity extends BaseActivity {
filesListArray[i] = filesList.get(i).getFileUri();
}
File zipFile = UploadsHelper.createZipFile(this);
assert zipFile != null;
tempFileUri = FileProvider.getUriForFile(this, getPackageName() +
".provider", zipFile);
dialogProgressText.setText(R.string.upload_progress_dialog_zipping_files);
UploadsHelper.zip(this, filesListArray, tempFileUri);
new ZipTask(this, editTextFilename, categorySelected,
uploadTitleText, uploadDescriptionText[0], fileIcon,
uploaderProfileIndex).execute(filesListArray);
finish();
}
for (UploadFile file : filesList) {
if (file.isCameraPhoto()) {
TakePhoto.galleryAddPic(this, file.getPhotoFile());
}
}
Intent retryIntent = new Intent(this, UploadsReceiver.class);
retryIntent.setAction(UploadsReceiver.ACTION_RETRY_UPLOAD);
Intent cancelIntent = new Intent(this, UploadsReceiver.class);
cancelIntent.setAction(UploadsReceiver.ACTION_CANCEL_UPLOAD);
try {
UploadNotificationConfig uploadNotificationConfig = new UploadNotificationConfig();
uploadNotificationConfig.setIconForAllStatuses(android.R.drawable.stat_sys_upload);
@ -468,24 +404,27 @@ public class UploadActivity extends BaseActivity {
uploadNotificationConfig.getError().iconResourceID = android.R.drawable.stat_sys_upload_done;
uploadNotificationConfig.getError().iconColorResourceID = R.color.error_red;
new MultipartUploadRequest(view.getContext(), uploadIndexUrl)
.setUtf8Charset()
.setNotificationConfig(uploadNotificationConfig)
.addParameter("tp-dluploadtitle", uploadTitleText)
.addParameter("tp-dluploadcat", categorySelected)
.addParameter("tp-dluploadtext", uploadDescriptionText[0])
.addFileToUpload(tempFileUri == null
? filesList.get(0).getFileUri().toString()
: tempFileUri.toString()
, "tp-dluploadfile")
.addParameter("tp_dluploadicon", fileIcon)
.addParameter("tp-uploaduser", uploaderProfileIndex)
.setNotificationConfig(uploadNotificationConfig)
.setMaxRetries(2)
.startUpload();
} catch (Exception exception) {
Timber.e(exception, "AndroidUploadService: %s", exception.getMessage());
progressBar.setVisibility(View.GONE);
uploadNotificationConfig.getProgress().actions.add(new UploadNotificationAction(
R.drawable.ic_cancel_accent_24dp,
this.getString(R.string.upload_notification_cancel),
PendingIntent.getBroadcast(this, 0, cancelIntent,
PendingIntent.FLAG_UPDATE_CURRENT)
));
uploadNotificationConfig.getError().actions.add(new UploadNotificationAction(
R.drawable.ic_cached_accent_24dp,
this.getString(R.string.upload_notification_retry),
PendingIntent.getBroadcast(this, 0, retryIntent,
PendingIntent.FLAG_UPDATE_CURRENT)
));
if (uploadFile(this, uploadNotificationConfig, categorySelected,
uploadTitleText, uploadDescriptionText[0], fileIcon, uploaderProfileIndex,
tempFileUri == null
? filesList.get(0).getFileUri()
: tempFileUri)) {
finish();
} else {
Toast.makeText(this, "Couldn't initiate upload.", Toast.LENGTH_SHORT).show();
}
});
@ -526,15 +465,15 @@ public class UploadActivity extends BaseActivity {
protected void onResume() {
drawer.setSelection(UPLOAD_ID);
super.onResume();
uploadsReceiver.setDelegate(uploadDelegate);
/*uploadsReceiver.setDelegate(uploadDelegate);
uploadsReceiver.provideStorage(storage);
uploadsReceiver.register(this);
uploadsReceiver.register(this);*/
}
@Override
protected void onPause() {
super.onPause();
uploadsReceiver.unregister(this);
//uploadsReceiver.unregister(this);
}
@Override
@ -560,6 +499,13 @@ public class UploadActivity extends BaseActivity {
fileIcon = "archive.gif";
textWatcher.setFileExtension(".zip");
if (!hasModifiedFilename) {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.FRANCE).format(new Date());
String zipFilename = "mThmmy_" + timeStamp + ".zip";
uploadFilename.setText(zipFilename);
hasModifiedFilename = false;
}
for (int fileIndex = 0; fileIndex < data.getClipData().getItemCount(); ++fileIndex) {
Uri newFileUri = data.getClipData().getItemAt(fileIndex).getUri();
String filename = FileUtils.filenameFromUri(this, newFileUri);
@ -601,6 +547,13 @@ public class UploadActivity extends BaseActivity {
} else {
fileIcon = "archive.gif";
textWatcher.setFileExtension(".zip");
if (!hasModifiedFilename) {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.FRANCE).format(new Date());
String zipFilename = "mThmmy_" + timeStamp + ".zip";
uploadFilename.setText(zipFilename);
hasModifiedFilename = false;
}
}
addFileViewToList(filename);
@ -626,6 +579,13 @@ public class UploadActivity extends BaseActivity {
} else {
fileIcon = "archive.gif";
textWatcher.setFileExtension(".zip");
if (!hasModifiedFilename) {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.FRANCE).format(new Date());
String zipFilename = "mThmmy_" + timeStamp + ".zip";
uploadFilename.setText(zipFilename);
hasModifiedFilename = false;
}
}
UploadFile newFile = new UploadFile(true, TakePhoto.processResult(this,
@ -739,6 +699,32 @@ public class UploadActivity extends BaseActivity {
filesListView.setVisibility(View.VISIBLE);
}
private static boolean uploadFile(Context context,
UploadNotificationConfig uploadNotificationConfig,
String categorySelected, String uploadTitleText,
String uploadDescriptionText, String fileIcon,
String uploaderProfileIndex, Uri fileUri) {
try {
new MultipartUploadRequest(context, uploadIndexUrl)
.setUtf8Charset()
.setNotificationConfig(uploadNotificationConfig)
.addParameter("tp-dluploadtitle", uploadTitleText)
.addParameter("tp-dluploadcat", categorySelected)
.addParameter("tp-dluploadtext", uploadDescriptionText)
.addFileToUpload(fileUri.toString()
, "tp-dluploadfile")
.addParameter("tp_dluploadicon", fileIcon)
.addParameter("tp-uploaduser", uploaderProfileIndex)
.setNotificationConfig(uploadNotificationConfig)
.setMaxRetries(2)
.startUpload();
return true;
} catch (Exception exception) {
Timber.e(exception, "AndroidUploadService: %s", exception.getMessage());
return false;
}
}
private class CustomTextWatcher implements TextWatcher {
String oldFilename, fileExtension;
@ -938,4 +924,106 @@ public class UploadActivity extends BaseActivity {
progressBar.setVisibility(ProgressBar.GONE);
}
}
public static class ZipTask extends AsyncTask<Uri, Void, Boolean> {
// Weak references will still allow the Activity to be garbage-collected
private final WeakReference<Activity> weakActivity;
final String zipFilename, categorySelected, uploadTitleText, uploadDescriptionText,
fileIcon, uploaderProfileIndex;
Uri zipFileUri;
// Suppresses default constructor
@SuppressWarnings("unused")
private ZipTask() {
weakActivity = null;
this.zipFilename = null;
this.categorySelected = null;
this.uploadTitleText = null;
this.uploadDescriptionText = null;
this.fileIcon = null;
this.uploaderProfileIndex = null;
}
ZipTask(Activity uploadsActivity, @NonNull String zipFilename,
@NonNull String categorySelected, @NonNull String uploadTitleText,
@NonNull String uploadDescriptionText, @NonNull String fileIcon,
@NonNull String uploaderProfileIndex) {
weakActivity = new WeakReference<>(uploadsActivity);
this.zipFilename = zipFilename;
this.categorySelected = categorySelected;
this.uploadTitleText = uploadTitleText;
this.uploadDescriptionText = uploadDescriptionText;
this.fileIcon = fileIcon;
this.uploaderProfileIndex = uploaderProfileIndex;
}
@Override
protected void onPreExecute() {
assert weakActivity != null;
Toast.makeText(weakActivity.get(), "Zipping files", Toast.LENGTH_SHORT).show();
}
@Override
protected Boolean doInBackground(Uri... filesToZip) {
if (weakActivity == null || zipFilename == null) {
return false;
}
File zipFile = UploadsHelper.createZipFile(zipFilename);
if (zipFile == null) {
return false;
}
zipFileUri = FileProvider.getUriForFile(weakActivity.get(),
weakActivity.get().getPackageName() +
".provider", zipFile);
UploadsHelper.zip(weakActivity.get(), filesToZip, zipFileUri);
return true;
}
@Override
protected void onPostExecute(Boolean result) {
if (weakActivity == null) {
return;
}
if (!result) {
Toast.makeText(weakActivity.get(), "Couldn't create zip!", Toast.LENGTH_SHORT).show();
return;
}
Intent retryIntent = new Intent(weakActivity.get(), UploadsReceiver.class);
retryIntent.setAction(UploadsReceiver.ACTION_RETRY_UPLOAD);
Intent cancelIntent = new Intent(weakActivity.get(), UploadsReceiver.class);
cancelIntent.setAction(UploadsReceiver.ACTION_CANCEL_UPLOAD);
UploadNotificationConfig uploadNotificationConfig = new UploadNotificationConfig();
uploadNotificationConfig.setIconForAllStatuses(android.R.drawable.stat_sys_upload);
uploadNotificationConfig.getProgress().iconResourceID = android.R.drawable.stat_sys_upload;
uploadNotificationConfig.getCompleted().iconResourceID = android.R.drawable.stat_sys_upload_done;
uploadNotificationConfig.getError().iconResourceID = android.R.drawable.stat_sys_upload_done;
uploadNotificationConfig.getError().iconColorResourceID = R.color.error_red;
uploadNotificationConfig.getProgress().actions.add(new UploadNotificationAction(
R.drawable.ic_cancel_accent_24dp,
weakActivity.get().getString(R.string.upload_notification_cancel),
PendingIntent.getBroadcast(weakActivity.get(), 0, cancelIntent,
PendingIntent.FLAG_UPDATE_CURRENT)
));
uploadNotificationConfig.getError().actions.add(new UploadNotificationAction(
R.drawable.ic_cached_accent_24dp,
weakActivity.get().getString(R.string.upload_notification_retry),
PendingIntent.getBroadcast(weakActivity.get(), 0, retryIntent,
PendingIntent.FLAG_UPDATE_CURRENT)
));
if (!uploadFile(weakActivity.get(), uploadNotificationConfig, categorySelected,
uploadTitleText, uploadDescriptionText, fileIcon, uploaderProfileIndex,
zipFileUri)) {
Toast.makeText(weakActivity.get(), "Couldn't initiate upload.", Toast.LENGTH_SHORT).show();
}
}
}
}

12
app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadsHelper.java

@ -3,6 +3,7 @@ package gr.thmmy.mthmmy.activities.upload;
import android.content.Context;
import android.net.Uri;
import android.os.Environment;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.FileProvider;
import android.widget.Toast;
@ -16,9 +17,6 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@ -83,23 +81,19 @@ public class UploadsHelper {
}
@Nullable
public static File createZipFile(Context context) {
public static File createZipFile(@NonNull String zipFilename) {
// Create a zip file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.FRANCE).format(new Date());
String zipFileName = "mThmmy_" + timeStamp + ".zip";
File zipFolder = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) +
File.separator + "mThmmy");
if (!zipFolder.exists()) {
if (!zipFolder.mkdirs()) {
Timber.w("Zip folder build returned false in %s", UploadsHelper.class.getSimpleName());
Toast.makeText(context, "Couldn't create zip directory", Toast.LENGTH_SHORT).show();
return null;
}
}
return new File(zipFolder, zipFileName);
return new File(zipFolder, zipFilename);
}
public static void zip(Context context, Uri[] files, Uri zipFile) {

63
app/src/main/java/gr/thmmy/mthmmy/services/UploadsReceiver.java

@ -1,75 +1,82 @@
package gr.thmmy.mthmmy.services;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
import com.snatik.storage.Storage;
import net.gotev.uploadservice.ServerResponse;
import net.gotev.uploadservice.UploadInfo;
import net.gotev.uploadservice.UploadService;
import net.gotev.uploadservice.UploadServiceBroadcastReceiver;
import gr.thmmy.mthmmy.activities.upload.UploadsHelper;
import gr.thmmy.mthmmy.base.BaseApplication;
public class UploadsReceiver extends UploadServiceBroadcastReceiver {
public interface Delegate {
void onProgress(long uploadedBytes, long totalBytes, int progress, double uploadRate);
public static final String UPLOAD_NOTIFICATION_ID_KEY = "UPLOAD_NOTIFICATION_ID_KEY";
void onError(Exception exception);
public static final String ACTION_CANCEL_UPLOAD = "ACTION_CANCEL_UPLOAD";
public static final String ACTION_RETRY_UPLOAD = "ACTION_RETRY_UPLOAD";
void onCompleted(int serverResponseCode, byte[] serverResponseBody);
void onCancelled();
}
private Delegate delegate;
private Storage storage;
public void setDelegate(Delegate delegate) {
this.delegate = delegate;
@Override
public void onReceive(Context context, Intent intent) {
String intentAction = intent.getAction();
Bundle intentBundle = intent.getExtras();
if (intentAction == null || intentBundle == null) {
return;
}
public void provideStorage(Storage storage) {
this.storage = storage;
if (intentAction.equals(ACTION_CANCEL_UPLOAD)) {
String notificationID = intentBundle.getString(UPLOAD_NOTIFICATION_ID_KEY);
UploadService.stopUpload(notificationID);
} else if (intentAction.equals(ACTION_RETRY_UPLOAD)) {
//TODO
}
}
@Override
public void onProgress(Context context, UploadInfo uploadInfo) {
if (delegate != null) {
delegate.onProgress(uploadInfo.getUploadedBytes(), uploadInfo.getTotalBytes(),
uploadInfo.getProgressPercent(), uploadInfo.getUploadRate());
}
}
@Override
public void onError(Context context, UploadInfo uploadInfo, ServerResponse serverResponse,
Exception exception) {
if (delegate != null) {
delegate.onError(exception);
Toast.makeText(context.getApplicationContext(), "Upload failed", Toast.LENGTH_SHORT).show();
if (storage == null) {
storage = new Storage(context.getApplicationContext());
}
if (storage != null){
UploadsHelper.deleteTempFiles(storage);
}
}
@Override
public void onCompleted(Context context, UploadInfo uploadInfo, ServerResponse serverResponse) {
if (delegate != null) {
delegate.onCompleted(serverResponse.getHttpCode(), serverResponse.getBody());
Toast.makeText(context.getApplicationContext(), "Upload completed successfully", Toast.LENGTH_SHORT).show();
if (storage == null) {
storage = new Storage(context.getApplicationContext());
}
if (storage != null){
UploadsHelper.deleteTempFiles(storage);
}
BaseApplication.getInstance().logFirebaseAnalyticsEvent("file_upload", null);
}
@Override
public void onCancelled(Context context, UploadInfo uploadInfo) {
if (delegate != null) {
delegate.onCancelled();
Toast.makeText(context.getApplicationContext(), "Upload canceled", Toast.LENGTH_SHORT).show();
if (storage == null) {
storage = new Storage(context.getApplicationContext());
}
if (storage != null){
UploadsHelper.deleteTempFiles(storage);
NotificationManager notificationManager = (NotificationManager) context.getApplicationContext().
getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager != null) {
notificationManager.cancel(uploadInfo.getNotificationID());
}
}
}

4
app/src/main/res/drawable/ic_cached_accent_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="#26A69A" android:pathData="M19,8l-4,4h3c0,3.31 -2.69,6 -6,6 -1.01,0 -1.97,-0.25 -2.8,-0.7l-1.46,1.46C8.97,19.54 10.43,20 12,20c4.42,0 8,-3.58 8,-8h3l-4,-4zM6,12c0,-3.31 2.69,-6 6,-6 1.01,0 1.97,0.25 2.8,0.7l1.46,-1.46C15.03,4.46 13.57,4 12,4c-4.42,0 -8,3.58 -8,8H1l4,4 4,-4H6z"/>
</vector>

4
app/src/main/res/drawable/ic_cancel_accent_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="#26A69A" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2zM17,15.59L15.59,17 12,13.41 8.41,17 7,15.59 10.59,12 7,8.41 8.41,7 12,10.59 15.59,7 17,8.41 13.41,12 17,15.59z"/>
</vector>

38
app/src/main/res/layout/dialog_upload_progress.xml

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingEnd="24dp"
android:paddingStart="24dp">
<TextView
android:id="@+id/dialog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginTop="24dp"
android:text="@string/upload_progress_dialog_title"
android:textColor="@color/accent"
android:textSize="20sp" />
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/dialogProgressBar"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding"
android:layout_width="match_parent"
android:layout_height="@dimen/progress_bar_height"
android:indeterminate="false"
app:mpb_progressStyle="horizontal"
app:mpb_progressTint="@color/accent" />
<TextView
android:id="@+id/dialog_bytes_uploaded"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginTop="12dp"
android:minEms="64"
android:text="@string/upload_progress_dialog_bytes_uploaded"
android:textColor="@color/white" />
</LinearLayout>

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

@ -124,9 +124,8 @@
<string name="upload_filename_info">Please follow the filename rules as\ndescribed
in&#160;<a href="https://www.thmmy.gr/smf/index.php?topic=34294.0">this topic</a>.\n
\nThis does not rename your local files.</string>
<string name="upload_progress_dialog_title">Uploading your files</string>
<string name="upload_progress_dialog_zipping_files">Zipping files.</string>
<string name="upload_progress_dialog_bytes_uploaded">Uploading at %1$.2f Kbit/s, %2$d/%3$d KBytes uploaded.</string>
<string name="upload_notification_cancel">"Cancel"</string>
<string name="upload_notification_retry">"Retry"</string>
<!--Upload Fields Builder Activity-->
<string name="upload_fields_builder_type_radio_buttons_title">Select type of upload</string>
@ -143,8 +142,8 @@
<string name="upload_fields_builder_toolbar_title">Upload fields generator</string>
<!--Settings Activity-->
<string name="action_settings">Settings</string>
<string name="title_activity_settings">Settings</string>
<!--<string name="action_settings">Settings</string>-->
<!--<string name="title_activity_settings">Settings</string>-->
<string name="pref_category_app">App</string>
<string name="pref_title_app_main_default_tab">Default home tab</string>

4
app/src/main/res/values/styles.xml

@ -35,11 +35,11 @@
<item name="colorControlActivated">@color/accent</item>
</style>
<style name="PopupMenuStyle">
<!--<style name="PopupMenuStyle">
<item name="android:popupBackground">@color/primary_light</item>
<item name="android:textAppearanceLargePopupMenu">@color/accent</item>
<item name="android:textAppearanceSmallPopupMenu">@color/accent</item>
</style>
</style>-->
<style name="PopupMenuItem" parent="Widget.AppCompat.PopupMenu">
<item name="android:layout_height">32dp</item>

Loading…
Cancel
Save