Clean code
This commit is contained in:
parent
51eb4db7bd
commit
0d80852531
4 changed files with 21 additions and 39 deletions
|
@ -47,7 +47,6 @@
|
||||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
|
||||||
<uses-feature android:name="android.hardware.camera.autofocus" />
|
|
||||||
<supports-screens
|
<supports-screens
|
||||||
android:anyDensity="true"
|
android:anyDensity="true"
|
||||||
android:largeScreens="true"
|
android:largeScreens="true"
|
||||||
|
|
|
@ -87,7 +87,6 @@ public class AssistantActivity extends Activity
|
||||||
AccountCreatorListener {
|
AccountCreatorListener {
|
||||||
private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 201;
|
private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 201;
|
||||||
private static final int PERMISSIONS_REQUEST_CAMERA = 202;
|
private static final int PERMISSIONS_REQUEST_CAMERA = 202;
|
||||||
private static final int PERMISSIONS_ENABLED_CAMERA = 203;
|
|
||||||
private static AssistantActivity instance;
|
private static AssistantActivity instance;
|
||||||
public DialPlan country;
|
public DialPlan country;
|
||||||
public String phone_number;
|
public String phone_number;
|
||||||
|
@ -399,17 +398,11 @@ public class AssistantActivity extends Activity
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PERMISSIONS_REQUEST_RECORD_AUDIO:
|
case PERMISSIONS_REQUEST_RECORD_AUDIO:
|
||||||
LinphoneUtils.dispatchOnUIThread(
|
|
||||||
new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
launchEchoCancellerCalibration(true);
|
launchEchoCancellerCalibration(true);
|
||||||
} else {
|
} else {
|
||||||
isEchoCalibrationFinished();
|
isEchoCalibrationFinished();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -581,7 +574,7 @@ public class AssistantActivity extends Activity
|
||||||
!= PackageManager.PERMISSION_GRANTED) {
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
checkAndRequestVideoPermission();
|
checkAndRequestVideoPermission();
|
||||||
} else {
|
} else {
|
||||||
fragment = new QrcodeFragment();
|
fragment = new QrCodeFragment();
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
currentFragment = AssistantFragmentsEnum.QRCODE_READER;
|
currentFragment = AssistantFragmentsEnum.QRCODE_READER;
|
||||||
back.setVisibility(View.VISIBLE);
|
back.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.linphone.assistant;
|
package org.linphone.assistant;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
QrcodeFragment.java
|
QrCodeFragment.java
|
||||||
Copyright (C) 2018 Belledonne Communications, Grenoble, France
|
Copyright (C) 2018 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
|
@ -31,7 +31,7 @@ import org.linphone.core.Core;
|
||||||
import org.linphone.core.CoreListenerStub;
|
import org.linphone.core.CoreListenerStub;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||||
|
|
||||||
public class QrcodeFragment extends Fragment {
|
public class QrCodeFragment extends Fragment {
|
||||||
private TextureView mQrcodeView;
|
private TextureView mQrcodeView;
|
||||||
private CoreListenerStub mListener;
|
private CoreListenerStub mListener;
|
||||||
|
|
||||||
|
@ -84,11 +84,6 @@ public class QrcodeFragment extends Fragment {
|
||||||
enableQrcodeReader(true);
|
enableQrcodeReader(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
launchQrcodeReader();
|
launchQrcodeReader();
|
||||||
|
@ -101,9 +96,4 @@ public class QrcodeFragment extends Fragment {
|
||||||
// setBackCamera(false);
|
// setBackCamera(false);
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -33,24 +33,24 @@ import org.linphone.R;
|
||||||
import org.linphone.settings.LinphonePreferences;
|
import org.linphone.settings.LinphonePreferences;
|
||||||
|
|
||||||
public class RemoteProvisioningFragment extends Fragment implements OnClickListener, TextWatcher {
|
public class RemoteProvisioningFragment extends Fragment implements OnClickListener, TextWatcher {
|
||||||
private EditText remoteProvisioningUrl;
|
private EditText mRemoteProvisioningUrl;
|
||||||
private Button apply, qrcode;
|
private Button mApply, mQrcode;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(
|
public View onCreateView(
|
||||||
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.assistant_remote_provisioning, container, false);
|
View view = inflater.inflate(R.layout.assistant_remote_provisioning, container, false);
|
||||||
|
|
||||||
remoteProvisioningUrl = view.findViewById(R.id.assistant_remote_provisioning_url);
|
mRemoteProvisioningUrl = view.findViewById(R.id.assistant_remote_provisioning_url);
|
||||||
remoteProvisioningUrl.addTextChangedListener(this);
|
mRemoteProvisioningUrl.addTextChangedListener(this);
|
||||||
qrcode = view.findViewById(R.id.assistant_qrcode);
|
mQrcode = view.findViewById(R.id.assistant_qrcode);
|
||||||
qrcode.setOnClickListener(this);
|
mQrcode.setOnClickListener(this);
|
||||||
apply = view.findViewById(R.id.assistant_apply);
|
mApply = view.findViewById(R.id.assistant_apply);
|
||||||
apply.setEnabled(false);
|
mApply.setEnabled(false);
|
||||||
apply.setOnClickListener(this);
|
mApply.setOnClickListener(this);
|
||||||
|
|
||||||
if (!getArguments().getString("RemoteUrl").isEmpty()) {
|
if (getArguments() != null && !getArguments().getString("RemoteUrl").isEmpty()) {
|
||||||
remoteProvisioningUrl.setText(getArguments().getString("RemoteUrl"));
|
mRemoteProvisioningUrl.setText(getArguments().getString("RemoteUrl"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
@ -61,7 +61,7 @@ public class RemoteProvisioningFragment extends Fragment implements OnClickListe
|
||||||
int id = v.getId();
|
int id = v.getId();
|
||||||
|
|
||||||
if (id == R.id.assistant_apply) {
|
if (id == R.id.assistant_apply) {
|
||||||
String url = remoteProvisioningUrl.getText().toString();
|
String url = mRemoteProvisioningUrl.getText().toString();
|
||||||
AssistantActivity.instance().displayRemoteProvisioningInProgressDialog();
|
AssistantActivity.instance().displayRemoteProvisioningInProgressDialog();
|
||||||
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
|
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
|
||||||
LinphoneManager.getLc().getConfig().sync();
|
LinphoneManager.getLc().getConfig().sync();
|
||||||
|
@ -77,7 +77,7 @@ public class RemoteProvisioningFragment extends Fragment implements OnClickListe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
apply.setEnabled(!remoteProvisioningUrl.getText().toString().isEmpty());
|
mApply.setEnabled(!mRemoteProvisioningUrl.getText().toString().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue