update
This commit is contained in:
parent
477bd580e9
commit
27bd52d415
9 changed files with 258 additions and 133 deletions
|
@ -23,8 +23,8 @@ android {
|
|||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,11 @@
|
|||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:exported="true">
|
||||
<!--
|
||||
android:launchMode="singleInstance"
|
||||
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden" >
|
||||
-->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
@ -39,7 +41,6 @@
|
|||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:exported="false"
|
||||
android:launchMode="singleInstance"
|
||||
android:label="@string/title_activity_settings">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.jerryxiao.droidcast;
|
|||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
|
@ -13,90 +14,142 @@ import android.content.pm.PackageManager;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.pedro.rtplibrary.rtmp.RtmpDisplay;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private RtmpDisplay screenCapDisplay;
|
||||
private static final String TAG = "MainActivity";
|
||||
private ActivityResultLauncher<Intent> screenCapReq;
|
||||
private ScreenCapService screenCapService;
|
||||
private Button startButton;
|
||||
private TextView infoDisplay;
|
||||
private SharedPreferences prefs;
|
||||
private final ServiceConnection serviceConnection = new ServiceConnection() {
|
||||
private void updateButtonText(boolean connected) {
|
||||
Log.d(TAG, String.format("updateButtonText: %b", connected));
|
||||
runOnUiThread(() -> {
|
||||
((Button)MainActivity.this.findViewById(R.id.startButton)).setText(connected
|
||||
? getString(R.string.stop_button)
|
||||
: getString(R.string.start_button));
|
||||
});
|
||||
}
|
||||
private void updateInfoDisplay(String t) {
|
||||
Log.d(TAG, String.format("updateInfoDisplay: %s", t));
|
||||
runOnUiThread(() -> {
|
||||
((TextView)MainActivity.this.findViewById(R.id.infoDisplay)).setText(t);
|
||||
});
|
||||
}
|
||||
public void onServiceConnected(ComponentName componentName, IBinder binder) {
|
||||
Log.d(TAG, "service connected");
|
||||
MainActivity.this.screenCapService = ((ScreenCapService.MBinder)binder).getService();
|
||||
MainActivity.this.screenCapDisplay = MainActivity.this.screenCapService.getScreenCapDisplay();
|
||||
MainActivity.this.screenCapReq.launch(MainActivity.this.screenCapDisplay.sendIntent());
|
||||
MainActivity.this.screenCapService.addDisconnectCallback(() -> {
|
||||
unbindService(serviceConnection);
|
||||
runOnUiThread(() -> {
|
||||
startButton.setText(getString(R.string.start_button));
|
||||
});
|
||||
MainActivity.this.screenCapService = null;
|
||||
});
|
||||
MainActivity.this.screenCapService.addInfoDisplayCallback((t) -> {
|
||||
runOnUiThread(() -> {
|
||||
MainActivity.this.infoDisplay.setText(t);
|
||||
});
|
||||
});
|
||||
runOnUiThread(() -> {
|
||||
MainActivity.this.startButton.setText(getString(R.string.stop_button));
|
||||
});
|
||||
MainActivity.this.screenCapService.addConnectionStateCallback(this::updateButtonText);
|
||||
MainActivity.this.screenCapService.addInfoDisplayCallback(this::updateInfoDisplay);
|
||||
this.updateButtonText(MainActivity.this.screenCapService != null && MainActivity.this.screenCapService.isConnected());
|
||||
this.updateInfoDisplay(MainActivity.this.screenCapService.getInfoDisplayText());
|
||||
}
|
||||
|
||||
public void onServiceDisconnected(ComponentName componentName) {
|
||||
Log.d(TAG, "service disconnected");
|
||||
MainActivity.this.screenCapService.removeConnectionStateCallback(this::updateButtonText);
|
||||
MainActivity.this.screenCapService.removeInfoDisplayCallback(this::updateInfoDisplay);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Log.d(TAG, "activity created");
|
||||
this.prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
setContentView(R.layout.main_activity);
|
||||
Map<String, String> permissionsToRequest = Collections.emptyMap();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
permissionsToRequest = new HashMap<>(Map.of("android.permission.POST_NOTIFICATIONS",
|
||||
getString(R.string.permission_denied_post_notifications)));
|
||||
if (checkSelfPermission("android.permission.POST_NOTIFICATIONS") != PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
requestPermissions(new String[]{"android.permission.POST_NOTIFICATIONS"}, 0);
|
||||
}
|
||||
}
|
||||
else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
|
||||
if (checkSelfPermission("android.permission.RECORD_AUDIO") != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissions(new String[]{"android.permission.RECORD_AUDIO"}, 0);
|
||||
else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
|
||||
permissionsToRequest = new HashMap<>(Map.of("android.permission.RECORD_AUDIO",
|
||||
getString(R.string.permission_denied_record_audio)));
|
||||
}
|
||||
permissionsToRequest.entrySet().removeIf(i -> checkSelfPermission(i.getKey()) == PackageManager.PERMISSION_GRANTED);
|
||||
if (!permissionsToRequest.isEmpty()) {
|
||||
Log.d(TAG, String.format("requesting permissions %s", String.join(" + ", permissionsToRequest.keySet().toArray(new String[0]))));
|
||||
Map<String, String> finalPermissionsToRequest = permissionsToRequest;
|
||||
ActivityResultLauncher<String[]> permissionReq = registerForActivityResult(new ActivityResultContracts.RequestMultiplePermissions(), (result) -> {
|
||||
result.forEach((perm, granted) -> {
|
||||
if (!granted) {
|
||||
Log.d(TAG, String.format("permission denied: %s", perm));
|
||||
(new AlertDialog.Builder(this))
|
||||
.setTitle(getText(R.string.error_title))
|
||||
.setMessage(finalPermissionsToRequest.get(perm))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.button_ok), (dialog, id) -> {})
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
});
|
||||
});
|
||||
permissionReq.launch(permissionsToRequest.keySet().toArray(new String[0]));
|
||||
}
|
||||
this.startButton = (Button)this.findViewById(R.id.startButton);
|
||||
this.infoDisplay = (TextView)this.findViewById(R.id.infoDisplay);
|
||||
this.screenCapReq = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), (activityResult) -> {
|
||||
int result = activityResult.getResultCode();
|
||||
screenCapDisplay.setIntentResult(result, activityResult.getData());
|
||||
screenCapService.getScreenCapDisplay().setIntentResult(result, activityResult.getData());
|
||||
if (result == RESULT_OK) {
|
||||
Log.d(TAG, "capture granted");
|
||||
screenCapService.startCapture(prefs.getString("server", ""));
|
||||
}
|
||||
else {
|
||||
runOnUiThread(() -> {
|
||||
Toast.makeText(MainActivity.this, getText(R.string.error_capture_denied), Toast.LENGTH_SHORT).show();
|
||||
Log.d(TAG, "capture denied");
|
||||
(new AlertDialog.Builder(this))
|
||||
.setTitle(getText(R.string.error_title))
|
||||
.setMessage(getText(R.string.error_capture_denied))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.button_ok), (dialog, id) -> {})
|
||||
.create()
|
||||
.show();
|
||||
});
|
||||
screenCapService.stopCapture();
|
||||
}
|
||||
});
|
||||
this.startButton.setOnClickListener((view) -> {
|
||||
bindService(new Intent(this, ScreenCapService.class), serviceConnection, BIND_AUTO_CREATE);
|
||||
((Button)this.findViewById(R.id.startButton)).setOnClickListener((view) -> {
|
||||
if (screenCapService != null) {
|
||||
new Thread(() -> {
|
||||
screenCapService.stopCapture();
|
||||
}).start();
|
||||
if (screenCapService.isConnected()) {
|
||||
Log.d(TAG, "button stop");
|
||||
new Thread(() -> { if (screenCapService.getScreenCapDisplay() != null) screenCapService.getScreenCapDisplay().stopStream(); }).start();
|
||||
}
|
||||
else {
|
||||
Intent intent = new Intent(this, ScreenCapService.class);
|
||||
bindService(intent, serviceConnection, BIND_AUTO_CREATE);
|
||||
Log.d(TAG, "button start");
|
||||
MainActivity.this.screenCapService.createDisplay();
|
||||
MainActivity.this.screenCapReq.launch(MainActivity.this.screenCapService.getScreenCapDisplay().sendIntent());
|
||||
}
|
||||
}
|
||||
else {
|
||||
Log.e(TAG, "service died");
|
||||
(new AlertDialog.Builder(this))
|
||||
.setTitle(getText(R.string.error_title))
|
||||
.setMessage(getText(R.string.error_service_died))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.button_ok), (dialog, id) -> {})
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
});
|
||||
Button settingsButton = (Button)this.findViewById(R.id.settingsButton);
|
||||
settingsButton.setOnClickListener((view) -> {
|
||||
Intent intent = new Intent(this, SettingsActivity.class);
|
||||
startActivity(intent);
|
||||
((Button)this.findViewById(R.id.settingsButton)).setOnClickListener((view) -> {
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
Log.d(TAG, "activity destroyed");
|
||||
unbindService(serviceConnection);
|
||||
this.screenCapService = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import android.os.Binder;
|
|||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -26,14 +27,21 @@ import com.pedro.encoder.utils.CodecUtil;
|
|||
import com.pedro.rtmp.utils.ConnectCheckerRtmp;
|
||||
import com.pedro.rtplibrary.rtmp.RtmpDisplay;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.HashSet;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ScreenCapService extends Service {
|
||||
private static final String TAG = "ScreenCapService";
|
||||
private static final int RESOLUTION_GAP = 100000;
|
||||
private final LinkedList<Runnable> disconnectCallbacks = new LinkedList<>();
|
||||
private final LinkedList<Consumer<String>> infoDisplayCallbacks = new LinkedList<>();
|
||||
private final HashSet<Consumer<Boolean>> connectionStateCallbacks = new HashSet<>();
|
||||
private final HashSet<Consumer<String>> infoDisplayCallbacks = new HashSet<>();
|
||||
private SharedPreferences prefs;
|
||||
|
||||
private boolean connected = false;
|
||||
public boolean isConnected() {
|
||||
return connected;
|
||||
}
|
||||
|
||||
protected class MBinder extends Binder {
|
||||
public ScreenCapService getService() {
|
||||
return ScreenCapService.this;
|
||||
|
@ -46,6 +54,10 @@ public class ScreenCapService extends Service {
|
|||
public RtmpDisplay getScreenCapDisplay() {
|
||||
return this.screenCapDisplay;
|
||||
}
|
||||
private String infoDisplayText = "";
|
||||
public String getInfoDisplayText() {
|
||||
return infoDisplayText;
|
||||
}
|
||||
|
||||
public IBinder onBind(Intent intent) {
|
||||
return this.mBinder;
|
||||
|
@ -53,70 +65,66 @@ public class ScreenCapService extends Service {
|
|||
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.d(TAG, "service created");
|
||||
this.prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
this.screenCapDisplay = new RtmpDisplay(this, prefs.getBoolean("use_gl", true), new ConnectCheckerRtmp() {
|
||||
this.infoDisplayText = getString(R.string.status_disconnected);
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
Log.d(TAG, "service destroyed");
|
||||
}
|
||||
|
||||
protected void createDisplay() {
|
||||
boolean use_gl = prefs.getBoolean("use_gl", true);
|
||||
Log.d(TAG, String.format("creating display use_gl=%b", use_gl));
|
||||
this.screenCapDisplay = new RtmpDisplay(this, use_gl, new ConnectCheckerRtmp() {
|
||||
public void onAuthErrorRtmp() {
|
||||
String text = getString(R.string.status_auth_error);
|
||||
(new Handler(Looper.getMainLooper())).post(() -> {
|
||||
Toast.makeText(ScreenCapService.this, text, Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
for (Consumer<String> stringConsumer : ScreenCapService.this.infoDisplayCallbacks) {
|
||||
stringConsumer.accept(text);
|
||||
}
|
||||
showToast(text);
|
||||
setInfoDisplay(text);
|
||||
ScreenCapService.this.stop();
|
||||
}
|
||||
|
||||
public void onAuthSuccessRtmp() {
|
||||
for (Consumer<String> stringConsumer : ScreenCapService.this.infoDisplayCallbacks) {
|
||||
stringConsumer.accept(getString(R.string.status_auth_success));
|
||||
}
|
||||
setInfoDisplay(getString(R.string.status_auth_success));
|
||||
}
|
||||
|
||||
public void onConnectionFailedRtmp(@NonNull String reason) {
|
||||
String text = getString(R.string.status_connection_failed_format, reason);
|
||||
(new Handler(Looper.getMainLooper())).post(() -> {
|
||||
Toast.makeText(ScreenCapService.this, text, Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
for (Consumer<String> stringConsumer : ScreenCapService.this.infoDisplayCallbacks) {
|
||||
stringConsumer.accept(text);
|
||||
}
|
||||
showToast(text);
|
||||
setInfoDisplay(text);
|
||||
ScreenCapService.this.stop();
|
||||
}
|
||||
|
||||
public void onConnectionStartedRtmp(@NonNull String rtmpUrl) {
|
||||
for (Consumer<String> stringConsumer : ScreenCapService.this.infoDisplayCallbacks) {
|
||||
stringConsumer.accept(getString(R.string.status_connecting));
|
||||
}
|
||||
setInfoDisplay(getString(R.string.status_connecting, rtmpUrl));
|
||||
ScreenCapService.this.connectionStateChange(true);
|
||||
}
|
||||
|
||||
public void onConnectionSuccessRtmp() {
|
||||
for (Consumer<String> stringConsumer : ScreenCapService.this.infoDisplayCallbacks) {
|
||||
stringConsumer.accept(getString(R.string.status_connected));
|
||||
}
|
||||
setInfoDisplay(getString(R.string.status_connected));
|
||||
}
|
||||
|
||||
public void onDisconnectRtmp() {
|
||||
String text = getString(R.string.status_disconnected);
|
||||
(new Handler(Looper.getMainLooper())).post(() -> {
|
||||
Toast.makeText(ScreenCapService.this, text, Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
for (Consumer<String> stringConsumer : ScreenCapService.this.infoDisplayCallbacks) {
|
||||
stringConsumer.accept(text);
|
||||
}
|
||||
setInfoDisplay(getString(R.string.status_disconnected));
|
||||
ScreenCapService.this.stop();
|
||||
}
|
||||
|
||||
public void onNewBitrateRtmp(long bitrate) {
|
||||
synchronized (ScreenCapService.this.infoDisplayCallbacks) {
|
||||
for (Consumer<String> stringConsumer : ScreenCapService.this.infoDisplayCallbacks) {
|
||||
stringConsumer.accept(getString(R.string.status_bitrate_format, bitrate));
|
||||
}
|
||||
}
|
||||
setInfoDisplay(getString(R.string.status_bitrate_format, bitrate));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void startCapture(String server) {
|
||||
if (this.connected) {
|
||||
Log.d(TAG, "not starting capture");
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "start capture");
|
||||
startService(new Intent(this, ScreenCapService.class));
|
||||
this.connected = true;
|
||||
NotificationChannel notificationChannel = new NotificationChannel("notifications", "Notifications", NotificationManager.IMPORTANCE_LOW);
|
||||
notificationChannel.setDescription("Notifications");
|
||||
getSystemService(NotificationManager.class).createNotificationChannel(notificationChannel);
|
||||
|
@ -129,7 +137,9 @@ public class ScreenCapService extends Service {
|
|||
screenCapDisplay.setForce(prefs.getBoolean("software_video_encoder", false) ? CodecUtil.Force.SOFTWARE : CodecUtil.Force.FIRST_COMPATIBLE_FOUND,
|
||||
prefs.getBoolean("software_audio_encoder", false) ? CodecUtil.Force.SOFTWARE : CodecUtil.Force.FIRST_COMPATIBLE_FOUND);
|
||||
screenCapDisplay.setWriteChunkSize(prefs.getInt("write_chunk_size_int", 1024));
|
||||
screenCapDisplay.setReTries(prefs.getInt("retries_int", 0));
|
||||
screenCapDisplay.resizeCache(prefs.getInt("cache_size_int", 120));
|
||||
screenCapDisplay.setLogs(prefs.getBoolean("enable_droidcast_logs", false));
|
||||
if (prefs.getBoolean("use_gl", true) && prefs.getBoolean("use_force_render", true)) {
|
||||
screenCapDisplay.getGlInterface().setForceRender(true);
|
||||
}
|
||||
|
@ -150,34 +160,42 @@ public class ScreenCapService extends Service {
|
|||
video_height = video_width;
|
||||
video_width = tmp;
|
||||
}
|
||||
Log.d(TAG, String.format("capture width %d height %d", video_width, video_height));
|
||||
if (this.screenCapDisplay.prepareInternalAudio(Integer.parseInt(prefs.getString("audio_bitrate", "131072")), 48000, prefs.getBoolean("stereo_audio", true), false, false) &&
|
||||
this.screenCapDisplay.prepareVideo(video_width, video_height, Integer.parseInt(prefs.getString("fps", "30")), Integer.parseInt(prefs.getString("video_bitrate", "10485760")), 0, 320, -1, -1, 2)) {
|
||||
this.screenCapDisplay.startStream(server);
|
||||
}
|
||||
else {
|
||||
(new Handler(Looper.getMainLooper())).post(() -> {
|
||||
Toast.makeText(ScreenCapService.this, "Cannot prepare audio and video", Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
Log.d(TAG, "cannot prepare video audio");
|
||||
String text = getString(R.string.error_prepare_video_audio);
|
||||
setInfoDisplay(text);
|
||||
showToast(text);
|
||||
this.stop();
|
||||
}
|
||||
}
|
||||
|
||||
private void stop() {
|
||||
Log.d(TAG, "stop called");
|
||||
this.connected = false;
|
||||
this.stopForeground(true);
|
||||
this.stopSelf();
|
||||
synchronized (this.disconnectCallbacks) {
|
||||
while (!this.disconnectCallbacks.isEmpty()) {
|
||||
this.disconnectCallbacks.pop().run();
|
||||
this.connectionStateChange(false);
|
||||
}
|
||||
|
||||
private void connectionStateChange(boolean connected) {
|
||||
synchronized (this.connectionStateCallbacks) {
|
||||
for (Consumer<Boolean> booleanConsumer : this.connectionStateCallbacks) {
|
||||
try {
|
||||
booleanConsumer.accept(connected);
|
||||
}
|
||||
catch (Throwable ignored) {}
|
||||
}
|
||||
synchronized (this.infoDisplayCallbacks) {
|
||||
this.infoDisplayCallbacks.clear();
|
||||
}
|
||||
}
|
||||
|
||||
protected void addDisconnectCallback(Runnable runnable) {
|
||||
synchronized (this.disconnectCallbacks) {
|
||||
this.disconnectCallbacks.add(runnable);
|
||||
protected void addConnectionStateCallback(Consumer<Boolean> runnable) {
|
||||
synchronized (this.connectionStateCallbacks) {
|
||||
this.connectionStateCallbacks.add(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,8 +205,33 @@ public class ScreenCapService extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
protected void stopCapture() {
|
||||
this.screenCapDisplay.stopStream();
|
||||
this.stop();
|
||||
protected void removeConnectionStateCallback(Consumer<Boolean> runnable) {
|
||||
synchronized (this.connectionStateCallbacks) {
|
||||
this.connectionStateCallbacks.remove(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
protected void removeInfoDisplayCallback(Consumer<String> stringConsumer) {
|
||||
synchronized (this.infoDisplayCallbacks) {
|
||||
this.infoDisplayCallbacks.remove(stringConsumer);
|
||||
}
|
||||
}
|
||||
|
||||
private void setInfoDisplay(String t) {
|
||||
synchronized (this.infoDisplayCallbacks) {
|
||||
this.infoDisplayText = t;
|
||||
for (Consumer<String> stringConsumer : this.infoDisplayCallbacks) {
|
||||
try {
|
||||
stringConsumer.accept(t);
|
||||
}
|
||||
catch (Throwable ignored) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showToast(String text) {
|
||||
(new Handler(Looper.getMainLooper())).post(() -> {
|
||||
Toast.makeText(ScreenCapService.this, text, Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
}
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(false);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,16 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.4">
|
||||
|
||||
<Button
|
||||
android:id="@+id/startButton"
|
||||
android:layout_width="128dp"
|
||||
|
@ -32,7 +42,7 @@
|
|||
android:id="@+id/infoDisplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="78dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text = "@string/status_disconnected"
|
||||
android:gravity="center"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -40,4 +50,6 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -8,7 +8,7 @@
|
|||
<string name="resolution_title">分辨率</string>
|
||||
<string name="fps_title">每秒帧数</string>
|
||||
<string name="opengl_title">使用OpenGL</string>
|
||||
<string name="force_render_title">固定比特率替代方法</string>
|
||||
<string name="force_render_title">非活动时低帧率替代解决办法</string>
|
||||
<string name="stereo_audio_title">双声道音频</string>
|
||||
<string name="screen_landscape_title">横屏</string>
|
||||
<string name="software_video_encoder_title">使用软件视频编码器</string>
|
||||
|
@ -20,8 +20,11 @@
|
|||
<string name="start_button">开始</string>
|
||||
<string name="stop_button">停止</string>
|
||||
<string name="settings_button">设置</string>
|
||||
<string name="error_title">发生错误</string>
|
||||
<string name="error_service_died">服务终止</string>
|
||||
<string name="error_prepare_video_audio">未能开始视频与音频录制</string>
|
||||
<string name="error_capture_denied">录像被禁止</string>
|
||||
<string name="status_connecting">正在连接</string>
|
||||
<string name="status_connecting">正在连接到 %1$s</string>
|
||||
<string name="status_auth_error">鉴权失败</string>
|
||||
<string name="status_auth_success">鉴权成功</string>
|
||||
<string name="status_connected">已连接</string>
|
||||
|
@ -29,4 +32,7 @@
|
|||
<string name="status_bitrate_format">比特率: %1$d</string>
|
||||
<string name="status_connection_failed_format">连接失败: %1$s</string>
|
||||
<string name="use_device_resolution">使用设备分辨率</string>
|
||||
<string name="permission_denied_post_notifications">通知权限被禁止</string>
|
||||
<string name="permission_denied_record_audio">录音权限被禁止,在安卓12-上内录音频时这项权限是必需的</string>
|
||||
<string name="button_ok">好</string>
|
||||
</resources>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<string-array name="fps_entries">
|
||||
<item>120</item>
|
||||
<item>60</item>
|
||||
<item>45</item>
|
||||
<item>30</item>
|
||||
<item>24</item>
|
||||
<item>15</item>
|
||||
|
@ -32,6 +33,7 @@
|
|||
<string-array name="fps_values">
|
||||
<item>120</item>
|
||||
<item>60</item>
|
||||
<item>45</item>
|
||||
<item>30</item>
|
||||
<item>24</item>
|
||||
<item>15</item>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<resources>
|
||||
<string name="app_name">DroidCast</string>
|
||||
<string name="title_activity_settings">Settings</string>
|
||||
<string name="title_activity_settings">DroidCast Settings</string>
|
||||
|
||||
<string name="server_header">Servers</string>
|
||||
<string name="server_title">Server</string>
|
||||
|
@ -8,7 +8,7 @@
|
|||
<string name="resolution_title">Resolution</string>
|
||||
<string name="fps_title">FPS</string>
|
||||
<string name="opengl_title">Enable OpenGL</string>
|
||||
<string name="force_render_title">CBR Hack</string>
|
||||
<string name="force_render_title">Force Render</string>
|
||||
<string name="stereo_audio_title">Stereo Audio</string>
|
||||
<string name="screen_landscape_title">Landscape</string>
|
||||
<string name="software_video_encoder_title">Software video encoding</string>
|
||||
|
@ -21,8 +21,7 @@
|
|||
<string name="start_button">Start</string>
|
||||
<string name="stop_button">Stop</string>
|
||||
<string name="settings_button">Settings</string>
|
||||
<string name="error_capture_denied">Capture permission denied</string>
|
||||
<string name="status_connecting">Connecting</string>
|
||||
<string name="status_connecting">Connecting to %1$s</string>
|
||||
<string name="status_auth_error">Auth Error</string>
|
||||
<string name="status_auth_success">Auth Success</string>
|
||||
<string name="status_connected">Connected</string>
|
||||
|
@ -31,4 +30,13 @@
|
|||
<string name="status_connection_failed_format">Connection failed: %1$s</string>
|
||||
|
||||
<string name="use_device_resolution">Use device resolution</string>
|
||||
|
||||
<string name="error_title">Error</string>
|
||||
<string name="error_capture_denied">Capture permission denied</string>
|
||||
<string name="error_service_died">Service died</string>
|
||||
<string name="error_prepare_video_audio">Cannot prepare audio and video</string>
|
||||
<string name="permission_denied_post_notifications">Notification permission denied</string>
|
||||
<string name="permission_denied_record_audio">Audio recording permission denied, on Android 12- this is required for internal audio recording</string>
|
||||
|
||||
<string name="button_ok">OK</string>
|
||||
</resources>
|
Loading…
Reference in a new issue