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; ItemStr finalLanguageToSend = languageToSend;
Item finalPrivacyToSend = privacyToSend; Item finalPrivacyToSend = privacyToSend;
binding.setUploadSubmit.setOnClickListener(v -> { binding.setUploadSubmit.setOnClickListener(v -> {
String title1 = binding.pVideoTitle.getText().toString().trim(); String title1 = binding.pVideoTitle.getText() != null ? binding.pVideoTitle.getText().toString().trim() : "";
String description = binding.pVideoDescription.getText().toString().trim(); String description = binding.pVideoDescription.getText() != null ? binding.pVideoDescription.getText().toString().trim() : "";
boolean isNSFW1 = binding.setUploadNsfw.isChecked(); boolean isNSFW1 = binding.setUploadNsfw.isChecked();
boolean commentEnabled1 = binding.setUploadEnableComments.isChecked(); boolean commentEnabled1 = binding.setUploadEnableComments.isChecked();
videoParams = new VideoParams(); videoParams = new VideoParams();

View File

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

View File

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

View File

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