stashing non-working progress. SplashActivity will redirect to a new choose library...
authorkenstir <kenstir@gmail.com>
Thu, 5 Nov 2015 14:37:55 +0000 (09:37 -0500)
committerkenstir <kenstir@gmail.com>
Thu, 5 Nov 2015 14:37:55 +0000 (09:37 -0500)
Open-ILS/src/Android/core/res/layout/activity_choose_library.xml [new file with mode: 0644]
Open-ILS/src/Android/core/res/values/strings.xml
Open-ILS/src/Android/core/src/org/evergreen_ils/views/splashscreen/SplashActivity.java
Open-ILS/src/Android/eg_app/AndroidManifest.xml
Open-ILS/src/Android/eg_app/res/values/ou.xml

diff --git a/Open-ILS/src/Android/core/res/layout/activity_choose_library.xml b/Open-ILS/src/Android/core/res/layout/activity_choose_library.xml
new file mode 100644 (file)
index 0000000..8eeea10
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:paddingTop="32dp"
+              android:paddingLeft="17dp"
+              android:paddingRight="17dp"
+        >
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/choose_library_message"
+        android:textAppearance="?android:attr/textAppearanceLarge" />
+    
+    <Spinner
+        android:id="@+id/choose_library_spinner"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:background="#000000"
+        android:layout_marginTop="5dip"
+        android:layout_marginBottom="5dip"
+        />
+
+    <Button android:id="@+id/choose_library_button"
+              android:layout_width="wrap_content"
+              android:layout_height="wrap_content"
+              android:layout_gravity="right"
+              android:layout_marginTop="16dp"
+              android:text="@string/action_choose_library"
+              android:paddingLeft="32dp"
+              android:paddingRight="32dp"/>
+
+</LinearLayout>
+
index 7ac9682..ac8c161 100644 (file)
 
     <string name="action_settings">Settings</string>
     <string name="retry_label">Retry</string>
+    <string name="choose_library_message">Select your Evergreen Library</string>
+    <string name="action_choose_library">Select</string>
 
 </resources>
index 0464c7d..b9c2b5d 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.evergreen_ils.views.splashscreen;
 
+import android.content.SharedPreferences;
 import android.os.Build;
 import org.evergreen_ils.R;
 import org.evergreen_ils.globals.GlobalConfigs;
@@ -44,7 +45,7 @@ import org.evergreen_ils.auth.Const;
 
 public class SplashActivity extends Activity implements LoadingTaskListener {
 
-    private static String TAG = "SplashActivity";
+    private static String TAG = SplashActivity.class.getSimpleName();
     private TextView mProgressText;
     private Context mContext;
     private ProgressBar mProgressBar;
@@ -85,12 +86,25 @@ public class SplashActivity extends Activity implements LoadingTaskListener {
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_splash);
-
-        this.mContext = this;
 
         // make sure default values are set up for preferences
         PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+        String library_url = getString(R.string.ou_library_url);
+        if (library_url.isEmpty()) {
+            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+            library_url = prefs.getString("library_url", "");
+        }
+        if (library_url.isEmpty()) {
+            Intent intent = new Intent(this, ChooseLibraryActivity.class);
+            //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+            startActivity(intent);
+            finish();
+        }
+        GlobalConfigs.httpAddress = library_url;
+
+        this.mContext = this;
+
+        setContentView(R.layout.activity_splash);
 
         mProgressText = (TextView) findViewById(R.id.action_in_progress);
         mProgressBar = (ProgressBar) findViewById(R.id.activity_splash_progress_bar);
@@ -103,14 +117,6 @@ public class SplashActivity extends Activity implements LoadingTaskListener {
             }
         });
 
-        /* this didn't work, but the progress bar is weird on GB 2.2,
-           and it's lopsided in landscape mode on GB 2.3.7
-        int currentApiVersion = android.os.Build.VERSION.SDK_INT;
-        if (currentApiVersion < Build.VERSION_CODES.HONEYCOMB)
-            mProgressBar.setScrollBarStyle(android.R.attr.progressBarStyleHorizontal);
-         */
-
-        GlobalConfigs.httpAddress = getString(R.string.ou_library_url);
         startTask();
     }
     
index 3983e6f..8db59c7 100644 (file)
         android:label="@string/ou_app_label"
         android:theme="@style/Theme.AppCompat" >
 
-        <!-- Notification receiver -->
-        <receiver
-                android:name="org.evergreen_ils.services.NotificationReceiver"
-                android:process=":remote">
-        </receiver>
-        <!-- Receiver to reinit notifications on reboot -->
-        <!--
-        <receiver android:name="org.evergreen_ils.services.RebootReceiver">
-            <intent-filter>
-                <action android:name="android.intent.action.BOOT_COMPLETED"/>
-            </intent-filter>
-        </receiver>
-        <receiver android:name="org.evergreen_ils.services.PeriodicServiceBroadcastReceiver">
-            <intent-filter>
-                <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
-            </intent-filter>
-        </receiver>
-        -->
-
-        <!--
-        <service android:name="org.evergreen_ils.services.ScheduledIntentService">
-        </service>
-        -->
-
         <activity
                 android:name="org.evergreen_ils.views.splashscreen.SplashActivity"
                 android:theme="@android:style/Theme.NoTitleBar">
index 8f0d3bd..b6ebfaa 100644 (file)
@@ -6,5 +6,6 @@
     <string name="ou_account_type">org.evergreen-ils.eg_app</string>
     <string name="ou_app_label">Evergreen</string>
     <string name="ou_app_name">Evergreen</string>
+    <!-- an empty ou_library_url indicates that we must prompt for it -->
     <string name="ou_library_url"></string>
 </resources>