We were using the SubBaseActivity class for two different kind of activities: (1) "Wrapper" activities, where we define an activity that on start simply launches another one (2) "Interactive" activities, where the user has to manually trigger the start of the subactivity, or skip the step. When the subactivity ends, only in case (1) we want to finish our activity as well, since we wouldn't have anything to show. Change-Id: I1a3ae51f6146ac32b5e7542d9a18b0b032efe144
58 lines
2.0 KiB
Java
58 lines
2.0 KiB
Java
/*
|
|
* Copyright (C) 2016 The CyanogenMod Project
|
|
* Copyright (C) 2017-2018,2020 The LineageOS Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package org.lineageos.setupwizard;
|
|
|
|
import static org.lineageos.setupwizard.SetupWizardApp.REQUEST_CODE_SETUP_BLUETOOTH;
|
|
|
|
import android.content.Intent;
|
|
import android.util.Log;
|
|
|
|
import org.lineageos.setupwizard.util.SetupWizardUtils;
|
|
|
|
public class BluetoothSetupActivity extends WrapperSubBaseActivity {
|
|
|
|
public static final String TAG = BluetoothSetupActivity.class.getSimpleName();
|
|
|
|
private static final String ACTION_CONNECT_INPUT =
|
|
"com.google.android.intent.action.CONNECT_INPUT";
|
|
|
|
private static final String INTENT_EXTRA_NO_INPUT_MODE = "no_input_mode";
|
|
|
|
@Override
|
|
protected void onStartSubactivity() {
|
|
try {
|
|
Intent intent = new Intent();
|
|
intent.setComponent(SetupWizardUtils.mTvAddAccessorySettingsActivity);
|
|
intent.setAction(ACTION_CONNECT_INPUT);
|
|
intent.putExtra(INTENT_EXTRA_NO_INPUT_MODE, true);
|
|
startActivityForResult(intent, REQUEST_CODE_SETUP_BLUETOOTH);
|
|
} catch (Exception e) {
|
|
Log.e(TAG, "Error starting bluetooth setup", e);
|
|
nextAction(RESULT_OK);
|
|
SetupWizardUtils.disableComponent(this, BluetoothSetupActivity.class);
|
|
finish();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
protected int getSubactivityNextTransition() {
|
|
nextAction(RESULT_OK);
|
|
return TRANSITION_ID_SLIDE;
|
|
}
|
|
}
|