Search in sources :

Example 1 with SyncthingService

use of com.nutomic.syncthingandroid.service.SyncthingService in project syncthing-android by syncthing.

the class MainActivity method onDestroy.

@Override
public void onDestroy() {
    super.onDestroy();
    SyncthingService mSyncthingService = getService();
    if (mSyncthingService != null) {
        mSyncthingService.unregisterOnServiceStateChangeListener(this);
        mSyncthingService.unregisterOnServiceStateChangeListener(mFolderListFragment);
        mSyncthingService.unregisterOnServiceStateChangeListener(mDeviceListFragment);
    }
}
Also used : SyncthingService(com.nutomic.syncthingandroid.service.SyncthingService)

Example 2 with SyncthingService

use of com.nutomic.syncthingandroid.service.SyncthingService in project syncthing-android by syncthing.

the class FolderActivity method onServiceConnected.

/**
 * Save current settings in case we are in create mode and they aren't yet stored in the config.
 */
@Override
public void onServiceConnected() {
    Log.v(TAG, "onServiceConnected");
    SyncthingService syncthingService = (SyncthingService) getService();
    syncthingService.getNotificationHandler().cancelConsentNotification(getIntent().getIntExtra(EXTRA_NOTIFICATION_ID, 0));
    syncthingService.registerOnServiceStateChangeListener(this);
}
Also used : SyncthingService(com.nutomic.syncthingandroid.service.SyncthingService)

Example 3 with SyncthingService

use of com.nutomic.syncthingandroid.service.SyncthingService in project syncthing-android by syncthing.

the class MainActivity method onResume.

@Override
public void onResume() {
    // Check if storage permission has been revoked at runtime.
    if (!PermissionUtil.haveStoragePermission(this)) {
        startActivity(new Intent(this, FirstStartActivity.class));
        this.finish();
    }
    // Evaluate run conditions to detect changes made to the metered wifi flags.
    SyncthingService mSyncthingService = getService();
    if (mSyncthingService != null) {
        mSyncthingService.evaluateRunConditions();
    }
    super.onResume();
}
Also used : Intent(android.content.Intent) SyncthingService(com.nutomic.syncthingandroid.service.SyncthingService)

Example 4 with SyncthingService

use of com.nutomic.syncthingandroid.service.SyncthingService in project syncthing-android by syncthing.

the class MainActivity method onServiceConnected.

@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
    super.onServiceConnected(componentName, iBinder);
    SyncthingServiceBinder syncthingServiceBinder = (SyncthingServiceBinder) iBinder;
    SyncthingService syncthingService = syncthingServiceBinder.getService();
    syncthingService.registerOnServiceStateChangeListener(this);
    syncthingService.registerOnServiceStateChangeListener(mFolderListFragment);
    syncthingService.registerOnServiceStateChangeListener(mDeviceListFragment);
}
Also used : SyncthingService(com.nutomic.syncthingandroid.service.SyncthingService) SyncthingServiceBinder(com.nutomic.syncthingandroid.service.SyncthingServiceBinder)

Example 5 with SyncthingService

use of com.nutomic.syncthingandroid.service.SyncthingService in project syncthing-android by syncthing.

the class DeviceActivity method onDestroy.

@Override
public void onDestroy() {
    super.onDestroy();
    SyncthingService syncthingService = getService();
    if (syncthingService != null) {
        syncthingService.getNotificationHandler().cancelConsentNotification(getIntent().getIntExtra(EXTRA_NOTIFICATION_ID, 0));
        syncthingService.unregisterOnServiceStateChangeListener(this::onServiceStateChange);
    }
    mIdView.removeTextChangedListener(mIdTextWatcher);
    mNameView.removeTextChangedListener(mNameTextWatcher);
    mAddressesView.removeTextChangedListener(mAddressesTextWatcher);
}
Also used : SyncthingService(com.nutomic.syncthingandroid.service.SyncthingService)

Aggregations

SyncthingService (com.nutomic.syncthingandroid.service.SyncthingService)9 Intent (android.content.Intent)1 SyncthingServiceBinder (com.nutomic.syncthingandroid.service.SyncthingServiceBinder)1