Executing Logon Operations

After you initialize the LogonUIFacade, present the MAF Logon UI screens. The LogonUIFacade interacts with MAFLogonCore components.

To present a particular screen, call the corresponding method on the LogonUIFacade. If any user input is required for the started operation, the LogonUIFacade presents a corresponding screen. The LogonUIFacade generates input screens. You must set the generated view to a presented activity, in this example, the LogonActivity. The user fills in the input screen fields with valid data and triggers the execution of the next step of the requested operation.

In all of the following examples, the application must construct an activity, which implements the LogonListener interface:
public class LogonActivity extends Activity implements LogonListener {
	//helper fields to keep the code cleaner
	private final String LOG_TAG = "LogonActivity";
	private final String APPLICATIONID = "com.sap.maf.test.adr.logonapp";
	private Activity act;
	private Context ctx;
	private LogonUIFacade logonUIFacade;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		act = this;
		ctx = this;

		//prepare styling
		MAFSkinManager.getInstance(this).loadStyle("green", 
					getResources().openRawResource(R.raw.styles_def));
		MAFSkinManager.getInstance(this).loadStyle("red", 
					getResources().openRawResource(R.raw.styles_red));
		
		//get instance of LogonUIFacade Singleton
		logonUIFacade = LogonUIFacade.getInstance();

		//reset MAFLogger
		MAFLogger.clearLogData();
		MAFLogger.logToAndroid(true);

		//Initialize LogonUIFacade
		logonUIFacade.init(this, act, ctx, APPLICATIONID);

		//call the actual LogonUIFacade method that corresponds to 
		//the Operation you would like to execute.
		...
		
		//Once presented reskin the UI
		MAFUIFactory.getInstance().reskinUI(this);
	}

		//LogonListener interface methods implemented!
}

Logon

To present the logon screen from your activity:
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	...
	//call Logon method of LogonUIFacade and set the resulting
	//view as content view of this Acvitity.
	setContentView(logonUIFacade.logon());
	...
}

Delete Registration

You can present a button for the user to delete the registration. To trigger the delete user operation, write a similar action callback method in your Activity:
private void onDeleteUserButtonClicked() {
	...
	logonUIFacade.deleteUser();
	...
}

Lock Secure Store

To lock the secure store when the application is running and is in foreground, write a method similar to this in your Activity:
private void onLockButtonClicked() {
	...
	logonUIFacade.lockSecureStore();
	...
}
This locks the secure store but does not present the logon screen. To present the logon screen after the secure store is locked, call the logon method of LogonUIFacade. This shows the unlock screen if the user has already been registered:
private void onLockButtonClicked() {
	...
	logonUIFacade.lockSecureStore();
	//call Logon method of LogonUIFacade and set the resulting
	//view as content view of this Acvitity.
	setContentView(logonUIFacade.logon());
	...
}

Change App Passcode

You can provide a button to change the App Passcode. To trigger the change operation, write a method similar to this in your activity:
private void onChangeAppPasscodeButtonClicked() {
	...
	this.ctx = this;
	
	...
	logonUIFacade.changeSecureStorePassword(ctx, true);
	...
}

Update Back-End Password

You can provide a button to update the stored back-end password. To trigger the change operation, write a method similar to this in your activity:
private void onChangeBackendPassowordButtonClicked() {
	...
	this.ctx = this;
	...
	logonUIFacade.changeBackendPassword(ctx);
	...
}

Review Login Data

You can provide a dialog to review the registration information. Create a button on the UI and write a method similar to this in your activity:
private void onShowRegInfoButtonClicked() {
	...
	this.ctx = this;
	...
	logonUIFacade.getRegistrationInfo(ctx);
	...
}