some changes

This commit is contained in:
Thomas 2020-06-26 18:17:17 +02:00
parent 67417bd65c
commit 51860ff399
26 changed files with 182 additions and 112 deletions

View File

@ -1,5 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: "androidx.navigation.safeargs"
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
@ -10,7 +12,7 @@ android {
targetSdkVersion 29
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -34,15 +36,18 @@ allprojects {
}
dependencies {
implementation "androidx.multidex:multidex:2.0.1"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.navigation:navigation-fragment:2.3.0'
implementation "androidx.fragment:fragment:1.2.5"
implementation 'androidx.navigation:navigation-ui:2.3.0'
implementation ("androidx.navigation:navigation-dynamic-features-fragment:2.3.0")
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'org.jetbrains:annotations-java5:15.0'
implementation 'androidx.browser:browser:1.2.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'

View File

@ -2,12 +2,22 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.fedilab.fedilabtube">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:name=".FedilabTupe"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"

View File

@ -0,0 +1,14 @@
package app.fedilab.fedilabtube;
import android.content.Context;
import androidx.multidex.MultiDex;
import androidx.multidex.MultiDexApplication;
public class FedilabTupe extends MultiDexApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}

View File

@ -67,7 +67,6 @@ import javax.net.ssl.HttpsURLConnection;
import app.fedilab.fedilabtube.asynctasks.ManagePlaylistsAsyncTask;
import app.fedilab.fedilabtube.asynctasks.PostActionAsyncTask;
import app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask;
import app.fedilab.fedilabtube.asynctasks.RetrievePeertubeSingleAsyncTask;
import app.fedilab.fedilabtube.asynctasks.RetrievePeertubeSingleCommentsAsyncTask;
import app.fedilab.fedilabtube.client.APIResponse;
@ -559,7 +558,6 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
StatusDrawerParams statusDrawerParams = new StatusDrawerParams();
statusDrawerParams.setType(RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE);
statusDrawerParams.setTargetedId(userId);
statusDrawerParams.setStatuses(statuses);
StatusListAdapter statusListAdapter = new StatusListAdapter(statusDrawerParams);

View File

@ -60,9 +60,6 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
if (action == null)
return null;
switch (action) {
case REMOTE_INSTANCE_FILTERED:
apiResponse = peertubeAPI.searchPeertube(this.remoteInstance, search);
break;
case USER:
apiResponse = peertubeAPI.getVideos(targetedID, max_id);
break;
@ -116,57 +113,21 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
}
public enum Type {
HOME,
LOCAL,
DIRECT,
CONVERSATION,
PUBLIC,
HASHTAG,
LIST,
USER,
FAVOURITES,
ONESTATUS,
CONTEXT,
TAG,
REMOTE_INSTANCE,
REMOTE_INSTANCE_FILTERED,
ART,
PEERTUBE,
NOTIFICATION,
SEARCH,
NEWS,
ANNOUNCEMENTS,
USER,
PPUBLIC,
PSUBSCRIPTIONS,
POVERVIEW,
PTRENDING,
PRECENTLYADDED,
PMOSTLIKED,
PLOCAL,
CHANNEL,
MYVIDEOS,
PEERTUBE_HISTORY,
PIXELFED,
PF_HOME,
PF_LOCAL,
PF_DISCOVER,
PF_NOTIFICATION,
PF_REPLIES,
GNU_HOME,
GNU_LOCAL,
GNU_WHOLE,
GNU_NOTIFICATION,
GNU_DM,
GNU_ART,
GNU_TAG,
GNU_GROUP_TIMELINE,
SCHEDULED_TOOTS,
CACHE_BOOKMARKS,
CACHE_BOOKMARKS_PEERTUBE,
CACHE_STATUS,
}
}

View File

@ -1677,13 +1677,11 @@ public class PeertubeAPI {
status.setUri(comment.get("url").toString());
status.setUrl(comment.get("url").toString());
status.setSensitive(false);
status.setSpoiler_text("");
status.setContent(context, comment.get("text").toString());
status.setContent(comment.get("text").toString());
status.setIn_reply_to_id(comment.get("inReplyToCommentId").toString());
status.setAccount(parseAccountResponsePeertube(instance, comment.getJSONObject("account")));
status.setCreated_at(Helper.mstStringToDate(comment.get("createdAt").toString()));
status.setVisibility("public");
status.setViewType(context);
SpannableString spannableString;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
spannableString = new SpannableString(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));

