Merge pull request #19 from sschueller/develop

Version 1.0.1-anlpha
This commit is contained in:
Stefan Schüller 2018-11-10 17:51:03 +01:00 committed by GitHub
commit 79ab5e55dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 84 additions and 22 deletions

View File

@ -1,13 +1,13 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
compileSdkVersion 28
defaultConfig {
applicationId "net.schueller.peertube"
minSdkVersion 23
targetSdkVersion 27
versionCode 100
versionName "1.0.0"
targetSdkVersion 28
versionCode 101
versionName "1.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
@ -20,16 +20,20 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
applicationVariants.all { variant ->
variant.resValue "string", "versionName", variant.versionName
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
@ -39,7 +43,7 @@ dependencies {
implementation 'com.google.code.gson:gson:2.8.2'
// implementation 'org.webrtc:google-webrtc:1.0.+'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.blackboardtheory:android-iconify-fontawesome:3.0.1-SNAPSHOT'
@ -50,7 +54,7 @@ dependencies {
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

View File

@ -61,6 +61,7 @@ public class VideoListActivity extends AppCompatActivity {
private int count = 12;
private String sort = "-createdAt";
private String filter = "";
private String nsfw = "false";
private boolean isLoading = false;
@ -107,8 +108,7 @@ public class VideoListActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_list);
//SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
filter = ""; //"nsfw:" + sharedPref.getBoolean("pref_show_nsfw", true);
filter = "";
// Init icons
Iconify.with(new FontAwesomeModule());
@ -237,15 +237,18 @@ public class VideoListActivity extends AppCompatActivity {
isLoading = true;
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
nsfw = sharedPref.getBoolean("pref_show_nsfw", true) ? "both" : "false";
String apiBaseURL = APIUrlHelper.getUrl(this);
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL + "/api/v1/").create(GetVideoDataService.class);
Call<VideoList> call = service.getVideosData(start, count, sort, filter);
Call<VideoList> call = service.getVideosData(start, count, sort, nsfw);
/*Log the URL called*/
Log.d("URL Called", call.request().url() + "");
Toast.makeText(VideoListActivity.this, "URL Called: " + call.request().url(), Toast.LENGTH_SHORT).show();
// Toast.makeText(VideoListActivity.this, "URL Called: " + call.request().url(), Toast.LENGTH_SHORT).show();
call.enqueue(new Callback<VideoList>() {
@Override
@ -255,7 +258,9 @@ public class VideoListActivity extends AppCompatActivity {
videoAdapter.clearData();
}
videoAdapter.setData(response.body().getVideoArrayList());
if (response.body() != null) {
videoAdapter.setData(response.body().getVideoArrayList());
}
isLoading = false;
swipeRefreshLayout.setRefreshing(false);
}

View File

@ -2,6 +2,7 @@ package net.schueller.peertube.activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
@ -11,7 +12,12 @@ import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
@ -216,6 +222,41 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
TextView nameView = findViewById(R.id.name);
TextView videoMetaView = findViewById(R.id.videoMeta);
TextView descriptionView = findViewById(R.id.description);
// Checking the orientation of the screen
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) simpleExoPlayerView.getLayoutParams();
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
simpleExoPlayerView.setLayoutParams(params);
nameView.setVisibility(View.GONE);
videoMetaView.setVisibility(View.GONE);
descriptionView.setVisibility(View.GONE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) simpleExoPlayerView.getLayoutParams();
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
simpleExoPlayerView.setLayoutParams(params);
nameView.setVisibility(View.VISIBLE);
videoMetaView.setVisibility(View.VISIBLE);
descriptionView.setVisibility(View.VISIBLE);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
@Override
public void onVideoEnabled(DecoderCounters counters) {

View File

@ -20,7 +20,7 @@ public class BottomNavigationViewHelper {
for (int i = 0; i < menuView.getChildCount(); i++) {
BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i);
//noinspection RestrictedApi
item.setShiftingMode(false);
//item.setShiftingMode(false);
// set once again checked value, so view will be updated
//noinspection RestrictedApi
item.setChecked(item.getItemData().isChecked());

View File

@ -14,7 +14,8 @@ public interface GetVideoDataService {
@Query("start") int start,
@Query("count") int count,
@Query("sort") String sort,
@Query("filter") String filter
@Query("nsfw") String nsfw
//@Query("filter") String filter
);
@GET("videos/{id}")

View File

@ -39,7 +39,7 @@
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"

View File

@ -51,5 +51,8 @@
<string name="title_activity_url_video_play">UrlVideoPlayActivity</string>
<string name="pref_title_torrent_player">Torrent Video Player</string>
<string name="pref_description_torrent_player">Videos playback via a torrent stream</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_title_version">Version</string>
</resources>

View File

@ -22,5 +22,13 @@
android:summary="@string/pref_description_torrent_player"
android:defaultValue="false" />
<Preference
android:title="@string/pref_title_version"
android:summary="@string/versionName" />
<Preference
android:title="@string/pref_title_license"
android:summary="@string/pref_description_license" />
</PreferenceScreen>

View File

@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong

View File

@ -1,6 +1,6 @@
#Sun Jul 01 13:53:14 CEST 2018
#Wed Nov 07 22:40:24 CET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip