|
|
|
@ -5,6 +5,8 @@ import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
import android.view.Menu;
|
|
|
|
|
import android.view.MenuInflater;
|
|
|
|
|
import android.view.MenuItem;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
import android.view.inputmethod.InputMethodManager;
|
|
|
|
@ -77,6 +79,16 @@ public class ChannelActivity extends AppCompatActivity {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
MenuInflater mMenuInflater = new MenuInflater(this);
|
|
|
|
|
mMenuInflater.inflate(R.menu.menu_channel, menu);
|
|
|
|
|
//return true;
|
|
|
|
|
return super.onCreateOptionsMenu(menu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
@ -86,6 +98,11 @@ public class ChannelActivity extends AppCompatActivity {
|
|
|
|
|
finish();
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
case R.id.action_save:
|
|
|
|
|
// todo: goto back activity from here
|
|
|
|
|
int channel = binding.channels.getSelectedItemPosition() + 1;
|
|
|
|
|
saveChannelParams(channel);
|
|
|
|
|
return true;
|
|
|
|
|
default:
|
|
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
|
|
}
|
|
|
|
@ -131,6 +148,22 @@ public class ChannelActivity extends AppCompatActivity {
|
|
|
|
|
binding.cameraId.setText("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (jsonObject.has("resolutionCX")) {
|
|
|
|
|
binding.resolutionCX.setText(Integer.toString(jsonObject.optInt("resolutionCX")));
|
|
|
|
|
} else {
|
|
|
|
|
binding.resolutionCX.setText("");
|
|
|
|
|
}
|
|
|
|
|
if (jsonObject.has("resolutionCY")) {
|
|
|
|
|
binding.resolutionCY.setText(Integer.toString(jsonObject.optInt("resolutionCY")));
|
|
|
|
|
} else {
|
|
|
|
|
binding.resolutionCY.setText("");
|
|
|
|
|
}
|
|
|
|
|
if (jsonObject.has("quality")) {
|
|
|
|
|
binding.quality.setText(Integer.toString(jsonObject.optInt("quality")));
|
|
|
|
|
} else {
|
|
|
|
|
binding.quality.setText("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject osdJsonObj = jsonObject.optJSONObject("osd");
|
|
|
|
|
if (osdJsonObj != null) {
|
|
|
|
|
binding.osdLeftTop.setText(osdJsonObj.optString("leftTop", ""));
|
|
|
|
@ -228,6 +261,21 @@ public class ChannelActivity extends AppCompatActivity {
|
|
|
|
|
} else {
|
|
|
|
|
jsonObject.remove("cameraId");
|
|
|
|
|
}
|
|
|
|
|
if (!TextUtils.isEmpty(binding.resolutionCX.getText().toString())) {
|
|
|
|
|
jsonObject.put("resolutionCX", Integer.parseInt(binding.resolutionCX.getText().toString()));
|
|
|
|
|
} else {
|
|
|
|
|
jsonObject.remove("resolutionCX");
|
|
|
|
|
}
|
|
|
|
|
if (!TextUtils.isEmpty(binding.resolutionCY.getText().toString())) {
|
|
|
|
|
jsonObject.put("resolutionCY", Integer.parseInt(binding.resolutionCY.getText().toString()));
|
|
|
|
|
} else {
|
|
|
|
|
jsonObject.remove("resolutionCY");
|
|
|
|
|
}
|
|
|
|
|
if (!TextUtils.isEmpty(binding.quality.getText().toString())) {
|
|
|
|
|
jsonObject.put("quality", Integer.parseInt(binding.quality.getText().toString()));
|
|
|
|
|
} else {
|
|
|
|
|
jsonObject.remove("quality");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject osdJsonObj = jsonObject.optJSONObject("osd");
|
|
|
|
|
if (osdJsonObj == null) {
|
|
|
|
|