aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2018-05-07 16:30:01 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-07 21:30:27 +0000
commit4e9e32572529ffc5bb442fe082206df2285261e3 (patch)
treee81897b758b73a6b346945d40abe367b8a125451 /platform_tools
parentd3cee17add2becfa526d6ec7337cdcf72a74e108 (diff)
[viewer] Avoid per-frame json UI updates
The reason we push Json updates for every frame is to support the Android FPS meter - which happens to require the native FPS meter for updates. Instead of supporting two meters: 1) scale up the native FPS widget on Android (1.5x) 2) remove the Android widget 3) stop calling updateUIState() from onPaint() Change-Id: Ica8109869035b2f885743a7e38b50688b69fa5e4 Reviewed-on: https://skia-review.googlesource.com/126621 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'platform_tools')
-rw-r--r--platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/StateAdapter.java25
-rw-r--r--platform_tools/android/apps/viewer/src/main/res/layout-xlarge-land/activity_main.xml13
-rw-r--r--platform_tools/android/apps/viewer/src/main/res/layout/activity_main.xml13
-rw-r--r--platform_tools/android/apps/viewer/src/main/res/layout/fps_toggle.xml23
-rw-r--r--platform_tools/android/apps/viewer/src/main/res/values/strings.xml3
5 files changed, 2 insertions, 75 deletions
diff --git a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/StateAdapter.java b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/StateAdapter.java
index f82a7b66cd..0c4f736e80 100644
--- a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/StateAdapter.java
+++ b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/StateAdapter.java
@@ -36,7 +36,6 @@ public class StateAdapter extends BaseAdapter implements AdapterView.OnItemSelec
private static final String VALUE = "value";
private static final String OPTIONS = "options";
private static final String BACKEND_STATE_NAME = "Backend";
- private static final String FPS_STATE_NAME = "FPS";
private static final String REFRESH_STATE_NAME = "Refresh";
private static final String ON = "ON";
private static final String OFF = "OFF";
@@ -45,11 +44,9 @@ public class StateAdapter extends BaseAdapter implements AdapterView.OnItemSelec
private ViewerActivity mViewerActivity;
private LinearLayout mLayout;
private JSONArray mStateJson;
- private TextView mFPSFloatText;
public StateAdapter(ViewerActivity viewerActivity) {
mViewerActivity = viewerActivity;
- mFPSFloatText = (TextView) viewerActivity.findViewById(R.id.fpsFloatText);
try {
mStateJson = new JSONArray("[{\"name\": \"Please\", " +
"\"value\": \"Initialize\", \"options\": []}]");
@@ -72,10 +69,9 @@ public class StateAdapter extends BaseAdapter implements AdapterView.OnItemSelec
}
// The first list item is the mLayout that contains a list of state items
- // The second list item is the toggle for float FPS
@Override
public int getCount() {
- return 2;
+ return 1;
}
@Override
@@ -99,19 +95,6 @@ public class StateAdapter extends BaseAdapter implements AdapterView.OnItemSelec
}
return mLayout;
}
- case 1: {
- View view = LayoutInflater.from(mViewerActivity).inflate(R.layout.fps_toggle, null);
- Switch theSwitch = (Switch) view.findViewById(R.id.theSwitch);
- theSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- mFPSFloatText.setVisibility(isChecked ? View.VISIBLE : View.INVISIBLE);
- // Quickly set the bool fRefresh in native Viewer app for continuous refresh
- mViewerActivity.onStateChanged(REFRESH_STATE_NAME, isChecked ? ON : OFF);
- }
- });
- return view;
- }
default: {
return null;
}
@@ -130,12 +113,6 @@ public class StateAdapter extends BaseAdapter implements AdapterView.OnItemSelec
nameText.setText(item.getString(NAME));
- if (nameText.getText().equals(FPS_STATE_NAME) && mFPSFloatText != null) {
- mFPSFloatText.setText(value);
- // Don't show FPS in the drawer. We'll show it in the float text.
- itemView.setVisibility(View.GONE);
- }
-
JSONArray options = item.getJSONArray(OPTIONS);
if (options.length() == 0) {
valueText.setText(value);
diff --git a/platform_tools/android/apps/viewer/src/main/res/layout-xlarge-land/activity_main.xml b/platform_tools/android/apps/viewer/src/main/res/layout-xlarge-land/activity_main.xml
index b78112dc52..49457c9802 100644
--- a/platform_tools/android/apps/viewer/src/main/res/layout-xlarge-land/activity_main.xml
+++ b/platform_tools/android/apps/viewer/src/main/res/layout-xlarge-land/activity_main.xml
@@ -35,19 +35,6 @@
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
</LinearLayout>
-
- <TextView
- android:visibility="invisible"
- android:layout_width="100dp"
- android:layout_height="wrap_content"
- android:layout_margin="10dp"
- android:padding="10dp"
- android:background="@android:color/holo_blue_dark"
- android:textColor="@android:color/white"
- android:text=" 100.000ms"
- android:id="@+id/fpsFloatText"
- android:layout_alignParentBottom="true"
- android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
diff --git a/platform_tools/android/apps/viewer/src/main/res/layout/activity_main.xml b/platform_tools/android/apps/viewer/src/main/res/layout/activity_main.xml
index 7041d0e8ed..bfb91dff57 100644
--- a/platform_tools/android/apps/viewer/src/main/res/layout/activity_main.xml
+++ b/platform_tools/android/apps/viewer/src/main/res/layout/activity_main.xml
@@ -23,19 +23,6 @@
android:layout_centerHorizontal="true" />
</LinearLayout>
- <TextView
- android:layout_width="100dp"
- android:layout_height="wrap_content"
- android:layout_margin="10dp"
- android:padding="10dp"
- android:background="@android:color/holo_blue_dark"
- android:textColor="@android:color/white"
- android:text=" 100.000ms"
- android:id="@+id/fpsFloatText"
- android:visibility="invisible"
- android:layout_alignParentBottom="true"
- android:layout_alignParentEnd="true" />
-
</RelativeLayout>
<!-- The navigation drawer -->
diff --git a/platform_tools/android/apps/viewer/src/main/res/layout/fps_toggle.xml b/platform_tools/android/apps/viewer/src/main/res/layout/fps_toggle.xml
deleted file mode 100644
index 4463629ab7..0000000000
--- a/platform_tools/android/apps/viewer/src/main/res/layout/fps_toggle.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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="wrap_content">
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
- android:layout_marginLeft="10dp"
- android:layout_marginBottom="0dp"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:text="@string/float_fps" />
-
- <Switch
- android:id="@+id/theSwitch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginBottom="10dp"
- android:layout_marginLeft="10dp"
- android:layout_marginTop="0dp" />
-</LinearLayout> \ No newline at end of file
diff --git a/platform_tools/android/apps/viewer/src/main/res/values/strings.xml b/platform_tools/android/apps/viewer/src/main/res/values/strings.xml
index 5e218af9e3..84a0af3c02 100644
--- a/platform_tools/android/apps/viewer/src/main/res/values/strings.xml
+++ b/platform_tools/android/apps/viewer/src/main/res/values/strings.xml
@@ -2,5 +2,4 @@
<resources>
<string name="drawer_open">Open navigation drawer</string>
<string name="drawer_close">Close navigation drawer</string>
- <string name="float_fps">Render time</string>
-</resources> \ No newline at end of file
+</resources>