Compare commits
15 Commits
main
...
yt_mpremot
Author | SHA1 | Date |
---|---|---|
|
b646c5436b | 6 days ago |
|
f1c946172b | 2 weeks ago |
|
dc4c10c9a7 | 2 months ago |
|
7c51f7894d | 2 months ago |
|
26f12089a2 | 2 months ago |
|
8a68778555 | 2 months ago |
|
f609c2012c | 2 months ago |
|
f30825c20b | 2 months ago |
|
bdb4726f55 | 2 months ago |
|
7e45f59973 | 2 months ago |
|
9984c5ace0 | 2 months ago |
|
3fedd401eb | 3 months ago |
|
5bb02cd10d | 3 months ago |
|
fcb880375f | 3 months ago |
|
2ce5d1f821 | 3 months ago |
@ -0,0 +1,37 @@
|
||||
package com.xypower.mpremote;
|
||||
|
||||
public class Constants {
|
||||
|
||||
public static final String PACKAGE_NAME_MP = "com.xypower.mpapp";
|
||||
public static final String PACKAGE_NAME_MPMASTER = "com.xypower.mpmaster";
|
||||
public static final String PACKAGE_NAME_MPREMOTE = "com.xypower.mpremote";
|
||||
public static final String REMOTE_PATH_ROOT = "/sdcard/" + PACKAGE_NAME_MP + "/";
|
||||
public static final String REMOTE_PATH_DATA = REMOTE_PATH_ROOT + "data/";
|
||||
public static final String REMOTE_PATH_DATA_CHANNELS = REMOTE_PATH_ROOT + "data/channels/";
|
||||
public static final String REMOTE_PATH_PHOTOS = REMOTE_PATH_ROOT + "photos/";
|
||||
public static final String REMOTE_PATH_TMP = REMOTE_PATH_ROOT + "tmp/";
|
||||
public static final String REMOTE_PATH_APP = REMOTE_PATH_ROOT + "data/App.json";
|
||||
|
||||
|
||||
public static final String LOCAL_PATH_REMOTE = "/sdcard/" + PACKAGE_NAME_MPREMOTE + "/" + "tmp/App.json";
|
||||
|
||||
public static final String KEY_APP_BV = "app.bv";
|
||||
public static final String KEY_APP_BCV = "app.bcv";
|
||||
public static final String KEY_RO_SERIALNO = "ro.serialno";
|
||||
public static final String KEY_RO_CUSTOM_OTA_VERSION = "ro.custom.ota.version";
|
||||
public static final String KEY_RO_MODEMS_MAX_COUNT = "telephony.active_modems.max_count";
|
||||
// ro.telephony.sim.count
|
||||
public static final String KEY_RO_SIGNAL_STRNGTH_PREFIX = "vendor.ril.nw.signalstrength.lte.";
|
||||
|
||||
public static final String KEY_RO_ICCID_PREFIX = "persist.vendor.radio.cfu.iccid.";
|
||||
|
||||
public static final String KEY_GSM_VENDOR_NAME = "gsm.operator.alpha";
|
||||
|
||||
public static final String KEY_APP_MP_VERSION = "mpapp.version";
|
||||
public static final String KEY_APP_MPMASTER_VERSION = "mpmaster.version";
|
||||
|
||||
public static final String KEY_PREFIX_GLOBAL_SETTING = "settings.global.";
|
||||
|
||||
public static final String KEY_IMEI = KEY_PREFIX_GLOBAL_SETTING + "dev_imei";
|
||||
public static final String KEY_IMEI2 = KEY_PREFIX_GLOBAL_SETTING + "dev_imei2";
|
||||
}
|
@ -1,244 +1,127 @@
|
||||
package com.xypower.mpremote;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ContentUris;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.wifi.ScanResult;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowInsets;
|
||||
import android.widget.SimpleAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.xypower.mpremote.adapter.ImageItemAdapter;
|
||||
import com.xypower.mpremote.databinding.ActivityImageBinding;
|
||||
import com.xypower.mpremote.utils.AppUtils;
|
||||
import com.xypower.mpremote.utils.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* An example full-screen activity that shows and hides the system UI (i.e.
|
||||
* status bar and navigation/system bar) with user interaction.
|
||||
*/
|
||||
public class ImageActivity extends AppCompatActivity {
|
||||
/**
|
||||
* Whether or not the system UI should be auto-hidden after
|
||||
* {@link #AUTO_HIDE_DELAY_MILLIS} milliseconds.
|
||||
*/
|
||||
private static final boolean AUTO_HIDE = true;
|
||||
|
||||
/**
|
||||
* If {@link #AUTO_HIDE} is set, the number of milliseconds to wait after
|
||||
* user interaction before hiding the system UI.
|
||||
*/
|
||||
private static final int AUTO_HIDE_DELAY_MILLIS = 3000;
|
||||
|
||||
/**
|
||||
* Some older devices needs a small delay between UI widget updates
|
||||
* and a change of the status and navigation bar.
|
||||
*/
|
||||
private static final int UI_ANIMATION_DELAY = 300;
|
||||
private final Handler mHideHandler = new Handler(Looper.myLooper());
|
||||
|
||||
public class ImageActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
private String mSerialNo = "";
|
||||
|
||||
private List<File> mImageFiles = new ArrayList<>();
|
||||
private ImagesAdaper mAdapter;
|
||||
private List<Map<String, Object>> mItems = new ArrayList<Map<String, Object>>();
|
||||
|
||||
/**
|
||||
* Touch listener to use for in-layout UI controls to delay hiding the
|
||||
* system UI. This is to prevent the jarring behavior of controls going away
|
||||
* while interacting with activity UI.
|
||||
*/
|
||||
private final View.OnTouchListener mDelayHideTouchListener = new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
switch (motionEvent.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
ImageActivity.this.finish();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
private ImageItemAdapter mAdapter;
|
||||
private ActivityImageBinding binding;
|
||||
private String path;//图片地址
|
||||
private String cmdid;
|
||||
private String photodirpath;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
binding = ActivityImageBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
initIntent();
|
||||
initView();
|
||||
initData();
|
||||
}
|
||||
|
||||
binding.imageView.setImageDrawable(null);
|
||||
|
||||
binding.imageView.setClickable(true);
|
||||
binding.imageView.setOnTouchListener(mDelayHideTouchListener);
|
||||
|
||||
binding.imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ImageActivity.this.finish();
|
||||
}
|
||||
});
|
||||
|
||||
private void initIntent() {
|
||||
Intent intent = getIntent();
|
||||
String path = intent.getStringExtra("path");
|
||||
if (path != null) {
|
||||
loadImage(path);
|
||||
}
|
||||
|
||||
path = intent.getStringExtra("path");
|
||||
photodirpath = intent.getStringExtra("photodirpath");
|
||||
cmdid = intent.getStringExtra("cmdid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
private void initView() {
|
||||
String versionName = AppUtils.getAppNameWithVersion(this);
|
||||
binding.toolbar.title.setText(versionName);
|
||||
binding.toolbar.refresh.setVisibility(View.VISIBLE);
|
||||
binding.toolbar.back.setOnClickListener(this);
|
||||
binding.toolbar.refresh.setOnClickListener(this);
|
||||
mAdapter = new ImageItemAdapter();
|
||||
// mAdapter.setOnClickListener(this);
|
||||
binding.recyclerView.setAdapter(mAdapter);
|
||||
binding.recyclerView.setHasFixedSize(true);
|
||||
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
|
||||
binding.imageView.requestLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return false;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
private void initData() {
|
||||
// getPicList();
|
||||
loadPhotos();
|
||||
}
|
||||
|
||||
private boolean loadImage(String path) {
|
||||
private void loadPhotos() {
|
||||
List<String> imageFiles = FileUtils.getImageFiles(photodirpath);
|
||||
mAdapter.setItemList(imageFiles);
|
||||
}
|
||||
|
||||
binding.imageView.setImageDrawable(null);
|
||||
//获取文件夹下所有的照片
|
||||
private void getPicList() {
|
||||
// 获取应用专属目录的相对路径
|
||||
// String relativePath = Environment.DIRECTORY_PICTURES + "/" + Constants.PACKAGE_NAME_MPREMOTE + "/";
|
||||
String relativePath = photodirpath;
|
||||
|
||||
File file = new File(path);
|
||||
if (!file.exists()) {
|
||||
return false;
|
||||
}
|
||||
Drawable drawable = loadDrawable(path);
|
||||
if (drawable != null) {
|
||||
binding.imageView.setImageDrawable(drawable);
|
||||
}
|
||||
String[] projection = {MediaStore.Images.Media._ID, MediaStore.Images.Media.DISPLAY_NAME};
|
||||
|
||||
return drawable != null;
|
||||
}
|
||||
String selection = MediaStore.Images.Media.RELATIVE_PATH + " = ?";
|
||||
String[] selectionArgs = new String[]{relativePath};
|
||||
|
||||
private Drawable loadDrawable(String file) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Cursor cursor = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, selection, selectionArgs, null);
|
||||
|
||||
List<String> imageList = new ArrayList<>();
|
||||
if (cursor != null) {
|
||||
int idColumn = cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID);
|
||||
int nameColumn = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DISPLAY_NAME);
|
||||
|
||||
while (cursor.moveToNext()) {
|
||||
long id = cursor.getLong(idColumn);
|
||||
String name = cursor.getString(nameColumn);
|
||||
Uri contentUri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id);
|
||||
|
||||
Drawable drawable = null;
|
||||
try {
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(file);
|
||||
drawable = new BitmapDrawable(getResources(), bitmap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
imageList.add(name);
|
||||
}
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
return drawable;
|
||||
Log.e("dfsdaf", imageList.toString());
|
||||
}
|
||||
|
||||
|
||||
protected void loadAllImages() {
|
||||
File localDevicePath = new File(getFilesDir(), "Photos" + File.separator + mSerialNo);
|
||||
if (!localDevicePath.exists()) {
|
||||
localDevicePath.mkdirs();
|
||||
}
|
||||
|
||||
// binding.imagesView.
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> getData() {
|
||||
mItems.clear();
|
||||
|
||||
WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
|
||||
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
|
||||
|
||||
String ssid = "";
|
||||
if (wifiInfo != null) {
|
||||
ssid = wifiInfo.getSSID();
|
||||
if (!TextUtils.isEmpty(ssid)) {
|
||||
if (ssid.startsWith("\"") && ssid.endsWith("\"")) {
|
||||
ssid = ssid.substring(1, ssid.length() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (File file : mImageFiles) {
|
||||
Map map = new HashMap<String, Object>();
|
||||
|
||||
|
||||
// Bitmap bm =
|
||||
map.put("img", null);
|
||||
// if (scanR)
|
||||
map.put("text", file.getName());
|
||||
mItems.add(map);
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.back:
|
||||
finish();
|
||||
break;
|
||||
case R.id.refresh:
|
||||
loadPhotos();
|
||||
break;
|
||||
}
|
||||
return mItems;
|
||||
}
|
||||
|
||||
private void refreshListView() {
|
||||
mAdapter = new ImagesAdaper(this, getData(), R.layout.list_item, new String[] { "img", "text" },
|
||||
new int[] { R.id.id_img, R.id.id_text });
|
||||
|
||||
binding.imagesView.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
public class ImagesAdaper extends SimpleAdapter {
|
||||
public ImagesAdaper(Context context, List<Map<String, Object>> items, int resource, String[] from, int[] to) {
|
||||
super(context, items, resource, from, to);
|
||||
|
||||
}
|
||||
|
||||
public View getView(int position, View convertView, ViewGroup parent){
|
||||
convertView = super.getView(position, convertView, parent);
|
||||
|
||||
TextView textView = (TextView)convertView.findViewById(R.id.id_channel);
|
||||
|
||||
File file = mImageFiles.get(position);
|
||||
// if (scanResult.)
|
||||
String text = (String)mItems.get(position).get("text");
|
||||
if (text.startsWith("XY") || text.startsWith("xy")) {
|
||||
textView.setTextColor(Color.RED);
|
||||
textView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
} else {
|
||||
textView.setTextColor(Color.BLACK);
|
||||
textView.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,327 @@
|
||||
//package com.xypower.mpremote;
|
||||
//
|
||||
//import android.app.AlertDialog;
|
||||
//import android.content.Intent;
|
||||
//import android.os.Bundle;
|
||||
//import android.os.Handler;
|
||||
//import android.util.Log;
|
||||
//import android.view.Menu;
|
||||
//import android.view.MenuItem;
|
||||
//import android.view.View;
|
||||
//import android.widget.Toast;
|
||||
//
|
||||
//import androidx.annotation.NonNull;
|
||||
//import androidx.annotation.OptIn;
|
||||
//import androidx.appcompat.app.AppCompatActivity;
|
||||
//import androidx.media3.common.MediaItem;
|
||||
//import androidx.media3.common.PlaybackException;
|
||||
//import androidx.media3.common.Player;
|
||||
//import androidx.media3.common.util.UnstableApi;
|
||||
//import androidx.media3.common.util.Util;
|
||||
//import androidx.media3.exoplayer.DefaultLoadControl;
|
||||
//import androidx.media3.exoplayer.DefaultRenderersFactory;
|
||||
//import androidx.media3.exoplayer.ExoPlayer;
|
||||
//import androidx.media3.exoplayer.RenderersFactory;
|
||||
//import androidx.media3.exoplayer.rtsp.RtspMediaSource;
|
||||
//import androidx.media3.ui.PlayerView;
|
||||
//
|
||||
//import com.xypower.mpremote.databinding.ActivityStreamBinding;
|
||||
//import com.xypower.mpremote.utils.AdbUtils;
|
||||
//import com.xypower.mpremote.utils.AlertDialogUtils;
|
||||
//import com.xypower.mpremote.utils.AppUtils;
|
||||
//
|
||||
//import dadb.AdbShellResponse;
|
||||
//import dadb.Dadb;
|
||||
//
|
||||
//
|
||||
//@UnstableApi public class Stream2Activity extends AppCompatActivity implements View.OnClickListener {
|
||||
//
|
||||
// private static final String TAG = "STRM";
|
||||
// private static final int MAX_RETRIES = 5;
|
||||
//
|
||||
// private ExoPlayer player;
|
||||
// private String mDeviceIp;
|
||||
// private Handler retryHandler = new Handler();
|
||||
// @NonNull
|
||||
// private ActivityStreamBinding binding;
|
||||
// private String localIp;
|
||||
// private int cameraId;
|
||||
// private int anInt;
|
||||
// private int rotation;
|
||||
// private int netCamera;
|
||||
// private int vendor;
|
||||
// private int retryCount;
|
||||
// private static final long INITIAL_RETRY_DELAY_MS = 1000; // 初始重试延迟
|
||||
// private static final long MAX_RETRY_DELAY_MS = 15000; // 最大重试延迟
|
||||
// private static final float RETRY_BACKOFF_MULTIPLIER = 1.5f; // 退避乘数
|
||||
// private long currentRetryDelay = INITIAL_RETRY_DELAY_MS;
|
||||
// private boolean isBuffering = false;
|
||||
// private long bufferingStartTime = 0;
|
||||
// private static final long BUFFERING_TIMEOUT_MS = 100000; // 10秒缓冲超时
|
||||
// private String RTMP_URL;
|
||||
// private PlayerView playerView;
|
||||
// private AlertDialog alertDialog;
|
||||
//
|
||||
// @Override
|
||||
// protected void onCreate(Bundle savedInstanceState) {
|
||||
// super.onCreate(savedInstanceState);
|
||||
// binding = ActivityStreamBinding.inflate(getLayoutInflater());
|
||||
// setContentView(binding.getRoot());
|
||||
// initHandler();
|
||||
// initIntent();
|
||||
// initView();
|
||||
// initEvent();
|
||||
// }
|
||||
//
|
||||
// private void initEvent() {
|
||||
// Runnable runnable = new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// initializePlayer();
|
||||
// }
|
||||
// };
|
||||
// runnable.run();
|
||||
// }
|
||||
//
|
||||
// private void initHandler() {
|
||||
// }
|
||||
//
|
||||
// private void initIntent() {
|
||||
// Intent intent = getIntent();
|
||||
// mDeviceIp = intent.getStringExtra("deviceIp");
|
||||
// localIp = intent.getStringExtra("localIp");
|
||||
// cameraId = intent.getIntExtra("cameraId", 0);
|
||||
// anInt = intent.getIntExtra("channel", 1);
|
||||
// rotation = intent.getIntExtra("rotation", -1);
|
||||
// netCamera = intent.getIntExtra("netCamera", 0);
|
||||
// vendor = intent.getIntExtra("vendor", 0);
|
||||
// }
|
||||
//
|
||||
// private void initView() {
|
||||
// String versionName = AppUtils.getAppNameWithVersion(this);
|
||||
// binding.toolbar.title.setText(versionName);
|
||||
// binding.toolbar.refresh.setVisibility(View.VISIBLE);
|
||||
// binding.toolbar.back.setOnClickListener(this);
|
||||
// binding.toolbar.refresh.setOnClickListener(this);
|
||||
// playerView = binding.playerView;
|
||||
// }
|
||||
//
|
||||
// private void startStreaming(final String cmd, final Runnable runnable) {
|
||||
// Thread th = new Thread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// Dadb adb = null;
|
||||
// try {
|
||||
// Log.i(TAG, "Start connecting " + mDeviceIp);
|
||||
// adb = AdbManager.getAdb(mDeviceIp, AdbUtils.DEFAULT_ADB_PORT);
|
||||
// Log.i(TAG, "Finish connecting " + mDeviceIp);
|
||||
// if (adb == null) {
|
||||
// retryHandler.postDelayed(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// Toast.makeText(Stream2Activity.this, R.string.err_dev_failed_to_connect, Toast.LENGTH_LONG).show();
|
||||
// }
|
||||
// }, 100);
|
||||
// return;
|
||||
// }
|
||||
// AdbShellResponse adbShellResponse = null;
|
||||
// try {
|
||||
// adbShellResponse = adb.shell("am force-stop com.xypower.mplive");
|
||||
// Thread.sleep(200);
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// try {
|
||||
// adbShellResponse = adb.shell(cmd);
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// if (adbShellResponse != null) {
|
||||
// if (adbShellResponse.getExitCode() == 0) {
|
||||
// try {
|
||||
// Thread.sleep(5000);
|
||||
// } catch (Exception ex) {
|
||||
// }
|
||||
// runOnUiThread(runnable);
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// th.start();
|
||||
// }
|
||||
//
|
||||
// private void stopStreaming() {
|
||||
// String cmd = "am force-stop com.xypower.mplive";
|
||||
// Thread th = new Thread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// Dadb adb = null;
|
||||
// try {
|
||||
// Log.i(TAG, "Start connecting " + mDeviceIp);
|
||||
// adb = AdbManager.getAdb(mDeviceIp, AdbUtils.DEFAULT_ADB_PORT);
|
||||
// Log.i(TAG, "Finish connecting " + mDeviceIp);
|
||||
// if (adb == null) {
|
||||
// return;
|
||||
// }
|
||||
// AdbShellResponse adbShellResponse = null;
|
||||
// try {
|
||||
// adbShellResponse = adb.shell(cmd);
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// if (adbShellResponse != null) {
|
||||
// if (adbShellResponse.getExitCode() == 0) {
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// th.start();
|
||||
// }
|
||||
//
|
||||
// private void initializePlayer() {
|
||||
// if (player == null) {
|
||||
//
|
||||
// // 创建一个默认的 RenderersFactory
|
||||
// RenderersFactory renderersFactory = new DefaultRenderersFactory(this)
|
||||
// .setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON);
|
||||
// player = new ExoPlayer.Builder(this).setRenderersFactory(renderersFactory)
|
||||
// .setLoadControl(new DefaultLoadControl()).build();
|
||||
// playerView.setPlayer(player);
|
||||
// player.addListener(new Player.Listener() {
|
||||
// @Override
|
||||
// public void onPlayerError(PlaybackException error) {
|
||||
// Log.e(TAG, "播放错误: " + error.getMessage());
|
||||
// Log.e(TAG, "播放错误: " + error.getCause());
|
||||
// Log.e(TAG, "播放错误: " + error.getErrorCodeName());
|
||||
// handlePlaybackError();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPlaybackStateChanged(int state) {
|
||||
// if (state == Player.STATE_BUFFERING) {
|
||||
// if (!isBuffering) {
|
||||
// isBuffering = true;
|
||||
// bufferingStartTime = System.currentTimeMillis();
|
||||
// // 启动缓冲超时检查
|
||||
// retryHandler.postDelayed(bufferingTimeoutRunnable, BUFFERING_TIMEOUT_MS);
|
||||
// }
|
||||
// } else if (state == Player.STATE_READY) {
|
||||
// AlertDialogUtils.dismiss(alertDialog);
|
||||
// isBuffering = false;
|
||||
// retryHandler.removeCallbacks(bufferingTimeoutRunnable);
|
||||
// retryCount = 0;
|
||||
// currentRetryDelay = INITIAL_RETRY_DELAY_MS;
|
||||
// Log.d(TAG, "播放器准备就绪");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// startPlayback();
|
||||
// }
|
||||
//
|
||||
// private Runnable bufferingTimeoutRunnable = new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// if (isBuffering) {
|
||||
// Log.w(TAG, "缓冲超时,触发重连");
|
||||
// handlePlaybackError();
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// private void startPlayback() {
|
||||
// if (player == null) return;
|
||||
// Log.d(TAG, "开始播放,重试次数: " + retryCount);
|
||||
// MediaItem mediaItem = MediaItem.fromUri("rtsp://61.169.135.146:1554/live/abc");
|
||||
// RtspMediaSource mediaSource = new RtspMediaSource.Factory().createMediaSource(mediaItem);
|
||||
// player.setMediaItem(mediaItem);
|
||||
// player.prepare();
|
||||
// player.setPlayWhenReady(true);
|
||||
// }
|
||||
//
|
||||
// private void handlePlaybackError() {
|
||||
// releasePlayerInternal();
|
||||
// if (retryCount < MAX_RETRIES) {
|
||||
// retryCount++;
|
||||
// Log.d(TAG, "准备重试 (" + retryCount + "), 延迟: " + currentRetryDelay + "ms");
|
||||
// retryHandler.postDelayed(() -> {
|
||||
// initializePlayer();
|
||||
// // 增加下次重试的延迟时间(使用退避算法)
|
||||
// currentRetryDelay = Math.min((long) (currentRetryDelay * RETRY_BACKOFF_MULTIPLIER), MAX_RETRY_DELAY_MS);
|
||||
// }, currentRetryDelay);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void releasePlayerInternal() {
|
||||
// if (player != null) {
|
||||
// player.release();
|
||||
// player = null;
|
||||
// isBuffering = false;
|
||||
// retryHandler.removeCallbacks(bufferingTimeoutRunnable);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void onDestroy() {
|
||||
// super.onDestroy();
|
||||
// AlertDialogUtils.dismiss(alertDialog);
|
||||
// releasePlayerInternal();
|
||||
// stopStreaming();
|
||||
// }
|
||||
//
|
||||
// @OptIn(markerClass = UnstableApi.class)
|
||||
// @Override
|
||||
// protected void onPause() {
|
||||
// super.onPause();
|
||||
// if (Util.SDK_INT < 24) {
|
||||
// releasePlayerInternal();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @OptIn(markerClass = UnstableApi.class)
|
||||
// @Override
|
||||
// protected void onStop() {
|
||||
// super.onStop();
|
||||
// if (Util.SDK_INT >= 24) {
|
||||
// releasePlayerInternal();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// // Inflate the menu; this adds items to the action bar if it is present.
|
||||
// getMenuInflater().inflate(R.menu.stream_activity_actions, menu);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// int id = item.getItemId();
|
||||
// switch (id) {
|
||||
// case android.R.id.home: //返回键的id
|
||||
// initializePlayer();
|
||||
// return false;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// return super.onOptionsItemSelected(item);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// switch (v.getId()) {
|
||||
// case R.id.back:
|
||||
// finish();
|
||||
// break;
|
||||
// case R.id.refresh:
|
||||
// initEvent();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -0,0 +1,45 @@
|
||||
package com.xypower.mpremote;
|
||||
|
||||
import android.net.wifi.WifiNetworkSuggestion;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.content.Context;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class WifiConnector {
|
||||
|
||||
private final Context context;
|
||||
private final WifiManager wifiManager;
|
||||
|
||||
public WifiConnector(Context context) {
|
||||
this.context = context;
|
||||
this.wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.Q)
|
||||
public void suggestWifiNetwork(String ssid, String password) {
|
||||
if (wifiManager == null) {
|
||||
Toast.makeText(context, "Wi-Fi 服务不可用", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
// 创建 Wi-Fi 网络建议
|
||||
WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder()
|
||||
.setSsid(ssid) // SSID
|
||||
.setWpa2Passphrase(password) // 密码
|
||||
.setIsAppInteractionRequired(true) // 需要用户交互
|
||||
.build();
|
||||
|
||||
// 提交网络建议
|
||||
int status = wifiManager.addNetworkSuggestions(Collections.singletonList(suggestion));
|
||||
if (status == WifiManager.STATUS_NETWORK_SUGGESTIONS_SUCCESS) {
|
||||
Toast.makeText(context, "已建议连接到 Wi-Fi", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(context, "无法建议连接到 Wi-Fi", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.xypower.mpremote.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.xypower.mpremote.R;
|
||||
import com.xypower.mpremote.interfaces.OnImageItemClickListener;
|
||||
import com.xypower.mpremote.utils.ImageUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ImageItemAdapter extends RecyclerView.Adapter<ImageItemAdapter.MyViewHolder> {
|
||||
public int adapterType;
|
||||
public OnImageItemClickListener listener;
|
||||
|
||||
private List<String> itemList = new ArrayList<>();
|
||||
|
||||
public class MyViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView imageView;
|
||||
|
||||
public MyViewHolder(View view, OnImageItemClickListener listener) {
|
||||
super(view);
|
||||
imageView = view.findViewById(R.id.id_imageview);
|
||||
}
|
||||
|
||||
public ImageView getImage() {
|
||||
return imageView;
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnClickListener(OnImageItemClickListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void setItemList(List<String> list) {
|
||||
this.itemList = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_img_item, parent, false);
|
||||
return new MyViewHolder(view, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHolder holder, @SuppressLint("RecyclerView") int position) {
|
||||
String s = itemList.get(position);
|
||||
Glide.with(holder.itemView.getContext()).load(s).into(holder.getImage());
|
||||
// holder.getImage().setImageDrawable(ImageUtils.loadDrawable(s));
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
if (listener != null) {
|
||||
listener.onItemClick(v, position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return itemList.size();
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.xypower.mpremote.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.xypower.mpremote.R;
|
||||
import com.xypower.mpremote.bean.ChannelBean;
|
||||
import com.xypower.mpremote.interfaces.OnItemClickListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemAdapter extends RecyclerView.Adapter<ItemAdapter.MyViewHolder> {
|
||||
public int adapterType;
|
||||
public OnItemClickListener listener;
|
||||
|
||||
private List<ChannelBean> itemList = new ArrayList<>();
|
||||
|
||||
public class MyViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView title;
|
||||
public MyViewHolder(View view, OnItemClickListener listener) {
|
||||
super(view);
|
||||
title = view.findViewById(R.id.channel);
|
||||
}
|
||||
public TextView getTitle() {
|
||||
return title;
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnClickListener(OnItemClickListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void setItemList(List<ChannelBean> list) {
|
||||
this.itemList = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
public void setAdapterType(int type) {
|
||||
this.adapterType = type;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
|
||||
return new MyViewHolder(view, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHolder holder, @SuppressLint("RecyclerView") int position) {
|
||||
ChannelBean channelBean = itemList.get(position);
|
||||
holder.getTitle().setText(channelBean.getChannelname());
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
if (listener != null) {
|
||||
listener.onItemClick(v, channelBean,adapterType);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return itemList.size();
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.xypower.mpremote.bean;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class ChannelBean {
|
||||
public ChannelBean() {
|
||||
}
|
||||
|
||||
String text;
|
||||
|
||||
int channel;
|
||||
String channelname;
|
||||
JSONObject jsonObject;
|
||||
|
||||
public JSONObject getJsonObject() {
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
public void setJsonObject(JSONObject jsonObject) {
|
||||
this.jsonObject = jsonObject;
|
||||
}
|
||||
|
||||
public String getChannelname() {
|
||||
return channelname;
|
||||
}
|
||||
|
||||
public void setChannelname(String channelname) {
|
||||
this.channelname = channelname;
|
||||
}
|
||||
|
||||
public int getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
public void setChannel(int channel) {
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.xypower.mpremote.interfaces;
|
||||
|
||||
public interface CompleteCallback {
|
||||
void onResult();
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.xypower.mpremote.interfaces;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.xypower.mpremote.bean.ChannelBean;
|
||||
|
||||
public interface OnImageItemClickListener {
|
||||
void onItemClick(View v, int position);
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
package com.xypower.mpremote.interfaces;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.xypower.mpremote.bean.ChannelBean;
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(View v, ChannelBean position, int adapterType);
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
package com.xypower.mpremote.utils;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.xypower.mpremote.R;
|
||||
|
||||
public class AlertDialogUtils {
|
||||
|
||||
public static AlertDialog show(Context context,String hint) {
|
||||
// 创建 AlertDialog
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
View dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_loading, null);
|
||||
TextView viewById = dialogView.findViewById(R.id.tvLoading);
|
||||
viewById.setText(hint);
|
||||
builder.setView(dialogView);
|
||||
builder.setCancelable(true); // 是否允许用户取消
|
||||
AlertDialog loadingDialog = builder.create();
|
||||
loadingDialog.show();
|
||||
return loadingDialog;
|
||||
}
|
||||
|
||||
|
||||
public static void dismiss(AlertDialog loadingDialog) {
|
||||
if (loadingDialog != null) {
|
||||
loadingDialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.xypower.mpremote.utils;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.os.CountDownTimer;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.xypower.mpremote.R;
|
||||
|
||||
|
||||
public class CountdownAlertDialog {
|
||||
|
||||
private static AlertDialog dialog;
|
||||
private static CountDownTimer countDownTimer;
|
||||
private static OnCountdownFinishedListener listener;
|
||||
|
||||
// 显示对话框(静态方法)
|
||||
public static void show(Context context,
|
||||
int countdownSeconds, OnCountdownFinishedListener listener) {
|
||||
// 先关闭已存在的对话框
|
||||
dismiss();
|
||||
// 创建 AlertDialog
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
View dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_loading, null);
|
||||
TextView viewById = dialogView.findViewById(R.id.tvLoading);
|
||||
viewById.setText("视频加载倒计时: " + countdownSeconds + " 秒");
|
||||
builder.setView(dialogView);
|
||||
builder.setCancelable(true); // 是否允许用户取消
|
||||
dialog = builder.create();
|
||||
dialog.show();
|
||||
|
||||
CountdownAlertDialog.listener = listener;
|
||||
// 创建并显示对话框
|
||||
|
||||
if (countdownSeconds > 0) {
|
||||
// 创建倒计时器
|
||||
countDownTimer = new CountDownTimer(countdownSeconds * 1000, 1000) {
|
||||
public void onTick(long millisUntilFinished) {
|
||||
int secondsLeft = (int) (millisUntilFinished / 1000);
|
||||
viewById.setText("视频加载倒计时: " + secondsLeft + " 秒");
|
||||
}
|
||||
|
||||
public void onFinish() {
|
||||
dismiss();
|
||||
if (CountdownAlertDialog.listener != null) {
|
||||
CountdownAlertDialog.listener.onCountdownFinished();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
// 设置对话框监听
|
||||
dialog.setOnCancelListener(dialogInterface -> {
|
||||
if (CountdownAlertDialog.listener != null) {
|
||||
CountdownAlertDialog.listener.onCountdownCancelled();
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
|
||||
dialog.setOnDismissListener(dialogInterface -> dismiss());
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
// 关闭对话框(静态方法)
|
||||
public static void dismiss() {
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
dialog = null;
|
||||
}
|
||||
listener = null;
|
||||
}
|
||||
|
||||
// 检查对话框是否显示中(静态方法)
|
||||
public static boolean isShowing() {
|
||||
return dialog != null && dialog.isShowing();
|
||||
}
|
||||
|
||||
// 回调接口
|
||||
public interface OnCountdownFinishedListener {
|
||||
void onCountdownFinished();
|
||||
|
||||
default void onCountdownCancelled() {
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.xypower.mpremote.utils;
|
||||
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
public class ImageUtils {
|
||||
|
||||
public static Drawable loadDrawable(String file) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Drawable drawable = null;
|
||||
try {
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(file);
|
||||
drawable = new BitmapDrawable(bitmap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return drawable;
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.xypower.mpremote.utils;
|
||||
|
||||
public class WifiUtils {
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- res/drawable/rounded_button.xml -->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 设置背景颜色 -->
|
||||
<solid android:color="#C0C0C0" />
|
||||
<!-- 设置圆角半径 -->
|
||||
<corners android:radius="15dp" />
|
||||
<!-- 可选:设置边框 -->
|
||||
<stroke android:width="2dp" android:color="#fff" />
|
||||
</shape>
|
@ -1,112 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".DeviceActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/deviceInfo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:singleLine="false"
|
||||
android:lineSpacingMultiplier="1.25"
|
||||
android:textSize="16sp"
|
||||
android:text=""
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@+id/takePhoto1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:minWidth="72dp"
|
||||
android:visibility="gone"
|
||||
android:text="通道1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/takeVideo1" />
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/takePhoto2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:minWidth="72dp"
|
||||
android:visibility="gone"
|
||||
android:text="通道2"
|
||||
app:layout_constraintStart_toEndOf="@+id/takePhoto1"
|
||||
app:layout_constraintTop_toTopOf="@+id/takePhoto1" />
|
||||
<TextView
|
||||
android:id="@+id/deviceInfo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:lineSpacingMultiplier="1.25"
|
||||
android:singleLine="false"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/takePhoto3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:minWidth="72dp"
|
||||
android:visibility="gone"
|
||||
android:text="通道3"
|
||||
app:layout_constraintStart_toEndOf="@+id/takePhoto2"
|
||||
app:layout_constraintTop_toTopOf="@+id/takePhoto1" />
|
||||
<Button
|
||||
android:id="@+id/yt_control"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="云台控制"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/deviceInfo" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/takePhoto4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:minWidth="72dp"
|
||||
android:visibility="gone"
|
||||
android:text="通道4"
|
||||
app:layout_constraintStart_toEndOf="@+id/takePhoto3"
|
||||
app:layout_constraintTop_toTopOf="@+id/takePhoto1" />
|
||||
<TextView
|
||||
android:id="@+id/phototext"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="拍照"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/deviceInfo" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/takeVideo1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:minWidth="72dp"
|
||||
android:visibility="gone"
|
||||
android:text="视频1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerViewPhoto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="20dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/phototext" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/takeVideo2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:minWidth="72dp"
|
||||
android:visibility="gone"
|
||||
android:text="视频2"
|
||||
app:layout_constraintStart_toEndOf="@id/takeVideo1"
|
||||
app:layout_constraintBottom_toBottomOf="@id/takeVideo1" />
|
||||
<TextView
|
||||
android:id="@+id/videotext"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="视频预览"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/recyclerViewPhoto" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/takeVideo3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:minWidth="72dp"
|
||||
android:visibility="gone"
|
||||
android:text="视频3"
|
||||
app:layout_constraintStart_toEndOf="@id/takeVideo2"
|
||||
app:layout_constraintBottom_toBottomOf="@id/takeVideo1" />
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerViewVideo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="20dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/videotext" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/takeVideo4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:minWidth="72dp"
|
||||
android:visibility="gone"
|
||||
android:text="视频4"
|
||||
app:layout_constraintStart_toEndOf="@id/takeVideo3"
|
||||
app:layout_constraintBottom_toBottomOf="@id/takeVideo1" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
@ -1,18 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical"
|
||||
tools:context=".StreamActivity">
|
||||
|
||||
<androidx.media3.ui.PlayerView
|
||||
android:id="@+id/playerView"
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
|
||||
<!-- <SurfaceView-->
|
||||
<!-- android:id="@+id/playerView"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/toolbar" />-->
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:show_buffering="always"
|
||||
app:show_timeout="5000"
|
||||
app:use_controller="false"
|
||||
app:resize_mode="fit"/>
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextureView
|
||||
android:id="@+id/textureView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center" />
|
||||
</FrameLayout>
|
||||
<!-- <TextureView-->
|
||||
<!-- android:id="@+id/textureView"-->
|
||||
<!-- android:layout_gravity="center"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- />-->
|
||||
<!-- <androidx.media3.ui.PlayerView-->
|
||||
<!-- android:id="@+id/playerView"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="0dip"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/toolbar"-->
|
||||
<!-- app:resize_mode="fit"-->
|
||||
<!-- app:show_buffering="always"-->
|
||||
<!-- app:show_timeout="5000"-->
|
||||
<!-- app:use_controller="false"-->
|
||||
<!-- tools:ignore="MissingConstraints" />-->
|
||||
|
||||
<!-- <tv.danmaku.ijk.media.widget.IjkVideoView-->
|
||||
<!-- android:id="@+id/video_view"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent" />-->
|
||||
|
||||
<!-- <FrameLayout-->
|
||||
<!-- android:id="@+id/video_container"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent" />-->
|
||||
|
||||
<!-- <ImageButton-->
|
||||
<!-- android:id="@+id/center"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:background="@mipmap/refresh"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- app:layout_constraintVertical_bias="0.9" />-->
|
||||
|
||||
<!-- <ImageButton-->
|
||||
<!-- android:layout_marginBottom="10dp"-->
|
||||
<!-- android:id="@+id/top"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:background="@mipmap/up"-->
|
||||
<!-- app:layout_constraintBottom_toTopOf="@+id/center"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="@+id/center" />-->
|
||||
|
||||
<!-- <ImageButton-->
|
||||
<!-- android:layout_marginRight="10dp"-->
|
||||
<!-- android:id="@+id/left"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:background="@mipmap/left"-->
|
||||
<!-- app:layout_constraintRight_toLeftOf="@+id/center"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@+id/center" />-->
|
||||
|
||||
<!-- <ImageButton-->
|
||||
<!-- android:layout_marginLeft="10dp"-->
|
||||
<!-- android:id="@+id/right"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:background="@mipmap/right"-->
|
||||
<!-- app:layout_constraintLeft_toRightOf="@+id/center"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@+id/center" />-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:layout_marginTop="10dp"-->
|
||||
<!-- android:id="@+id/bottom"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:background="@mipmap/down"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="@+id/center"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/center" />-->
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressbar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLoading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="Loading..."
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/progressbar" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/id_channel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/id_datetime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="" />
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingBottom="20dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/id_imageview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="2dp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -1,25 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:orientation="horizontal" >
|
||||
android:layout_height="50dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/id_img"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_wifi" />
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/id_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="" />
|
||||
<TextView
|
||||
android:id="@+id/channel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="dfdsasdafdsd"
|
||||
android:textSize="15sp"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,48 @@
|
||||
<!-- res/layout/custom_title_bar.xml -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dip"
|
||||
android:background="@color/orange_dark"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/back"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/back" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="欣影遥控"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/refresh"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="invisible">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="刷新"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="25sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
After Width: | Height: | Size: 549 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1 @@
|
||||
XyMpApp
|