ManagerActivity¶
-
public class
ManagerActivity
extends AppCompatActivity¶ ManagerActivity
is an activity which displays Idopte Manager GUI in aWebView
.Use case 1: start activity
To use Idopte Manager GUI, you can directly start this activity in your application from another activity:
Intent managerActivity = new Intent(this, com.idopte.scmapi.ui.ManagerActivity.class); startActivity(managerActivity);
You do not need to add any activity in the application
AndroidManifest.xml
file. Everything is managed by the SDK.ManagerActivity
is destroyed when the user clicks the white cross on the action bar.Note that
idopte_manager.xml
layout file is internally used. To avoid any conflict, you should not have a layout file with this name in your application.All the required initializations (card system, HTTP server…) are handled internally with this use case.
Use case 2: directly load manager in a WebView
You can also just use
ManagerActivity.loadManager(WebView,ManagerCallbacks)
andManagerActivity.exitManager(WebView)
static methods to directly load manager:public class MyActivity extends AppCompatActivity implements ManagerActivity.ManagerCallbacks { private WebView webView = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_manager); // initialize all SCM stuff SCMHelper.observableActivityCreated(this); // load Manager GUI webView = findViewById(R.id.web_view_manager_id); try { ManagerActivity.loadManager(webView, this); } catch (SCMException e) { e.printStackTrace(); } } @Override protected void onDestroy() { super.onDestroy(); // exit Manager ManagerActivity.exitManager(webView); } @Override @JavascriptInterface public void updateTitle(String title) { // ... } @Override @JavascriptInterface public void showBackButton(boolean show) { // ... } }
Note that SCM initializations must be done before loading manager GUI.
Methods¶
exitManager¶
-
public static void
exitManager
(WebView webView)¶ Exits Idopte Manager GUI, previously loaded with given
WebView
throughManagerActivity.loadManager(WebView,ManagerCallbacks)
.Parameters: - webView – object in which was displayed Idopte Manager GUI.
loadManager¶
-
public static void
loadManager
(WebView webView, ManagerCallbacks managerCallbacks)¶ Loads Idopte Manager GUI in given
WebView
, without needing instantiate aManagerActivity
.JavaScript execution in given
WebView
is enabled. All the required initializations (card system, HTTP server…) must be done by the caller, throughcom.idopte.scmapiembed.SCMHelper
methods for instance.Parameters: - webView – object in which will be displayed Idopte Manager GUI.
- managerCallbacks – interface to use which defines some callbacks.
See also:
ManagerActivity.exitManager(WebView)
onBackButtonPressed¶
-
public static void
onBackButtonPressed
(WebView webView)¶ Triggers action to run when back button is pressed, in Idopte Manager navigation.
This method must be called when back button defined in
ManagerCallbacks.showBackButton(boolean)
is pressed by the user.Parameters: - webView – the
WebView
previously used withManagerActivity.loadManager(WebView,ManagerCallbacks)
.
- webView – the