Add basic HistoryFragment
Bug: 31623549
Test: Manually verified history fragment can be added / removed.
Change-Id: Ib3ae8d976811f057d9b99dd503abcaa47ac92ae7
diff --git a/res/layout/activity_calculator_port.xml b/res/layout/activity_calculator_port.xml
index 4cafa94..30aaf00 100644
--- a/res/layout/activity_calculator_port.xml
+++ b/res/layout/activity_calculator_port.xml
@@ -21,7 +21,7 @@
android:layout_height="match_parent"
android:orientation="vertical">
- <include layout="@layout/display"/>
+ <include layout="@layout/display" />
<com.android.calculator2.CalculatorPadViewPager
android:id="@+id/pad_pager"
diff --git a/res/layout/fragment_history.xml b/res/layout/fragment_history.xml
new file mode 100644
index 0000000..b746a9c
--- /dev/null
+++ b/res/layout/fragment_history.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/display_background_color"
+ android:orientation="vertical">
+
+ <Toolbar
+ android:id="@+id/history_toolbar"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="?android:attr/colorPrimary"
+ android:elevation="4dip"
+ android:minHeight="?android:attr/actionBarSize"
+ android:navigationContentDescription="@string/desc_navigate_up"
+ android:navigationIcon="?android:attr/homeAsUpIndicator"
+ android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar"
+ android:title="@string/title_history" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:text="No History" />
+
+</LinearLayout>
diff --git a/res/menu/activity_calculator.xml b/res/menu/activity_calculator.xml
index 8d086d1..d0c5659 100644
--- a/res/menu/activity_calculator.xml
+++ b/res/menu/activity_calculator.xml
@@ -17,6 +17,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:id="@+id/menu_history"
+ android:title="@string/menu_history" />
+
<item android:id="@+id/menu_leading"
android:title="@string/menu_leading" />
diff --git a/res/menu/fragment_history.xml b/res/menu/fragment_history.xml
new file mode 100644
index 0000000..8c9f1d6
--- /dev/null
+++ b/res/menu/fragment_history.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item
+ android:id="@+id/menu_clear_history"
+ android:title="@string/menu_clear_history" />
+
+</menu>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 137a141..fd916a7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -276,5 +276,13 @@
<string name="menu_fraction">Answer as fraction</string>
<!-- Menu option to view the app's open source licenses. [CHAR_LIMIT=40] -->
<string name="menu_licenses">Open source licenses</string>
+ <!-- Menu option to access calculation history. [CHAR_LIMIT=40] -->
+ <string name="menu_history">History</string>
+ <!-- Menu option to clear calculation history. [CHAR_LIMIT=40] -->
+ <string name="menu_clear_history">Clear history</string>
+ <!-- Action bar title in history page. [CHAR_LIMIT=40] -->
+ <string name="title_history">History</string>
+ <!-- Action bar navigate up description in history page. [CHAR_LIMIT=40] -->
+ <string name="desc_navigate_up">Navigate up</string>
</resources>