Main and items-checked-out activities now using action bar.
authorkenstir <kenstir@gmail.com>
Sun, 29 Dec 2013 04:20:53 +0000 (23:20 -0500)
committerkenstir <kenstir@gmail.com>
Sun, 29 Dec 2013 04:20:53 +0000 (23:20 -0500)
Open-ILS/src/Android/core/AndroidManifest.xml
Open-ILS/src/Android/core/res/layout-land/dashbord_account.xml
Open-ILS/src/Android/core/res/layout/activity_main.xml [new file with mode: 0644]
Open-ILS/src/Android/core/res/layout/checkout_list.xml
Open-ILS/src/Android/core/res/layout/dashbord_account.xml
Open-ILS/src/Android/core/res/values/styles.xml
Open-ILS/src/Android/core/src/org/evergreen_ils/accountAccess/checkout/ItemsCheckOutListView.java
Open-ILS/src/Android/core/src/org/evergreen_ils/views/AccountScreenDashboard.java
Open-ILS/src/Android/core/src/org/evergreen_ils/views/MainActivity.java [new file with mode: 0644]
Open-ILS/src/Android/core/src/org/evergreen_ils/views/splashscreen/SplashActivity.java
Open-ILS/src/Android/cwmars_app/AndroidManifest.xml

index 6fa134f..2434468 100644 (file)
     android:versionCode="1"\r
     android:versionName="1.0" >\r
 \r
-    <uses-sdk\r
-        android:minSdkVersion="8"\r
-        android:targetSdkVersion="18" />\r
-\r
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />\r
-    <uses-permission android:name="android.permission.INTERNET" />\r
-    <uses-permission android:name="android.permission.CAMERA" />\r
-    <uses-permission android:name="android.permission.VIBRATE" />\r
-    <uses-permission android:name="android.permission.FLASHLIGHT" />\r
-    <uses-permission android:name="android.permission.WAKE_LOCK" />\r
-\r
-    <uses-feature android:name="android.hardware.camera" />\r
-    <uses-feature android:name="android.hardware.camera.autofocus" />\r
-\r
-    <!--\r
-    <uses-permission android:name="android.permission.READ_CALENDAR" />\r
-    <uses-permission android:name="android.permission.WRITE_CALENDAR" />\r
-    -->\r
-    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />\r
-    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />\r
-    <uses-permission android:name="android.permission.USE_CREDENTIALS" />\r
-    <uses-permission android:name="android.permission.GET_ACCOUNTS" />\r
-    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />\r
-\r
-    <application\r
-        android:allowBackup="true"\r
-        android:icon="@drawable/evergreen_launcher_icon"\r
-        android:label="@string/ou_app_label" >\r
-\r
-        <!-- Notification receiver -->\r
-        <receiver\r
-            android:name="org.evergreen_ils.services.NotificationReceiver"\r
-            android:process=":remote" >\r
-        </receiver>\r
-        <!-- Receiver to reinit notifications on reboot -->\r
-        <receiver android:name="org.evergreen_ils.services.RebootReceiver" >\r
-            <intent-filter>\r
-                <action android:name="android.intent.action.BOOT_COMPLETED" />\r
-            </intent-filter>\r
-        </receiver>\r
-        <receiver android:name="org.evergreen_ils.services.PeriodicServiceBroadcastReceiver" >\r
-            <intent-filter>\r
-                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />\r
-            </intent-filter>\r
-        </receiver>\r
-\r
-        <service android:name="org.evergreen_ils.services.ScheduledIntentService" >\r
-        </service>\r
-\r
-        <activity\r
-            android:name="org.evergreen_ils.views.splashscreen.SplashActivity"\r
-            >\r
-            <!--  android:theme="@android:style/Theme.Light.NoTitleBar"  -->\r
+    <application>\r
+        <activity android:name=".views.MainActivity">\r
             <intent-filter>\r
-                <action android:name="android.intent.action.MAIN" />\r
-\r
-                <category android:name="android.intent.category.LAUNCHER" />\r
+                <action android:name="android.intent.action.MAIN"/>\r
+                <category android:name="android.intent.category.LAUNCHER"/>\r
             </intent-filter>\r
         </activity>\r
-        <activity\r
-            android:name="org.evergreen_ils.views.AccountScreenDashboard"\r
-            android:theme="@android:style/Theme.Light.NoTitleBar" >\r
-        </activity>\r
-        <activity android:name="org.evergreen_ils.views.ApplicationPreferences" >\r
-        </activity>\r
-\r
-        <!-- Search -->\r
-\r
-        <activity android:name="org.evergreen_ils.searchCatalog.SampleUnderlinesNoFade">\r
-        </activity>\r
-        <activity android:name="org.evergreen_ils.searchCatalog.MoreCopyInformation" >\r
-        </activity>\r
-        <activity android:name="org.evergreen_ils.searchCatalog.SearchCatalogListView">\r
-        </activity>\r
-        <activity android:name="org.evergreen_ils.searchCatalog.AdvancedSearchActivity" >\r
-        </activity>\r
-        <activity\r
-            android:name="org.evergreen_ils.barcodescan.CaptureActivity"\r
-            android:screenOrientation="landscape"\r
-            android:theme="@android:style/Theme.NoTitleBar"\r
-            android:windowSoftInputMode="stateAlwaysHidden" >\r
-        </activity>\r
-\r
-        <!-- Checkout Activities -->\r
-        <activity android:name="org.evergreen_ils.accountAccess.checkout.ItemsCheckOutListView" >\r
-        </activity>\r
-\r
-        <!-- Holds Activities -->\r
-        <activity android:name="org.evergreen_ils.accountAccess.holds.HoldsListView" >\r
-        </activity>\r
-        <activity android:name="org.evergreen_ils.accountAccess.holds.PlaceHold" >\r
-        </activity>\r
-        <activity android:name="org.evergreen_ils.accountAccess.holds.HoldDetails" >\r
-        </activity>\r
-\r
-        <!-- Fines Activities -->\r
-        <activity android:name="org.evergreen_ils.accountAccess.fines.FinesActivity" >\r
-        </activity>\r
-\r
-        <!-- Bookbags -->\r
-        <activity android:name="org.evergreen_ils.accountAccess.bookbags.BookbagsListView" >\r
-        </activity>\r
-        <activity android:name="org.evergreen_ils.accountAccess.bookbags.BookBagDetails" >\r
-        </activity>\r
-\r
-        <activity\r
-            android:name="org.evergreen_ils.auth.AuthenticatorActivity"\r
-            android:label="@string/ou_account_label"\r
-            android:theme="@android:style/Theme.Light" >\r
-        </activity>\r
-\r
-        <service\r
-            android:name="org.evergreen_ils.auth.AuthenticatorService"\r
-            android:exported="false" >\r
-            <intent-filter>\r
-                <action android:name="android.accounts.AccountAuthenticator" />\r
-            </intent-filter>\r
-\r
-            <meta-data\r
-                android:name="android.accounts.AccountAuthenticator"\r
-                android:resource="@xml/authenticator" />\r
-        </service>\r
     </application>\r
-\r
 </manifest>\r
index 15a3159..c96eabc 100644 (file)
@@ -47,7 +47,7 @@
                 style="@style/HomeButton"
                 android:layout_weight="1"
                 android:drawableTop="@drawable/check_out"
-                android:onClick="onClickFeature"
+                android:onClick="onButtonClick"
                 android:text="@string/title_check_out" />
 
             <Button
@@ -55,7 +55,7 @@
                 style="@style/HomeButton"
                 android:layout_weight="1"
                 android:drawableTop="@drawable/holds"
-                android:onClick="onClickFeature"
+                android:onClick="onButtonClick"
                 android:text="@string/title_holds" />
 
             <Button
@@ -63,7 +63,7 @@
                 style="@style/HomeButton"
                 android:layout_weight="1"
                 android:drawableTop="@drawable/fines"
-                android:onClick="onClickFeature"
+                android:onClick="onButtonClick"
                 android:text="@string/title_fines" />
 
             <Button
