Implement grouped headers.
Fixes: 32943152
Fixes: 33203390
Fixes: 33105914
-Add divider
-Adjust padding to better match spec
-Make HistoryFormula/Result padding match DisplayFormula/Result padding
Change-Id: I5e5a7e61079b6d1367bf61f4c88dd79555f4bcb7
diff --git a/src/com/android/calculator2/HistoryFragment.java b/src/com/android/calculator2/HistoryFragment.java
index 22adcd3..f65f1e9 100644
--- a/src/com/android/calculator2/HistoryFragment.java
+++ b/src/com/android/calculator2/HistoryFragment.java
@@ -20,7 +20,9 @@
import android.animation.ObjectAnimator;
import android.app.Fragment;
import android.app.FragmentTransaction;
+import android.graphics.Color;
import android.os.Bundle;
+import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.MenuItem;
@@ -96,6 +98,7 @@
mRecyclerView = (RecyclerView) view.findViewById(R.id.history_recycler_view);
// The size of the RecyclerView is not affected by the adapter's contents.
+ mRecyclerView.setHasFixedSize(true);
mRecyclerView.setAdapter(mAdapter);
final Toolbar toolbar = (Toolbar) view.findViewById(R.id.history_toolbar);
@@ -153,7 +156,11 @@
for (long i = 0; i < maxIndex; ++i) {
newDataSet.add(null);
}
- if (newDataSet.isEmpty()) {
+ final boolean isEmpty = newDataSet.isEmpty();
+ mRecyclerView.setBackgroundColor(isEmpty
+ ? ContextCompat.getColor(activity, R.color.empty_history_color)
+ : Color.TRANSPARENT);
+ if (isEmpty) {
newDataSet.add(new HistoryItem());
}
mDataSet = newDataSet;