From da8035ad027b4f9f483a943d327205345b4c1776 Mon Sep 17 00:00:00 2001 From: Luis Silva Date: Thu, 12 Nov 2015 17:36:35 +0000 Subject: [PATCH] Added support for custom application settings. Fixed push notifications with links. Enable remote debugging. --- .../platforms/android/AndroidManifest.xml | 2 +- .../Outsystems/platforms/android/build.gradle | 55 ++++- .../platforms/android/gradle.properties | 5 + .../android/res/layout/activity_login.xml | 11 + .../res/layout/activity_web_application.xml | 3 +- .../android/res/layout/network_error.xml | 2 +- .../android/res/raw/appsettings.json | 10 + .../android/ApplicationsActivity.java | 73 +++++++ .../com/outsystems/android/BaseActivity.java | 11 +- .../outsystems/android/HubAppActivity.java | 5 +- .../com/outsystems/android/LoginActivity.java | 116 ++++++++--- .../com/outsystems/android/SplashScreen.java | 85 ++++++-- .../android/WebApplicationActivity.java | 125 +++++++++++- .../ApplicationSettingsController.java | 188 ++++++++++++++++++ .../outsystems/android/model/AppSettings.java | 98 +++++++++ 15 files changed, 737 insertions(+), 52 deletions(-) create mode 100644 outsystems-app-android/Outsystems/platforms/android/gradle.properties create mode 100644 outsystems-app-android/Outsystems/platforms/android/res/raw/appsettings.json create mode 100644 outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/helpers/ApplicationSettingsController.java create mode 100644 outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/model/AppSettings.java diff --git a/outsystems-app-android/Outsystems/platforms/android/AndroidManifest.xml b/outsystems-app-android/Outsystems/platforms/android/AndroidManifest.xml index badf18c..a361b5c 100644 --- a/outsystems-app-android/Outsystems/platforms/android/AndroidManifest.xml +++ b/outsystems-app-android/Outsystems/platforms/android/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/outsystems-app-android/Outsystems/platforms/android/build.gradle b/outsystems-app-android/Outsystems/platforms/android/build.gradle index fc7b4a1..cd40943 100644 --- a/outsystems-app-android/Outsystems/platforms/android/build.gradle +++ b/outsystems-app-android/Outsystems/platforms/android/build.gradle @@ -12,6 +12,22 @@ android { compileSdkVersion 20 buildToolsVersion "20.0.0" + + defaultConfig{ + + if (project.hasProperty('APPLICATION_ID') && !((String)APPLICATION_ID).isEmpty()) { + applicationId APPLICATION_ID + } + + if (project.hasProperty('APPLICATION_VERSION') && !((String)APPLICATION_VERSION).isEmpty()){ + versionName APPLICATION_VERSION + } + + if (project.hasProperty('APPLICATION_CODE') && !((String)APPLICATION_CODE).isEmpty()){ + versionCode APPLICATION_CODE.toInteger() + } + } + sourceSets { main { manifest.srcFile 'AndroidManifest.xml' @@ -35,4 +51,41 @@ android { debug.setRoot('build-types/debug') release.setRoot('build-types/release') } -} + + + buildTypes { + + if( project.hasProperty('OUTPUT_DIR') && !((String)OUTPUT_DIR).isEmpty()){ + + // this is used to alter output directory and file name. If you don't need it + // you can safely comment it out. + applicationVariants.all { variant -> + + variant.outputs.each { output -> + def file = output.outputFile + + String parent = file.parent + if ( new File( (String)OUTPUT_DIR ).exists() ) { + parent = OUTPUT_DIR + } + + if( project.hasProperty('APPLICATION_NAME') && !((String)APPLICATION_NAME).isEmpty()){ + output.outputFile = new File( + parent, + (String)(APPLICATION_NAME + "-" + defaultConfig.versionName + ".apk") + ) + } + else{ + output.outputFile = new File( + parent, + (String)("OutsystemsNow.apk") + ) + } + + } + } + } + + } + +} \ No newline at end of file diff --git a/outsystems-app-android/Outsystems/platforms/android/gradle.properties b/outsystems-app-android/Outsystems/platforms/android/gradle.properties new file mode 100644 index 0000000..572bd1f --- /dev/null +++ b/outsystems-app-android/Outsystems/platforms/android/gradle.properties @@ -0,0 +1,5 @@ +APPLICATION_NAME= +APPLICATION_ID= +APPLICATION_VERSION= +APPLICATION_CODE= +OUTPUT_DIR= \ No newline at end of file diff --git a/outsystems-app-android/Outsystems/platforms/android/res/layout/activity_login.xml b/outsystems-app-android/Outsystems/platforms/android/res/layout/activity_login.xml index f23db1a..99564be 100644 --- a/outsystems-app-android/Outsystems/platforms/android/res/layout/activity_login.xml +++ b/outsystems-app-android/Outsystems/platforms/android/res/layout/activity_login.xml @@ -8,6 +8,17 @@ android:gravity="center_horizontal" android:orientation="vertical" > + + + diff --git a/outsystems-app-android/Outsystems/platforms/android/res/layout/network_error.xml b/outsystems-app-android/Outsystems/platforms/android/res/layout/network_error.xml index ff9fd85..5c97139 100644 --- a/outsystems-app-android/Outsystems/platforms/android/res/layout/network_error.xml +++ b/outsystems-app-android/Outsystems/platforms/android/res/layout/network_error.xml @@ -51,7 +51,7 @@ android:layout_height="wrap_content"> )arrayList); - intent.putExtra(ApplicationsActivity.KEY_TITLE_ACTION_BAR, getResources().getString(R.string.label_logout)); - startActivity(intent); + + private void openNextActivity(boolean singleApp, Login login){ + if (singleApp) { + openWebApplicationActivity(login); + } else { + + Intent nextIntent = ApplicationSettingsController.getInstance().getNextActivity(this); + + if(nextIntent == null ){ + nextIntent = new Intent(getApplicationContext(), ApplicationsActivity.class); + } + + if(nextIntent.getComponent() != null && nextIntent.getComponent().getClassName().equals(ApplicationsActivity.class)) + { + ArrayList arrayList = (ArrayList)login.getApplications(); + nextIntent.putParcelableArrayListExtra(ApplicationsActivity.KEY_CONTENT_APPLICATIONS, + (ArrayList)arrayList); + nextIntent.putExtra(ApplicationsActivity.KEY_TITLE_ACTION_BAR, getResources().getString(R.string.label_logout)); + + } + startActivity(nextIntent); + } } + /** * Open web application activity. * diff --git a/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/SplashScreen.java b/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/SplashScreen.java index 3cf6b6b..7fb9dfb 100644 --- a/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/SplashScreen.java +++ b/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/SplashScreen.java @@ -11,18 +11,26 @@ import android.app.Activity; import android.content.Intent; +import android.graphics.Color; +import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.Handler; +import android.view.View; import android.webkit.CookieManager; import android.webkit.CookieSyncManager; +import android.widget.ImageView; +import android.widget.ProgressBar; import com.arellomobile.android.push.PushManager; import com.outsystems.android.core.DatabaseHandler; import com.outsystems.android.core.EventLogger; +import com.outsystems.android.helpers.ApplicationSettingsController; import com.outsystems.android.helpers.DeepLinkController; import com.outsystems.android.helpers.HubManagerHelper; import com.outsystems.android.helpers.OfflineSupport; +import com.outsystems.android.model.AppSettings; import com.outsystems.android.model.DeepLink; import com.outsystems.android.model.HubApplicationModel; @@ -56,6 +64,7 @@ protected void onCreate(Bundle savedInstanceState) { // Create and start push manager pushManager = PushManager.getInstance(this); + // Start push manager, this will count app open for Pushwoosh stats as well pushManager.onStartup(this); // Register for push! @@ -70,9 +79,33 @@ protected void onCreate(Bundle savedInstanceState) { if(data != null){ DeepLinkController.getInstance().createSettingsFromUrl(data); - } - - + } + + // Application Settings + ApplicationSettingsController.getInstance().loadSettings(this); + + + // Application Settings + + boolean hasValidSettings = ApplicationSettingsController.getInstance().hasValidSettings(); + if(hasValidSettings){ + + // Change colors + AppSettings appSettings = ApplicationSettingsController.getInstance().getSettings(); + + boolean customBgColor = appSettings.getTintColor() != null && !appSettings.getBackgroundColor().isEmpty(); + + if(customBgColor){ + int newColor = Color.parseColor(appSettings.getBackgroundColor()); + ImageView backgroundView = (ImageView)findViewById(R.id.image_view_splash_bg); + + Drawable drawable = backgroundView.getBackground(); + drawable.setColorFilter(newColor, PorterDuff.Mode.SRC_ATOP); + } + + } + + // Add delay to show splashscreen delaySplashScreen(); } @@ -124,33 +157,57 @@ protected void goNextActivity() { DeepLink deepLinkSettings = DeepLinkController.getInstance().getDeepLinkSettings(); HubManagerHelper.getInstance().setApplicationHosted(deepLinkSettings.getEnvironment()); - Intent intent = new Intent(getApplicationContext(), HubAppActivity.class); - startActivity(intent); + boolean hasAppSettings = ApplicationSettingsController.getInstance().hasValidSettings(); + + if(hasAppSettings){ + Intent intent = ApplicationSettingsController.getInstance().getFirstActivity(this); + startActivity(intent); + } + else{ + Intent intent = new Intent(this, HubAppActivity.class); + startActivity(intent); + } } else{ - openHubActivity(); - + + boolean hasAppSettings = ApplicationSettingsController.getInstance().hasValidSettings(); + + if(!hasAppSettings){ + Intent intent = new Intent(this, HubAppActivity.class); + startActivity(intent); + } + if (hubApplications != null && hubApplications.size() > 0) { HubApplicationModel hubApplication = hubApplications.get(0); if (hubApplication != null) { HubManagerHelper.getInstance().setApplicationHosted(hubApplication.getHost()); HubManagerHelper.getInstance().setJSFApplicationServer(hubApplication.isJSF()); } - Intent intent = new Intent(getApplicationContext(), LoginActivity.class); - if (hubApplication != null) { + Intent intent = null; + if(hasAppSettings) + intent = ApplicationSettingsController.getInstance().getFirstActivity(this); + else + intent = new Intent(this, LoginActivity.class); + + if (hubApplication != null && intent.getComponent().getClassName().equals(LoginActivity.class.getName())) { intent.putExtra(LoginActivity.KEY_INFRASTRUCTURE_NAME, hubApplication.getName()); - intent.putExtra(LoginActivity.KEY_AUTOMATICLY_LOGIN, true); + boolean autoLogin = hubApplication.getUserName() != null && !hubApplication.getUserName().isEmpty()&& + hubApplication.getPassword() != null && !hubApplication.getPassword().isEmpty(); + intent.putExtra(LoginActivity.KEY_AUTOMATICALLY_LOGIN, autoLogin); } startActivity(intent); } + else{ + if(hasAppSettings){ + Intent intent = ApplicationSettingsController.getInstance().getFirstActivity(this); + startActivity(intent); + } + } + } finish(); } - private void openHubActivity() { - Intent intent = new Intent(this, HubAppActivity.class); - startActivity(intent); - } } diff --git a/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/WebApplicationActivity.java b/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/WebApplicationActivity.java index f576d2f..7c455ac 100644 --- a/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/WebApplicationActivity.java +++ b/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/WebApplicationActivity.java @@ -37,19 +37,28 @@ import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.ColorFilter; import android.graphics.Paint; +import android.graphics.PorterDuff; import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.ClipDrawable; import android.graphics.drawable.Drawable; +import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.StateListDrawable; +import android.graphics.drawable.shapes.RoundRectShape; import android.net.Uri; import android.net.http.SslError; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.util.StateSet; +import android.view.Gravity; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; +import android.view.ViewGroup; +import android.view.ViewParent; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.webkit.CookieManager; @@ -60,6 +69,7 @@ import android.webkit.ValueCallback; import android.webkit.WebSettings; import android.webkit.WebView; +import android.widget.Button; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; @@ -70,13 +80,16 @@ import com.outsystems.android.core.EventLogger; import com.outsystems.android.core.CustomWebView; import com.outsystems.android.core.WebServicesClient; +import com.outsystems.android.helpers.ApplicationSettingsController; import com.outsystems.android.helpers.DeepLinkController; import com.outsystems.android.helpers.HubManagerHelper; import com.outsystems.android.helpers.OfflineSupport; import com.outsystems.android.mobileect.MobileECTController; import com.outsystems.android.mobileect.interfaces.OSECTContainerListener; +import com.outsystems.android.model.AppSettings; import com.outsystems.android.model.Application; import com.outsystems.android.model.MobileECT; +import com.outsystems.android.widgets.CustomFontTextView; import com.phonegap.plugins.barcodescanner.BarcodeScanner; /** @@ -273,6 +286,11 @@ public void onDownloadStart(String url, String userAgent, String contentDisposit cordovaWebView.getSettings().setJavaScriptEnabled( true ); cordovaWebView.getSettings().setCacheMode( WebSettings.LOAD_NO_CACHE ); + // Allow remote debugging + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + cordovaWebView.setWebContentsDebuggingEnabled(true); + } + ApplicationOutsystems app = (ApplicationOutsystems)getApplication(); if ( !app.isNetworkAvailable() ) { // loading offline @@ -382,8 +400,103 @@ public void onClick(View view) { if(singleApp){ buttonApplications.setVisibility(View.INVISIBLE); buttonApplications.setOnClickListener(null); + + if(this.networkErrorView != null) { + View backToAppList = this.networkErrorView.findViewById(R.id.networkErrorAppsListLink); + backToAppList.setVisibility(View.GONE); + } + } + + // Application Settings + + boolean hasValidSettings = ApplicationSettingsController.getInstance().hasValidSettings(); + + if(hasValidSettings){ + + boolean hideNavigationBar = ApplicationSettingsController.getInstance().hideNavigationBar(); + if(hideNavigationBar){ + + View navigationBar = findViewById(R.id.toolbar); + if(navigationBar != null) + navigationBar.setVisibility(View.GONE); + + View divider = findViewById(R.id.divider_toolbar); + if(divider != null) + divider.setVisibility(View.GONE); + + } + + AppSettings appSettings = ApplicationSettingsController.getInstance().getSettings(); + + + boolean customBgColor = appSettings.getBackgroundColor() != null && !appSettings.getBackgroundColor().isEmpty(); + if(customBgColor){ + this.networkErrorView.setBackgroundColor(Color.parseColor(appSettings.getBackgroundColor())); + } + + boolean customFgColor = appSettings.getForegroundColor() != null && !appSettings.getForegroundColor().isEmpty(); + if(customFgColor){ + int newColor = Color.parseColor(appSettings.getForegroundColor()); + PorterDuff.Mode mMode = PorterDuff.Mode.SRC_ATOP; + + CustomFontTextView networkErrorHeader = (CustomFontTextView)findViewById(R.id.networkErrorHeader); + networkErrorHeader.setTextColor(newColor); + + CustomFontTextView networkErrorMessage = (CustomFontTextView)findViewById(R.id.networkErrorMessage); + networkErrorMessage.setTextColor(newColor); + + CustomFontTextView networkErrorAppsListLink = (CustomFontTextView)findViewById(R.id.networkErrorAppsListLink); + networkErrorAppsListLink.setTextColor(newColor); + + ImageView networkErrorImage = (ImageView)findViewById(R.id.imgNetworkError); + Drawable drawable = networkErrorImage.getDrawable(); + drawable.setColorFilter(newColor, mMode); + + Button buttonRetry = (Button)findViewById(R.id.networkErrorButtonRetry); + drawable = buttonRetry.getBackground(); + drawable.setColorFilter(newColor, PorterDuff.Mode.SRC_ATOP); + buttonRetry.setTextColor(newColor); + + ProgressBar networkErrorProgressBar = (ProgressBar)findViewById(R.id.networkErrorProgressBar); + drawable = networkErrorProgressBar.getIndeterminateDrawable(); + drawable.setColorFilter(newColor, PorterDuff.Mode.SRC_ATOP); + } + + boolean customTintColor = appSettings.getTintColor() != null && !appSettings.getTintColor().isEmpty(); + + if(customTintColor){ + int newColor = Color.parseColor(appSettings.getTintColor()); + PorterDuff.Mode mMode = PorterDuff.Mode.SRC_ATOP; + + // Back Button + Drawable drawable = buttonBack.getDrawable(); + drawable.setColorFilter(newColor,mMode); + + // Forward Button + drawable = buttonForth.getDrawable(); + drawable.setColorFilter(newColor,mMode); + + // Application List Button + drawable = buttonApplications.getDrawable(); + drawable.setColorFilter(newColor, mMode); + + // ECT Button + drawable = buttonECT.getDrawable(); + drawable.setColorFilter(newColor, mMode); + + // Progress Bar + + drawable = progressBar.getBackground(); + // drawable.setColorFilter(newColor, mMode); + + } + + + } + + } /* @@ -627,6 +740,15 @@ public void run() { if (buttonECT != null) { boolean showECT = app.isNetworkAvailable() && show; buttonECT.setVisibility(showECT ? View.VISIBLE : View.GONE); + + + AppSettings appSettings = ApplicationSettingsController.getInstance().getSettings(); + boolean customTintColor = appSettings.getTintColor() != null && !appSettings.getTintColor().isEmpty(); + + if(customTintColor) { + + } + findViewById(R.id.toolbar).invalidate(); } } @@ -1132,13 +1254,12 @@ private void retryWebViewAction(){ protected void showNetworkErrorRetryLoading(boolean show) { if(this.networkErrorView != null) { - ProgressBar progressbar = (ProgressBar) networkErrorView.findViewById(R.id.progress_bar); + ProgressBar progressbar = (ProgressBar) networkErrorView.findViewById(R.id.networkErrorProgressBar); progressbar.setVisibility(show ? View.VISIBLE : View.INVISIBLE); View retryButton = networkErrorView.findViewById(R.id.networkErrorButtonRetry); retryButton.setVisibility(show ? View.INVISIBLE : View.VISIBLE); - if(networkErrorView.getVisibility() == View.VISIBLE && retryButton.getVisibility() == View.VISIBLE){ Animation shake = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.shake); networkErrorView.startAnimation(shake); diff --git a/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/helpers/ApplicationSettingsController.java b/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/helpers/ApplicationSettingsController.java new file mode 100644 index 0000000..8033f9a --- /dev/null +++ b/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/helpers/ApplicationSettingsController.java @@ -0,0 +1,188 @@ +package com.outsystems.android.helpers; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; + +import com.google.gson.Gson; +import com.outsystems.android.ApplicationsActivity; +import com.outsystems.android.LoginActivity; +import com.outsystems.android.R; +import com.outsystems.android.WebApplicationActivity; +import com.outsystems.android.core.DatabaseHandler; +import com.outsystems.android.model.AppSettings; +import com.outsystems.android.model.Application; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; + +/** + * Created by lrs on 8/19/2015. + */ +public class ApplicationSettingsController { + + private static ApplicationSettingsController _instance; + private AppSettings settings; + + public ApplicationSettingsController(){ + } + + public static ApplicationSettingsController getInstance() { + if (_instance == null) { + _instance = new ApplicationSettingsController(); + } + return _instance; + } + + + public void loadSettings(Context context){ + Gson gson = new Gson(); + InputStream raw = context.getResources().openRawResource(R.raw.appsettings); + Reader rd = new BufferedReader(new InputStreamReader(raw)); + AppSettings appSettings = gson.fromJson(rd,AppSettings.class); + + this.settings = appSettings; + } + + public boolean hasValidSettings(){ + return this.settings != null && settings.hasValidSettings(); + } + + + public boolean hideActionBar(Activity currentActivity){ + boolean result = this.hasValidSettings(); + + if (result){ + if(currentActivity instanceof ApplicationsActivity){ + result = this.settings.skipNativeLogin(); + } + } + + return result; + } + + public boolean hideNavigationBar(){ + return this.hasValidSettings() && this.settings.hideNavigationBar(); + } + + + public Intent getFirstActivity(Context context){ + Intent result = null; + + + // Create Entry to save hub application + DatabaseHandler database = new DatabaseHandler(context); + if (database.getHubApplication(settings.getDefaultHostname()) == null) { + database.addHostHubApplication(settings.getDefaultHostname(), settings.getDefaultHostname(), HubManagerHelper + .getInstance().isJSFApplicationServer()); + } + + HubManagerHelper.getInstance().setApplicationHosted(settings.getDefaultHostname()); + + + if(settings.skipNativeLogin()){ + if(settings.skipApplicationList() && settings.getDefaultApplicationURL() != null){ + + String url = settings.getDefaultApplicationURL(); + + // Ensure that the url format its correct + String applicationName = url.replace("\\", "/"); + + // Get the application's name + if(applicationName.contains("/")){ + + while(applicationName.startsWith("/")){ + applicationName = applicationName.substring(1); + } + + url = applicationName; + + int slashPosition = applicationName.indexOf("/"); + + if(slashPosition > 0 ){ + applicationName = applicationName.substring(0,slashPosition); + } + } + + Application application = new Application(applicationName, -1, applicationName); + application.setPath(url); + + result = new Intent(context, WebApplicationActivity.class); // webview + result.putExtra(WebApplicationActivity.KEY_APPLICATION, application); + result.putExtra(WebApplicationActivity.KEY_SINGLE_APPLICATION,true); + + + } + else{ + result = new Intent(context, ApplicationsActivity.class); // applist + } + } + else { + result = new Intent(context, LoginActivity.class); + + result.putExtra(LoginActivity.KEY_AUTOMATICALLY_LOGIN, false); + result.putExtra(LoginActivity.KEY_INFRASTRUCTURE_NAME, settings.getDefaultHostname()); + + } + + return result; + } + + public Intent getNextActivity(Activity currentActivity){ + Intent result = null; + + if(currentActivity instanceof LoginActivity){ + + if(settings.skipApplicationList()){ + // Go to WebApplicationActivity + if (settings.getDefaultApplicationURL() != null){ + + String url = settings.getDefaultApplicationURL(); + + // Ensure that the url format its correct + String applicationName = url.replace("\\", "/"); + + // Get the application's name + if(applicationName.contains("/")){ + + while(applicationName.startsWith("/")){ + applicationName = applicationName.substring(1); + } + + url = applicationName; + + int slashPosition = applicationName.indexOf("/"); + + if(slashPosition > 0 ){ + applicationName = applicationName.substring(0,slashPosition); + } + } + + Application application = new Application(applicationName, -1, applicationName); + application.setPath(url); + + result = new Intent(currentActivity.getApplicationContext(), WebApplicationActivity.class); // webview + result.putExtra(WebApplicationActivity.KEY_APPLICATION, application); + result.putExtra(WebApplicationActivity.KEY_SINGLE_APPLICATION,true); + + return result; + } + } + + // Otherwise... + // Go to ApplicationsActivity + result = new Intent(currentActivity.getApplicationContext(), ApplicationsActivity.class); + + } + + + return result; + } + + public AppSettings getSettings(){ + return settings; + } + +} diff --git a/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/model/AppSettings.java b/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/model/AppSettings.java new file mode 100644 index 0000000..bb2a8c1 --- /dev/null +++ b/outsystems-app-android/Outsystems/platforms/android/src/com/outsystems/android/model/AppSettings.java @@ -0,0 +1,98 @@ +package com.outsystems.android.model; + +/** + * Created by lrs on 8/19/2015. + */ +public class AppSettings { + private boolean SkipNativeLogin; + private boolean SkipApplicationList; + private boolean HideNavigationBar; + private String DefaultHostname; + private String DefaultApplicationURL; + private String BackgroundColor; + private String ForegroundColor; + private String TintColor; + + public AppSettings() { + } + + public AppSettings(boolean skipNativeLogin, boolean skipApplicationList, boolean hideNavigationBar, String defaultHostname, String defaultApplicationURL, String backgroundColor, String foregroundColor, String tintColor) { + SkipNativeLogin = skipNativeLogin; + SkipApplicationList = skipApplicationList; + HideNavigationBar = hideNavigationBar; + DefaultHostname = defaultHostname; + DefaultApplicationURL = defaultApplicationURL; + BackgroundColor = backgroundColor; + ForegroundColor = foregroundColor; + TintColor = tintColor; + } + + public boolean skipNativeLogin() { + return SkipNativeLogin; + } + + public void setSkipNativeLogin(boolean skipNativeLogin) { + SkipNativeLogin = skipNativeLogin; + } + + public boolean skipApplicationList() { + return SkipApplicationList; + } + + public void setSkipApplicationList(boolean skipApplicationList) { + SkipApplicationList = skipApplicationList; + } + + public boolean hideNavigationBar() { + return HideNavigationBar; + } + + public void setHideNavigationBar(boolean hideNavigationBar) { + HideNavigationBar = hideNavigationBar; + } + + public String getDefaultHostname() { + return DefaultHostname; + } + + public void setDefaultHostname(String defaultHostname) { + DefaultHostname = defaultHostname; + } + + public String getDefaultApplicationURL() { + return DefaultApplicationURL; + } + + public void setDefaultApplicationURL(String defaultApplicationURL) { + DefaultApplicationURL = defaultApplicationURL; + } + + public String getBackgroundColor() { + return BackgroundColor; + } + + public void setBackgroundColor(String backgroundColor) { + BackgroundColor = backgroundColor; + } + + public String getForegroundColor() { + return ForegroundColor; + } + + public void setForegroundColor(String foregroundColor) { + ForegroundColor = foregroundColor; + } + + public String getTintColor() { + return TintColor; + } + + public void setTintColor(String tintColor) { + TintColor = tintColor; + } + + public boolean hasValidSettings(){ + return getDefaultHostname() != null && !getDefaultHostname().isEmpty(); + } + +}