Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-05-19 03:46:42 +02:00
commit 7498dd3800
5 changed files with 32 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
@ -68,6 +69,7 @@ public class SearchFragment extends BaseFragment implements SuggestionWorker.OnS
private int serviceId = -1;
private String searchQuery = "";
private int pageNumber = 0;
private boolean showSuggestions = true;
private SearchWorker curSearchWorker;
private SuggestionWorker curSuggestionWorker;
@ -135,6 +137,8 @@ public class SearchFragment extends BaseFragment implements SuggestionWorker.OnS
if (pageNumber > 0) search(searchQuery, pageNumber);
else search(searchQuery, 0, true);
}
showSuggestions = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean(getString(R.string.show_search_suggestions_key), true);
}
@Override
@ -523,6 +527,11 @@ public class SearchFragment extends BaseFragment implements SuggestionWorker.OnS
}
private void searchSuggestions(String query) {
if (!showSuggestions) {
if (DEBUG) Log.d(TAG, "searchSuggestions() showSuggestions is disabled");
return;
}
if (DEBUG) Log.d(TAG, "searchSuggestions() called with: query = [" + query + "]");
if (curSuggestionWorker != null && curSuggestionWorker.isRunning()) curSuggestionWorker.cancel();
curSuggestionWorker = SuggestionWorker.startForQuery(activity, serviceId, query, this);

View File

@ -449,6 +449,8 @@ public class MainVideoPlayer extends Activity {
return true;
}
private final boolean isGestureControlsEnabled = playerImpl.getSharedPreferences().getBoolean(getString(R.string.player_gesture_controls_key), true);
private final float stepsBrightness = 15, stepBrightness = (1f / stepsBrightness), minBrightness = .01f;
private float currentBrightness = .5f;
@ -466,6 +468,8 @@ public class MainVideoPlayer extends Activity {
// TODO: Improve video gesture controls
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
if (!isGestureControlsEnabled) return false;
//noinspection PointlessBooleanExpression
if (DEBUG && false) Log.d(TAG, "MainVideoPlayer.onScroll = " +
", e1.getRaw = [" + e1.getRawX() + ", " + e1.getRawY() + "]" +

View File

@ -13,6 +13,7 @@
<string name="use_external_audio_player_key" translatable="false">use_external_audio_player</string>
<string name="autoplay_through_intent_key" translatable="false">autoplay_through_intent</string>
<string name="use_old_player_key" translatable="false">use_oldplayer</string>
<string name="player_gesture_controls_key" translatable="false">player_gesture_controls</string>
<string name="default_resolution_key" translatable="false">default_resolution_preference</string>
<string name="default_resolution_value" translatable="false">360p</string>
@ -43,6 +44,7 @@
<item>3GPP</item>
</string-array>
<string name="show_search_suggestions_key" translatable="false">show_search_suggestions</string>
<string name="show_play_with_kodi_key" translatable="false">show_play_with_kodi</string>
<string name="theme_key" translatable="false">theme</string>

View File

@ -62,6 +62,10 @@
<string name="black_theme_title">Black</string>
<string name="popup_remember_size_pos_title">Remember popup size and position</string>
<string name="popup_remember_size_pos_summary">Remember the last size and position set to the popup</string>
<string name="player_gesture_controls_title">Player gesture controls</string>
<string name="player_gesture_controls_summary">Use gestures to control the brightness and volume of the player</string>
<string name="show_search_suggestions_title">Search suggestions</string>
<string name="show_search_suggestions_summary">Show suggestions when searching</string>
<string name="download_dialog_title">Download</string>
<string-array name="download_options">

View File

@ -56,6 +56,13 @@
android:title="@string/use_old_player_title"
android:summary="@string/use_old_player_summary"
android:defaultValue="false"/>
<CheckBoxPreference
android:key="@string/player_gesture_controls_key"
android:title="@string/player_gesture_controls_title"
android:summary="@string/player_gesture_controls_summary"
android:defaultValue="true"/>
</PreferenceCategory>
<PreferenceCategory
@ -148,6 +155,12 @@
android:summary="@string/autoplay_by_calling_app_summary"
android:defaultValue="false" />
<CheckBoxPreference
android:key="@string/show_search_suggestions_key"
android:title="@string/show_search_suggestions_title"
android:summary="@string/show_search_suggestions_summary"
android:defaultValue="true"/>
<!--
<CheckBoxPreference
android:key="@string/use_tor_key"