AppCompatRosActivity.java
Go to the documentation of this file.
1 /*
2  * Copyright 2016 Intermodalics All Rights Reserved.
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 
17 package eu.intermodalics.tango_ros_streamer.activities;
18 
19 import android.content.res.Configuration;
20 import android.os.Bundle;
21 import android.support.annotation.LayoutRes;
22 import android.support.annotation.Nullable;
23 import android.support.v7.app.ActionBar;
24 import android.support.v7.app.AppCompatDelegate;
25 import android.support.v7.widget.Toolbar;
26 import android.view.MenuInflater;
27 import android.view.View;
28 import android.view.ViewGroup;
29 
30 import org.ros.android.RosActivity;
31 
36 public abstract class AppCompatRosActivity extends RosActivity {
37  private AppCompatDelegate mDelegate;
38 
40  super("", "");
41  }
42 
43  protected AppCompatRosActivity(String notificationTicker, String notificationTitle) {
44  super(notificationTicker, notificationTitle);
45  }
46 
47  @Override
48  protected void onCreate(Bundle savedInstanceState) {
49  getDelegate().installViewFactory();
50  getDelegate().onCreate(savedInstanceState);
51  super.onCreate(savedInstanceState);
52  }
53  @Override
54  protected void onPostCreate(Bundle savedInstanceState) {
55  super.onPostCreate(savedInstanceState);
56  getDelegate().onPostCreate(savedInstanceState);
57  }
58  public ActionBar getSupportActionBar() {
59  return getDelegate().getSupportActionBar();
60  }
61  public void setSupportActionBar(@Nullable Toolbar toolbar) {
62  getDelegate().setSupportActionBar(toolbar);
63  }
64  @Override
65  public MenuInflater getMenuInflater() {
66  return getDelegate().getMenuInflater();
67  }
68  @Override
69  public void setContentView(@LayoutRes int layoutResID) {
70  getDelegate().setContentView(layoutResID);
71  }
72  @Override
73  public void setContentView(View view) {
74  getDelegate().setContentView(view);
75  }
76  @Override
77  public void setContentView(View view, ViewGroup.LayoutParams params) {
78  getDelegate().setContentView(view, params);
79  }
80  @Override
81  public void addContentView(View view, ViewGroup.LayoutParams params) {
82  getDelegate().addContentView(view, params);
83  }
84  @Override
85  protected void onPostResume() {
86  super.onPostResume();
87  getDelegate().onPostResume();
88  }
89  @Override
90  protected void onTitleChanged(CharSequence title, int color) {
91  super.onTitleChanged(title, color);
92  getDelegate().setTitle(title);
93  }
94  @Override
95  public void onConfigurationChanged(Configuration newConfig) {
96  super.onConfigurationChanged(newConfig);
97  getDelegate().onConfigurationChanged(newConfig);
98  }
99  @Override
100  protected void onStop() {
101  super.onStop();
102  getDelegate().onStop();
103  }
104  @Override
105  protected void onDestroy() {
106  super.onDestroy();
107  getDelegate().onDestroy();
108  }
109  public void invalidateOptionsMenu() {
110  getDelegate().invalidateOptionsMenu();
111  }
112  private AppCompatDelegate getDelegate() {
113  if (mDelegate == null) {
114  mDelegate = AppCompatDelegate.create(this, null);
115  }
116  return mDelegate;
117  }
118 }
AppCompatRosActivity(String notificationTicker, String notificationTitle)


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