Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-05-14 21:46:25 +02:00
commit f2b38be2b0
9 changed files with 34 additions and 18 deletions

View File

@ -8,8 +8,8 @@ android {
applicationId "org.schabi.newpipe" applicationId "org.schabi.newpipe"
minSdkVersion 15 minSdkVersion 15
targetSdkVersion 25 targetSdkVersion 25
versionCode 32 versionCode 33
versionName "0.9.5" versionName "0.9.6"
} }
buildTypes { buildTypes {
release { release {

View File

@ -40,6 +40,7 @@ import java.util.List;
*/ */
@SuppressWarnings("WeakerAccess")
class ActionBarHandler { class ActionBarHandler {
private static final String TAG = "ActionBarHandler"; private static final String TAG = "ActionBarHandler";
@ -103,6 +104,10 @@ class ActionBarHandler {
defaultPreferences = PreferenceManager.getDefaultSharedPreferences(activity); defaultPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
inflater.inflate(R.menu.video_detail_menu, menu); inflater.inflate(R.menu.video_detail_menu, menu);
updateItemsVisibility();
}
public void updateItemsVisibility(){
showPlayWithKodiAction(defaultPreferences.getBoolean(activity.getString(R.string.show_play_with_kodi_key), false)); showPlayWithKodiAction(defaultPreferences.getBoolean(activity.getString(R.string.show_play_with_kodi_key), false));
} }

View File

@ -98,6 +98,7 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
private static final int RELATED_STREAMS_UPDATE_FLAG = 0x1; private static final int RELATED_STREAMS_UPDATE_FLAG = 0x1;
private static final int RESOLUTIONS_MENU_UPDATE_FLAG = 0x2; private static final int RESOLUTIONS_MENU_UPDATE_FLAG = 0x2;
private static final int TOOLBAR_ITEMS_UPDATE_FLAG = 0x4;
private int updateFlags = 0; private int updateFlags = 0;
private boolean autoPlayEnabled; private boolean autoPlayEnabled;
@ -219,6 +220,8 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
if ((updateFlags & RELATED_STREAMS_UPDATE_FLAG) != 0) initRelatedVideos(currentStreamInfo); if ((updateFlags & RELATED_STREAMS_UPDATE_FLAG) != 0) initRelatedVideos(currentStreamInfo);
if ((updateFlags & RESOLUTIONS_MENU_UPDATE_FLAG) != 0) setupActionBarHandler(currentStreamInfo); if ((updateFlags & RESOLUTIONS_MENU_UPDATE_FLAG) != 0) setupActionBarHandler(currentStreamInfo);
} }
if ((updateFlags & TOOLBAR_ITEMS_UPDATE_FLAG) != 0 && actionBarHandler != null) actionBarHandler.updateItemsVisibility();
updateFlags = 0; updateFlags = 0;
} }
@ -329,6 +332,8 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
|| key.equals(getString(R.string.default_resolution_key)) || key.equals(getString(R.string.default_resolution_key))
|| key.equals(getString(R.string.show_higher_resolutions_key))) { || key.equals(getString(R.string.show_higher_resolutions_key))) {
updateFlags |= RESOLUTIONS_MENU_UPDATE_FLAG; updateFlags |= RESOLUTIONS_MENU_UPDATE_FLAG;
} else if (key.equals(getString(R.string.show_play_with_kodi_key))) {
updateFlags |= TOOLBAR_ITEMS_UPDATE_FLAG;
} }
} }

View File