@@ -71,7 +71,7 @@
                 style="@style/HomeButton"
                 android:layout_weight="1"
                 android:drawableTop="@drawable/book_bag"
-                android:onClick="onClickFeature"
+                android:onClick="onButtonClick"
                 android:text="@string/title_book_bags" />
         </LinearLayout>
 
diff --git a/Open-ILS/src/Android/core/res/layout/activity_main.xml b/Open-ILS/src/Android/core/res/layout/activity_main.xml
new file mode 100644 (file)
index 0000000..ad7f1f6
--- /dev/null
@@ -0,0 +1,46 @@
+<?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:background="@drawable/background_grey_image">
+
+    <TextView
+            android:layout_width="20px"
+            android:layout_height="18dp"
+            />
+
+    <Button
+            android:layout_width="match_parent"
+            android:layout_height="56dp"
+            style="@style/BigActionButton"
+            android:text="@string/title_check_out"
+            android:id="@+id/account_btn_check_out"
+            android:onClick="onButtonClick"
+            android:drawableStart="@drawable/check_out"/>
+
+    <Button
+            android:layout_width="match_parent"
+            android:layout_height="56dp"
+            style="@style/BigActionButton"
+            android:text="@string/title_holds"
+            android:id="@+id/account_btn_holds"
+            android:onClick="onButtonClick"
+            android:drawableStart="@drawable/holds"/>
+
+    <Button
+            android:layout_width="match_parent"
+            android:layout_height="56dp"
+            style="@style/BigActionButton"
+            android:text="@string/title_fines"
+            android:id="@+id/account_btn_fines"
+            android:onClick="onButtonClick"
+            android:drawableStart="@drawable/fines"/>
+
+    <TextView
+            android:layout_width="20px"
+            android:layout_height="12dp"
+            />
+
+</LinearLayout>
\ No newline at end of file
index 1a8fd9a..2f4ce58 100644 (file)
@@ -6,8 +6,6 @@
     android:background="@color/background"
      >
 
-       <include android:id="@+id/header_actionbar" layout="@layout/simple_actionbar"/>
-
     <TableLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
index 2688d54..a3d977a 100644 (file)
         >
         <Button android:id="@+id/account_btn_check_out"
             style="@style/HomeButton"
-            android:onClick="onClickFeature"
+            android:onClick="onButtonClick"
             android:text="@string/title_check_out"
             android:drawableTop="@drawable/check_out"/>
         <Button android:id="@+id/account_btn_holds"
             style="@style/HomeButton"
-            android:onClick="onClickFeature"
+            android:onClick="onButtonClick"
             android:text="@string/title_holds"
             android:drawableTop="@drawable/holds"/>
     </LinearLayout>
         android:layout_weight="1">
         <Button android:id="@+id/account_btn_fines"
             style="@style/HomeButton"
-            android:onClick="onClickFeature"
+            android:onClick="onButtonClick"
             android:text="@string/title_fines"
             android:drawableTop="@drawable/fines"/>
         <Button android:id="@+id/account_btn_book_bags"
             style="@style/HomeButton"
-            android:onClick="onClickFeature"
+            android:onClick="onButtonClick"
             android:text="@string/title_book_bags"
             android:drawableTop="@drawable/book_bag"/>
     </LinearLayout>
index 8d9fe43..cc5988a 100644 (file)
         <item name="android:layout_height">14dip</item>
     </style>
 
-    <!--
-    <style name="EvergreenTheme" parent="@style/Theme.AppCompat.Light.">
-    </style>
-    -->
-
     <style name="HomeButton">
         <item name="android:layout_gravity">center_vertical</item>
         <item name="android:layout_width">130dip</item>
         <item name="android:background">@drawable/menu_background_button</item>
     </style>
 
