mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-25 04:22:30 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
23615a39ac
@ -8,8 +8,8 @@ android {
|
||||
applicationId "org.schabi.newpipe"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 27
|
||||
versionCode 41
|
||||
versionName "0.11.0"
|
||||
versionCode 42
|
||||
versionName "0.11.1"
|
||||
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
@ -52,7 +52,7 @@ dependencies {
|
||||
exclude module: 'support-annotations'
|
||||
}
|
||||
|
||||
implementation 'com.github.TeamNewPipe:NewPipeExtractor:b9d0941411'
|
||||
implementation 'com.github.TeamNewPipe:NewPipeExtractor:a5ba4828'
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'org.mockito:mockito-core:1.10.19'
|
||||
|
@ -135,8 +135,12 @@ public class AboutActivity extends AppCompatActivity {
|
||||
View githubLink = rootView.findViewById(R.id.github_link);
|
||||
githubLink.setOnClickListener(new OnGithubLinkClickListener());
|
||||
|
||||
View licenseLink = rootView.findViewById(R.id.app_read_license);
|
||||
licenseLink.setOnClickListener(new OnReadFullLicenseClickListener());
|
||||
View donationLink = rootView.findViewById(R.id.donation_link);
|
||||
donationLink.setOnClickListener(new OnDonationLinkClickListener());
|
||||
|
||||
View websiteLink = rootView.findViewById(R.id.website_link);
|
||||
websiteLink.setOnClickListener(new OnWebsiteLinkClickListener());
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@ -149,10 +153,21 @@ public class AboutActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private static class OnReadFullLicenseClickListener implements View.OnClickListener {
|
||||
private static class OnDonationLinkClickListener implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LicenseFragment.showLicense(v.getContext(), StandardLicenses.GPL3);
|
||||
public void onClick(final View view) {
|
||||
final Context context = view.getContext();
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(context.getString(R.string.donation_url)));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private static class OnWebsiteLinkClickListener implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
final Context context = view.getContext();
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(context.getString(R.string.website_url)));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,9 @@ public class LicenseFragment extends Fragment {
|
||||
View rootView = inflater.inflate(R.layout.fragment_licenses, container, false);
|
||||
ViewGroup softwareComponentsView = rootView.findViewById(R.id.software_components);
|
||||
|
||||
View licenseLink = rootView.findViewById(R.id.app_read_license);
|
||||
licenseLink.setOnClickListener(new OnReadFullLicenseClickListener());
|
||||
|
||||
for (final SoftwareComponent component : softwareComponents) {
|
||||
View componentView = inflater.inflate(R.layout.item_software_component, container, false);
|
||||
TextView softwareName = componentView.findViewById(R.id.name);
|
||||
@ -119,4 +122,11 @@ public class LicenseFragment extends Fragment {
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(componentLink));
|
||||
startActivity(browserIntent);
|
||||
}
|
||||
|
||||
private static class OnReadFullLicenseClickListener implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LicenseFragment.showLicense(v.getContext(), StandardLicenses.GPL3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,10 +116,7 @@ public class SubscriptionEntity {
|
||||
|
||||
@Ignore
|
||||
public ChannelInfoItem toChannelInfoItem() {
|
||||
ChannelInfoItem item = new ChannelInfoItem();
|
||||
item.url = getUrl();
|
||||
item.service_id = getServiceId();
|
||||
item.name = getName();
|
||||
ChannelInfoItem item = new ChannelInfoItem(getServiceId(), getUrl(), getName());
|
||||
item.thumbnail_url = getAvatarUrl();
|
||||
item.subscriber_count = getSubscriberCount();
|
||||
item.description = getDescription();
|
||||
|
@ -22,12 +22,15 @@ package org.schabi.newpipe.player;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
@ -81,6 +84,8 @@ public final class MainVideoPlayer extends Activity {
|
||||
private boolean activityPaused;
|
||||
private VideoPlayerImpl playerImpl;
|
||||
|
||||
private SharedPreferences defaultPreferences;
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// Activity LifeCycle
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
@ -89,6 +94,7 @@ public final class MainVideoPlayer extends Activity {
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (DEBUG) Log.d(TAG, "onCreate() called with: savedInstanceState = [" + savedInstanceState + "]");
|
||||
defaultPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
ThemeHelper.setTheme(this);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) getWindow().setStatusBarColor(Color.BLACK);
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
@ -99,6 +105,8 @@ public final class MainVideoPlayer extends Activity {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
showSystemUi();
|
||||
setContentView(R.layout.activity_main_player);
|
||||
playerImpl = new VideoPlayerImpl(this);
|
||||
@ -146,6 +154,11 @@ public final class MainVideoPlayer extends Activity {
|
||||
|
||||
activityPaused = false;
|
||||
}
|
||||
if(globalScreenOrientationLocked()) {
|
||||
boolean lastOrientationWasLandscape
|
||||
= defaultPreferences.getBoolean(getString(R.string.last_orientation_landscape_key), false);
|
||||
setLandScape(lastOrientationWasLandscape);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -198,11 +211,28 @@ public final class MainVideoPlayer extends Activity {
|
||||
}
|
||||
|
||||
private void toggleOrientation() {
|
||||
setRequestedOrientation(getResources().getDisplayMetrics().heightPixels > getResources().getDisplayMetrics().widthPixels
|
||||
setLandScape(!isLandScape());
|
||||
defaultPreferences.edit()
|
||||
.putBoolean(getString(R.string.last_orientation_landscape_key), !isLandScape())
|
||||
.apply();
|
||||
}
|
||||
|
||||
private boolean isLandScape() {
|
||||
return getResources().getDisplayMetrics().heightPixels < getResources().getDisplayMetrics().widthPixels;
|
||||
}
|
||||
|
||||
private void setLandScape(boolean v) {
|
||||
setRequestedOrientation(v
|
||||
? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
|
||||
: ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
||||
}
|
||||
|
||||
private boolean globalScreenOrientationLocked() {
|
||||
// 1: Screen orientation changes using acelerometer
|
||||
// 0: Screen orientatino is locked
|
||||
return !(android.provider.Settings.System.getInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 1);
|
||||
}
|
||||
|
||||
protected void setRepeatModeButton(final ImageButton imageButton, final int repeatMode) {
|
||||
switch (repeatMode) {
|
||||
case Player.REPEAT_MODE_OFF:
|
||||
|
@ -45,6 +45,7 @@
|
||||
android:id="@+id/app_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="@string/app_description" />
|
||||
|
||||
<TextView
|
||||
@ -60,7 +61,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/contribution_encouragement" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/github_link"
|
||||
style="@style/Base.Widget.AppCompat.Button.Borderless"
|
||||
@ -70,26 +70,46 @@
|
||||
android:text="@string/view_on_github" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_license_title"
|
||||
android:id="@+id/title_donate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dp"
|
||||
android:text="@string/app_license_title"
|
||||
android:text="@string/donation_title"
|
||||
android:textAppearance="@android:style/TextAppearance.Medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_license"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_license" />
|
||||
android:text="@string/donation_encouragement" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/app_read_license"
|
||||
android:id="@+id/donation_link"
|
||||
style="@style/Base.Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:text="@string/read_full_license" />
|
||||
android:text="@string/give_back" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_website"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dp"
|
||||
android:text="@string/website_title"
|
||||
android:textAppearance="@android:style/TextAppearance.Medium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/website_encouragement" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/website_link"
|
||||
style="@style/Base.Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:text="@string/open_in_browser" />
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
|
@ -11,12 +11,40 @@
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_license_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_vertical_margin"
|
||||
android:text="@string/app_license_title"
|
||||
android:textAppearance="@android:style/TextAppearance.Large" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_license"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
android:text="@string/app_license" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/app_read_license"
|
||||
style="@style/Base.Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/activity_vertical_margin"
|
||||
android:layout_gravity="end"
|
||||
android:text="@string/read_full_license" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingTop="10dp"
|
||||
android:text="@string/title_licenses"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
|
@ -75,6 +75,8 @@
|
||||
<item>@string/audio_webm_key</item>
|
||||
</string-array>
|
||||
|
||||
<string name="last_orientation_landscape_key" translatable="false">last_orientation_landscape_key</string>
|
||||
|
||||
<!-- THEMES -->
|
||||
<string name="theme_key" translatable="false">theme</string>
|
||||
<string name="light_theme_key" translatable="false">light_theme</string>
|
||||
|
@ -258,14 +258,22 @@
|
||||
<string name="tab_about">About</string>
|
||||
<string name="tab_contributors">Contributors</string>
|
||||
<string name="tab_licenses">Licenses</string>
|
||||
<string name="github_url" translatable="false">https://github.com/TeamNewPipe/NewPipe</string>
|
||||
<string name="app_description">A free lightweight YouTube frontend for Android.</string>
|
||||
<string name="app_license" translatable="false">NewPipe is Free Software: You can use, study share and improve it at your will. Specifically you can redistribute 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.</string>
|
||||
<string name="view_on_github">View on GitHub</string>
|
||||
<string name="app_license_title">NewPipe\'s License</string>
|
||||
<string name="contribution_title">Contribute</string>
|
||||
<string name="contribution_encouragement">Whether you have ideas of; translation, design changes, code cleaning, or real heavy code changes—help is always welcome. The more is done the better it gets!</string>
|
||||
<string name="github_url" translatable="false">https://github.com/TeamNewPipe/NewPipe</string>
|
||||
<string name="view_on_github">View on GitHub</string>
|
||||
<string name="donation_title">Donate</string>
|
||||
<string name="donation_encouragement">NewPipe gets developed by volunteers which spend their free time to bring the best experience to you. Now it is time to give back to make sure our developers can make NewPipe even more better while enjoying a cup of java!</string>
|
||||
<string name="donation_url" translatable="false">https://newpipe.schabi.org/donate</string>
|
||||
<string name="give_back">Give back</string>
|
||||
<string name="website_title">Website</string>
|
||||
<string name="website_encouragement">To get more information and the latest news about NewPipe visit our website.</string>
|
||||
<string name="website_url" translatable="false">https://newpipe.schabi.org/</string>
|
||||
<string name="app_license_title">NewPipe\'s License</string>
|
||||
<string name="app_license" translatable="false">NewPipe is Free Software: You can use, study share and improve it at your will. Specifically you can redistribute 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.</string>
|
||||
<string name="read_full_license">Read license</string>
|
||||
<string name="contribution_title">Contribution</string>
|
||||
|
||||
|
||||
<!-- History -->
|
||||
<string name="title_activity_history">History</string>
|
||||
|
Loading…
Reference in New Issue
Block a user