Home | History | Annotate | Download | only in phone
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
      5  * except in compliance with the License. You may obtain a copy of the License at
      6  *
      7  *      http://www.apache.org/licenses/LICENSE-2.0
      8  *
      9  * Unless required by applicable law or agreed to in writing, software distributed under the
     10  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     11  * KIND, either express or implied. See the License for the specific language governing
     12  * permissions and limitations under the License.
     13  */
     14 
     15 package com.android.systemui.plugins.statusbar.phone;
     16 
     17 import android.annotation.Nullable;
     18 import android.graphics.drawable.Drawable;
     19 import android.view.View;
     20 import android.view.ViewGroup;
     21 
     22 import com.android.systemui.plugins.Plugin;
     23 import com.android.systemui.plugins.annotations.ProvidesInterface;
     24 
     25 @ProvidesInterface(action = NavBarButtonProvider.ACTION, version = NavBarButtonProvider.VERSION)
     26 public interface NavBarButtonProvider extends Plugin {
     27 
     28     public static final String ACTION = "com.android.systemui.action.PLUGIN_NAV_BUTTON";
     29 
     30     public static final int VERSION = 2;
     31 
     32     /**
     33      * Returns a view in the nav bar.  If the id is set "back", "home", "recent_apps", "menu",
     34      * or "ime_switcher", it is expected to implement ButtonInterface.
     35      */
     36     public View createView(String spec, ViewGroup parent);
     37 
     38     /**
     39      * Interface for button actions.
     40      */
     41     interface ButtonInterface {
     42 
     43         void setImageDrawable(@Nullable Drawable drawable);
     44 
     45         void abortCurrentGesture();
     46 
     47         void setVertical(boolean vertical);
     48 
     49         default void setCarMode(boolean carMode) {
     50         }
     51 
     52         void setDarkIntensity(float intensity);
     53 
     54         void setDelayTouchFeedback(boolean shouldDelay);
     55     }
     56 }
     57