View File

@ -82,6 +82,10 @@ public class Status implements Parcelable {
private String conversationId;
private String contentType;
public void setContent(String content) {
this.content = content;
}
public Status() {
}

View File

@ -70,12 +70,16 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_video, container, false);
peertubes = new ArrayList<>();
context = getContext();
Bundle bundle = this.getArguments();
if (getArguments() != null) {
type = DisplayStatusFragmentArgs.fromBundle(getArguments()).getType();
}
if (bundle != null) {
type = (RetrieveFeedsAsyncTask.Type) bundle.get("type");
String targetedId = bundle.getString("targetedid", null);
String tag = bundle.getString("tag", null);
search_peertube = bundle.getString("search_peertube", null);

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96zM14,13v4h-4v-4H7l5,-5 5,5h-3z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M10,9h4L14,6h3l-5,-5 -5,5h3v3zM9,10L6,10L6,7l-5,5 5,5v-3h3v-4zM23,12l-5,-5v3h-3v4h3v3l5,-5zM14,15h-4v3L7,18l5,5 5,-5h-3v-3z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
</vector>

View File

@ -18,7 +18,7 @@
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/bottom_nav_menu" />
<fragment
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
@ -30,4 +30,5 @@
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/mobile_navigation" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -36,7 +36,7 @@
android:layout_height="match_parent"
android:gravity="center" />
<app.fedilab.android.webview.CustomWebview
<app.fedilab.fedilabtube.webview.CustomWebview
android:id="@+id/webview_video"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -95,7 +95,7 @@
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawableTop="@drawable/ic_visibility_peertube"
android:drawableTop="@drawable/ic_baseline_visibility_24"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text="0"
@ -110,7 +110,7 @@
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawableTop="@drawable/ic_thumb_up_peertube"
android:drawableTop="@drawable/ic_baseline_thumb_up_alt_24"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text="0"
@ -125,7 +125,7 @@
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawableTop="@drawable/ic_thumb_down_peertube"
android:drawableTop="@drawable/ic_baseline_thumb_down_alt_24"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text="0"
@ -140,7 +140,7 @@
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawableTop="@drawable/ic_bookmark_peertube_border"
android:drawableTop="@drawable/ic_baseline_bookmark_border_24"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text="" />
@ -154,7 +154,7 @@
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawableTop="@drawable/ic_list_peertube_activity"
android:drawableTop="@drawable/ic_baseline_list_24"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text=""
@ -175,10 +175,10 @@
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawableTop="@drawable/ic_share_peertube"
android:drawableTop="@drawable/ic_baseline_share_24"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text="@string/more_action_6"
android:text="@string/share"
android:textSize="12sp" />
<TextView
@ -190,7 +190,7 @@
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:drawableTop="@drawable/ic_cloud_download_peertube"
android:drawableTop="@drawable/ic_baseline_cloud_upload_24"
android:drawablePadding="5dp"
android:gravity="center_horizontal"
android:text="@string/download"
@ -229,7 +229,7 @@
android:layout_height="30dp"
android:layout_marginTop="5dp"
android:contentDescription="@string/send_comment"
android:src="@drawable/ic_send"
android:src="@drawable/ic_baseline_send_24"
android:visibility="gone" />
</LinearLayout>
@ -296,7 +296,7 @@
android:id="@+id/videoLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:background="@android:color/black"
android:visibility="gone" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -236,7 +236,6 @@
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:backgroundTint="@color/unfollow"
android:gravity="center"
android:text="@string/delete_video" />

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_open_browser"
android:icon="@drawable/ic_open_with"
android:title="@string/action_open_in_web"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_mute"
android:icon="@drawable/ic_volume_mute"
android:title="@string/more_action_1"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_block"
android:icon="@drawable/ic_block"
android:title="@string/more_action_2"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_report"
android:icon="@drawable/ic_block"
android:title="@string/more_action_3"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_block_instance"
android:icon="@drawable/ic_block"
android:title="@string/block_domain"
app:showAsAction="ifRoom" />
</menu>

View File

@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_go"
android:icon="@drawable/ic_open_with"
android:icon="@drawable/ic_baseline_open_with_24"
android:title="@string/open_with"
app:showAsAction="always" />
</menu>

View File

@ -3,36 +3,61 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mobile_navigation"
app:startDestination="@+id/navigation_home">
app:startDestination="@id/navigation_home">
<fragment
android:id="@+id/navigation_home"
android:name="app.fedilab.fedilabtube.ui.video.VideoListFragment"
android:name="app.fedilab.fedilabtube.fragment.DisplayStatusFragment"
android:label="@string/title_home"
tools:layout="@layout/fragment_video" />
tools:layout="@layout/fragment_video" >
<argument
android:name="type"
app:argType="app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask.Type"
android:defaultValue="PLOCAL"/>
</fragment>
<fragment
android:id="@+id/navigation_recently_added"
android:name="app.fedilab.fedilabtube.ui.video.VideoListFragment"
android:name="app.fedilab.fedilabtube.fragment.DisplayStatusFragment"
android:label="@string/title_recently_added"
tools:layout="@layout/fragment_video" />
tools:layout="@layout/fragment_video">
<argument
android:name="type"
app:argType="app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask.Type"
android:defaultValue="PRECENTLYADDED"/>
</fragment>
<fragment
android:id="@+id/navigation_most_liked"
android:name="app.fedilab.fedilabtube.ui.video.VideoListFragment"
android:name="app.fedilab.fedilabtube.fragment.DisplayStatusFragment"
android:label="@string/title_most_liked"
tools:layout="@layout/fragment_video" />
tools:layout="@layout/fragment_video">
<argument
android:name="type"
app:argType="app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask.Type"
android:defaultValue="PMOSTLIKED"/>
</fragment>
<fragment
android:id="@+id/navigation_trending"
android:name="app.fedilab.fedilabtube.ui.video.VideoListFragment"
android:name="app.fedilab.fedilabtube.fragment.DisplayStatusFragment"
android:label="@string/title_trending"
tools:layout="@layout/fragment_video" />
tools:layout="@layout/fragment_video">
<argument
android:name="type"
app:argType="app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask.Type"
android:defaultValue="PTRENDING"/>
</fragment>
<fragment
android:id="@+id/navigation_discover"
android:name="app.fedilab.fedilabtube.ui.video.VideoListFragment"
android:name="app.fedilab.fedilabtube.fragment.DisplayStatusFragment"
android:label="@string/title_discover"
tools:layout="@layout/fragment_video" />
tools:layout="@layout/fragment_video">
<argument
android:name="type"
app:argType="app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask.Type"
android:defaultValue="PPUBLIC"/>
</fragment>
</navigation>

View File

@ -3,4 +3,5 @@
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_margin">5dp</dimen>
<dimen name="drawer_padding">2dp</dimen>
</resources>

View File

@ -73,4 +73,24 @@
<string name="reply">Répondre</string>
<string name="delete">Supprimer</string>
<string name="no_video_to_display">Aucune vidéo nest disponible !</string>
<string name="my_videos">Mes vidéos</string>
<string name="title">Titre</string>
<string name="license">Licence</string>
<string name="category">Catégorie</string>
<string name="language">Langue</string>
<string name="description">Description</string>
<string name="tags">Étiquettes</string>
<string name="action_privacy">Confidentialité</string>
<string name="peertube_nsfw">Cette vidéo contient du contenu pour adultes</string>
<string name="delete_video">Supprimer la vidéo</string>
<string name="peertube_enable_comments">Activer les commentaires</string>
<string name="send_comment">Envoyer un commentaire</string>
<string name="add_public_comment">Ajouter un commentaire public</string>
<string name="share">Partager</string>
<string name="no_comments">Soyez le·a premier·ère à laisser un commentaire sur cette vidéo en utilisant le bouton supérieur droit !</string>
<string name="title_video_peertube">Titre de la vidéo</string>
<string name="set_video_mode">Mode pour les vidéos</string>
<string name="display_nsfw_videos">Afficher les vidéos sensibles</string>
<string name="action_playlist_add">Vous n\'avez aucune liste de lecture. Cliquez sur l\'icône « + » pour en ajouter une</string>
</resources>

View File

@ -6,7 +6,8 @@ buildscript {
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
def nav_version = "2.3.0"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
@ -22,3 +23,4 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}