@ -320,7 +320,6 @@ public abstract class BasePlayer implements ExoPlayer.EventListener, AudioManage
if (DEBUG) Log.d(TAG, "onAudioFocusGain() called"); if (DEBUG) Log.d(TAG, "onAudioFocusGain() called");
if (simpleExoPlayer != null) simpleExoPlayer.setVolume(DUCK_AUDIO_TO); if (simpleExoPlayer != null) simpleExoPlayer.setVolume(DUCK_AUDIO_TO);
animateAudio(DUCK_AUDIO_TO, 1f, DUCK_DURATION); animateAudio(DUCK_AUDIO_TO, 1f, DUCK_DURATION);
simpleExoPlayer.setPlayWhenReady(true);
} }
protected void onAudioFocusLoss() { protected void onAudioFocusLoss() {

View File

@ -184,6 +184,7 @@ public class MainVideoPlayer extends Activity {
repeatButton.setAlpha(77); repeatButton.setAlpha(77);
} }
getRootView().setKeepScreenOn(true);
} }
@Override @Override
@ -308,12 +309,14 @@ public class MainVideoPlayer extends Activity {
super.onLoading(); super.onLoading();
playPauseButton.setImageResource(R.drawable.ic_pause_white); playPauseButton.setImageResource(R.drawable.ic_pause_white);
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100); animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100);
getRootView().setKeepScreenOn(true);
} }
@Override @Override
public void onBuffering() { public void onBuffering() {
super.onBuffering(); super.onBuffering();
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100); animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100);
getRootView().setKeepScreenOn(true);
} }
@Override @Override
@ -326,8 +329,8 @@ public class MainVideoPlayer extends Activity {
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, true, 200); animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, true, 200);
} }
}); });
showSystemUi(); showSystemUi();
getRootView().setKeepScreenOn(true);
} }
@Override @Override
@ -342,12 +345,14 @@ public class MainVideoPlayer extends Activity {
}); });
showSystemUi(); showSystemUi();
getRootView().setKeepScreenOn(false);
} }
@Override @Override
public void onPausedSeek() { public void onPausedSeek() {
super.onPausedSeek(); super.onPausedSeek();
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100); animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100);
getRootView().setKeepScreenOn(true);
} }
@ -365,6 +370,7 @@ public class MainVideoPlayer extends Activity {
} }
}); });
} }
getRootView().setKeepScreenOn(false);
super.onCompleted(); super.onCompleted();
} }

View File

@ -53,15 +53,17 @@ public class SettingsActivity extends AppCompatActivity {
actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayShowTitleEnabled(true);
} }
getFragmentManager().beginTransaction() if (savedInstanceBundle == null) {
.replace(R.id.fragment_holder, new SettingsFragment()) getFragmentManager().beginTransaction()
.commit(); .replace(R.id.fragment_holder, new SettingsFragment())
.commit();
}
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId(); int id = item.getItemId();
if(id == android.R.id.home) { if (id == android.R.id.home) {
finish(); finish();
} }
return true; return true;

View File

@ -5,8 +5,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@android:color/black" android:background="@android:color/black"
android:gravity="center" android:gravity="center">
android:keepScreenOn="true">
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout <com.google.android.exoplayer2.ui.AspectRatioFrameLayout
android:id="@+id/aspectRatioLayout" android:id="@+id/aspectRatioLayout"

View File

@ -8,20 +8,20 @@
android:title="@string/download" android:title="@string/download"
app:showAsAction="always"/> app:showAsAction="always"/>
<item
android:id="@+id/menu_item_share"
android:icon="?attr/share"
android:title="@string/share"
app:showAsAction="ifRoom"/>
<item <item
android:id="@+id/action_play_with_kodi" android:id="@+id/action_play_with_kodi"
android:icon="?attr/cast" android:icon="?attr/cast"
android:title="@string/play_with_kodi_title" android:title="@string/play_with_kodi_title"
app:showAsAction="ifRoom"/> app:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_item_share"
android:icon="?attr/share"
android:title="@string/share"
app:showAsAction="ifRoom"/>
<item <item
android:id="@+id/menu_item_openInBrowser" android:id="@+id/menu_item_openInBrowser"
android:title="@string/open_in_browser" android:title="@string/open_in_browser"
app:showAsAction="never"/> app:showAsAction="never"/>
</menu> </menu>

View File

@ -31,7 +31,7 @@
<string name="popup_remember_size_pos_key" translatable="false">popup_remember_size_pos_key</string> <string name="popup_remember_size_pos_key" translatable="false">popup_remember_size_pos_key</string>
<string name="default_popup_resolution_key" translatable="false">default_popup_resolution_key</string> <string name="default_popup_resolution_key" translatable="false">default_popup_resolution_key</string>
<string name="default_popup_resolution_value" translatable="false">480p</string> <string name="default_popup_resolution_value" translatable="false">360p</string>
<string name="show_higher_resolutions_key" translatable="false">show_higher_resolutions_key</string> <string name="show_higher_resolutions_key" translatable="false">show_higher_resolutions_key</string>