+    <style name="BigActionButton">
+        <item name="android:layout_marginLeft">24dp</item>
+        <item name="android:layout_marginTop">18dp</item>
+        <item name="android:layout_marginRight">24dp</item>
+        <item name="android:layout_marginBottom">18dp</item>
+        <item name="android:textSize">@dimen/text_size_medium</item>
+        <item name="android:textStyle">normal</item>
+        <item name="android:textColor">@color/dark</item>
+        <item name="android:background">@drawable/menu_background_button</item>
+    </style>
+
     <style name="TitleSearchStyleList">
         <item name="android:textSize">18sp</item>
         <item name="android:gravity">left</item>
index 312efff..bb5d43a 100644 (file)
@@ -24,6 +24,8 @@ import java.util.Date;
 import java.util.List;
 
 import android.opengl.Visibility;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.ActionBarActivity;
 import org.evergreen_ils.R;
 import org.evergreen_ils.accountAccess.AccountAccess;
 import org.evergreen_ils.accountAccess.MaxRenewalsException;
@@ -52,7 +54,7 @@ import android.widget.ListView;
 import android.widget.TextView;
 import android.widget.Toast;
 
-public class ItemsCheckOutListView extends Activity {
+public class ItemsCheckOutListView extends ActionBarActivity {
 
     private final String TAG = ItemsCheckOutListView.class.getName();
 
@@ -68,16 +70,8 @@ public class ItemsCheckOutListView extends Activity {
 
     private ProgressDialog progressDialog;
 
-    private Button homeButton;
-
-    private Button myAccountButton;
-
-    private TextView headerTitle;
-
     private TextView itemsNo;
 
-    private Activity thisActivity;
-
     private TextView overdueItems;
 
     private Date currentDate;
@@ -90,34 +84,13 @@ public class ItemsCheckOutListView extends Activity {
             return;
         }
 
-        thisActivity = this;
         setContentView(R.layout.checkout_list);
-        setTitle(R.string.checkout_items_title);
 
-        currentDate = new Date(System.currentTimeMillis());
+        ActionBar actionBar = getSupportActionBar();
+        actionBar.setSubtitle(AccountAccess.userName);
+        actionBar.setDisplayHomeAsUpEnabled(true);
 
-        // header portion actions
-        myAccountButton = (Button) findViewById(R.id.my_account_button);
-        myAccountButton.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                Intent intent = new Intent(getApplicationContext(),
-                        AccountScreenDashboard.class);
-                startActivity(intent);
-            }
-        });
-
-        homeButton = (Button) findViewById(R.id.action_bar_home_button);
-        homeButton.setText(R.string.checkout_items_title);
-        homeButton.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                Intent intent = new Intent(getApplicationContext(),
-                        SearchCatalogListView.class);
-                startActivity(intent);
-            }
-        });
-        // end header portion actions
+        currentDate = new Date(System.currentTimeMillis());
 
         context = this;
         itemsNo = (TextView) findViewById(R.id.checkout_items_number);
index e55b42d..db86206 100644 (file)
@@ -157,7 +157,7 @@ public class AccountScreenDashboard extends Activity {
         super.onStop();
     }
 
