Loading tests/ActivityViewTest/Android.mk +1 −1 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_PACKAGE_NAME := ActivityViewTest LOCAL_PRIVATE_PLATFORM_APIS := true Loading tests/ActivityViewTest/AndroidManifest.xml +6 −3 Original line number Diff line number Diff line Loading @@ -35,17 +35,20 @@ <activity android:name=".ActivityViewActivity" android:label="AV" android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"> android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" android:windowSoftInputMode="stateHidden|adjustResize"> </activity> <activity android:name=".ActivityViewResizeActivity" android:label="AV Resize" android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"> android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" android:windowSoftInputMode="stateHidden|adjustResize"> </activity> <activity android:name=".ActivityViewScrollActivity" android:label="AV Scroll" android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"> android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" android:windowSoftInputMode="stateHidden"> </activity> <activity android:name=".ActivityViewTestActivity" Loading tests/ActivityViewTest/res/layout/activity_view_test_activity.xml +6 −6 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/test_activity_root" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" Loading Loading @@ -60,11 +61,10 @@ android:background="#00000000" android:gravity="center" /> <View android:id="@+id/touch_intercept_view" <EditText android:id="@+id/test_activity_edittext" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00000000" /> android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_margin="16dp" /> </RelativeLayout> No newline at end of file tests/ActivityViewTest/src/com/google/android/test/activityview/ActivityViewTestActivity.java +8 −10 Original line number Diff line number Diff line Loading @@ -29,26 +29,24 @@ import android.view.View; import android.view.ViewTreeObserver; import android.widget.TextView; public class ActivityViewTestActivity extends Activity implements View.OnTouchListener { public class ActivityViewTestActivity extends Activity { private View mRoot; private TextView mTextView; private TextView mWidthTextView; private TextView mHeightTextView; private TextView mTouchStateTextView; private View mTouchInterceptView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_test_activity); mRoot = findViewById(R.id.test_activity_root); mTextView = findViewById(R.id.test_activity_title); mWidthTextView = findViewById(R.id.test_activity_width_text); mHeightTextView = findViewById(R.id.test_activity_height_text); mTouchStateTextView = findViewById(R.id.test_activity_touch_state); mTouchInterceptView = findViewById(R.id.touch_intercept_view); mTouchInterceptView.setOnTouchListener(this); ViewTreeObserver viewTreeObserver = mTouchInterceptView.getViewTreeObserver(); ViewTreeObserver viewTreeObserver = mRoot.getViewTreeObserver(); if (viewTreeObserver.isAlive()) { viewTreeObserver.addOnGlobalLayoutListener(this::updateDimensionTexts); } Loading Loading @@ -90,8 +88,8 @@ public class ActivityViewTestActivity extends Activity implements View.OnTouchLi } private void updateDimensionTexts() { mWidthTextView.setText("" + mTouchInterceptView.getWidth()); mHeightTextView.setText("" + mTouchInterceptView.getHeight()); mWidthTextView.setText("" + mRoot.getWidth()); mHeightTextView.setText("" + mRoot.getHeight()); } private void updateTouchState(MotionEvent event) { Loading @@ -108,8 +106,8 @@ public class ActivityViewTestActivity extends Activity implements View.OnTouchLi } @Override public boolean onTouch(View v, MotionEvent event) { public boolean dispatchTouchEvent(MotionEvent event) { updateTouchState(event); return true; return super.dispatchTouchEvent(event); } } Loading
tests/ActivityViewTest/Android.mk +1 −1 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_PACKAGE_NAME := ActivityViewTest LOCAL_PRIVATE_PLATFORM_APIS := true Loading
tests/ActivityViewTest/AndroidManifest.xml +6 −3 Original line number Diff line number Diff line Loading @@ -35,17 +35,20 @@ <activity android:name=".ActivityViewActivity" android:label="AV" android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"> android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" android:windowSoftInputMode="stateHidden|adjustResize"> </activity> <activity android:name=".ActivityViewResizeActivity" android:label="AV Resize" android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"> android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" android:windowSoftInputMode="stateHidden|adjustResize"> </activity> <activity android:name=".ActivityViewScrollActivity" android:label="AV Scroll" android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"> android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" android:windowSoftInputMode="stateHidden"> </activity> <activity android:name=".ActivityViewTestActivity" Loading
tests/ActivityViewTest/res/layout/activity_view_test_activity.xml +6 −6 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/test_activity_root" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" Loading Loading @@ -60,11 +61,10 @@ android:background="#00000000" android:gravity="center" /> <View android:id="@+id/touch_intercept_view" <EditText android:id="@+id/test_activity_edittext" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00000000" /> android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_margin="16dp" /> </RelativeLayout> No newline at end of file
tests/ActivityViewTest/src/com/google/android/test/activityview/ActivityViewTestActivity.java +8 −10 Original line number Diff line number Diff line Loading @@ -29,26 +29,24 @@ import android.view.View; import android.view.ViewTreeObserver; import android.widget.TextView; public class ActivityViewTestActivity extends Activity implements View.OnTouchListener { public class ActivityViewTestActivity extends Activity { private View mRoot; private TextView mTextView; private TextView mWidthTextView; private TextView mHeightTextView; private TextView mTouchStateTextView; private View mTouchInterceptView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_test_activity); mRoot = findViewById(R.id.test_activity_root); mTextView = findViewById(R.id.test_activity_title); mWidthTextView = findViewById(R.id.test_activity_width_text); mHeightTextView = findViewById(R.id.test_activity_height_text); mTouchStateTextView = findViewById(R.id.test_activity_touch_state); mTouchInterceptView = findViewById(R.id.touch_intercept_view); mTouchInterceptView.setOnTouchListener(this); ViewTreeObserver viewTreeObserver = mTouchInterceptView.getViewTreeObserver(); ViewTreeObserver viewTreeObserver = mRoot.getViewTreeObserver(); if (viewTreeObserver.isAlive()) { viewTreeObserver.addOnGlobalLayoutListener(this::updateDimensionTexts); } Loading Loading @@ -90,8 +88,8 @@ public class ActivityViewTestActivity extends Activity implements View.OnTouchLi } private void updateDimensionTexts() { mWidthTextView.setText("" + mTouchInterceptView.getWidth()); mHeightTextView.setText("" + mTouchInterceptView.getHeight()); mWidthTextView.setText("" + mRoot.getWidth()); mHeightTextView.setText("" + mRoot.getHeight()); } private void updateTouchState(MotionEvent event) { Loading @@ -108,8 +106,8 @@ public class ActivityViewTestActivity extends Activity implements View.OnTouchLi } @Override public boolean onTouch(View v, MotionEvent event) { public boolean dispatchTouchEvent(MotionEvent event) { updateTouchState(event); return true; return super.dispatchTouchEvent(event); } }