13ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov/* 23ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov * Copyright (C) 2016 The Android Open Source Project 33ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov * 43ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov * Licensed under the Apache License, Version 2.0 (the "License"); 53ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov * you may not use this file except in compliance with the License. 63ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov * You may obtain a copy of the License at 73ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov * 83ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov * http://www.apache.org/licenses/LICENSE-2.0 93ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov * 103ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov * Unless required by applicable law or agreed to in writing, software 113ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov * distributed under the License is distributed on an "AS IS" BASIS, 123ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 133ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov * See the License for the specific language governing permissions and 143ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov * limitations under the License. 153ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov */ 163ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov 173ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikovpackage android.support.v4; 183ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov 193ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikovimport android.app.Activity; 203ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikovimport android.os.Bundle; 213ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikovimport android.view.WindowManager; 223ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov 233ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikovpublic abstract class BaseTestActivity extends Activity { 243ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov @Override 253ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov protected void onCreate(Bundle savedInstanceState) { 263ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov super.onCreate(savedInstanceState); 273ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 283ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov final int contentView = getContentViewLayoutResId(); 293ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov if (contentView > 0) { 303ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov setContentView(contentView); 313ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov } 323ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov onContentViewSet(); 333ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 343ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov } 353ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov 363ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov protected abstract int getContentViewLayoutResId(); 373ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov 383ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov protected void onContentViewSet() {} 393ac77bf186f87ecad4bf0063b2f6c4384efbd56aKirill Grouchnikov} 40