AppCompatPreferenceActivity.java
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package eu.intermodalics.tango_ros_streamer.activities;
17 import android.content.res.Configuration;
18 import android.os.Bundle;
19 import android.preference.PreferenceActivity;
20 import android.support.annotation.LayoutRes;
21 import android.support.annotation.Nullable;
22 import android.support.v7.app.ActionBar;
23 import android.support.v7.app.AppCompatDelegate;
24 import android.support.v7.widget.Toolbar;
25 import android.view.MenuInflater;
26 import android.view.View;
27 import android.view.ViewGroup;
35 public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
36  private AppCompatDelegate mDelegate;
37  @Override
38  protected void onCreate(Bundle savedInstanceState) {
39  getDelegate().installViewFactory();
40  getDelegate().onCreate(savedInstanceState);
41  super.onCreate(savedInstanceState);
42  }
43  @Override
44  protected void onPostCreate(Bundle savedInstanceState) {
45  super.onPostCreate(savedInstanceState);
46  getDelegate().onPostCreate(savedInstanceState);
47  }
48  public ActionBar getSupportActionBar() {
49  return getDelegate().getSupportActionBar();
50  }
51  public void setSupportActionBar(@Nullable Toolbar toolbar) {
52  getDelegate().setSupportActionBar(toolbar);
53  }
54  @Override
55  public MenuInflater getMenuInflater() {
56  return getDelegate().getMenuInflater();
57  }
58  @Override
59  public void setContentView(@LayoutRes int layoutResID) {
60  getDelegate().setContentView(layoutResID);
61  }
62  @Override
63  public void setContentView(View view) {
64  getDelegate().setContentView(view);
65  }
66  @Override
67  public void setContentView(View view, ViewGroup.LayoutParams params) {
68  getDelegate().setContentView(view, params);
69  }
70  @Override
71  public void addContentView(View view, ViewGroup.LayoutParams params) {
72  getDelegate().addContentView(view, params);
73  }
74  @Override
75  protected void onPostResume() {
76  super.onPostResume();
77  getDelegate().onPostResume();
78  }
79  @Override
80  protected void onTitleChanged(CharSequence title, int color) {
81  super.onTitleChanged(title, color);
82  getDelegate().setTitle(title);
83  }
84  @Override
85  public void onConfigurationChanged(Configuration newConfig) {
86  super.onConfigurationChanged(newConfig);
87  getDelegate().onConfigurationChanged(newConfig);
88  }
89  @Override
90  protected void onStop() {
91  super.onStop();
92  getDelegate().onStop();
93  }
94  @Override
95  protected void onDestroy() {
96  super.onDestroy();
97  getDelegate().onDestroy();
98  }
99  public void invalidateOptionsMenu() {
100  getDelegate().invalidateOptionsMenu();
101  }
102  private AppCompatDelegate getDelegate() {
103  if (mDelegate == null) {
104  mDelegate = AppCompatDelegate.create(this, null);
105  }
106  return mDelegate;
107  }
108 }


TangoRosStreamer
Author(s):
autogenerated on Mon Jun 10 2019 15:37:54