Fix issue #328
This commit is contained in:
parent
74aeb6d44d
commit
18fe3399be
|
@ -40,6 +40,7 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -83,6 +84,7 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
||||||
private Button set_upload_file, set_upload_submit;
|
private Button set_upload_file, set_upload_submit;
|
||||||
private MaterialSpinner set_upload_privacy, set_upload_channel;
|
private MaterialSpinner set_upload_privacy, set_upload_channel;
|
||||||
private TextView set_upload_file_name;
|
private TextView set_upload_file_name;
|
||||||
|
private EditText video_title;
|
||||||
private HashMap<String, String> channels;
|
private HashMap<String, String> channels;
|
||||||
private final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 724;
|
private final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 724;
|
||||||
private Uri uri;
|
private Uri uri;
|
||||||
|
@ -140,6 +142,7 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
||||||
set_upload_channel = findViewById(R.id.set_upload_channel);
|
set_upload_channel = findViewById(R.id.set_upload_channel);
|
||||||
set_upload_privacy = findViewById(R.id.set_upload_privacy);
|
set_upload_privacy = findViewById(R.id.set_upload_privacy);
|
||||||
set_upload_submit = findViewById(R.id.set_upload_submit);
|
set_upload_submit = findViewById(R.id.set_upload_submit);
|
||||||
|
video_title = findViewById(R.id.video_title);
|
||||||
|
|
||||||
Helper.changeMaterialSpinnerColor(PeertubeUploadActivity.this, set_upload_privacy);
|
Helper.changeMaterialSpinnerColor(PeertubeUploadActivity.this, set_upload_privacy);
|
||||||
Helper.changeMaterialSpinnerColor(PeertubeUploadActivity.this, set_upload_channel);
|
Helper.changeMaterialSpinnerColor(PeertubeUploadActivity.this, set_upload_channel);
|
||||||
|
@ -233,6 +236,9 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
||||||
android.R.layout.simple_spinner_dropdown_item, channelName);
|
android.R.layout.simple_spinner_dropdown_item, channelName);
|
||||||
set_upload_channel.setAdapter(adapterChannel);
|
set_upload_channel.setAdapter(adapterChannel);
|
||||||
|
|
||||||
|
if( peertubeInformation == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
LinkedHashMap<String, String> translations = null;
|
LinkedHashMap<String, String> translations = null;
|
||||||
if ( peertubeInformation.getTranslations() != null)
|
if ( peertubeInformation.getTranslations() != null)
|
||||||
translations = new LinkedHashMap<>(peertubeInformation.getTranslations());
|
translations = new LinkedHashMap<>(peertubeInformation.getTranslations());
|
||||||
|
@ -251,7 +257,7 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
||||||
if (translations == null || translations.size() == 0 || !translations.containsKey((String) pair.getValue()))
|
if (translations == null || translations.size() == 0 || !translations.containsKey((String) pair.getValue()))
|
||||||
privaciesA[i] = (String) pair.getValue();
|
privaciesA[i] = (String) pair.getValue();
|
||||||
else
|
else
|
||||||
privaciesA[i] = translations.get((String) pair.getValue());
|
privaciesA[i] = translations.get(pair.getValue());
|
||||||
it.remove();
|
it.remove();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +291,6 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
||||||
set_upload_file.setOnClickListener(new View.OnClickListener() {
|
set_upload_file.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
|
||||||
if (ContextCompat.checkSelfPermission(PeertubeUploadActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
if (ContextCompat.checkSelfPermission(PeertubeUploadActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
||||||
PackageManager.PERMISSION_GRANTED) {
|
PackageManager.PERMISSION_GRANTED) {
|
||||||
ActivityCompat.requestPermissions(PeertubeUploadActivity.this,
|
ActivityCompat.requestPermissions(PeertubeUploadActivity.this,
|
||||||
|
@ -293,7 +298,6 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
||||||
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
|
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
||||||
|
@ -357,6 +361,9 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
||||||
uploadConfig.getCancelled().message = getString(R.string.toast_cancelled);
|
uploadConfig.getCancelled().message = getString(R.string.toast_cancelled);
|
||||||
uploadConfig.getCompleted().actions.add(new UploadNotificationAction(R.drawable.ic_check, getString(R.string.video_uploaded_action), clickIntent));
|
uploadConfig.getCompleted().actions.add(new UploadNotificationAction(R.drawable.ic_check, getString(R.string.video_uploaded_action), clickIntent));
|
||||||
|
|
||||||
|
if( video_title != null && video_title.getText() != null && video_title.getText().toString().trim().length() > 0 ){
|
||||||
|
filename = video_title.getText().toString().trim();
|
||||||
|
}
|
||||||
String uploadId = UUID.randomUUID().toString();
|
String uploadId = UUID.randomUUID().toString();
|
||||||
uploadReceiver.setUploadID(uploadId);
|
uploadReceiver.setUploadID(uploadId);
|
||||||
new MultipartUploadRequest(PeertubeUploadActivity.this, uploadId, "https://" + Helper.getLiveInstance(PeertubeUploadActivity.this) + "/api/v1/videos/upload")
|
new MultipartUploadRequest(PeertubeUploadActivity.this, uploadId, "https://" + Helper.getLiveInstance(PeertubeUploadActivity.this) + "/api/v1/videos/upload")
|
||||||
|
|
|
@ -94,6 +94,17 @@
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:id="@+id/video_title"
|
||||||
|
android:layout_width="250dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:inputType="text"
|
||||||
|
android:hint="@string/title_video_peertube" />
|
||||||
|
|
||||||
<!-- Videos upload submit -->
|
<!-- Videos upload submit -->
|
||||||
<Button
|
<Button
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="40dp"
|
||||||
|
|
|
@ -1243,4 +1243,5 @@
|
||||||
<string name="report_mention">Add mentions in each message</string>
|
<string name="report_mention">Add mentions in each message</string>
|
||||||
<string name="fetch_conversation">Fetching conversation</string>
|
<string name="fetch_conversation">Fetching conversation</string>
|
||||||
<string name="order_by">Order by</string>
|
<string name="order_by">Order by</string>
|
||||||
|
<string name="title_video_peertube">Title for the video</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue