commit
4f5e1d2111
BIN
Screenshot1.png
Normal file
BIN
Screenshot1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 114 KiB |
BIN
Screenshot2.jpg
Normal file
BIN
Screenshot2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 95 KiB |
@ -6,8 +6,8 @@ android {
|
||||
applicationId "net.schueller.peertube"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
versionCode 1012
|
||||
versionName "1.0.12"
|
||||
versionCode 1013
|
||||
versionName "1.0.13"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
@ -23,6 +23,8 @@ import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
||||
|
||||
public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
|
||||
private static String previousThemeColorValue = "";
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
@ -33,6 +35,21 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private static String getSelectedColor(Context context, String colorId){
|
||||
|
||||
String res = "Color not found";
|
||||
String [ ] themeArray = context.getResources().getStringArray(R.array.themeValues);
|
||||
String [ ] colorArray = context.getResources().getStringArray(R.array.themeArray);
|
||||
|
||||
for (int i = 0 ; i < themeArray.length ; i++){
|
||||
if (themeArray[i].equals(colorId)){
|
||||
res = colorArray[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* A preference value change listener that updates the preference's summary
|
||||
* to reflect its new value.
|
||||
@ -45,6 +62,19 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
Toast.makeText(preference.getContext(), R.string.invalid_url, Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
// Check if Theme color has change & Provide selected color
|
||||
else if (preference.getKey().equals("pref_theme")) {
|
||||
|
||||
stringValue = getSelectedColor(preference.getContext(), stringValue);
|
||||
|
||||
if (!previousThemeColorValue.equals("") && !previousThemeColorValue.equals(stringValue)) {
|
||||
Toast.makeText(preference.getContext(), R.string.pref_description_app_theme, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
previousThemeColorValue = stringValue;
|
||||
preference.setSummary(stringValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
preference.setSummary(stringValue);
|
||||
|
||||
@ -96,7 +126,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
|
||||
setupActionBar();
|
||||
getFragmentManager().beginTransaction().replace(android.R.id.content, new GeneralPreferenceFragment()).commit();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -153,6 +182,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
// updated to reflect the new value, per the Android Design
|
||||
// guidelines.
|
||||
bindPreferenceSummaryToValue(findPreference("pref_api_base"));
|
||||
bindPreferenceSummaryToValue(findPreference("pref_theme"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,6 +20,7 @@ import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
@ -39,6 +40,7 @@ import com.google.android.exoplayer2.util.Util;
|
||||
import com.google.android.exoplayer2.video.VideoRendererEventListener;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import net.schueller.peertube.R;
|
||||
import net.schueller.peertube.fragment.VideoOptionsFragment;
|
||||
import net.schueller.peertube.helper.APIUrlHelper;
|
||||
import net.schueller.peertube.helper.MetaDataHelper;
|
||||
import net.schueller.peertube.intents.Intents;
|
||||
@ -241,6 +243,8 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
||||
TextView videoMeta = findViewById(R.id.videoMeta);
|
||||
ImageView avatarView = findViewById(R.id.avatar);
|
||||
ImageButton moreButton = findViewById(R.id.moreButton);
|
||||
ImageButton videoOptions = findViewById(R.id.exo_more);
|
||||
|
||||
|
||||
Video video = response.body();
|
||||
|
||||
@ -287,8 +291,18 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
||||
popup.show();
|
||||
});
|
||||
|
||||
// video player options
|
||||
videoOptions.setOnClickListener(v -> {
|
||||
|
||||
VideoOptionsFragment videoOptionsFragment =
|
||||
VideoOptionsFragment.newInstance(mService);
|
||||
videoOptionsFragment.show(getSupportFragmentManager(),
|
||||
"video_options_fragment");
|
||||
});
|
||||
|
||||
mService.setCurrentStreamUrl(video.getFiles().get(0).getFileUrl());
|
||||
|
||||
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
if (sharedPref.getBoolean("pref_torrent_player", false)) {
|
||||
|
||||
|
@ -0,0 +1,51 @@
|
||||
package net.schueller.peertube.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
|
||||
import net.schueller.peertube.R;
|
||||
import net.schueller.peertube.service.VideoPlayerService;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class VideoOptionsFragment extends BottomSheetDialogFragment {
|
||||
|
||||
private static VideoPlayerService videoPlayerService;
|
||||
|
||||
public static VideoOptionsFragment newInstance(VideoPlayerService mService) {
|
||||
videoPlayerService = mService;
|
||||
return new VideoOptionsFragment();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
|
||||
View view = inflater.inflate(R.layout.bottom_sheet_video_options_fragment, container,
|
||||
false);
|
||||
|
||||
// get the views and attach the listener
|
||||
|
||||
//Playback speed buttons
|
||||
TextView speed05 = view.findViewById(R.id.video_speed05);
|
||||
TextView speed10 = view.findViewById(R.id.video_speed10);
|
||||
TextView speed15 = view.findViewById(R.id.video_speed15);
|
||||
TextView speed20 = view.findViewById(R.id.video_speed20);
|
||||
|
||||
//Playback speed controls
|
||||
speed05.setOnClickListener(v -> videoPlayerService.setPlayBackSpeed(0.5f));
|
||||
speed10.setOnClickListener(v -> videoPlayerService.setPlayBackSpeed(1.0f));
|
||||
speed15.setOnClickListener(v -> videoPlayerService.setPlayBackSpeed(1.5f));
|
||||
speed20.setOnClickListener(v -> videoPlayerService.setPlayBackSpeed(2.0f));
|
||||
|
||||
return view;
|
||||
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@ import androidx.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.exoplayer2.ExoPlayerFactory;
|
||||
import com.google.android.exoplayer2.PlaybackParameters;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||
import com.google.android.exoplayer2.source.ExtractorMediaSource;
|
||||
@ -123,8 +124,14 @@ public class VideoPlayerService extends Service {
|
||||
currentStreamUrl = streamUrl;
|
||||
}
|
||||
|
||||
public void playVideo()
|
||||
{
|
||||
//Playback speed control
|
||||
public void setPlayBackSpeed(float speed) {
|
||||
|
||||
Log.v("VideoPlayerService", "setPlayBackSpeed...");
|
||||
player.setPlaybackParameters(new PlaybackParameters(speed));
|
||||
}
|
||||
|
||||
public void playVideo() {
|
||||
Context context = this;
|
||||
|
||||
Log.v("VideoPlayerService", "playVideo...");
|
||||
@ -143,6 +150,9 @@ public class VideoPlayerService extends Service {
|
||||
// Auto play
|
||||
player.setPlayWhenReady(true);
|
||||
|
||||
//reset playback speed
|
||||
this.setPlayBackSpeed(1.0f);
|
||||
|
||||
playerNotificationManager = PlayerNotificationManager.createWithNotificationChannel(
|
||||
context, PLAYBACK_CHANNEL_ID, R.string.playback_channel_name,
|
||||
PLAYBACK_NOTIFICATION_ID,
|
||||
|
@ -17,6 +17,7 @@
|
||||
android:id="@+id/video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:background="@color/videoBackgroundColor"
|
||||
|
||||
app:layout_constraintDimensionRatio="H,3:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@ -108,9 +109,10 @@
|
||||
android:layout_marginEnd="12dp"
|
||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
@ -0,0 +1,65 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@color/videoBackgroundColor"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_speed05"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="16sp"
|
||||
|
||||
android:text="@string/video_speed_05"
|
||||
android:textAllCaps="false"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_speed10"
|
||||
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="16sp"
|
||||
|
||||
android:textAllCaps="false"
|
||||
android:text="@string/video_speed_10"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_speed15"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="16sp"
|
||||
|
||||
android:text="@string/video_speed_15"
|
||||
android:textAllCaps="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_speed20"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="16sp"
|
||||
|
||||
android:text="@string/video_speed_20"
|
||||
android:textAllCaps="false" />
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -2,13 +2,44 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_gravity="center"
|
||||
android:layoutDirection="ltr"
|
||||
android:background="#CC000000"
|
||||
android:orientation="vertical"
|
||||
tools:targetApi="28">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="0dp"
|
||||
android:gravity="bottom"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageButton android:src="@drawable/ic_action_more_vert"
|
||||
android:id="@+id/exo_more"
|
||||
android:tint="#ffffff"
|
||||
android:background="@null"
|
||||
android:paddingTop="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -19,9 +50,6 @@
|
||||
<ImageButton android:id="@id/exo_rew"
|
||||
style="@style/ExoMediaButton.Rewind"/>
|
||||
|
||||
<ImageButton android:id="@id/exo_shuffle"
|
||||
style="@style/ExoMediaButton.Shuffle"/>
|
||||
|
||||
<ImageButton android:id="@id/exo_repeat_toggle"
|
||||
style="@style/ExoMediaButton"/>
|
||||
|
||||
@ -36,11 +64,18 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:gravity="bottom"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView android:id="@id/exo_position"
|
||||
@ -48,27 +83,43 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#FFBEBEBE"/>
|
||||
|
||||
<com.google.android.exoplayer2.ui.DefaultTimeBar
|
||||
android:id="@id/exo_progress"
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="26dp"/>
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView android:id="@id/exo_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#FFBEBEBE"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:gravity="bottom"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<com.google.android.exoplayer2.ui.DefaultTimeBar
|
||||
android:id="@id/exo_progress"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="26dp"
|
||||
app:played_color="?attr/colorPrimary"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
7
app/src/main/res/menu/menu_video_play_options.xml
Normal file
7
app/src/main/res/menu/menu_video_play_options.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/menu_video_playback_speed"
|
||||
android:icon="@drawable/ic_action_share"
|
||||
android:title="@string/menu_share" />
|
||||
</menu>
|
@ -59,5 +59,28 @@
|
||||
<string name="menu_share">Partager</string>
|
||||
<string name="playback_channel_name">PeerTube</string>
|
||||
<string name="invalid_url">URL invalide !</string>
|
||||
<string name="pref_title_dark_mode">Mode Sombre</string>
|
||||
<string name="pref_description_dark_mode">Relancez l\'application pour que le Mode Sombre soit activé</string>
|
||||
<string name="pref_title_app_theme">Thème de l\'Application</string>
|
||||
<string name="pref_description_app_theme">Relancez l\'application pour que le nouveau thème soit activé</string>
|
||||
|
||||
<string name="red">Rouge</string>
|
||||
<string name="pink">Rose</string>
|
||||
<string name="purple">Violet</string>
|
||||
<string name="deeppurple">Violet Foncé</string>
|
||||
<string name="indigo">Indigo</string>
|
||||
<string name="blue">Bleu</string>
|
||||
<string name="lightblue">Bleu Clair</string>
|
||||
<string name="cyan">Cyan</string>
|
||||
<string name="teal">Turquoise</string>
|
||||
<string name="green">Vert</string>
|
||||
<string name="lightgreen">Vert Clair</string>
|
||||
<string name="lime">Citron Vert</string>
|
||||
<string name="yellow">Jaune</string>
|
||||
<string name="amber">Ambre</string>
|
||||
<string name="orange">Orange</string>
|
||||
<string name="deeporange">Orange Foncé</string>
|
||||
<string name="brown">Brun</string>
|
||||
<string name="gray">Gris</string>
|
||||
<string name="bluegray">Bleu-Gris</string>
|
||||
</resources>
|
||||
|
@ -4,6 +4,7 @@
|
||||
<color name="themeDeselected">#d69b9b9b</color>
|
||||
<color name="themeSelected">#e300aaff</color>
|
||||
<color name="seperator">#7ca6a6a6</color>
|
||||
<color name="videoBackgroundColor">#000000</color>
|
||||
|
||||
|
||||
<!-- RED Theme -->
|
||||
|
@ -70,7 +70,7 @@
|
||||
<string name="purple">Purple</string>
|
||||
<string name="deeppurple">Deep Purple</string>
|
||||
<string name="indigo">Indigo</string>
|
||||
<string name="blue">Nlue</string>
|
||||
<string name="blue">Blue</string>
|
||||
<string name="lightblue">Light Blue</string>
|
||||
<string name="cyan">Cyan</string>
|
||||
<string name="teal">Teal</string>
|
||||
@ -84,5 +84,9 @@
|
||||
<string name="brown">Brown</string>
|
||||
<string name="gray">Gray</string>
|
||||
<string name="bluegray">Bluegray</string>
|
||||
<string name="video_speed_05">0.5x</string>
|
||||
<string name="video_speed_10">Normal</string>
|
||||
<string name="video_speed_15">1.5x</string>
|
||||
<string name="video_speed_20">2x</string>
|
||||
|
||||
</resources>
|
||||
|
@ -20,7 +20,7 @@
|
||||
android:title="@string/pref_title_app_theme"
|
||||
android:summary="@string/pref_description_app_theme"
|
||||
android:key="pref_theme"
|
||||
android:defaultValue="1"
|
||||
android:defaultValue="AppTheme.ORANGE"
|
||||
android:entries="@array/themeArray"
|
||||
android:entryValues="@array/themeValues" />
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user