AppCompatRosActivity.java
Go to the documentation of this file.
00001 /*
00002  * Copyright 2016 Intermodalics All Rights Reserved.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 package eu.intermodalics.tango_ros_streamer.activities;
00018 
00019 import android.content.res.Configuration;
00020 import android.os.Bundle;
00021 import android.support.annotation.LayoutRes;
00022 import android.support.annotation.Nullable;
00023 import android.support.v7.app.ActionBar;
00024 import android.support.v7.app.AppCompatDelegate;
00025 import android.support.v7.widget.Toolbar;
00026 import android.view.MenuInflater;
00027 import android.view.View;
00028 import android.view.ViewGroup;
00029 
00030 import org.ros.android.RosActivity;
00031 
00036 public abstract class AppCompatRosActivity extends RosActivity {
00037     private AppCompatDelegate mDelegate;
00038 
00039     public AppCompatRosActivity() {
00040         super("", "");
00041     }
00042 
00043     protected AppCompatRosActivity(String notificationTicker, String notificationTitle) {
00044         super(notificationTicker, notificationTitle);
00045     }
00046 
00047     @Override
00048     protected void onCreate(Bundle savedInstanceState) {
00049         getDelegate().installViewFactory();
00050         getDelegate().onCreate(savedInstanceState);
00051         super.onCreate(savedInstanceState);
00052     }
00053     @Override
00054     protected void onPostCreate(Bundle savedInstanceState) {
00055         super.onPostCreate(savedInstanceState);
00056         getDelegate().onPostCreate(savedInstanceState);
00057     }
00058     public ActionBar getSupportActionBar() {
00059         return getDelegate().getSupportActionBar();
00060     }
00061     public void setSupportActionBar(@Nullable Toolbar toolbar) {
00062         getDelegate().setSupportActionBar(toolbar);
00063     }
00064     @Override
00065     public MenuInflater getMenuInflater() {
00066         return getDelegate().getMenuInflater();
00067     }
00068     @Override
00069     public void setContentView(@LayoutRes int layoutResID) {
00070         getDelegate().setContentView(layoutResID);
00071     }
00072     @Override
00073     public void setContentView(View view) {
00074         getDelegate().setContentView(view);
00075     }
00076     @Override
00077     public void setContentView(View view, ViewGroup.LayoutParams params) {
00078         getDelegate().setContentView(view, params);
00079     }
00080     @Override
00081     public void addContentView(View view, ViewGroup.LayoutParams params) {
00082         getDelegate().addContentView(view, params);
00083     }
00084     @Override
00085     protected void onPostResume() {
00086         super.onPostResume();
00087         getDelegate().onPostResume();
00088     }
00089     @Override
00090     protected void onTitleChanged(CharSequence title, int color) {
00091         super.onTitleChanged(title, color);
00092         getDelegate().setTitle(title);
00093     }
00094     @Override
00095     public void onConfigurationChanged(Configuration newConfig) {
00096         super.onConfigurationChanged(newConfig);
00097         getDelegate().onConfigurationChanged(newConfig);
00098     }
00099     @Override
00100     protected void onStop() {
00101         super.onStop();
00102         getDelegate().onStop();
00103     }
00104     @Override
00105     protected void onDestroy() {
00106         super.onDestroy();
00107         getDelegate().onDestroy();
00108     }
00109     public void invalidateOptionsMenu() {
00110         getDelegate().invalidateOptionsMenu();
00111     }
00112     private AppCompatDelegate getDelegate() {
00113         if (mDelegate == null) {
00114             mDelegate = AppCompatDelegate.create(this, null);
00115         }
00116         return mDelegate;
00117     }
00118 }


TangoRosStreamer
Author(s):
autogenerated on Thu Jun 6 2019 19:49:57