Skip to content
Snippets Groups Projects
Commit 4ecfd81c authored by Alexandre Lision's avatar Alexandre Lision
Browse files

ui: Clean up variables

Refs #40232
parent 89ff687c
Branches
Tags
No related merge requests found
...@@ -51,11 +51,8 @@ import android.view.*; ...@@ -51,11 +51,8 @@ import android.view.*;
import android.view.SurfaceHolder.Callback; import android.view.SurfaceHolder.Callback;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.Button; import android.widget.*;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
import android.widget.ToggleButton;
import org.sflphone.R; import org.sflphone.R;
import org.sflphone.interfaces.CallInterface; import org.sflphone.interfaces.CallInterface;
import org.sflphone.model.*; import org.sflphone.model.*;
...@@ -72,21 +69,18 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -72,21 +69,18 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
static final float ATTRACTOR_SIZE = 40; static final float ATTRACTOR_SIZE = 40;
public static final int REQUEST_TRANSFER = 10; public static final int REQUEST_TRANSFER = 10;
private TextView callStatusTxt;
private ToggleButton speakers;
private PowerManager powerManager;
// Screen wake lock for incoming call // Screen wake lock for incoming call
private WakeLock wakeLock; private WakeLock mScreenWakeLock;
private BubblesView view; private BubblesView mBubbleView;
private BubbleModel model; private BubbleModel model;
ViewSwitcher mSecuritySwitch;
private TextView mCallStatusTxt;
private ToggleButton mToggleSpeakers;
public Callbacks mCallbacks = sDummyCallbacks; public Callbacks mCallbacks = sDummyCallbacks;
boolean accepted = false; boolean accepted = false;
private Bitmap call_icon;
TransferDFragment editName; TransferDFragment editName;
private WifiManager wifiManager; private WifiManager wifiManager;
...@@ -107,16 +101,14 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -107,16 +101,14 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
BUBBLE_SIZE = getResources().getDimension(R.dimen.bubble_size); BUBBLE_SIZE = getResources().getDimension(R.dimen.bubble_size);
Log.e(TAG, "BUBBLE_SIZE " + BUBBLE_SIZE); Log.e(TAG, "BUBBLE_SIZE " + BUBBLE_SIZE);
this.setHasOptionsMenu(true); this.setHasOptionsMenu(true);
PowerManager powerManager = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE);
powerManager = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE); mScreenWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
"org.sflphone.onIncomingCall"); "org.sflphone.onIncomingCall");
wakeLock.setReferenceCounted(false); mScreenWakeLock.setReferenceCounted(false);
Log.d(TAG, "Acquire wake up lock"); Log.d(TAG, "Acquire wake up lock");
if (wakeLock != null && !wakeLock.isHeld()) { if (mScreenWakeLock != null && !mScreenWakeLock.isHeld()) {
wakeLock.acquire(); mScreenWakeLock.acquire();
} }
} }
...@@ -240,8 +232,8 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -240,8 +232,8 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
getActivity().unregisterReceiver(wifiReceiver); getActivity().unregisterReceiver(wifiReceiver);
if (wakeLock != null && wakeLock.isHeld()) { if (mScreenWakeLock != null && mScreenWakeLock.isHeld()) {
wakeLock.release(); mScreenWakeLock.release();
} }
} }
...@@ -254,14 +246,14 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -254,14 +246,14 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
if (getConference().isOnGoing()) { if (getConference().isOnGoing()) {
initNormalStateDisplay(); initNormalStateDisplay();
} else if (getConference().isRinging()) { } else if (getConference().isRinging()) {
callStatusTxt.setText(newState); mCallStatusTxt.setText(newState);
if (getConference().isIncoming()) { if (getConference().isIncoming()) {
initIncomingCallDisplay(); initIncomingCallDisplay();
} else } else
initOutGoingCallDisplay(); initOutGoingCallDisplay();
} else { } else {
callStatusTxt.setText(newState); mCallStatusTxt.setText(newState);
mCallbacks.terminateCall(); mCallbacks.terminateCall();
} }
} }
...@@ -283,26 +275,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -283,26 +275,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
Log.i(TAG, "displaySAS"); Log.i(TAG, "displaySAS");
mCallbacks.updateDisplayedConference(updated); mCallbacks.updateDisplayedConference(updated);
SecureSipCall display = (SecureSipCall) getConference().getCallById(securedCallID); SecureSipCall display = (SecureSipCall) getConference().getCallById(securedCallID);
enableZRTP(display);
if (display != null) {
if (!display.isConfirmedSAS()) {
final Button sas = (Button) getView().findViewById(R.id.confirm_sas);
sas.setText("Confirm SAS: " + display.getSAS());
sas.setVisibility(View.VISIBLE);
sas.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
mCallbacks.getService().confirmSAS(securedCallID);
sas.setVisibility(View.INVISIBLE);
} catch (RemoteException e) {
e.printStackTrace();
}
}
});
}
}
} }
@Override @Override
...@@ -346,17 +319,17 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -346,17 +319,17 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.frag_call, container, false); final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.frag_call, container, false);
view = (BubblesView) rootView.findViewById(R.id.main_view); mBubbleView = (BubblesView) rootView.findViewById(R.id.main_view);
view.setFragment(this); mBubbleView.setFragment(this);
view.setModel(model); mBubbleView.setModel(model);
view.getHolder().addCallback(this); mBubbleView.getHolder().addCallback(this);
mCallStatusTxt = (TextView) rootView.findViewById(R.id.call_status_txt);
callStatusTxt = (TextView) rootView.findViewById(R.id.call_status_txt);
call_icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_action_call);
speakers = (ToggleButton) rootView.findViewById(R.id.speaker_toggle); mToggleSpeakers = (ToggleButton) rootView.findViewById(R.id.speaker_toggle);
speakers.setOnCheckedChangeListener(new OnCheckedChangeListener() { mToggleSpeakers.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
...@@ -437,7 +410,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -437,7 +410,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
int radiusCalls = (int) (model.width / 2 - BUBBLE_SIZE); int radiusCalls = (int) (model.width / 2 - BUBBLE_SIZE);
getBubbleForUser(getConference(), model.width / 2, model.height / 2 + radiusCalls); getBubbleForUser(getConference(), model.width / 2, model.height / 2 + radiusCalls);
getBubbleFor(getConference().getParticipants().get(0), model.width / 2, model.height / 2 - radiusCalls); getBubbleFor(getConference().getParticipants().get(0), model.width / 2, model.height / 2 - radiusCalls);
Bitmap call_icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_action_call);
model.clearAttractors(); model.clearAttractors();
model.addAttractor(new Attractor(new PointF(model.width / 2, model.height / 2), ATTRACTOR_SIZE, new Attractor.Callback() { model.addAttractor(new Attractor(new PointF(model.width / 2, model.height / 2), ATTRACTOR_SIZE, new Attractor.Callback() {
@Override @Override
...@@ -527,7 +500,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -527,7 +500,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
} }
public boolean draggingBubble() { public boolean draggingBubble() {
return view == null ? false : view.isDraggingBubble(); return mBubbleView == null ? false : mBubbleView.isDraggingBubble();
} }
@Override @Override
...@@ -571,14 +544,14 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -571,14 +544,14 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
public void surfaceDestroyed(SurfaceHolder holder) { public void surfaceDestroyed(SurfaceHolder holder) {
// check that soft input is hidden // check that soft input is hidden
InputMethodManager lManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager lManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
lManager.hideSoftInputFromWindow(view.getWindowToken(), 0); lManager.hideSoftInputFromWindow(mBubbleView.getWindowToken(), 0);
if (editName != null && editName.isVisible()) { if (editName != null && editName.isVisible()) {
editName.dismiss(); editName.dismiss();
} }
} }
public BubblesView getBubbleView() { public BubblesView getBubbleView() {
return view; return mBubbleView;
} }
public void updateTime() { public void updateTime() {
...@@ -586,7 +559,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -586,7 +559,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
long duration = System.currentTimeMillis() - getConference().getParticipants().get(0).getTimestampStart_(); long duration = System.currentTimeMillis() - getConference().getParticipants().get(0).getTimestampStart_();
duration = duration / 1000; duration = duration / 1000;
if (getConference().isOnGoing()) if (getConference().isOnGoing())
callStatusTxt.setText(String.format("%d:%02d:%02d", duration / 3600, duration % 3600 / 60, duration % 60)); mCallStatusTxt.setText(String.format("%d:%02d:%02d", duration / 3600, duration % 3600 / 60, duration % 60));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment