This commit is contained in:
Thomas 2020-11-21 11:06:26 +01:00
parent ebc0d744ed
commit 363132d331
4 changed files with 42 additions and 50 deletions

View File

@ -440,8 +440,8 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
ItemStr finalLanguageToSend = languageToSend;
Item finalPrivacyToSend = privacyToSend;
binding.setUploadSubmit.setOnClickListener(v -> {
String title1 = binding.pVideoTitle.getText().toString().trim();
String description = binding.pVideoDescription.getText().toString().trim();
String title1 = binding.pVideoTitle.getText() != null ? binding.pVideoTitle.getText().toString().trim() : "";
String description = binding.pVideoDescription.getText() != null ? binding.pVideoDescription.getText().toString().trim() : "";
boolean isNSFW1 = binding.setUploadNsfw.isChecked();
boolean commentEnabled1 = binding.setUploadEnableComments.isChecked();
videoParams = new VideoParams();

View File

@ -21,7 +21,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
@ -262,7 +261,9 @@ public class PeertubeUploadActivity extends AppCompatActivity {
String idChannel = channelM.getValue();
Map.Entry<Integer, String> privacyM = privacyToSend.entrySet().iterator().next();
Integer idPrivacy = privacyM.getKey();
if (binding.videoTitle.getText() != null && binding.videoTitle.getText().toString().trim().length() > 0) {
filename = binding.videoTitle.getText().toString().trim();
}
try {
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
@ -295,7 +296,6 @@ public class PeertubeUploadActivity extends AppCompatActivity {
PeertubeUploadActivity.this, 1, new Intent(this, PeertubeEditUploadActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
final boolean autoClear = false;
final Bitmap largeIcon = null;
final boolean clearOnAction = true;
final boolean ringToneEnabled = true;
final ArrayList<UploadNotificationAction> noActions = new ArrayList<>(1);
@ -306,11 +306,6 @@ public class PeertubeUploadActivity extends AppCompatActivity {
ContextExtensionsKt.getCancelUploadIntent(this, uploadId)
);
final UploadNotificationAction successAction = new UploadNotificationAction(
R.drawable.ic_baseline_cancel_24,
getString(R.string.video_uploaded_action),
clickIntent
);
final ArrayList<UploadNotificationAction> progressActions = new ArrayList<>(1);
progressActions.add(cancelAction);
@ -320,24 +315,21 @@ public class PeertubeUploadActivity extends AppCompatActivity {
getString(R.string.uploading),
R.drawable.ic_baseline_cloud_upload_24,
Color.BLUE,
largeIcon,
null,
clickIntent,
progressActions,
clearOnAction,
autoClear
);
final ArrayList<UploadNotificationAction> successActions = new ArrayList<>(1);
progressActions.add(successAction);
UploadNotificationStatusConfig success = new UploadNotificationStatusConfig(
getString(R.string.app_name),
getString(R.string.upload_video_success),
R.drawable.ic_baseline_check_24,
Color.GREEN,
largeIcon,
null,
clickIntent,
successActions,
noActions,
clearOnAction,
autoClear
);
@ -348,7 +340,7 @@ public class PeertubeUploadActivity extends AppCompatActivity {
getString(R.string.toast_error),
R.drawable.ic_baseline_error_24,
Color.RED,
largeIcon,
null,
clickIntent,
noActions,
clearOnAction,
@ -360,7 +352,7 @@ public class PeertubeUploadActivity extends AppCompatActivity {
getString(R.string.toast_cancelled),
R.drawable.ic_baseline_cancel_24,
Color.YELLOW,
largeIcon,
null,
clickIntent,
noActions,
clearOnAction

View File

@ -26,24 +26,21 @@
android:orientation="vertical">
<!-- Video title -->
<LinearLayout
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:labelFor="@+id/p_video_title"
android:text="@string/title" />
<EditText
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/p_video_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/title"
android:importantForAutofill="no"
android:inputType="text" />
</LinearLayout>
android:inputType="text"
android:paddingTop="2dp"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<!-- Video media -->
<LinearLayout
@ -103,27 +100,24 @@
<!-- video description -->
<LinearLayout
<!-- Video title -->
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:labelFor="@+id/p_video_description"
android:text="@string/description" />
<EditText
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/p_video_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/description"
android:importantForAutofill="no"
android:inputType="textMultiLine"
android:paddingTop="2dp"
android:gravity="top"
android:lines="5"
android:maxLines="5"
android:scrollbars="vertical" />
</LinearLayout>
android:singleLine="false" />
</com.google.android.material.textfield.TextInputLayout>
<!-- Videos channels -->
<LinearLayout

View File

@ -93,17 +93,23 @@
android:textSize="16sp" />
</LinearLayout>
<EditText
android:id="@+id/video_title"
<com.google.android.material.textfield.TextInputLayout
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:hint="@string/title_video_peertube"
android:importantForAutofill="no"
android:inputType="text"
android:singleLine="true" />
android:layout_marginTop="20dp">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/video_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="@string/title_video_peertube"
android:importantForAutofill="no"
android:inputType="text"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<!-- Videos upload submit -->
<Button