Fix edit videos

This commit is contained in:
Thomas 2020-07-01 15:08:42 +02:00
parent df06590b00
commit 4b7b099fea
12 changed files with 881 additions and 499 deletions

View File

@ -78,8 +78,6 @@ public class AllPlaylistsActivity extends AppCompatActivity implements OnPlaylis
setTitle(R.string.playlists);
textviewNoAction = findViewById(R.id.no_action);
mainLoader = findViewById(R.id.loader);
RelativeLayout nextElementLoader = findViewById(R.id.loading_next_items);

View File

@ -1,5 +1,6 @@
package app.fedilab.fedilabtube;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
@ -15,40 +16,73 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.jetbrains.annotations.NotNull;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import app.fedilab.fedilabtube.asynctasks.RetrievePeertubeNotificationsAsyncTask;
import app.fedilab.fedilabtube.asynctasks.UpdateAccountInfoAsyncTask;
import app.fedilab.fedilabtube.client.APIResponse;
import app.fedilab.fedilabtube.client.HttpsConnection;
import app.fedilab.fedilabtube.client.entities.Account;
import app.fedilab.fedilabtube.client.entities.PeertubeNotification;
import app.fedilab.fedilabtube.drawer.PeertubeNotificationsListAdapter;
import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.interfaces.OnRetrievePeertubeNotificationsInterface;
import app.fedilab.fedilabtube.sqlite.AccountDAO;
import app.fedilab.fedilabtube.sqlite.Sqlite;
import es.dmoral.toasty.Toasty;
public class LoginActivity extends AppCompatActivity {
public class LoginActivity extends AppCompatActivity implements OnRetrievePeertubeNotificationsInterface {
//Peertube notification type
public static int NEW_VIDEO_FROM_SUBSCRIPTION = 1;
// public static int NEW_COMMENT_ON_MY_VIDEO = 2;
// public static int NEW_VIDEO_ABUSE_FOR_MODERATORS = 3;
public static int BLACKLIST_ON_MY_VIDEO = 4;
public static int UNBLACKLIST_ON_MY_VIDEO = 5;
public static int MY_VIDEO_PUBLISHED = 6;
public static int MY_VIDEO_IMPORT_SUCCESS = 7;
public static int MY_VIDEO_IMPORT_ERROR = 8;
private static String client_id;
private static String client_secret;
// public static int NEW_USER_REGISTRATION = 9;
//public static int NEW_FOLLOW = 10;
// public static int COMMENT_MENTION = 11;
LinearLayoutManager mLayoutManager;
private EditText login_uid;
private EditText login_passwd;
private Button connectionButton;
private String actionToken;
private boolean flag_loading;
private PeertubeNotificationsListAdapter notificationsListAdapter;
private String max_id;
private List<PeertubeNotification> notifications;
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
private boolean firstLoad;
private SwipeRefreshLayout swipeRefreshLayout;
private boolean swiped;
private AsyncTask<Void, Void, Void> asyncTask;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -123,7 +157,51 @@ public class LoginActivity extends AppCompatActivity {
Helper.logoutCurrentUser(LoginActivity.this, null);
}
max_id = null;
firstLoad = true;
flag_loading = true;
notifications = new ArrayList<>();
swiped = false;
swipeRefreshLayout = findViewById(R.id.swipeContainer);
RecyclerView lv_notifications = findViewById(R.id.lv_notifications);
mainLoader = findViewById(R.id.loader);
nextElementLoader = findViewById(R.id.loading_next_notifications);
textviewNoAction = findViewById(R.id.no_action);
mainLoader.setVisibility(View.VISIBLE);
nextElementLoader.setVisibility(View.GONE);
notificationsListAdapter = new PeertubeNotificationsListAdapter(this.notifications);
lv_notifications.setAdapter(notificationsListAdapter);
mLayoutManager = new LinearLayoutManager(LoginActivity.this);
lv_notifications.setLayoutManager(mLayoutManager);
lv_notifications.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(@NotNull RecyclerView recyclerView, int dx, int dy) {
if (dy > 0) {
int visibleItemCount = mLayoutManager.getChildCount();
int totalItemCount = mLayoutManager.getItemCount();
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
if (firstVisibleItem + visibleItemCount == totalItemCount) {
if (!flag_loading) {
flag_loading = true;
asyncTask = new RetrievePeertubeNotificationsAsyncTask(LoginActivity.this, null, max_id, LoginActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
nextElementLoader.setVisibility(View.VISIBLE);
}
} else {
nextElementLoader.setVisibility(View.GONE);
}
}
}
});
swipeRefreshLayout.setOnRefreshListener(() -> {
max_id = null;
firstLoad = true;
flag_loading = true;
swiped = true;
asyncTask = new RetrievePeertubeNotificationsAsyncTask(LoginActivity.this, null, null, LoginActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
});
asyncTask = new RetrievePeertubeNotificationsAsyncTask(LoginActivity.this, null, max_id, LoginActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
connected.setVisibility(View.GONE);
}
@ -257,5 +335,53 @@ public class LoginActivity extends AppCompatActivity {
return super.onOptionsItemSelected(item);
}
@Override
public void onDestroy() {
super.onDestroy();
if (asyncTask != null && !asyncTask.isCancelled()) {
asyncTask.cancel(true);
}
}
@Override
public void onRetrievePeertubeNotifications(APIResponse apiResponse, Account account) {
mainLoader.setVisibility(View.GONE);
nextElementLoader.setVisibility(View.GONE);
if (apiResponse.getError() != null) {
Toasty.error(LoginActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
flag_loading = false;
swipeRefreshLayout.setRefreshing(false);
swiped = false;
return;
}
int previousPosition = notifications.size();
max_id = apiResponse.getMax_id();
List<PeertubeNotification> notifications = apiResponse.getPeertubeNotifications();
if (!swiped && firstLoad && (notifications == null || notifications.size() == 0))
textviewNoAction.setVisibility(View.VISIBLE);
else
textviewNoAction.setVisibility(View.GONE);
if (swiped) {
if (previousPosition > 0) {
this.notifications.subList(0, previousPosition).clear();
notificationsListAdapter.notifyItemRangeRemoved(0, previousPosition);
}
swiped = false;
}
if (notifications != null && notifications.size() > 0) {
this.notifications.addAll(notifications);
notificationsListAdapter.notifyItemRangeInserted(previousPosition, notifications.size());
} else {
if (firstLoad)
textviewNoAction.setVisibility(View.VISIBLE);
}
swipeRefreshLayout.setRefreshing(false);
firstLoad = false;
//The initial call comes from a classic tab refresh
flag_loading = (max_id == null);
}
}

View File

@ -229,7 +229,7 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee
initFullscreenDialog();
initFullscreenButton();
}
if( Helper.isLoggedIn(PeertubeActivity.this)) {
if (Helper.isLoggedIn(PeertubeActivity.this)) {
new ManagePlaylistsAsyncTask(PeertubeActivity.this, GET_PLAYLIST, null, null, null, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@ -316,7 +316,6 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee
new ManagePlaylistsAsyncTask(PeertubeActivity.this, GET_PLAYLIST_FOR_VIDEO, null, peertube.getId(), null, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
add_comment_read.setOnClickListener(v -> {
if (isLoggedIn(PeertubeActivity.this)) {
add_comment_read.setVisibility(View.GONE);

View File

@ -5,21 +5,15 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
@ -81,21 +75,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity implements OnR
}
if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
assert inflater != null;
View view = inflater.inflate(R.layout.simple_bar, new LinearLayout(PeertubeEditUploadActivity.this), false);
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close);
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
toolbar_close.setOnClickListener(v -> finish());
toolbar_title.setText(R.string.update_video);
}
setContentView(R.layout.activity_peertube_edit);
set_upload_submit = findViewById(R.id.set_upload_submit);
Button set_upload_delete = findViewById(R.id.set_upload_delete);
set_upload_privacy = findViewById(R.id.set_upload_privacy);
@ -127,6 +107,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity implements OnR
LinkedHashMap<Integer, String> privacies = new LinkedHashMap<>(peertubeInformation.getPrivacies());
LinkedHashMap<String, String> languages = new LinkedHashMap<>(peertubeInformation.getLanguages());
LinkedHashMap<String, String> translations = null;
if (peertubeInformation.getTranslations() != null)
translations = new LinkedHashMap<>(peertubeInformation.getTranslations());
//Populate catgories
@ -169,13 +150,13 @@ public class PeertubeEditUploadActivity extends AppCompatActivity implements OnR
String[] languagesA = new String[languages.size()];
Iterator<Map.Entry<String, String>> itl = languages.entrySet().iterator();
i = 0;
while (it.hasNext()) {
while (itl.hasNext()) {
Map.Entry<String, String> pair = itl.next();
if (translations == null || translations.size() == 0 || !translations.containsKey(pair.getValue()))
languagesA[i] = pair.getValue();
else
languagesA[i] = translations.get(pair.getValue());
it.remove();
itl.remove();
i++;
}
ArrayAdapter<String> adapterLanguages = new ArrayAdapter<>(PeertubeEditUploadActivity.this,
@ -196,6 +177,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity implements OnR
it.remove();
i++;
}
ArrayAdapter<String> adapterPrivacies = new ArrayAdapter<>(PeertubeEditUploadActivity.this,
android.R.layout.simple_spinner_dropdown_item, privaciesA);
set_upload_privacy.setAdapter(adapterPrivacies);
@ -206,7 +188,6 @@ public class PeertubeEditUploadActivity extends AppCompatActivity implements OnR
channels = new LinkedHashMap<>();
}
@ -237,7 +218,6 @@ public class PeertubeEditUploadActivity extends AppCompatActivity implements OnR
privacyToSend = peertube.getPrivacy();
categoryToSend = peertube.getCategory();
if (languageToSend == null) {
LinkedHashMap<String, String> languages = new LinkedHashMap<>(peertubeInformation.getLanguages());
Map.Entry<String, String> entryString = languages.entrySet().iterator().next();
@ -266,7 +246,6 @@ public class PeertubeEditUploadActivity extends AppCompatActivity implements OnR
}
String language = null;
if (languageToSend != null) {
Map.Entry<String, String> entryString = languageToSend.entrySet().iterator().next();
language = entryString.getValue();
@ -289,7 +268,6 @@ public class PeertubeEditUploadActivity extends AppCompatActivity implements OnR
Map.Entry<Integer, String> entryInt = categoryToSend.entrySet().iterator().next();
category = entryInt.getValue();
}
channel = peertube.getChannel();
String title = peertube.getName();
boolean commentEnabled = peertube.isCommentsEnabled();
@ -301,7 +279,6 @@ public class PeertubeEditUploadActivity extends AppCompatActivity implements OnR
p_video_title.setText(title);
p_video_description.setText(peertube.getDescription());
LinkedHashMap<Integer, String> categories = new LinkedHashMap<>(peertubeInformation.getCategories());
LinkedHashMap<Integer, String> licences = new LinkedHashMap<>(peertubeInformation.getLicences());
LinkedHashMap<Integer, String> privacies = new LinkedHashMap<>(peertubeInformation.getPrivacies());
@ -352,7 +329,6 @@ public class PeertubeEditUploadActivity extends AppCompatActivity implements OnR
categoryPosition++;
}
}
//Manage privacies
set_upload_privacy.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
@ -523,7 +499,6 @@ public class PeertubeEditUploadActivity extends AppCompatActivity implements OnR
Toasty.error(PeertubeEditUploadActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
return;
}
//Populate channels
List<Account> accounts = apiResponse.getAccounts();
String[] channelName = new String[accounts.size()];
@ -536,7 +511,6 @@ public class PeertubeEditUploadActivity extends AppCompatActivity implements OnR
ArrayAdapter<String> adapterChannel = new ArrayAdapter<>(PeertubeEditUploadActivity.this,
android.R.layout.simple_spinner_dropdown_item, channelName);
set_upload_channel.setAdapter(adapterChannel);
int channelPosition = 0;
if (channels.containsKey(channel.getUsername())) {
LinkedHashMap<String, String> channelsIterator = new LinkedHashMap<>(channels);
@ -553,7 +527,6 @@ public class PeertubeEditUploadActivity extends AppCompatActivity implements OnR
}
}
set_upload_channel.setSelection(channelPosition);
set_upload_submit.setEnabled(true);
}

View File

@ -12,10 +12,9 @@ import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.interfaces.OnRetrievePeertubeInterface;
public class RetrievePeertubeSingleAsyncTask extends AsyncTask<Void, Void, Void> {
public class RetrievePeertubeSingleAsyncTask extends AsyncTask<Void, Void, APIResponse> {
private APIResponse apiResponse;
private String videoId;
private OnRetrievePeertubeInterface listener;
private WeakReference<Context> contextReference;
@ -31,21 +30,21 @@ public class RetrievePeertubeSingleAsyncTask extends AsyncTask<Void, Void, Void>
@Override
protected Void doInBackground(Void... params) {
protected APIResponse doInBackground(Void... params) {
PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get());
SharedPreferences sharedpreferences = contextReference.get().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
apiResponse = peertubeAPI.getSinglePeertube(this.instanceName, videoId, token);
APIResponse apiResponse = peertubeAPI.getSinglePeertube(this.instanceName, videoId, token);
if (apiResponse.getPeertubes() != null && apiResponse.getPeertubes().size() > 0 && apiResponse.getPeertubes().get(0) != null) {
String rate = new PeertubeAPI(this.contextReference.get()).getRating(videoId);
if (rate != null)
apiResponse.getPeertubes().get(0).setMyRating(rate);
}
return null;
return apiResponse;
}
@Override
protected void onPostExecute(Void result) {
protected void onPostExecute(APIResponse apiResponse) {
listener.onRetrievePeertube(apiResponse);
}
}

View File

@ -684,7 +684,7 @@ public class PeertubeAPI {
if (PeertubeInformation.langueMapped.containsKey(Locale.getDefault().getLanguage()))
lang = PeertubeInformation.langueMapped.get(Locale.getDefault().getLanguage());
if (lang != null && !lang.startsWith("en")) {
if (lang != null) {
response = new HttpsConnection(context).get(String.format("https://" + instance + "/client/locales/%s/server.json", lang), 60, null, null);
JSONObject translations = new JSONObject(response);
LinkedHashMap<String, String> _translations = new LinkedHashMap<>();

View File

@ -20,6 +20,7 @@ import com.bumptech.glide.Glide;
import java.util.List;
import app.fedilab.fedilabtube.PeertubeActivity;
import app.fedilab.fedilabtube.PeertubeEditUploadActivity;
import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.ShowAccountActivity;
import app.fedilab.fedilabtube.client.APIResponse;
@ -64,7 +65,6 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
ownVideos = peertube.getAccount().getInstance().compareTo(Helper.getLiveInstance(context)) == 0 && peertube.getAccount().getId().compareTo(userId) == 0;
holder.peertube_account_name.setText(account.getAcct());
holder.peertube_title.setText(peertube.getName());
holder.peertube_duration.setText(context.getString(R.string.duration_video, Helper.secondsToString(peertube.getDuration())));
@ -102,13 +102,23 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
holder.header_title.setVisibility(View.GONE);
}
holder.bottom_container.setOnClickListener(v -> {
Intent intent = new Intent(context, PeertubeActivity.class);
Bundle b = new Bundle();
b.putString("video_id", peertube.getUuid());
intent.putExtras(b);
context.startActivity(intent);
});
if (!ownVideos) {
holder.bottom_container.setOnClickListener(v -> {
Intent intent = new Intent(context, PeertubeActivity.class);
Bundle b = new Bundle();
b.putString("video_id", peertube.getUuid());
intent.putExtras(b);
context.startActivity(intent);
});
} else {
holder.bottom_container.setOnClickListener(v -> {
Intent intent = new Intent(context, PeertubeEditUploadActivity.class);
Bundle b = new Bundle();
b.putString("video_id", peertube.getUuid());
intent.putExtras(b);
context.startActivity(intent);
});
}
holder.peertube_video_image.setOnClickListener(v -> {
Intent intent = new Intent(context, PeertubeActivity.class);
Bundle b = new Bundle();

View File

@ -0,0 +1,180 @@
package app.fedilab.fedilabtube.drawer;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import app.fedilab.fedilabtube.LoginActivity;
import app.fedilab.fedilabtube.PeertubeActivity;
import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.ShowAccountActivity;
import app.fedilab.fedilabtube.client.entities.PeertubeAccountNotification;
import app.fedilab.fedilabtube.client.entities.PeertubeNotification;
import app.fedilab.fedilabtube.client.entities.PeertubeVideoNotification;
import app.fedilab.fedilabtube.helper.Helper;
public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private Context context;
private List<PeertubeNotification> notifications;
public PeertubeNotificationsListAdapter(List<PeertubeNotification> notifications) {
this.notifications = notifications;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
context = parent.getContext();
LayoutInflater layoutInflater = LayoutInflater.from(this.context);
return new ViewHolder(layoutInflater.inflate(R.layout.drawer_peertube_notification, parent, false));
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
ViewHolder holder = (ViewHolder) viewHolder;
PeertubeNotification notification = notifications.get(position);
//Follow Notification
PeertubeAccountNotification accountAction = null;
PeertubeVideoNotification videoAction;
if (notification.getPeertubeActorFollow() != null) {
String profileUrl = "https://" + Helper.getLiveInstance(context) + notification.getPeertubeActorFollow().getFollower().getAvatar();
Helper.loadGiF(context, profileUrl, holder.peertube_notif_pp);
accountAction = notification.getPeertubeActorFollow().getFollower();
String type = notification.getPeertubeActorFollow().getFollowing().getType();
String message;
if (type != null && type.equals("account")) {
message = context.getString(R.string.peertube_follow_channel, notification.getPeertubeActorFollow().getFollower().getDisplayName(), notification.getPeertubeActorFollow().getFollowing().getDisplayName());
} else {
message = context.getString(R.string.peertube_follow_account, accountAction.getDisplayName());
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
holder.peertube_notif_message.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));
else
holder.peertube_notif_message.setText(Html.fromHtml(message));
PeertubeAccountNotification finalAccountAction1 = accountAction;
holder.peertube_notif_pp.setOnClickListener(v -> {
Intent intent = new Intent(context, ShowAccountActivity.class);
Bundle b = new Bundle();
b.putBoolean("peertubeaccount", true);
b.putString("accountId", finalAccountAction1.getName());
intent.putExtras(b);
context.startActivity(intent);
});
} else if (notification.getPeertubeComment() != null) { //Comment Notification
String profileUrl = "https://" + Helper.getLiveInstance(context) + notification.getPeertubeComment().getPeertubeAccountNotification().getAvatar();
Helper.loadGiF(context, profileUrl, holder.peertube_notif_pp);
accountAction = notification.getPeertubeComment().getPeertubeAccountNotification();
videoAction = notification.getPeertubeComment().getPeertubeVideoNotification();
String message = context.getString(R.string.peertube_comment_on_video, accountAction.getDisplayName(), videoAction.getName());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
holder.peertube_notif_message.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));
else
holder.peertube_notif_message.setText(Html.fromHtml(message));
PeertubeVideoNotification finalVideoAction1 = videoAction;
holder.peertube_notif_message.setOnClickListener(v -> {
Intent intent = new Intent(context, PeertubeActivity.class);
Bundle b = new Bundle();
b.putString("peertube_instance", Helper.getLiveInstance(context));
b.putString("video_id", finalVideoAction1.getUuid());
intent.putExtras(b);
context.startActivity(intent);
});
} else {//Other Notifications
if (notification.getPeertubeVideoNotification() != null && notification.getPeertubeVideoNotification().getPeertubeAccountNotification() != null) {
String profileUrl = "https://" + Helper.getLiveInstance(context) + notification.getPeertubeVideoNotification().getPeertubeAccountNotification().getAvatar();
Helper.loadGiF(context, profileUrl, holder.peertube_notif_pp);
accountAction = notification.getPeertubeVideoNotification().getPeertubeAccountNotification();
videoAction = notification.getPeertubeVideoNotification();
String message = "";
if (notification.getType() == LoginActivity.MY_VIDEO_PUBLISHED) {
message = context.getString(R.string.peertube_video_published, videoAction.getName());
} else if (notification.getType() == LoginActivity.MY_VIDEO_IMPORT_ERROR) {
message = context.getString(R.string.peertube_video_import_error, videoAction.getName());
} else if (notification.getType() == LoginActivity.MY_VIDEO_IMPORT_SUCCESS) {
message = context.getString(R.string.peertube_video_import_success, videoAction.getName());
} else if (notification.getType() == LoginActivity.NEW_VIDEO_FROM_SUBSCRIPTION) {
message = context.getString(R.string.peertube_video_from_subscription, accountAction.getDisplayName(), videoAction.getName());
} else if (notification.getType() == LoginActivity.BLACKLIST_ON_MY_VIDEO) {
message = context.getString(R.string.peertube_video_blacklist, videoAction.getName());
} else if (notification.getType() == LoginActivity.UNBLACKLIST_ON_MY_VIDEO) {
message = context.getString(R.string.peertube_video_unblacklist, videoAction.getName());
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
holder.peertube_notif_message.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));
else
holder.peertube_notif_message.setText(Html.fromHtml(message));
PeertubeVideoNotification finalVideoAction = videoAction;
holder.peertube_notif_message.setOnClickListener(v -> {
Intent intent = new Intent(context, PeertubeActivity.class);
Bundle b = new Bundle();
b.putString("peertube_instance", Helper.getLiveInstance(context));
b.putString("video_id", finalVideoAction.getUuid());
intent.putExtras(b);
context.startActivity(intent);
});
}
}
holder.peertube_notif_date.setText(Helper.dateDiff(context, notification.getCreatedAt()));
PeertubeAccountNotification finalAccountAction = accountAction;
holder.peertube_notif_pp.setOnClickListener(v -> {
if (finalAccountAction != null) {
Intent intent = new Intent(context, ShowAccountActivity.class);
Bundle b = new Bundle();
b.putBoolean("peertubeaccount", true);
b.putString("accountId", finalAccountAction.getName() + "@" + finalAccountAction.getHost());
intent.putExtras(b);
context.startActivity(intent);
}
});
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public int getItemCount() {
return notifications.size();
}
static class ViewHolder extends RecyclerView.ViewHolder {
ImageView peertube_notif_pp;
TextView peertube_notif_message, peertube_notif_date;
RelativeLayout main_container_trans;
public ViewHolder(View itemView) {
super(itemView);
peertube_notif_pp = itemView.findViewById(R.id.peertube_notif_pp);
peertube_notif_message = itemView.findViewById(R.id.peertube_notif_message);
peertube_notif_date = itemView.findViewById(R.id.peertube_notif_date);
main_container_trans = itemView.findViewById(R.id.container_trans);
}
public View getView() {
return itemView;
}
}
}

View File

@ -75,7 +75,7 @@ public class Helper {
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
public static final Pattern hashtagPattern = Pattern.compile("(#[\\w_A-zÀ-ÿ]+)");
public static final String SET_CUSTOM_USER_AGENT = "set_custom_user_agent";
public static final String LAST_NOTIFICATION_MAX_ID = "last_notification_max_id";
public static final String SET_VIDEO_CACHE = "set_video_cache";
//Proxy
public static final String SET_PROXY_ENABLED = "set_proxy_enabled";
@ -421,10 +421,37 @@ public class Helper {
} catch (Exception ignored) {
}
}
}
public static void loadGiF(final Context context, String url, final ImageView imageView) {
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
if (url.startsWith("/")) {
url = Helper.getLiveInstance(context) + url;
}
if (!url.startsWith("http")) {
url = "https://" + url;
}
try {
Glide.with(imageView.getContext())
.load(url)
.thumbnail(0.1f)
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
.into(imageView);
} catch (Exception e) {
try {
Glide.with(imageView.getContext())
.asDrawable()
.load(R.drawable.missing_peertube)
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
.into(imageView);
} catch (Exception ignored) {
}
}
}
/**
* Manage URLs to open (built-in or external app)
*

View File

@ -1,224 +1,291 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/drawer_layout"
<LinearLayout
android:id="@+id/not_connected"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent"
android:visibility="gone"
android:orientation="vertical">
<LinearLayout
android:id="@+id/not_connected"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/step_instance"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/main_logo"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:contentDescription="@string/app_logo"
android:src="@drawable/ic_launcher_foreground"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/create_an_account_peertube"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:drawablePadding="10dp"
android:gravity="center"
android:text="@string/join_peertube"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/main_logo" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:paddingStart="50dp"
android:paddingEnd="50dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/step_instance"
<TextView
android:id="@+id/instance_chosen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:textColor="?colorAccent"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_uid_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/instance_chosen">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_uid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/email_address"
android:inputType="textEmailAddress"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_passwd_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/login_uid_container"
app:passwordToggleEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_passwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password"
android:inputType="textPassword"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/login_button"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:drawablePadding="10dp"
android:gravity="center"
android:paddingStart="15dp"
android:paddingTop="12dp"
android:paddingEnd="20dp"
android:paddingBottom="12dp"
android:singleLine="true"
android:text="@string/login"
android:textAllCaps="false"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/login_passwd_container" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/connected"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="50dp"
android:paddingEnd="50dp">
<TextView
android:id="@+id/instance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.cardview.widget.CardView
android:id="@+id/cardview_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:src="@drawable/ic_launcher_foreground"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/instance">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<ImageView
android:id="@+id/profile_picture"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/profile_picture"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/displayname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:textSize="18sp"
app:layout_constraintStart_toEndOf="@+id/profile_picture"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="30dp"
android:textSize="14sp"
app:layout_constraintStart_toEndOf="@+id/profile_picture"
app:layout_constraintTop_toTopOf="@+id/displayname" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<Button
android:id="@+id/logout_button"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:drawablePadding="10dp"
android:gravity="center"
android:paddingStart="15dp"
android:paddingTop="12dp"
android:paddingEnd="20dp"
android:paddingBottom="12dp"
android:singleLine="true"
android:text="@string/action_logout"
android:textAllCaps="false"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cardview_profile" />
<RelativeLayout
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/logout_button"
android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/main_logo"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:contentDescription="@string/app_logo"
android:src="@drawable/ic_launcher_foreground"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/create_an_account_peertube"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:drawablePadding="10dp"
android:gravity="center"
android:text="@string/join_peertube"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/main_logo" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="50dp"
android:paddingEnd="50dp">
<TextView
android:id="@+id/instance_chosen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:textColor="?colorAccent"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_uid_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/instance_chosen">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_uid"
<!-- Listview Notifications -->
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/lv_notifications"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/email_address"
android:inputType="textEmailAddress"
android:singleLine="true" />
android:scrollbars="none" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/login_passwd_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/login_uid_container"
app:passwordToggleEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/login_passwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password"
android:inputType="textPassword"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/login_button"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:drawablePadding="10dp"
android:gravity="center"
android:paddingStart="15dp"
android:paddingTop="12dp"
android:paddingEnd="20dp"
android:paddingBottom="12dp"
android:singleLine="true"
android:text="@string/login"
android:textAllCaps="false"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/login_passwd_container" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/connected"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="50dp"
android:paddingEnd="50dp">
<TextView
android:id="@+id/instance"
<RelativeLayout
android:id="@+id/no_action"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.cardview.widget.CardView
android:id="@+id/cardview_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:src="@drawable/ic_launcher_foreground"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/instance">
<androidx.constraintlayout.widget.ConstraintLayout
android:visibility="gone"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<ImageView
android:id="@+id/profile_picture"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/profile_picture"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/displayname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:textSize="18sp"
app:layout_constraintStart_toEndOf="@+id/profile_picture"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="30dp"
android:textSize="14sp"
app:layout_constraintStart_toEndOf="@+id/profile_picture"
app:layout_constraintTop_toTopOf="@+id/displayname" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<Button
android:id="@+id/logout_button"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:drawablePadding="10dp"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:padding="10dp"
android:text="@string/no_notifications"
android:textSize="25sp"
android:textStyle="italic|bold"
android:typeface="serif" />
</RelativeLayout>
<!-- Main Loader -->
<RelativeLayout
android:id="@+id/loader"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:paddingStart="15dp"
android:paddingTop="12dp"
android:paddingEnd="20dp"
android:paddingBottom="12dp"
android:singleLine="true"
android:text="@string/action_logout"
android:textAllCaps="false"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cardview_profile" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
android:visibility="gone">
</RelativeLayout>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
</RelativeLayout>
<!-- Loader for next notifications -->
<RelativeLayout
android:id="@+id/loading_next_notifications"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|center_horizontal"
android:gravity="bottom|center_horizontal"
android:visibility="gone">
</ScrollView>
<ProgressBar
android:layout_width="match_parent"
android:layout_height="match_parent"
android:indeterminate="true" />
</RelativeLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -1,257 +1,248 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:TagsEditText="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/fab_margin"
android:layout_marginLeft="@dimen/fab_margin"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_marginRight="@dimen/fab_margin"
tools:context=".PeertubeUploadActivity">
<ScrollView
android:layout_margin="@dimen/fab_margin"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Video title -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Video title -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
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:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />
</LinearLayout>
<!-- Video tags -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:labelFor="@+id/p_video_tags"
android:text="@string/tags" />
<mabbas007.tagsedittext.TagsEditText
android:id="@+id/p_video_tags"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:lines="2"
android:minLines="2"
TagsEditText:allowSpaceInTag="true"
TagsEditText:tagsCloseImagePadding="@dimen/defaultTagsCloseImagePadding"
TagsEditText:tagsCloseImageRight="@drawable/tag_close"
TagsEditText:tagsTextColor="?colorAccent"
TagsEditText:tagsTextSize="@dimen/defaultTagsTextSize" />
</LinearLayout>
<!-- video description -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
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:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:lines="5"
android:maxLines="5"
android:scrollbars="vertical" />
</LinearLayout>
<!-- Videos channels -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/channel" />
<Spinner
android:id="@+id/set_upload_channel"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- Videos categories -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/category" />
<Spinner
android:id="@+id/set_upload_categories"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- Videos licences -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/license" />
<Spinner
android:id="@+id/set_upload_licenses"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- Videos languages -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/language" />
<Spinner
android:id="@+id/set_upload_languages"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- Videos Privacy -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/action_privacy" />
<Spinner
android:id="@+id/set_upload_privacy"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- More options -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="20dp"
android:gravity="center_vertical"
android:orientation="vertical">
<CheckBox
android:id="@+id/set_upload_nsfw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/peertube_nsfw" />
<CheckBox
android:id="@+id/set_upload_enable_comments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/peertube_enable_comments" />
</LinearLayout>
<LinearLayout
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:orientation="horizontal">
<!-- Videos upload edit submit -->
<Button
android:id="@+id/set_upload_delete"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:gravity="center"
android:text="@string/delete_video" />
<!-- Videos upload edit submit -->
<Button
android:id="@+id/set_upload_submit"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:enabled="false"
android:gravity="center"
android:text="@string/update_video" />
</LinearLayout>
android:labelFor="@+id/p_video_title"
android:text="@string/title" />
<EditText
android:id="@+id/p_video_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:importantForAutofill="no" />
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- Video tags -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:labelFor="@+id/p_video_tags"
android:text="@string/tags" />
<mabbas007.tagsedittext.TagsEditText
android:id="@+id/p_video_tags"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:lines="2"
android:minLines="2"
TagsEditText:allowSpaceInTag="true"
TagsEditText:tagsCloseImagePadding="@dimen/defaultTagsCloseImagePadding"
TagsEditText:tagsCloseImageRight="@drawable/tag_close"
TagsEditText:tagsTextColor="?colorAccent"
TagsEditText:tagsTextSize="@dimen/defaultTagsTextSize" />
</LinearLayout>
<!-- video description -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
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:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:lines="5"
android:maxLines="5"
android:scrollbars="vertical" />
</LinearLayout>
<!-- Videos channels -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/channel" />
<Spinner
android:id="@+id/set_upload_channel"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- Videos categories -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/category" />
<Spinner
android:id="@+id/set_upload_categories"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- Videos licences -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/license" />
<Spinner
android:id="@+id/set_upload_licenses"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- Videos languages -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/language" />
<Spinner
android:id="@+id/set_upload_languages"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- Videos Privacy -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/action_privacy" />
<Spinner
android:id="@+id/set_upload_privacy"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- More options -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="20dp"
android:gravity="center_vertical"
android:orientation="vertical">
<CheckBox
android:id="@+id/set_upload_nsfw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/peertube_nsfw" />
<CheckBox
android:id="@+id/set_upload_enable_comments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/peertube_enable_comments" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:orientation="horizontal">
<!-- Videos upload edit submit -->
<Button
android:id="@+id/set_upload_delete"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:gravity="center"
android:text="@string/delete_video" />
<!-- Videos upload edit submit -->
<Button
android:id="@+id/set_upload_submit"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:enabled="false"
android:gravity="center"
android:text="@string/update_video" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@ -153,4 +153,16 @@
<string name="error_display_name">Vous devez fournir un nom d\'affichage !</string>
<string name="action_playlist_empty_content">Cette liste de lecture est vide.</string>
<string name="playlists">Listes de lecture</string>
<string name="no_notifications">Aucune notification à afficher</string>
<string name="peertube_comment_on_video"><![CDATA[<b>%1$s</b> a commenté votre vidéo <b>%2$s</b>]]></string>
<string name="peertube_follow_channel"><![CDATA[<b>%1$s</b> suit votre chaîne <b>%2$s</b>]]></string>
<string name="peertube_follow_account"><![CDATA[<b>%1$s</b> suit votre compte]]></string>
<string name="peertube_video_published"><![CDATA[Votre vidéo <b>%1$s</b> a été publiée]]></string>
<string name="peertube_video_import_success"><![CDATA[Limportation de votre vidéo <b>%1$s</b> a réussi]]></string>
<string name="peertube_video_import_error"><![CDATA[Échec lors de limportation de votre vidéo <b>%1$s</b>]]></string>
<string name="peertube_video_from_subscription"><![CDATA[<b>%1$s</b> a publié une nouvelle vidéo : <b>%2$s</b>]]></string>
<string name="peertube_video_blacklist"><![CDATA[Votre vidéo <b>%1$s</b> a été blacklisté]]></string>
<string name="peertube_video_unblacklist"><![CDATA[Votre vidéo <b>%1$s</b> nest plus blacklisté]]></string>
</resources>