Merge branch 'gradle-app-id-suffix' of github.com:Stypox/NewPipe into gradle-app-id-suffix
This commit is contained in:
commit
3434ff4d45
|
@ -453,15 +453,9 @@ public class MainActivity extends AppCompatActivity {
|
||||||
NavigationHelper.openMainActivity(this);
|
NavigationHelper.openMainActivity(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sharedPreferences.getBoolean(Constants.KEY_ENABLE_WATCH_HISTORY, true)) {
|
final boolean isHistoryEnabled = sharedPreferences.getBoolean(
|
||||||
if (DEBUG) Log.d(TAG, "do not show History-menu as its disabled in settings");
|
getString(R.string.enable_watch_history_key), true);
|
||||||
drawerItems.getMenu().findItem(ITEM_ID_HISTORY).setVisible(true);
|
drawerItems.getMenu().findItem(ITEM_ID_HISTORY).setVisible(isHistoryEnabled);
|
||||||
}
|
|
||||||
|
|
||||||
if (!sharedPreferences.getBoolean(Constants.KEY_ENABLE_WATCH_HISTORY, true)) {
|
|
||||||
if (DEBUG) Log.d(TAG, "show History-menu as its enabled in settings");
|
|
||||||
drawerItems.getMenu().findItem(ITEM_ID_HISTORY).setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -88,13 +88,6 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
|
||||||
getMenuInflater().inflate(R.menu.menu_about, menu);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import android.view.MenuItem;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
import org.schabi.newpipe.util.NavigationHelper;
|
||||||
import org.schabi.newpipe.util.ThemeHelper;
|
import org.schabi.newpipe.util.ThemeHelper;
|
||||||
|
|
||||||
import us.shandian.giga.service.DownloadManagerService;
|
import us.shandian.giga.service.DownloadManagerService;
|
||||||
|
@ -76,11 +77,9 @@ public class DownloadActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case android.R.id.home: {
|
case android.R.id.home:
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -600,22 +600,27 @@ public class VideoDetailFragment
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (isLoading.get()) {
|
int id = item.getItemId();
|
||||||
// if is still loading block menu
|
if (id == R.id.action_settings) {
|
||||||
|
NavigationHelper.openSettings(requireContext());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isLoading.get()) {
|
||||||
|
// if still loading, block menu buttons related to video info
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int id = item.getItemId();
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case R.id.menu_item_share: {
|
case R.id.menu_item_share: {
|
||||||
if (currentInfo != null) {
|
if (currentInfo != null) {
|
||||||
ShareUtils.shareUrl(this.getContext(), currentInfo.getName(), currentInfo.getOriginalUrl());
|
ShareUtils.shareUrl(requireContext(), currentInfo.getName(), currentInfo.getOriginalUrl());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case R.id.menu_item_openInBrowser: {
|
case R.id.menu_item_openInBrowser: {
|
||||||
if (currentInfo != null) {
|
if (currentInfo != null) {
|
||||||
ShareUtils.openUrlInBrowser(this.getContext(), currentInfo.getOriginalUrl());
|
ShareUtils.openUrlInBrowser(requireContext(), currentInfo.getOriginalUrl());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,17 +175,20 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
case R.id.action_settings:
|
||||||
|
NavigationHelper.openSettings(requireContext());
|
||||||
|
break;
|
||||||
case R.id.menu_item_rss:
|
case R.id.menu_item_rss:
|
||||||
openRssFeed();
|
openRssFeed();
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_openInBrowser:
|
case R.id.menu_item_openInBrowser:
|
||||||
if (currentInfo != null) {
|
if (currentInfo != null) {
|
||||||
ShareUtils.openUrlInBrowser(this.getContext(), currentInfo.getOriginalUrl());
|
ShareUtils.openUrlInBrowser(requireContext(), currentInfo.getOriginalUrl());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_share:
|
case R.id.menu_item_share:
|
||||||
if (currentInfo != null) {
|
if (currentInfo != null) {
|
||||||
ShareUtils.shareUrl(this.getContext(), name, currentInfo.getOriginalUrl());
|
ShareUtils.shareUrl(requireContext(), name, currentInfo.getOriginalUrl());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -222,11 +222,14 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
case R.id.action_settings:
|
||||||
|
NavigationHelper.openSettings(requireContext());
|
||||||
|
break;
|
||||||
case R.id.menu_item_openInBrowser:
|
case R.id.menu_item_openInBrowser:
|
||||||
ShareUtils.openUrlInBrowser(this.getContext(), url);
|
ShareUtils.openUrlInBrowser(requireContext(), url);
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_share:
|
case R.id.menu_item_share:
|
||||||
ShareUtils.shareUrl(this.getContext(), name, url);
|
ShareUtils.shareUrl(requireContext(), name, url);
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_bookmark:
|
case R.id.menu_item_bookmark:
|
||||||
onBookmarkClicked();
|
onBookmarkClicked();
|
||||||
|
|
|
@ -55,7 +55,13 @@ public final class BackgroundPlayerActivity extends ServicePlayerActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return switchTo(PopupVideoPlayer.class);
|
this.player.setRecovery();
|
||||||
|
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
|
||||||
|
getApplicationContext().startService(
|
||||||
|
getSwitchIntent(PopupVideoPlayer.class)
|
||||||
|
.putExtra(BasePlayer.START_PAUSED, !this.player.isPlaying())
|
||||||
|
);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,13 @@ public final class PopupVideoPlayerActivity extends ServicePlayerActivity {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPlayerOptionSelected(MenuItem item) {
|
public boolean onPlayerOptionSelected(MenuItem item) {
|
||||||
if (item.getItemId() == R.id.action_switch_background) {
|
if (item.getItemId() == R.id.action_switch_background) {
|
||||||
return switchTo(BackgroundPlayer.class);
|
this.player.setRecovery();
|
||||||
|
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
|
||||||
|
getApplicationContext().startService(
|
||||||
|
getSwitchIntent(BackgroundPlayer.class)
|
||||||
|
.putExtra(BasePlayer.START_PAUSED, !this.player.isPlaying())
|
||||||
|
);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,6 +156,9 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.action_settings:
|
||||||
|
NavigationHelper.openSettings(this);
|
||||||
|
return true;
|
||||||
case R.id.action_append_playlist:
|
case R.id.action_append_playlist:
|
||||||
appendAllToPlaylist();
|
appendAllToPlaylist();
|
||||||
return true;
|
return true;
|
||||||
|
@ -163,7 +166,13 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
||||||
startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS));
|
startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS));
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_switch_main:
|
case R.id.action_switch_main:
|
||||||
return switchTo(MainVideoPlayer.class);
|
this.player.setRecovery();
|
||||||
|
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
|
||||||
|
getApplicationContext().startActivity(
|
||||||
|
getSwitchIntent(MainVideoPlayer.class)
|
||||||
|
.putExtra(BasePlayer.START_PAUSED, !this.player.isPlaying())
|
||||||
|
);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return onPlayerOptionSelected(item) || super.onOptionsItemSelected(item);
|
return onPlayerOptionSelected(item) || super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
@ -190,13 +199,6 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
||||||
.putExtra(BasePlayer.START_PAUSED, !this.player.isPlaying());
|
.putExtra(BasePlayer.START_PAUSED, !this.player.isPlaying());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean switchTo(final Class clazz) {
|
|
||||||
this.player.setRecovery();
|
|
||||||
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
|
|
||||||
getApplicationContext().startActivity(getSwitchIntent(clazz));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Service Connection
|
// Service Connection
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -7,6 +7,8 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
@ -219,13 +221,23 @@ public class PlaybackParameterDialog extends DialogFragment {
|
||||||
private void setupHookingControl(@NonNull View rootView) {
|
private void setupHookingControl(@NonNull View rootView) {
|
||||||
unhookingCheckbox = rootView.findViewById(R.id.unhookCheckbox);
|
unhookingCheckbox = rootView.findViewById(R.id.unhookCheckbox);
|
||||||
if (unhookingCheckbox != null) {
|
if (unhookingCheckbox != null) {
|
||||||
unhookingCheckbox.setChecked(pitch != tempo);
|
// restore whether pitch and tempo are unhooked or not
|
||||||
|
unhookingCheckbox.setChecked(PreferenceManager.getDefaultSharedPreferences(getContext())
|
||||||
|
.getBoolean(getString(R.string.playback_unhook_key), true));
|
||||||
|
|
||||||
unhookingCheckbox.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
unhookingCheckbox.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||||
if (isChecked) return;
|
// save whether pitch and tempo are unhooked or not
|
||||||
// When unchecked, slide back to the minimum of current tempo or pitch
|
PreferenceManager.getDefaultSharedPreferences(getContext())
|
||||||
|
.edit()
|
||||||
|
.putBoolean(getString(R.string.playback_unhook_key), isChecked)
|
||||||
|
.apply();
|
||||||
|
|
||||||
|
if (!isChecked) {
|
||||||
|
// when unchecked, slide back to the minimum of current tempo or pitch
|
||||||
final double minimum = Math.min(getCurrentPitch(), getCurrentTempo());
|
final double minimum = Math.min(getCurrentPitch(), getCurrentTempo());
|
||||||
setSliders(minimum);
|
setSliders(minimum);
|
||||||
setCurrentPlaybackParameters();
|
setCurrentPlaybackParameters();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,5 @@ public class Constants {
|
||||||
public static final String KEY_THEME_CHANGE = "key_theme_change";
|
public static final String KEY_THEME_CHANGE = "key_theme_change";
|
||||||
public static final String KEY_MAIN_PAGE_CHANGE = "key_main_page_change";
|
public static final String KEY_MAIN_PAGE_CHANGE = "key_main_page_change";
|
||||||
|
|
||||||
public static final String KEY_ENABLE_WATCH_HISTORY = "enable_watch_history";
|
|
||||||
|
|
||||||
public static final int NO_SERVICE_ID = -1;
|
public static final int NO_SERVICE_ID = -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,4 @@
|
||||||
android:icon="?attr/ic_delete"
|
android:icon="?attr/ic_delete"
|
||||||
android:title="@string/clear_download_history"
|
android:title="@string/clear_download_history"
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="ifRoom" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<menu 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"
|
|
||||||
tools:context="org.schabi.newpipe.about.AboutActivity">
|
|
||||||
|
|
||||||
</menu>
|
|
|
@ -4,11 +4,6 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:context=".fragments.list.impl.ChannelFragment">
|
tools:context=".fragments.list.impl.ChannelFragment">
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/menu_item_openInBrowser"
|
|
||||||
android:title="@string/open_in_browser"
|
|
||||||
app:showAsAction="never"/>
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_item_rss"
|
android:id="@+id/menu_item_rss"
|
||||||
android:icon="?attr/rss"
|
android:icon="?attr/rss"
|
||||||
|
@ -22,4 +17,16 @@
|
||||||
android:icon="?attr/share"
|
android:icon="?attr/share"
|
||||||
android:title="@string/share"
|
android:title="@string/share"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_settings"
|
||||||
|
android:orderInCategory="1"
|
||||||
|
android:title="@string/settings"
|
||||||
|
app:showAsAction="never"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_item_openInBrowser"
|
||||||
|
android:orderInCategory="2"
|
||||||
|
android:title="@string/open_in_browser"
|
||||||
|
app:showAsAction="never"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -10,13 +10,18 @@
|
||||||
android:visible="true"
|
android:visible="true"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
|
||||||
|
<item android:id="@+id/action_settings"
|
||||||
|
android:orderInCategory="1"
|
||||||
|
android:title="@string/settings"
|
||||||
|
app:showAsAction="never"/>
|
||||||
|
|
||||||
<item android:id="@+id/action_system_audio"
|
<item android:id="@+id/action_system_audio"
|
||||||
android:orderInCategory="996"
|
android:orderInCategory="2"
|
||||||
android:title="@string/play_queue_audio_settings"
|
android:title="@string/play_queue_audio_settings"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
|
|
||||||
<item android:id="@+id/action_switch_main"
|
<item android:id="@+id/action_switch_main"
|
||||||
android:orderInCategory="999"
|
android:orderInCategory="3"
|
||||||
android:title="@string/switch_to_main"
|
android:title="@string/switch_to_main"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -3,11 +3,6 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/menu_item_openInBrowser"
|
|
||||||
android:title="@string/open_in_browser"
|
|
||||||
app:showAsAction="never"/>
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_item_share"
|
android:id="@+id/menu_item_share"
|
||||||
android:icon="?attr/share"
|
android:icon="?attr/share"
|
||||||
|
@ -21,4 +16,16 @@
|
||||||
android:visible="true"
|
android:visible="true"
|
||||||
app:showAsAction="ifRoom"
|
app:showAsAction="ifRoom"
|
||||||
tools:visible="true"/>
|
tools:visible="true"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_settings"
|
||||||
|
android:orderInCategory="1"
|
||||||
|
android:title="@string/settings"
|
||||||
|
app:showAsAction="never"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_item_openInBrowser"
|
||||||
|
android:orderInCategory="2"
|
||||||
|
android:title="@string/open_in_browser"
|
||||||
|
app:showAsAction="never"/>
|
||||||
</menu>
|
</menu>
|
|
@ -14,8 +14,15 @@
|
||||||
android:title="@string/share"
|
android:title="@string/share"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_settings"
|
||||||
|
android:orderInCategory="1"
|
||||||
|
android:title="@string/settings"
|
||||||
|
app:showAsAction="never"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_item_openInBrowser"
|
android:id="@+id/menu_item_openInBrowser"
|
||||||
|
android:orderInCategory="2"
|
||||||
android:title="@string/open_in_browser"
|
android:title="@string/open_in_browser"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -175,6 +175,7 @@
|
||||||
<string name="main_page_content_key" translatable="false">main_page_content</string>
|
<string name="main_page_content_key" translatable="false">main_page_content</string>
|
||||||
<string name="enable_playback_resume_key" translatable="false">enable_playback_resume</string>
|
<string name="enable_playback_resume_key" translatable="false">enable_playback_resume</string>
|
||||||
<string name="enable_playback_state_lists_key" translatable="false">enable_playback_state_lists</string>
|
<string name="enable_playback_state_lists_key" translatable="false">enable_playback_state_lists</string>
|
||||||
|
<string name="playback_unhook_key" translatable="false">playback_unhook_key</string>
|
||||||
|
|
||||||
<string name="app_language_key" translatable="false">app_language_key</string>
|
<string name="app_language_key" translatable="false">app_language_key</string>
|
||||||
<string name="enable_lock_screen_video_thumbnail_key" translatable="false">enable_lock_screen_video_thumbnail</string>
|
<string name="enable_lock_screen_video_thumbnail_key" translatable="false">enable_lock_screen_video_thumbnail</string>
|
||||||
|
|
|
@ -491,7 +491,7 @@
|
||||||
<string name="playback_speed_control">Playback Speed Controls</string>
|
<string name="playback_speed_control">Playback Speed Controls</string>
|
||||||
<string name="playback_tempo">Tempo</string>
|
<string name="playback_tempo">Tempo</string>
|
||||||
<string name="playback_pitch">Pitch</string>
|
<string name="playback_pitch">Pitch</string>
|
||||||
<string name="unhook_checkbox">Unlink (may cause distortion)</string>
|
<string name="unhook_checkbox">Unhook (may cause distortion)</string>
|
||||||
<string name="skip_silence_checkbox">Fast-forward during silence</string>
|
<string name="skip_silence_checkbox">Fast-forward during silence</string>
|
||||||
<string name="playback_step">Step</string>
|
<string name="playback_step">Step</string>
|
||||||
<string name="playback_reset">Reset</string>
|
<string name="playback_reset">Reset</string>
|
||||||
|
|
Loading…
Reference in New Issue