Built in player
This commit is contained in:
parent
dccfd0e1ae
commit
e514f57d90
|
@ -63,6 +63,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
public static String SET_BIBLIOGRAM_ENABLED = "set_bibliogram_enabled";
|
||||
public static String DEFAULT_BIBLIOGRAM_HOST = "bibliogram.art";
|
||||
public static String SET_GEO_URIS = "set_geo_uris";
|
||||
public static String SET_EMBEDDED_PLAYER = "set_embedded_player";
|
||||
//Supported domains
|
||||
public static String[] twitter_domains = {
|
||||
"twitter.com",
|
||||
|
@ -206,6 +207,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
boolean osm_enabled = sharedpreferences.getBoolean(SET_OSM_ENABLED, true);
|
||||
boolean bibliogram_enabled = sharedpreferences.getBoolean(SET_BIBLIOGRAM_ENABLED, true);
|
||||
boolean geouri_enabled = sharedpreferences.getBoolean(SET_GEO_URIS, false);
|
||||
boolean embedded_player = sharedpreferences.getBoolean(SET_EMBEDDED_PLAYER, false);
|
||||
|
||||
enable_nitter.setChecked(nitter_enabled);
|
||||
enable_invidious.setChecked(invidious_enabled);
|
||||
|
@ -218,6 +220,8 @@ public class MainActivity extends AppCompatActivity {
|
|||
ImageButton save_instance_osm = findViewById(R.id.button_save_instance_osm);
|
||||
|
||||
CheckBox enable_geo_uris = findViewById(R.id.enable_geo_uris);
|
||||
CheckBox enable_embed_player = findViewById(R.id.enable_embed_player);
|
||||
|
||||
list_apps = findViewById(R.id.list_apps);
|
||||
nitterHost = sharedpreferences.getString(SET_NITTER_HOST, null);
|
||||
invidiousHost = sharedpreferences.getString(SET_INVIDIOUS_HOST, null);
|
||||
|
@ -375,6 +379,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
osm_custom_group.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
enable_embed_player.setChecked(embedded_player);
|
||||
save_instance_nitter.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
if (nitter_instance.getText() != null && nitter_instance.getText().toString().trim().length() > 0) {
|
||||
|
@ -465,6 +470,11 @@ public class MainActivity extends AppCompatActivity {
|
|||
osm_indications.setText(R.string.redirect_gm_to_osm);
|
||||
}
|
||||
});
|
||||
enable_embed_player.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(SET_EMBEDDED_PLAYER, isChecked);
|
||||
editor.apply();
|
||||
});
|
||||
|
||||
sharedpreferences.registerOnSharedPreferenceChangeListener(
|
||||
(sharedPreferences, key) -> {
|
||||
|
|
|
@ -47,6 +47,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import static app.fedilab.nitterizeme.MainActivity.SET_BIBLIOGRAM_ENABLED;
|
||||
import static app.fedilab.nitterizeme.MainActivity.SET_EMBEDDED_PLAYER;
|
||||
import static app.fedilab.nitterizeme.MainActivity.SET_INVIDIOUS_ENABLED;
|
||||
import static app.fedilab.nitterizeme.MainActivity.SET_NITTER_ENABLED;
|
||||
import static app.fedilab.nitterizeme.MainActivity.bibliogram_instances;
|
||||
|
@ -422,7 +423,10 @@ public class TransformActivity extends Activity {
|
|||
targetIntents.add(targetIntent);
|
||||
}
|
||||
|
||||
if (Arrays.asList(invidious_instances).contains(Objects.requireNonNull(i.getData()).getHost())) {
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(MainActivity.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean embedded_player = sharedpreferences.getBoolean(SET_EMBEDDED_PLAYER, false);
|
||||
|
||||
if (Arrays.asList(invidious_instances).contains(Objects.requireNonNull(i.getData()).getHost()) && embedded_player) {
|
||||
if( !i.getData().toString().contains("videoplayback")){
|
||||
Intent intentPlayer = new Intent(TransformActivity.this, WebviewPlayerActivity.class);
|
||||
intentPlayer.putExtra("url", i.getData().toString());
|
||||
|
|
|
@ -281,7 +281,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/enable_embed_player"
|
||||
app:layout_constraintEnd_toStartOf="@id/button_save_instance_invidious"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/barrier_invidious">
|
||||
|
@ -305,7 +305,7 @@
|
|||
android:background="@null"
|
||||
android:contentDescription="@string/save"
|
||||
android:src="@drawable/ic_save"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/enable_embed_player"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/barrier_invidious" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue