Favorites for peertube

This commit is contained in:
stom79 2018-10-21 18:43:57 +02:00
parent c33ddd3952
commit be917d6b24
20 changed files with 478 additions and 6 deletions

View File

@ -106,6 +106,7 @@ import fr.gouv.etalab.mastodon.client.HttpsConnection;
import fr.gouv.etalab.mastodon.fragments.DisplayAccountsFragment;
import fr.gouv.etalab.mastodon.fragments.DisplayBookmarksFragment;
import fr.gouv.etalab.mastodon.fragments.DisplayDraftsFragment;
import fr.gouv.etalab.mastodon.fragments.DisplayFavoritesPeertubeFragment;
import fr.gouv.etalab.mastodon.fragments.DisplayFiltersFragment;
import fr.gouv.etalab.mastodon.fragments.DisplayFollowRequestSentFragment;
import fr.gouv.etalab.mastodon.fragments.DisplayHowToFragment;
@ -1830,7 +1831,7 @@ public abstract class BaseMainActivity extends BaseActivity
toolbarTitle.setVisibility(View.VISIBLE);
delete_instance.setVisibility(View.GONE);
appBar.setExpanded(true);
if (id != R.id.nav_drafts && id != R.id.nav_bookmarks ) {
if (id != R.id.nav_drafts && id != R.id.nav_bookmarks && id != R.id.nav_peertube ) {
delete_all.hide();
}else{
delete_all.show();
@ -1901,6 +1902,12 @@ public abstract class BaseMainActivity extends BaseActivity
fragmentManager.beginTransaction()
.replace(R.id.main_app_container, displayBookmarksFragment, fragmentTag).commit();
toot.hide();
}else if (id == R.id.nav_peertube) {
DisplayFavoritesPeertubeFragment displayFavoritesPeertubeFragment = new DisplayFavoritesPeertubeFragment();
fragmentTag = "BOOKMARKS_PEERTUBE";
fragmentManager.beginTransaction()
.replace(R.id.main_app_container, displayFavoritesPeertubeFragment, fragmentTag).commit();
toot.hide();
}else if( id == R.id.nav_follow_request){
toot.hide();
DisplayFollowRequestSentFragment followRequestSentFragment = new DisplayFollowRequestSentFragment();

View File

@ -21,6 +21,8 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.drawable.Drawable;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.AsyncTask;
@ -66,6 +68,8 @@ import fr.gouv.etalab.mastodon.drawers.StatusListAdapter;
import fr.gouv.etalab.mastodon.helper.FullScreenMediaController;
import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.interfaces.OnRetrievePeertubeInterface;
import fr.gouv.etalab.mastodon.sqlite.PeertubeFavoritesDAO;
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
import static fr.gouv.etalab.mastodon.helper.Helper.EXTERNAL_STORAGE_REQUEST_CODE;
import static fr.gouv.etalab.mastodon.helper.Helper.manageDownloads;
@ -82,7 +86,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
private FullScreenMediaController.fullscreen fullscreen;
private VideoView videoView;
private RelativeLayout loader;
private TextView peertube_view_count, peertube_like_count, peertube_dislike_count, peertube_share, peertube_download, peertube_description, peertube_title;
private TextView peertube_view_count, peertube_bookmark, peertube_like_count, peertube_dislike_count, peertube_share, peertube_download, peertube_description, peertube_title;
private ScrollView peertube_information_container;
private MediaPlayer mediaPlayer;
private FullScreenMediaController fullScreenMediaController;
@ -112,6 +116,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
setContentView(R.layout.activity_peertube);
loader = findViewById(R.id.loader);
peertube_view_count = findViewById(R.id.peertube_view_count);
peertube_bookmark = findViewById(R.id.peertube_bookmark);
peertube_like_count = findViewById(R.id.peertube_like_count);
peertube_dislike_count = findViewById(R.id.peertube_dislike_count);
peertube_share = findViewById(R.id.peertube_share);
@ -283,6 +288,34 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
}
}
});
SQLiteDatabase db = Sqlite.getInstance(PeertubeActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
List<Peertube> peertubes = new PeertubeFavoritesDAO(PeertubeActivity.this, db).getSinglePeertube(peertube);
Drawable img;
if( peertubes == null || peertubes.size() == 0)
img = ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_bookmark_peertube_border);
else
img = ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_bookmark_peertube);
peertube_bookmark.setCompoundDrawablesWithIntrinsicBounds(null, img, null, null);
peertube_bookmark.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List<Peertube> peertubes = new PeertubeFavoritesDAO(PeertubeActivity.this, db).getSinglePeertube(peertube);
if( peertubes == null || peertubes.size() == 0){
new PeertubeFavoritesDAO(PeertubeActivity.this, db).insert(peertube);
Toast.makeText(PeertubeActivity.this,R.string.bookmark_add_peertube, Toast.LENGTH_SHORT).show();
}else{
new PeertubeFavoritesDAO(PeertubeActivity.this, db).remove(peertube);
Toast.makeText(PeertubeActivity.this,R.string.bookmark_remove_peertube, Toast.LENGTH_SHORT).show();
}
if( peertubes != null && peertubes.size() > 0) //Was initially in cache
peertube_bookmark.setCompoundDrawablesWithIntrinsicBounds( null, ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_bookmark_peertube_border), null ,null);
else
peertube_bookmark.setCompoundDrawablesWithIntrinsicBounds( null, ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_bookmark_peertube), null ,null);
}
});
peertube_share.setOnClickListener(new View.OnClickListener() {
@Override

View File

@ -30,6 +30,7 @@ import fr.gouv.etalab.mastodon.helper.FilterToots;
import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsInterface;
import fr.gouv.etalab.mastodon.sqlite.InstancesDAO;
import fr.gouv.etalab.mastodon.sqlite.PeertubeFavoritesDAO;
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
import fr.gouv.etalab.mastodon.sqlite.StatusCacheDAO;
@ -68,6 +69,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
CONTEXT,
TAG,
CACHE_BOOKMARKS,
CACHE_BOOKMARKS_PEERTUBE,
CACHE_STATUS,
REMOTE_INSTANCE
}
@ -179,6 +181,12 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
List<fr.gouv.etalab.mastodon.client.Entities.Status> statuses = new StatusCacheDAO(contextReference.get(), db).getAllStatus(StatusCacheDAO.BOOKMARK_CACHE);
apiResponse.setStatuses(statuses);
break;
case CACHE_BOOKMARKS_PEERTUBE:
apiResponse = new APIResponse();
db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
List<Peertube> peertubes = new PeertubeFavoritesDAO(contextReference.get(), db).getAllPeertube();
apiResponse.setPeertubes(peertubes);
break;
case CACHE_STATUS:
apiResponse = new APIResponse();
db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();

View File

@ -616,7 +616,6 @@ public class API {
try {
HttpsConnection httpsConnection = new HttpsConnection(context);
String response = httpsConnection.get("https://"+instance+"/api/v1/videos", 60, params, null);
Helper.largeLog(response);
JSONArray jsonArray = new JSONObject(response).getJSONArray("data");
peertubes = parsePeertube(instance, jsonArray);
} catch (HttpsConnection.HttpsConnectionException e) {
@ -2386,10 +2385,11 @@ public class API {
* @param resobj JSONObject
* @return Peertube
*/
private static Peertube parsePeertube(Context context, String instance, JSONObject resobj){
public static Peertube parsePeertube(Context context, String instance, JSONObject resobj){
Peertube peertube = new Peertube();
try {
peertube.setId(resobj.get("id").toString());
peertube.setCache(resobj);
peertube.setUuid(resobj.get("uuid").toString());
peertube.setName(resobj.get("name").toString());
peertube.setDescription(resobj.get("description").toString());
@ -2425,6 +2425,7 @@ public class API {
peertube.setId(resobj.get("id").toString());
peertube.setUuid(resobj.get("uuid").toString());
peertube.setName(resobj.get("name").toString());
peertube.setCache(resobj);
peertube.setInstance(instance);
peertube.setHost(resobj.getJSONObject("account").get("host").toString());
peertube.setDescription(resobj.get("description").toString());

View File

@ -14,6 +14,8 @@
* see <http://www.gnu.org/licenses>. */
package fr.gouv.etalab.mastodon.client.Entities;
import org.json.JSONObject;
import java.util.Date;
import java.util.List;
@ -40,7 +42,7 @@ public class Peertube {
private Account account;
private List<String> resolution;
private boolean commentsEnabled;
private JSONObject cache;
public Peertube() {
}
@ -207,4 +209,12 @@ public class Peertube {
public void setCommentsEnabled(boolean commentsEnabled) {
this.commentsEnabled = commentsEnabled;
}
public JSONObject getCache() {
return cache;
}
public void setCache(JSONObject cache) {
this.cache = cache;
}
}

View File

@ -0,0 +1,148 @@
package fr.gouv.etalab.mastodon.fragments;
/* Copyright 2017 Thomas Schneider
*
* This file is a part of Mastalab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Mastalab; if not,
* see <http://www.gnu.org/licenses>. */
import android.content.Context;
import android.content.DialogInterface;
import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import java.util.ArrayList;
import java.util.List;
import fr.gouv.etalab.mastodon.R;
import fr.gouv.etalab.mastodon.activities.MainActivity;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveFeedsAsyncTask;
import fr.gouv.etalab.mastodon.client.APIResponse;
import fr.gouv.etalab.mastodon.client.Entities.Peertube;
import fr.gouv.etalab.mastodon.drawers.PeertubeAdapter;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsInterface;
import fr.gouv.etalab.mastodon.sqlite.PeertubeFavoritesDAO;
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
import fr.gouv.etalab.mastodon.sqlite.StatusCacheDAO;
/**
* Created by Thomas on 21/10/2018.
* Fragment to display bookmarks for Peertube
*/
public class DisplayFavoritesPeertubeFragment extends Fragment implements OnRetrieveFeedsInterface {
private Context context;
private List<Peertube> peertubes;
private PeertubeAdapter peertubeAdapter;
private RelativeLayout textviewNoAction;
private RelativeLayout mainLoader;
private RecyclerView lv_status;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_peertube_favourites, container, false);
context = getContext();
lv_status = rootView.findViewById(R.id.lv_status);
mainLoader = rootView.findViewById(R.id.loader);
textviewNoAction = rootView.findViewById(R.id.no_action);
mainLoader.setVisibility(View.VISIBLE);
return rootView;
}
@Override
public void onCreate(Bundle saveInstance)
{
super.onCreate(saveInstance);
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
this.context = context;
}
@Override
public void onResume() {
super.onResume();
new RetrieveFeedsAsyncTask(context, RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS_PEERTUBE, null, DisplayFavoritesPeertubeFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@Override
public void onRetrieveFeeds(APIResponse apiResponse) {
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
mainLoader.setVisibility(View.GONE);
FloatingActionButton delete_all = null;
try {
delete_all = ((MainActivity) context).findViewById(R.id.delete_all);
}catch (Exception ignored){}
peertubes = apiResponse.getPeertubes();
if( peertubes != null && peertubes.size() > 0) {
LinearLayoutManager mLayoutManager = new LinearLayoutManager(context);
peertubeAdapter = new PeertubeAdapter(context, peertubes.get(0).getInstance(), this.peertubes);
lv_status.setAdapter(peertubeAdapter);
lv_status.setLayoutManager(mLayoutManager);
textviewNoAction.setVisibility(View.GONE);
lv_status.setVisibility(View.VISIBLE);
}else {
textviewNoAction.setVisibility(View.VISIBLE);
lv_status.setVisibility(View.GONE);
}
if( delete_all != null)
delete_all.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.delete_all);
builder.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogConfirm, int which) {
new PeertubeFavoritesDAO(context, db).removeAll();
peertubes = new ArrayList<>();
peertubes.clear();
peertubeAdapter = new PeertubeAdapter(context,null, peertubes);
lv_status.setAdapter(peertubeAdapter);
peertubeAdapter.notifyDataSetChanged();
textviewNoAction.setVisibility(View.VISIBLE);
dialogConfirm.dismiss();
}
})
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogConfirm, int which) {
dialogConfirm.dismiss();
}
})
.show();
}
});
}
}

View File

@ -0,0 +1,146 @@
package fr.gouv.etalab.mastodon.sqlite;
/* Copyright 2018 Thomas Schneider
*
* This file is a part of Mastalab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Mastalab; if not,
* see <http://www.gnu.org/licenses>. */
import android.content.ContentValues;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import fr.gouv.etalab.mastodon.client.API;
import fr.gouv.etalab.mastodon.client.Entities.Peertube;
import fr.gouv.etalab.mastodon.helper.Helper;
/**
* Created by Thomas on 21/10/2018.
* Manage Peertube favorites
*/
public class PeertubeFavoritesDAO {
private SQLiteDatabase db;
public Context context;
public PeertubeFavoritesDAO(Context context, SQLiteDatabase db) {
//Creation of the DB with tables
this.context = context;
this.db = db;
}
//------- INSERTIONS -------
/**
* Insert a status in database
* @param peertube Peertube
* @return boolean
*/
public long insert(Peertube peertube) {
ContentValues values = new ContentValues();
values.put(Sqlite.COL_UUID, peertube.getUuid());
values.put(Sqlite.COL_INSTANCE, peertube.getInstance());
values.put(Sqlite.COL_DATE, Helper.dateToString(new Date()));
values.put(Sqlite.COL_CACHE, peertube.getCache().toString());
//Inserts cached peertube
long last_id;
try{
last_id = db.insert(Sqlite.TABLE_PEERTUBE_FAVOURITES, null, values);
}catch (Exception e) {
last_id = -1;
}
return last_id;
}
//------- REMOVE -------
/***
* Remove stored status
* @return int
*/
public int remove(Peertube peertube){
return db.delete(Sqlite.TABLE_PEERTUBE_FAVOURITES, Sqlite.COL_UUID + " = \""+ peertube.getUuid() +"\" AND " + Sqlite.COL_INSTANCE + " = \"" + peertube.getInstance() + "\"", null);
}
/***
* Remove stored status
* @return int
*/
public int removeAll(){
return db.delete(Sqlite.TABLE_PEERTUBE_FAVOURITES, null, null);
}
//------- GETTERS -------
/**
* Returns all cached Peertube
* @return stored peertube List<Peertube>
*/
public List<Peertube> getAllPeertube(){
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
try {
Cursor c = db.query(Sqlite.TABLE_PEERTUBE_FAVOURITES, null, null, null, null, null, Sqlite.COL_DATE+ " DESC");
return cursorToListPeertube(c);
} catch (Exception e) {
return null;
}
}
/**
* Returns a cached Peertube
* @return stored peertube List<Peertube>
*/
public List<Peertube> getSinglePeertube(Peertube peertube){
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
try {
Cursor c = db.query(Sqlite.TABLE_PEERTUBE_FAVOURITES, null, Sqlite.COL_UUID + " = \""+ peertube.getUuid() +"\" AND " + Sqlite.COL_INSTANCE + " = \"" + peertube.getInstance() + "\"", null, null, null, Sqlite.COL_DATE+ " DESC");
return cursorToListPeertube(c);
} catch (Exception e) {
return null;
}
}
/***
* Method to hydrate cached statuses from database
* @param c Cursor
* @return List<Peertube>
*/
private List<Peertube> cursorToListPeertube(Cursor c){
//No element found
if (c.getCount() == 0)
return null;
List<Peertube> peertubes = new ArrayList<>();
while (c.moveToNext() ) {
//Restore cached status
try {
Peertube peertube = API.parsePeertube(context, c.getString(c.getColumnIndex(Sqlite.COL_INSTANCE)), new JSONObject(c.getString(c.getColumnIndex(Sqlite.COL_CACHE))));
peertubes.add(peertube);
} catch (JSONException e) {
e.printStackTrace();
}
}
//Close the cursor
c.close();
//Peertubes list is returned
return peertubes;
}
}

