Update with player

This commit is contained in:
Thomas 2020-04-05 10:25:20 +02:00
parent d50fdd4757
commit 3dd652d5d2
3 changed files with 22 additions and 7 deletions

View File

@ -186,7 +186,7 @@
<activity android:name="app.fedilab.nitterizeme.WebviewPlayerActivity" <activity android:name="app.fedilab.nitterizeme.WebviewPlayerActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/Theme.AppCompat.NoActionBar.FullScreen"/> android:theme="@style/AppTheme"/>
</application> </application>
</manifest> </manifest>

View File

@ -429,6 +429,9 @@ public class TransformActivity extends Activity {
if (Arrays.asList(invidious_instances).contains(Objects.requireNonNull(i.getData()).getHost()) && embedded_player) { if (Arrays.asList(invidious_instances).contains(Objects.requireNonNull(i.getData()).getHost()) && embedded_player) {
if( !i.getData().toString().contains("videoplayback")){ if( !i.getData().toString().contains("videoplayback")){
Intent intentPlayer = new Intent(TransformActivity.this, WebviewPlayerActivity.class); Intent intentPlayer = new Intent(TransformActivity.this, WebviewPlayerActivity.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
intentPlayer.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT|Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
}
intentPlayer.putExtra("url", i.getData().toString()); intentPlayer.putExtra("url", i.getData().toString());
startActivity(intentPlayer); startActivity(intentPlayer);
}else{ }else{

View File

@ -20,6 +20,7 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager; import android.view.WindowManager;
@ -56,6 +57,12 @@ public class WebviewPlayerActivity extends AppCompatActivity {
} }
setContentView(R.layout.activity_webview_player); setContentView(R.layout.activity_webview_player);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
final ViewGroup videoLayout = findViewById(R.id.videoLayout); final ViewGroup videoLayout = findViewById(R.id.videoLayout);
webView = findViewById(R.id.webview); webView = findViewById(R.id.webview);
loader = findViewById(R.id.loader); loader = findViewById(R.id.loader);
@ -92,12 +99,6 @@ public class WebviewPlayerActivity extends AppCompatActivity {
webView.loadUrl(streaming_url); webView.loadUrl(streaming_url);
loader.setVisibility(View.GONE); loader.setVisibility(View.GONE);
webview_container.setVisibility(View.VISIBLE); webview_container.setVisibility(View.VISIBLE);
videoLayout.setVisibility(View.VISIBLE);
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
attrs.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
getWindow().setAttributes(attrs);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
} }
} }
}; };
@ -126,6 +127,17 @@ public class WebviewPlayerActivity extends AppCompatActivity {
}); });
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override @Override
public void onPause(){ public void onPause(){
super.onPause(); super.onPause();