Skip to content

Commit

Permalink
Try to resolve the connection problem
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaudM committed Dec 3, 2017
1 parent c97efeb commit 99e38fb
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.thibaudperso.sonycamera"
android:versionCode="19"
android:versionName="3.0.2">
android:versionCode="20"
android:versionName="3.0.3">

<uses-sdk tools:overrideLibrary=" com.google.android.gms.ads,
com.google.android.gms.ads.impl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ public CameraAPI(Context context) {

public void setDevice(Device device) {
mCameraWS.setWSUrl(device.getWebService());
initialize();

for (DeviceChangedListener listener : mDeviceChangedListeners) listener.onNewDevice(device);
}

private void initialize() {
public void initializeWS() {
if (mIsDeviceInitialized) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public DeviceManager(TimelapseApplication application) {
for (Device device : mDevicesList) {
if (device.getId() == currentCameraId) {
mSelectedDevice = device;
mApplication.getCameraAPI().setDevice(device);
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ protected String getGuideTitle() {

@Override
public void onBackPressed() {
mApplication.getCameraAPI().closeConnection();
mApplication.getWifiHandler().disconnect();
mStateMachineConnection.reset();
setResult(RESULT_CANCELED, new Intent().putExtra(EXTRA_EXIT, true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public void onClick(DialogInterface dialog, int id) {
.getDefaultSharedPreferences(getContext()).edit();
editor.putBoolean(PREF_AUTOMATIC_CONTINUE, false);
editor.apply();
mApplication.getCameraAPI().closeConnection();
mApplication.getWifiHandler().disconnect();
getActivity().finish();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ protected String getGuideTitle() {

@Override
public void onBackPressed() {
mApplication.getCameraAPI().closeConnection();
mApplication.getWifiHandler().disconnect();
mStateMachineConnection.reset();
finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
/*
* Handle Camera spinner
*/
mCameraSpinner = (Spinner) viewResult.findViewById(R.id.connection_camera_spinner);
mCameraSpinner = viewResult.findViewById(R.id.connection_camera_spinner);

mAdapter = new ArrayAdapter<>(getActivity(),
android.R.layout.simple_list_item_1, mDeviceManager.getDevices());
Expand Down Expand Up @@ -593,6 +593,7 @@ private void stepFinished() {
}

private void nextStep() {
((TimelapseApplication) getActivity().getApplication()).getCameraAPI().initializeWS();
startActivityForResult(new Intent(getContext(), AdjustmentsActivity.class),
ADJUSTMENTS_ACTIVITY_RESULT);
}
Expand Down

0 comments on commit 99e38fb

Please sign in to comment.