View File

@ -26,7 +26,7 @@ import android.database.sqlite.SQLiteOpenHelper;
public class Sqlite extends SQLiteOpenHelper {
public static final int DB_VERSION = 14;
public static final int DB_VERSION = 15;
public static final String DB_NAME = "mastodon_etalab_db";
public static SQLiteDatabase db;
private static Sqlite sInstance;
@ -52,6 +52,9 @@ public class Sqlite extends SQLiteOpenHelper {
//Table for instance names
static final String TABLE_INSTANCES = "INSTANCES";
//Table for peertube favorites
static final String TABLE_PEERTUBE_FAVOURITES = "PEERTUBE_FAVOURITES";
static final String COL_USER_ID = "USER_ID";
static final String COL_USERNAME = "USERNAME";
static final String COL_ACCT = "ACCT";
@ -166,6 +169,18 @@ public class Sqlite extends SQLiteOpenHelper {
+ COL_INSTANCE + " TEXT NOT NULL, " + COL_USER_ID + " TEXT NOT NULL, " + COL_INSTANCE_TYPE + " TEXT, " + COL_DATE_CREATION + " TEXT NOT NULL)";
static final String COL_UUID = "UUID";
static final String COL_CACHE = "CACHE";
static final String COL_DATE = "DATE";
private final String CREATE_TABLE_PEERTUBE_FAVOURITES = "CREATE TABLE "
+ TABLE_PEERTUBE_FAVOURITES + "("
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ COL_UUID + " TEXT NOT NULL, "
+ COL_INSTANCE + " TEXT NOT NULL, "
+ COL_CACHE + " TEXT NOT NULL, "
+ COL_DATE + " TEXT NOT NULL)";
public Sqlite(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
}
@ -189,6 +204,7 @@ public class Sqlite extends SQLiteOpenHelper {
db.execSQL(CREATE_TABLE_STATUSES_CACHE);
db.execSQL(CREATE_UNIQUE_CACHE_INDEX);
db.execSQL(CREATE_TABLE_INSTANCES);
db.execSQL(CREATE_TABLE_PEERTUBE_FAVOURITES);
}
@Override
@ -228,6 +244,8 @@ public class Sqlite extends SQLiteOpenHelper {
db.execSQL("ALTER TABLE " + TABLE_USER_ACCOUNT + " ADD COLUMN "+ COL_EMOJIS + " TEXT");
case 13:
db.execSQL("ALTER TABLE " + TABLE_INSTANCES + " ADD COLUMN "+ COL_INSTANCE_TYPE + " TEXT");
case 14:
db.execSQL(CREATE_TABLE_PEERTUBE_FAVOURITES);
default:
break;
}

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#606984"
android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#606984"
android:pathData="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

View File

@ -121,6 +121,20 @@
android:text="0"
android:layout_height="wrap_content"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/peertube_bookmark"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:drawableTop="@drawable/ic_bookmark_peertube_border"
android:drawablePadding="5dp"
android:layout_width="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:text=""
android:layout_height="wrap_content"
/>
<LinearLayout
android:layout_weight="1"
android:layout_width="0dp"

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Thomas Schneider
This file is a part of Mastalab
This program is free software; you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with Mastalab; if not,
see <http://www.gnu.org/licenses>.
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingLeft="@dimen/fab_margin"
android:paddingRight="@dimen/fab_margin"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Listview Peertube bookmark -->
<android.support.v7.widget.RecyclerView
android:id="@+id/lv_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
/>
<RelativeLayout
android:id="@+id/no_action"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:padding="10dp"
android:gravity="center"
android:textSize="25sp"
android:layout_gravity="center"
android:textStyle="italic|bold"
android:typeface="serif"
android:text="@string/bookmark_peertube_empty"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
<!-- Main Loader -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loader"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
</RelativeLayout>
</RelativeLayout>

View File

@ -31,6 +31,10 @@
android:id="@+id/nav_bookmarks"
android:icon="@drawable/ic_bookmark"
android:title="@string/bookmarks" />
<item
android:id="@+id/nav_peertube"
android:icon="@drawable/ic_favorite_peertube_full"
android:title="@string/peertube_favorites" />
<item
android:id="@+id/nav_filters"
android:icon="@drawable/ic_filter"

View File

@ -642,6 +642,10 @@
<string name="add_remote_instance">Add an instance</string>
<string name="comment_no_allowed_peertube">Comments are not enabled on this video!</string>
<string name="pickup_resolution">Pick up a resolution</string>
<string name="peertube_favorites">Peertube favourites</string>
<string name="bookmark_add_peertube">The video has been added to bookmarks!</string>
<string name="bookmark_remove_peertube">The video has been removed from bookmarks!</string>
<string name="bookmark_peertube_empty">There is no Peertube videos in your favourites!</string>
<string-array name="filter_expire">
<item>Never</item>