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"
minSdkVersion 15
targetSdkVersion 25
versionCode 32
versionName "0.9.5"
versionCode 33
versionName "0.9.6"
}
buildTypes {
release {

View File

@ -40,6 +40,7 @@ import java.util.List;
*/
@SuppressWarnings("WeakerAccess")
class ActionBarHandler {
private static final String TAG = "ActionBarHandler";
@ -103,6 +104,10 @@ class ActionBarHandler {
defaultPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
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));
}

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 RESOLUTIONS_MENU_UPDATE_FLAG = 0x2;
private static final int TOOLBAR_ITEMS_UPDATE_FLAG = 0x4;
private int updateFlags = 0;
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 & RESOLUTIONS_MENU_UPDATE_FLAG) != 0) setupActionBarHandler(currentStreamInfo);
}
if ((updateFlags & TOOLBAR_ITEMS_UPDATE_FLAG) != 0 && actionBarHandler != null) actionBarHandler.updateItemsVisibility();
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.show_higher_resolutions_key))) {
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 (simpleExoPlayer != null) simpleExoPlayer.setVolume(DUCK_AUDIO_TO);
animateAudio(DUCK_AUDIO_TO, 1f, DUCK_DURATION);
simpleExoPlayer.setPlayWhenReady(true);
}
protected void onAudioFocusLoss() {

View File

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

View File

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

View File

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

View File

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