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.
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! }
@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()); ... }
private void onDeleteUserButtonClicked() { ... logonUIFacade.deleteUser(); ... }
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()); ... }
private void onChangeAppPasscodeButtonClicked() { ... this.ctx = this; ... logonUIFacade.changeSecureStorePassword(ctx, true); ... }
private void onChangeBackendPassowordButtonClicked() { ... this.ctx = this; ... logonUIFacade.changeBackendPassword(ctx); ... }
private void onShowRegInfoButtonClicked() { ... this.ctx = this; ... logonUIFacade.getRegistrationInfo(ctx); ... }