commit
9ceed22423
@ -6,8 +6,8 @@ android {
|
|||||||
applicationId "net.schueller.peertube"
|
applicationId "net.schueller.peertube"
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 101
|
versionCode 103
|
||||||
versionName "1.0.1"
|
versionName "1.0.3"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@ -45,6 +45,10 @@ dependencies {
|
|||||||
// implementation 'org.webrtc:google-webrtc:1.0.+'
|
// implementation 'org.webrtc:google-webrtc:1.0.+'
|
||||||
implementation 'com.android.support:design:28.0.0'
|
implementation 'com.android.support:design:28.0.0'
|
||||||
|
|
||||||
|
// BottomNavigationViewEx -> https://github.com/ittianyu/BottomNavigationViewEx
|
||||||
|
implementation 'com.github.ittianyu:BottomNavigationViewEx:2.0.2'
|
||||||
|
|
||||||
|
|
||||||
implementation 'com.blackboardtheory:android-iconify-fontawesome:3.0.1-SNAPSHOT'
|
implementation 'com.blackboardtheory:android-iconify-fontawesome:3.0.1-SNAPSHOT'
|
||||||
|
|
||||||
implementation 'com.github.TorrentStream:TorrentStream-Android:2.5.0'
|
implementation 'com.github.TorrentStream:TorrentStream-Android:2.5.0'
|
||||||
|
@ -1,40 +1,68 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="net.schueller.peertube">
|
package="net.schueller.peertube">
|
||||||
|
|
||||||
|
<!-- connect to peertube server -->
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
<!-- To auto-complete the email text field in the login form with the user's emails -->
|
<!-- required for torrent downloading -->
|
||||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
|
||||||
<uses-permission android:name="android.permission.READ_PROFILE" />
|
|
||||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
tools:ignore="GoogleAppIndexingWarning"
|
||||||
|
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity android:name=".activity.VideoListActivity">
|
|
||||||
|
<meta-data android:name="android.app.default_searchable"
|
||||||
|
android:value=".activity.SearchActivity" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".activity.VideoListActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".activity.SearchActivity"
|
||||||
|
android:label="@string/title_activity_search"
|
||||||
|
android:launchMode="singleTop">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SEARCH" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.searchable"
|
||||||
|
android:resource="@xml/searchable" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.LoginActivity"
|
android:name=".activity.LoginActivity"
|
||||||
android:label="@string/title_activity_login" />
|
android:label="@string/title_activity_login" />
|
||||||
<activity
|
<activity
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
|
|
||||||
android:launchMode="singleTop"
|
|
||||||
android:name=".activity.VideoPlayActivity"
|
android:name=".activity.VideoPlayActivity"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
|
||||||
android:label="@string/title_activity_video_play"
|
android:label="@string/title_activity_video_play"
|
||||||
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/AppTheme" />
|
android:theme="@style/AppTheme" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.SettingsActivity"
|
android:name=".activity.SettingsActivity"
|
||||||
android:label="@string/title_activity_settings" />
|
android:label="@string/title_activity_settings" />
|
||||||
|
|
||||||
|
<!-- Content provider for search suggestions -->
|
||||||
|
<provider android:name=".provider.SearchSuggestionsProvider"
|
||||||
|
android:enabled="true"
|
||||||
|
android:authorities="net.schueller.peertube.provider.SearchSuggestionsProvider"
|
||||||
|
android:exported="false" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -0,0 +1,177 @@
|
|||||||
|
package net.schueller.peertube.activity;
|
||||||
|
|
||||||
|
import android.app.SearchManager;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.provider.SearchRecentSuggestions;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import net.schueller.peertube.R;
|
||||||
|
import net.schueller.peertube.adapter.VideoAdapter;
|
||||||
|
import net.schueller.peertube.helper.APIUrlHelper;
|
||||||
|
import net.schueller.peertube.model.VideoList;
|
||||||
|
import net.schueller.peertube.network.GetVideoDataService;
|
||||||
|
import net.schueller.peertube.network.RetrofitInstance;
|
||||||
|
import net.schueller.peertube.provider.SearchSuggestionsProvider;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
// TODO: cleanup, this code partially is duplicated from VideoList Activity and should be seperated out
|
||||||
|
|
||||||
|
public class SearchActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private VideoAdapter videoAdapter;
|
||||||
|
private SwipeRefreshLayout swipeRefreshLayout;
|
||||||
|
|
||||||
|
private int currentStart = 0;
|
||||||
|
private int count = 12;
|
||||||
|
private String sort = "-match";
|
||||||
|
private String filter = "";
|
||||||
|
|
||||||
|
private boolean isLoading = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_search);
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
|
||||||
|
// do search
|
||||||
|
handleIntent(intent);
|
||||||
|
|
||||||
|
// handle search suggestions
|
||||||
|
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||||
|
String query = intent.getStringExtra(SearchManager.QUERY);
|
||||||
|
SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
|
||||||
|
SearchSuggestionsProvider.AUTHORITY,
|
||||||
|
SearchSuggestionsProvider.MODE);
|
||||||
|
// Save recent searches
|
||||||
|
suggestions.saveRecentQuery(query, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createList(String query) {
|
||||||
|
RecyclerView recyclerView = findViewById(R.id.recyclerView);
|
||||||
|
swipeRefreshLayout = findViewById(R.id.swipeRefreshLayout);
|
||||||
|
|
||||||
|
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(SearchActivity.this);
|
||||||
|
recyclerView.setLayoutManager(layoutManager);
|
||||||
|
|
||||||
|
videoAdapter = new VideoAdapter(new ArrayList<>(), SearchActivity.this);
|
||||||
|
recyclerView.setAdapter(videoAdapter);
|
||||||
|
|
||||||
|
loadVideos(currentStart, count, sort, query, filter);
|
||||||
|
|
||||||
|
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||||
|
super.onScrollStateChanged(recyclerView, newState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
|
|
||||||
|
if (dy > 0) {
|
||||||
|
// is at end of list?
|
||||||
|
if(!recyclerView.canScrollVertically(RecyclerView.FOCUS_DOWN)){
|
||||||
|
if (!isLoading) {
|
||||||
|
currentStart = currentStart + count;
|
||||||
|
loadVideos(currentStart, count, sort, query, filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
swipeRefreshLayout.setOnRefreshListener(() -> {
|
||||||
|
// Refresh items
|
||||||
|
if (!isLoading) {
|
||||||
|
currentStart = 0;
|
||||||
|
loadVideos(currentStart, count, sort, query, filter);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void loadVideos(int start, int count, String sort, String search, String filter) {
|
||||||
|
|
||||||
|
isLoading = true;
|
||||||
|
|
||||||
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
String nsfw = sharedPref.getBoolean("pref_show_nsfw", false) ? "both" : "false";
|
||||||
|
|
||||||
|
String apiBaseURL = APIUrlHelper.getUrl(this);
|
||||||
|
|
||||||
|
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL + "/api/v1/").create(GetVideoDataService.class);
|
||||||
|
|
||||||
|
Call<VideoList> call = service.searchVideosData(start, count, sort, nsfw, search);
|
||||||
|
|
||||||
|
/*Log the URL called*/
|
||||||
|
Log.d("URL Called", call.request().url() + "");
|
||||||
|
// Toast.makeText(VideoListActivity.this, "URL Called: " + call.request().url(), Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
call.enqueue(new Callback<VideoList>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<VideoList> call, @NonNull Response<VideoList> response) {
|
||||||
|
|
||||||
|
if (currentStart == 0) {
|
||||||
|
videoAdapter.clearData();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.body() != null) {
|
||||||
|
videoAdapter.setData(response.body().getVideoArrayList());
|
||||||
|
}
|
||||||
|
isLoading = false;
|
||||||
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<VideoList> call, @NonNull Throwable t) {
|
||||||
|
Log.wtf("err", t.fillInStackTrace());
|
||||||
|
Toast.makeText(SearchActivity.this, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
|
||||||
|
isLoading = false;
|
||||||
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
setIntent(intent);
|
||||||
|
handleIntent(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleIntent(Intent intent) {
|
||||||
|
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||||
|
String query = intent.getStringExtra(SearchManager.QUERY);
|
||||||
|
Log.v("Search Activity", query);
|
||||||
|
createList(query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onSearchRequested() {
|
||||||
|
Bundle appData = new Bundle();
|
||||||
|
startSearch(null, false, appData, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -7,8 +7,8 @@ import android.content.SharedPreferences;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.BottomNavigationView;
|
|
||||||
import android.support.v4.app.ActivityCompat;
|
import android.support.v4.app.ActivityCompat;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -26,6 +26,7 @@ import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
|
|||||||
import com.google.android.gms.common.GooglePlayServicesRepairableException;
|
import com.google.android.gms.common.GooglePlayServicesRepairableException;
|
||||||
import com.google.android.gms.common.GooglePlayServicesUtil;
|
import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||||
import com.google.android.gms.security.ProviderInstaller;
|
import com.google.android.gms.security.ProviderInstaller;
|
||||||
|
import com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx;
|
||||||
import com.joanzapata.iconify.IconDrawable;
|
import com.joanzapata.iconify.IconDrawable;
|
||||||
import com.joanzapata.iconify.Iconify;
|
import com.joanzapata.iconify.Iconify;
|
||||||
import com.joanzapata.iconify.fonts.FontAwesomeIcons;
|
import com.joanzapata.iconify.fonts.FontAwesomeIcons;
|
||||||
@ -34,7 +35,6 @@ import com.joanzapata.iconify.fonts.FontAwesomeModule;
|
|||||||
import net.schueller.peertube.R;
|
import net.schueller.peertube.R;
|
||||||
import net.schueller.peertube.adapter.VideoAdapter;
|
import net.schueller.peertube.adapter.VideoAdapter;
|
||||||
import net.schueller.peertube.helper.APIUrlHelper;
|
import net.schueller.peertube.helper.APIUrlHelper;
|
||||||
import net.schueller.peertube.helper.BottomNavigationViewHelper;
|
|
||||||
import net.schueller.peertube.model.VideoList;
|
import net.schueller.peertube.model.VideoList;
|
||||||
import net.schueller.peertube.network.GetVideoDataService;
|
import net.schueller.peertube.network.GetVideoDataService;
|
||||||
import net.schueller.peertube.network.RetrofitInstance;
|
import net.schueller.peertube.network.RetrofitInstance;
|
||||||
@ -53,19 +53,16 @@ public class VideoListActivity extends AppCompatActivity {
|
|||||||
public static final String EXTRA_VIDEOID = "VIDEOID ";
|
public static final String EXTRA_VIDEOID = "VIDEOID ";
|
||||||
|
|
||||||
private VideoAdapter videoAdapter;
|
private VideoAdapter videoAdapter;
|
||||||
private RecyclerView recyclerView;
|
|
||||||
private SwipeRefreshLayout swipeRefreshLayout;
|
private SwipeRefreshLayout swipeRefreshLayout;
|
||||||
private Toolbar toolbar;
|
|
||||||
|
|
||||||
private int currentStart = 0;
|
private int currentStart = 0;
|
||||||
private int count = 12;
|
private int count = 12;
|
||||||
private String sort = "-createdAt";
|
private String sort = "-createdAt";
|
||||||
private String filter = "";
|
private String filter = "";
|
||||||
private String nsfw = "false";
|
|
||||||
|
|
||||||
private boolean isLoading = false;
|
private boolean isLoading = false;
|
||||||
|
|
||||||
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
private BottomNavigationViewEx.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||||
= item -> {
|
= item -> {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.navigation_home:
|
case R.id.navigation_home:
|
||||||
@ -82,20 +79,20 @@ public class VideoListActivity extends AppCompatActivity {
|
|||||||
//Log.v(TAG, "navigation_trending");
|
//Log.v(TAG, "navigation_trending");
|
||||||
|
|
||||||
if (!isLoading) {
|
if (!isLoading) {
|
||||||
sort = "-views";
|
sort = "-trending";
|
||||||
currentStart = 0;
|
currentStart = 0;
|
||||||
loadVideos(currentStart, count, sort, filter);
|
loadVideos(currentStart, count, sort, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case R.id.navigation_subscriptions:
|
case R.id.navigation_subscriptions:
|
||||||
Log.v(TAG, "navigation_subscriptions");
|
//Log.v(TAG, "navigation_subscriptions");
|
||||||
Toast.makeText(VideoListActivity.this, "Subscriptions Not Implemented", Toast.LENGTH_SHORT).show();
|
Toast.makeText(VideoListActivity.this, "Subscriptions Not Implemented", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case R.id.navigation_account:
|
case R.id.navigation_account:
|
||||||
Log.v(TAG, "navigation_account");
|
//Log.v(TAG, "navigation_account");
|
||||||
Toast.makeText(VideoListActivity.this, "Account Not Implemented", Toast.LENGTH_SHORT).show();
|
Toast.makeText(VideoListActivity.this, "Account Not Implemented", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -114,7 +111,7 @@ public class VideoListActivity extends AppCompatActivity {
|
|||||||
Iconify.with(new FontAwesomeModule());
|
Iconify.with(new FontAwesomeModule());
|
||||||
|
|
||||||
// Attaching the layout to the toolbar object
|
// Attaching the layout to the toolbar object
|
||||||
toolbar = findViewById(R.id.tool_bar);
|
Toolbar toolbar = findViewById(R.id.tool_bar);
|
||||||
// Setting toolbar as the ActionBar with setSupportActionBar() call
|
// Setting toolbar as the ActionBar with setSupportActionBar() call
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
@ -122,7 +119,12 @@ public class VideoListActivity extends AppCompatActivity {
|
|||||||
updateAndroidSecurityProvider(this);
|
updateAndroidSecurityProvider(this);
|
||||||
|
|
||||||
// Bottom Navigation
|
// Bottom Navigation
|
||||||
BottomNavigationView navigation = findViewById(R.id.navigation);
|
BottomNavigationViewEx navigation = findViewById(R.id.navigation);
|
||||||
|
|
||||||
|
navigation.enableAnimation(false);
|
||||||
|
navigation.enableShiftingMode(false);
|
||||||
|
navigation.enableItemShiftingMode(false);
|
||||||
|
|
||||||
Menu navMenu = navigation.getMenu();
|
Menu navMenu = navigation.getMenu();
|
||||||
navMenu.findItem(R.id.navigation_home).setIcon(
|
navMenu.findItem(R.id.navigation_home).setIcon(
|
||||||
new IconDrawable(this, FontAwesomeIcons.fa_home));
|
new IconDrawable(this, FontAwesomeIcons.fa_home));
|
||||||
@ -133,8 +135,6 @@ public class VideoListActivity extends AppCompatActivity {
|
|||||||
navMenu.findItem(R.id.navigation_account).setIcon(
|
navMenu.findItem(R.id.navigation_account).setIcon(
|
||||||
new IconDrawable(this, FontAwesomeIcons.fa_user_circle));
|
new IconDrawable(this, FontAwesomeIcons.fa_user_circle));
|
||||||
|
|
||||||
BottomNavigationViewHelper.removeShiftMode(navigation);
|
|
||||||
|
|
||||||
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||||
|
|
||||||
|
|
||||||
@ -172,8 +172,8 @@ public class VideoListActivity extends AppCompatActivity {
|
|||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
// action with ID action_refresh was selected
|
// action with ID action_refresh was selected
|
||||||
case R.id.action_search:
|
case R.id.action_search:
|
||||||
// TODO: implement
|
//Toast.makeText(this, "Search Selected", Toast.LENGTH_SHORT).show();
|
||||||
Toast.makeText(this, "Search Selected", Toast.LENGTH_SHORT).show();
|
onSearchRequested();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
case R.id.action_settings:
|
case R.id.action_settings:
|
||||||
@ -190,7 +190,7 @@ public class VideoListActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createList() {
|
private void createList() {
|
||||||
recyclerView = findViewById(R.id.recyclerView);
|
RecyclerView recyclerView = findViewById(R.id.recyclerView);
|
||||||
swipeRefreshLayout = findViewById(R.id.swipeRefreshLayout);
|
swipeRefreshLayout = findViewById(R.id.swipeRefreshLayout);
|
||||||
|
|
||||||
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(VideoListActivity.this);
|
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(VideoListActivity.this);
|
||||||
@ -203,12 +203,12 @@ public class VideoListActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||||
super.onScrollStateChanged(recyclerView, newState);
|
super.onScrollStateChanged(recyclerView, newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
|
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
// is at end of list?
|
// is at end of list?
|
||||||
@ -238,7 +238,7 @@ public class VideoListActivity extends AppCompatActivity {
|
|||||||
isLoading = true;
|
isLoading = true;
|
||||||
|
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
nsfw = sharedPref.getBoolean("pref_show_nsfw", true) ? "both" : "false";
|
String nsfw = sharedPref.getBoolean("pref_show_nsfw", false) ? "both" : "false";
|
||||||
|
|
||||||
String apiBaseURL = APIUrlHelper.getUrl(this);
|
String apiBaseURL = APIUrlHelper.getUrl(this);
|
||||||
|
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
package net.schueller.peertube.helper;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.support.design.internal.BottomNavigationItemView;
|
|
||||||
import android.support.design.internal.BottomNavigationMenuView;
|
|
||||||
import android.support.design.widget.BottomNavigationView;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
public class BottomNavigationViewHelper {
|
|
||||||
@SuppressLint("RestrictedApi")
|
|
||||||
public static void removeShiftMode(BottomNavigationView view) {
|
|
||||||
BottomNavigationMenuView menuView = (BottomNavigationMenuView) view.getChildAt(0);
|
|
||||||
try {
|
|
||||||
Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
|
|
||||||
shiftingMode.setAccessible(true);
|
|
||||||
shiftingMode.setBoolean(menuView, false);
|
|
||||||
shiftingMode.setAccessible(false);
|
|
||||||
for (int i = 0; i < menuView.getChildCount(); i++) {
|
|
||||||
BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i);
|
|
||||||
//noinspection RestrictedApi
|
|
||||||
//item.setShiftingMode(false);
|
|
||||||
// set once again checked value, so view will be updated
|
|
||||||
//noinspection RestrictedApi
|
|
||||||
item.setChecked(item.getItemData().isChecked());
|
|
||||||
}
|
|
||||||
} catch (NoSuchFieldException e) {
|
|
||||||
Log.e("BottomNav", "Unable to get shift mode field", e);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
Log.e("BottomNav", "Unable to change value of shift mode", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -23,12 +23,13 @@ public interface GetVideoDataService {
|
|||||||
@Path(value = "id", encoded = true) String id
|
@Path(value = "id", encoded = true) String id
|
||||||
);
|
);
|
||||||
|
|
||||||
@GET("videos/search/")
|
@GET("search/videos/")
|
||||||
Call<VideoList> searchVideosData(
|
Call<VideoList> searchVideosData(
|
||||||
@Query("start") int start,
|
@Query("start") int start,
|
||||||
@Query("count") int count,
|
@Query("count") int count,
|
||||||
@Query("sort") String sort,
|
@Query("sort") String sort,
|
||||||
@Query("filter") String filter,
|
@Query("nsfw") String nsfw,
|
||||||
@Query("search") String search
|
@Query("search") String search
|
||||||
|
// @Query("filter") String filter
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package net.schueller.peertube.provider;
|
||||||
|
|
||||||
|
import android.content.SearchRecentSuggestionsProvider;
|
||||||
|
|
||||||
|
public class SearchSuggestionsProvider extends SearchRecentSuggestionsProvider {
|
||||||
|
|
||||||
|
public final static String AUTHORITY = SearchSuggestionsProvider.class.getName();
|
||||||
|
public static final int MODE = SearchRecentSuggestionsProvider.DATABASE_MODE_QUERIES;
|
||||||
|
|
||||||
|
public SearchSuggestionsProvider()
|
||||||
|
{
|
||||||
|
setupSuggestions(AUTHORITY, MODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: add search suggestions once they become available in peertube server
|
||||||
|
|
||||||
|
}
|
21
app/src/main/res/color/bottom_bar.xml
Normal file
21
app/src/main/res/color/bottom_bar.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:color="@color/colorAccent"
|
||||||
|
android:state_checked="true"
|
||||||
|
android:state_pressed="true"
|
||||||
|
android:state_focused="true"
|
||||||
|
android:state_selected="true"
|
||||||
|
android:state_checkable="true"
|
||||||
|
android:state_enabled="true"
|
||||||
|
/>
|
||||||
|
<item
|
||||||
|
android:color="@color/viewBg"
|
||||||
|
android:state_checked="false"
|
||||||
|
android:state_pressed="false"
|
||||||
|
android:state_focused="false"
|
||||||
|
android:state_selected="false"
|
||||||
|
android:state_checkable="false"
|
||||||
|
android:state_enabled="false"
|
||||||
|
/>
|
||||||
|
</selector>
|
18
app/src/main/res/drawable/ic_peertube.xml
Normal file
18
app/src/main/res/drawable/ic_peertube.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="16dp"
|
||||||
|
android:height="22dp"
|
||||||
|
android:viewportWidth="16"
|
||||||
|
android:viewportHeight="22">
|
||||||
|
<path
|
||||||
|
android:pathData="m0.0336,0.34v10.667l8,-5.333"
|
||||||
|
android:fillColor="#211f20"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m0.0336,11.007v10.667l8,-5.333"
|
||||||
|
android:fillColor="#737373"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m8.0336,5.673v10.667l8,-5.333"
|
||||||
|
android:fillColor="#f1680d"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M8.0336,16.34L8.0336,5.673L0.0336,11.007Z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
</vector>
|
38
app/src/main/res/layout/activity_search.xml
Normal file
38
app/src/main/res/layout/activity_search.xml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="net.schueller.peertube.activity.SearchActivity">
|
||||||
|
|
||||||
|
<android.support.design.widget.AppBarLayout
|
||||||
|
android:id="@+id/appbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||||
|
|
||||||
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
<android.support.v4.widget.SwipeRefreshLayout
|
||||||
|
android:id="@+id/swipeRefreshLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_below="@+id/appbar"
|
||||||
|
android:layout_weight="1"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
>
|
||||||
|
|
||||||
|
</android.support.v7.widget.RecyclerView>
|
||||||
|
|
||||||
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
|
|
@ -37,17 +37,19 @@
|
|||||||
|
|
||||||
</android.support.v4.widget.SwipeRefreshLayout>
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
<android.support.design.widget.BottomNavigationView
|
<com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
|
||||||
android:id="@+id/navigation"
|
android:id="@+id/navigation"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="0dp"
|
android:layout_marginEnd="0dp"
|
||||||
android:layout_marginStart="0dp"
|
android:layout_marginStart="0dp"
|
||||||
android:background="?android:attr/windowBackground"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
app:menu="@menu/menu_bottom"
|
app:menu="@menu/menu_bottom"
|
||||||
android:layout_gravity="bottom" />
|
app:itemIconTint="@color/bottom_bar"
|
||||||
|
android:background="?android:attr/windowBackground"
|
||||||
|
/>
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
@ -19,8 +19,10 @@
|
|||||||
android:id="@+id/thumb"
|
android:id="@+id/thumb"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:maxHeight="300dp"
|
||||||
android:contentDescription="@string/video_row_video_thumbnail"
|
android:contentDescription="@string/video_row_video_thumbnail"
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
<de.hdodenhof.circleimageview.CircleImageView
|
||||||
|
@ -1,44 +1,45 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Unused? delete? -->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<android.support.v7.widget.CardView
|
<!--<android.support.v7.widget.CardView-->
|
||||||
|
|
||||||
android:layout_margin="16dp"
|
<!--android:layout_margin="16dp"-->
|
||||||
android:layout_width="220dp"
|
<!--android:layout_width="220dp"-->
|
||||||
android:layout_gravity="center"
|
<!--android:layout_gravity="center"-->
|
||||||
android:layout_height="wrap_content">
|
<!--android:layout_height="wrap_content">-->
|
||||||
|
|
||||||
<LinearLayout
|
<!--<LinearLayout-->
|
||||||
android:id="@+id/linearLayout"
|
<!--android:id="@+id/linearLayout"-->
|
||||||
android:padding="8dp"
|
<!--android:padding="8dp"-->
|
||||||
android:layout_width="match_parent"
|
<!--android:layout_width="match_parent"-->
|
||||||
android:layout_height="wrap_content"
|
<!--android:layout_height="wrap_content"-->
|
||||||
android:orientation="vertical">
|
<!--android:orientation="vertical">-->
|
||||||
|
|
||||||
<ImageView
|
<!--<ImageView-->
|
||||||
android:id="@+id/thumb"
|
<!--android:id="@+id/thumb"-->
|
||||||
android:layout_margin="5dp"
|
<!--android:layout_margin="5dp"-->
|
||||||
android:layout_width="match_parent"
|
<!--android:layout_width="match_parent"-->
|
||||||
android:layout_height="wrap_content" />
|
<!--android:layout_height="wrap_content" />-->
|
||||||
<TextView
|
<!--<TextView-->
|
||||||
android:id="@+id/name"
|
<!--android:id="@+id/name"-->
|
||||||
android:layout_margin="5dp"
|
<!--android:layout_margin="5dp"-->
|
||||||
android:gravity="center"
|
<!--android:gravity="center"-->
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"
|
<!--android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"-->
|
||||||
android:layout_width="match_parent"
|
<!--android:layout_width="match_parent"-->
|
||||||
android:layout_height="wrap_content"
|
<!--android:layout_height="wrap_content"-->
|
||||||
android:text="username"/>
|
<!--android:text="username"/>-->
|
||||||
|
|
||||||
<TextView
|
<!--<TextView-->
|
||||||
android:id="@+id/description"
|
<!--android:id="@+id/description"-->
|
||||||
android:layout_width="match_parent"
|
<!--android:layout_width="match_parent"-->
|
||||||
android:layout_height="wrap_content"
|
<!--android:layout_height="wrap_content"-->
|
||||||
/>
|
<!--/>-->
|
||||||
|
|
||||||
</LinearLayout>
|
<!--</LinearLayout>-->
|
||||||
</android.support.v7.widget.CardView>
|
<!--</android.support.v7.widget.CardView>-->
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -42,7 +42,6 @@
|
|||||||
<string name="meta_data_owner_seperator">\@</string>
|
<string name="meta_data_owner_seperator">\@</string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<string name="video_row_video_thumbnail">Video Thumbnail</string>
|
<string name="video_row_video_thumbnail">Video Thumbnail</string>
|
||||||
<string name="video_row_account_avatar">Account Avatar</string>
|
<string name="video_row_account_avatar">Account Avatar</string>
|
||||||
|
|
||||||
@ -54,5 +53,7 @@
|
|||||||
<string name="pref_title_license">License</string>
|
<string name="pref_title_license">License</string>
|
||||||
<string name="pref_description_license">\n<b>GNU Affero General Public License v3.0</b>\n\nPermissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.</string>
|
<string name="pref_description_license">\n<b>GNU Affero General Public License v3.0</b>\n\nPermissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.</string>
|
||||||
<string name="pref_title_version">Version</string>
|
<string name="pref_title_version">Version</string>
|
||||||
|
<string name="search_hint">Search PeerTube</string>
|
||||||
|
<string name="title_activity_search">Search</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
7
app/src/main/res/xml/searchable.xml
Normal file
7
app/src/main/res/xml/searchable.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:hint="@string/search_hint"
|
||||||
|
android:searchSuggestAuthority="net.schueller.peertube.provider.SearchSuggestionsProvider"
|
||||||
|
android:searchSuggestSelection=" ? ">
|
||||||
|
</searchable>
|
Loading…
Reference in New Issue
Block a user