Browse Source

Various fixes

pull/63/head
Apostolos Fanakis 6 years ago
parent
commit
a28ea28742
  1. 13
      app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java
  2. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadFieldsBuilderActivity.java
  3. 1
      app/src/main/res/layout/activity_board.xml
  4. 4
      app/src/main/res/xml-v26/app_preferences_user.xml

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

@ -360,6 +360,8 @@ public class UploadActivity extends BaseActivity {
if (!editTextFilename.equals(selectedFileFilename)) { if (!editTextFilename.equals(selectedFileFilename)) {
//File should be uploaded with a different name //File should be uploaded with a different name
if (checkPerms()) {
if (!uploadFile.isCameraPhoto()) { if (!uploadFile.isCameraPhoto()) {
//Temporarily copies the file to a another location and renames it //Temporarily copies the file to a another location and renames it
tempFileUri = UploadsHelper.createTempFile(this, storage, tempFileUri = UploadsHelper.createTempFile(this, storage,
@ -384,6 +386,12 @@ public class UploadActivity extends BaseActivity {
uploadFile.setFileUri(FileProvider.getUriForFile(this, getPackageName() + uploadFile.setFileUri(FileProvider.getUriForFile(this, getPackageName() +
".provider", uploadFile.getPhotoFile())); ".provider", uploadFile.getPhotoFile()));
} }
} else {
requestPerms(UPLOAD_REQUEST_STORAGE_CODE);
zipTask = null;
dialog.cancel();
return;
}
} }
} else { } else {
Uri[] filesListArray = new Uri[filesList.size()]; Uri[] filesListArray = new Uri[filesList.size()];
@ -586,8 +594,9 @@ public class UploadActivity extends BaseActivity {
if (previousName.isEmpty()) { if (previousName.isEmpty()) {
uploadFilename.setText(data.getStringExtra(RESULT_FILENAME)); uploadFilename.setText(data.getStringExtra(RESULT_FILENAME));
} else { } else {
String extractedExtension = FileUtils.getFileExtension(previousName);
String filenameWithExtension = data.getStringExtra(RESULT_FILENAME) + String filenameWithExtension = data.getStringExtra(RESULT_FILENAME) +
FileUtils.getFileExtension(previousName); (extractedExtension != null ? extractedExtension : "");
uploadFilename.setText(filenameWithExtension); uploadFilename.setText(filenameWithExtension);
} }
hasModifiedFilename = true; hasModifiedFilename = true;
@ -617,6 +626,8 @@ public class UploadActivity extends BaseActivity {
zipTask.execute(filesListArray); zipTask.execute(filesListArray);
finish(); finish();
} else {
Toast.makeText(this, "Please retry uploading.", Toast.LENGTH_SHORT).show();
} }
break; break;
} }

4
app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadFieldsBuilderActivity.java

@ -390,9 +390,9 @@ public class UploadFieldsBuilderActivity extends BaseActivity {
return greeklish ? "hlektronikh_1" : "Ηλεκτρονική 1"; return greeklish ? "hlektronikh_1" : "Ηλεκτρονική 1";
} else if (normalisedCourse.contains(("Ηλεκτρονικές Διατάξεις και Μετρήσεις"))) { } else if (normalisedCourse.contains(("Ηλεκτρονικές Διατάξεις και Μετρήσεις"))) {
return greeklish ? "hlektron_diatakseis_metrhseis" : "Ηλεκτρονικές Διατάξεις και Μετρήσεις"; return greeklish ? "hlektron_diatakseis_metrhseis" : "Ηλεκτρονικές Διατάξεις και Μετρήσεις";
} else if (normalisedCourse.contains(("Ηλεκτρονικά Iσχύος II"))) { } else if (normalisedCourse.contains(("Ηλεκτρονικά Ισχύος II"))) {
return greeklish ? "isxyos_II" : "Ισχύος 2"; return greeklish ? "isxyos_II" : "Ισχύος 2";
} else if (normalisedCourse.contains(("Ηλεκτρονικά Iσχύος I"))) { } else if (normalisedCourse.contains(("Ηλεκτρονικά Ισχύος I"))) {
return greeklish ? "isxyos_I" : "Ισχύος 1"; return greeklish ? "isxyos_I" : "Ισχύος 1";
} else if (normalisedCourse.contains(("Ηλεκτρομαγνητικό Πεδίο II"))) { } else if (normalisedCourse.contains(("Ηλεκτρομαγνητικό Πεδίο II"))) {
return greeklish ? "pedio_II" : "Πεδίο 2"; return greeklish ? "pedio_II" : "Πεδίο 2";

1
app/src/main/res/layout/activity_board.xml

@ -42,7 +42,6 @@
android:layout_marginTop="64dp" android:layout_marginTop="64dp"
android:background="@color/background" android:background="@color/background"
android:scrollbars="none" android:scrollbars="none"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="gr.thmmy.mthmmy.activities.topic.TopicActivity" /> tools:context="gr.thmmy.mthmmy.activities.topic.TopicActivity" />
<me.zhanghai.android.materialprogressbar.MaterialProgressBar <me.zhanghai.android.materialprogressbar.MaterialProgressBar

4
app/src/main/res/xml-v26/app_preferences_user.xml

@ -28,7 +28,7 @@
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
<!--<androidx.preference.PreferenceCategory <androidx.preference.PreferenceCategory
android:key="pref_category_uploading_key" android:key="pref_category_uploading_key"
android:title="@string/pref_category_uploading" android:title="@string/pref_category_uploading"
app:iconSpaceReserved="false"> app:iconSpaceReserved="false">
@ -38,7 +38,7 @@
android:title="@string/pref_title_uploading_app_signature_enable" android:title="@string/pref_title_uploading_app_signature_enable"
android:summary="@string/pref_summary_uploading_app_signature_enable" android:summary="@string/pref_summary_uploading_app_signature_enable"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory>--> </androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory <androidx.preference.PreferenceCategory
android:key="pref_category_privacy_key" android:key="pref_category_privacy_key"

Loading…
Cancel
Save