use of com.facebook.accountkit.ui.SkinManager in project facebook-android-sdk by facebook.
the class AccountKitLoginActivity method createAccountKitConfiguration.
private AccountKitConfiguration.AccountKitConfigurationBuilder createAccountKitConfiguration(final LoginType loginType) {
AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder = new AccountKitConfiguration.AccountKitConfigurationBuilder(loginType, getResponseType());
final Switch titleTypeSwitch = (Switch) findViewById(R.id.title_type_switch);
final Switch stateParamSwitch = (Switch) findViewById(R.id.state_param_switch);
final Switch facebookNotificationsSwitch = (Switch) findViewById(R.id.facebook_notification_switch);
final Switch useManualWhiteListBlacklist = (Switch) findViewById(R.id.whitelist_blacklist_switch);
final Switch readPhoneStateSwitch = (Switch) findViewById(R.id.read_phone_state_switch);
final Switch receiveSMS = (Switch) findViewById(R.id.receive_sms_switch);
if (titleTypeSwitch != null && titleTypeSwitch.isChecked()) {
configurationBuilder.setTitleType(AccountKitActivity.TitleType.APP_NAME);
}
final UIManager uiManager;
if (advancedUISwitch != null && advancedUISwitch.isChecked()) {
if (isReverbThemeSelected()) {
if (switchLoginTypeReceiver == null) {
switchLoginTypeReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
final String loginTypeString = intent.getStringExtra(ReverbUIManager.LOGIN_TYPE_EXTRA);
if (loginTypeString == null) {
return;
}
final LoginType loginType = LoginType.valueOf(loginTypeString);
onLogin(loginType);
}
};
LocalBroadcastManager.getInstance(getApplicationContext()).registerReceiver(switchLoginTypeReceiver, new IntentFilter(ReverbUIManager.SWITCH_LOGIN_TYPE_EVENT));
}
uiManager = new ReverbUIManager(confirmButton, entryButton, loginType, textPosition, selectedThemeId);
} else {
uiManager = new AccountKitSampleAdvancedUIManager(confirmButton, entryButton, textPosition, loginType);
}
} else if (isSkinSelected()) {
@ColorInt final int primaryColor = ContextCompat.getColor(this, R.color.default_color);
if (getBackgroundImage() >= 0) {
uiManager = new SkinManager(loginType, skin, primaryColor, getBackgroundImage(), getSkinTintOption(), getSkinBackgroundTintIntensity());
} else {
uiManager = new SkinManager(loginType, skin, primaryColor);
}
} else {
uiManager = new ThemeUIManager(loginType, selectedThemeId);
}
configurationBuilder.setUIManager(uiManager);
if (stateParamSwitch != null && stateParamSwitch.isChecked()) {
initialStateParam = UUID.randomUUID().toString();
configurationBuilder.setInitialAuthState(initialStateParam);
}
if (facebookNotificationsSwitch != null && !facebookNotificationsSwitch.isChecked()) {
configurationBuilder.setFacebookNotificationsEnabled(false);
}
if (useManualWhiteListBlacklist != null && useManualWhiteListBlacklist.isChecked()) {
final String[] blackList = getResources().getStringArray(R.array.blacklistedSmsCountryCodes);
final String[] whiteList = getResources().getStringArray(R.array.whitelistedSmsCountryCodes);
configurationBuilder.setSMSBlacklist(blackList);
configurationBuilder.setSMSWhitelist(whiteList);
}
if (readPhoneStateSwitch != null && !(readPhoneStateSwitch.isChecked())) {
configurationBuilder.setReadPhoneStateEnabled(false);
}
if (receiveSMS != null && !receiveSMS.isChecked()) {
configurationBuilder.setReceiveSMS(false);
}
return configurationBuilder;
}
Aggregations