-    public void onClickFeature(View v) {
+    public void onButtonClick(View v) {
         int id = v.getId();
         if (id == R.id.account_btn_check_out) {
             startActivity(new Intent(getApplicationContext(),
diff --git a/Open-ILS/src/Android/core/src/org/evergreen_ils/views/MainActivity.java b/Open-ILS/src/Android/core/src/org/evergreen_ils/views/MainActivity.java
new file mode 100644 (file)
index 0000000..54c3049
--- /dev/null
@@ -0,0 +1,61 @@
+package org.evergreen_ils.views;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.ActionBarActivity;
+import android.view.View;
+import android.widget.Button;
+import org.evergreen_ils.R;
+import org.evergreen_ils.accountAccess.AccountAccess;
+import org.evergreen_ils.accountAccess.bookbags.BookbagsListView;
+import org.evergreen_ils.accountAccess.checkout.ItemsCheckOutListView;
+import org.evergreen_ils.accountAccess.fines.FinesActivity;
+import org.evergreen_ils.accountAccess.holds.HoldsListView;
+import org.evergreen_ils.globals.GlobalConfigs;
+import org.evergreen_ils.views.splashscreen.SplashActivity;
+
+/**
+ * Created by kenstir on 12/28/13.
+ */
+public class MainActivity extends ActionBarActivity {
+
+    private Button checkedOutButton;
+    private Button holdsButton;
+    private Button finesButton;
+    private GlobalConfigs globalConfigs;
+
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        if (!SplashActivity.isAppInitialized()) {
+            SplashActivity.restartApp(this);
+            return;
+        }
+
+        setContentView(R.layout.activity_main);
+
+        ActionBar actionBar = getSupportActionBar();
+        actionBar.setSubtitle(AccountAccess.userName);
+
+        // singleton initialize necessary IDL and Org data
+        globalConfigs = GlobalConfigs.getGlobalConfigs(this);
+    }
+
+    public void onButtonClick(View v) {
+        int id = v.getId();
+        if (id == R.id.account_btn_check_out) {
+            startActivity(new Intent(getApplicationContext(), ItemsCheckOutListView.class));
+
+        } else if (id == R.id.account_btn_holds) {
+            startActivity(new Intent(getApplicationContext(), HoldsListView.class));
+
+        } else if (id == R.id.account_btn_fines) {
+            startActivity(new Intent(getApplicationContext(), FinesActivity.class));
+
+        } else if (id == R.id.account_btn_book_bags) {
+            startActivity(new Intent(getApplicationContext(), BookbagsListView.class));
+
+        }
+    }
+}
index 75092e3..32c8bc6 100644 (file)
@@ -23,6 +23,7 @@ import org.evergreen_ils.R;
 import org.evergreen_ils.globals.GlobalConfigs;
 import org.evergreen_ils.searchCatalog.SearchCatalogListView;
 import org.evergreen_ils.views.ApplicationPreferences;
+import org.evergreen_ils.views.MainActivity;
 import org.evergreen_ils.views.splashscreen.LoadingTask.LoadingTaskListener;
 
 import android.app.Activity;
@@ -128,7 +129,7 @@ public class SplashActivity extends Activity implements LoadingTaskListener {
 
     private void startApp() {
         mInitialized = true;
-        Intent intent = new Intent(SplashActivity.this, SearchCatalogListView.class);
+        Intent intent = new Intent(SplashActivity.this, MainActivity.class);
         startActivity(intent);
         finish();
     }
index c5dfa00..d8c7952 100644 (file)
@@ -28,7 +28,7 @@
         android:allowBackup="true"
         android:icon="@drawable/evergreen_launcher_icon"
         android:label="@string/ou_app_label"
-        android:theme="@style/Theme.AppCompat.Light.DarkActionBar" >
+        android:theme="@style/Theme.AppCompat" >
 
         <!-- Notification receiver -->
         <receiver
         <service android:name="org.evergreen_ils.services.ScheduledIntentService" >
         </service>
 
-        <activity android:name="org.evergreen_ils.views.splashscreen.SplashActivity">
-            <!--  android:theme="@android:style/Theme.Light.NoTitleBar"  -->
+        <activity
+                android:name="org.evergreen_ils.views.splashscreen.SplashActivity"
+                android:theme="@android:style/Theme.NoTitleBar">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
-
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
         </activity>
 
         <!-- Checkout Activities -->
-        <activity android:name="org.evergreen_ils.accountAccess.checkout.ItemsCheckOutListView" >
+        <activity
+                android:name="org.evergreen_ils.accountAccess.checkout.ItemsCheckOutListView"
+                android:label="@string/checkout_items_title"
+                android:parentActivityName="org.evergreen_ils.views.MainActivity">
+            <meta-data
+                android:name="android.support.PARENT_ACTIVITY"
+                android:value="org.evergreen_ils.views.MainActivity"/>
         </activity>
 
         <!-- Holds Activities -->
             android:theme="@android:style/Theme.Light" >
         </activity>
 
+        <activity android:name="org.evergreen_ils.views.MainActivity">
+        </activity>
+
         <service
             android:name="org.evergreen_ils.auth.AuthenticatorService"
             android:exported="false" >