CustomWidgetPlugin.java 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C) 2019 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 com.android.systemui.plugins;
  17. import android.appwidget.AppWidgetHostView;
  18. import com.android.systemui.plugins.annotations.ProvidesInterface;
  19. /**
  20. * Implement this plugin interface to add a custom widget.
  21. */
  22. @ProvidesInterface(action = CustomWidgetPlugin.ACTION, version = CustomWidgetPlugin.VERSION)
  23. public interface CustomWidgetPlugin extends Plugin {
  24. String ACTION = "com.android.systemui.action.PLUGIN_CUSTOM_WIDGET";
  25. int VERSION = 1;
  26. /**
  27. * The label to display to the user in the AppWidget picker.
  28. */
  29. String getLabel();
  30. /**
  31. * The default width of the widget when added to a host, in dp. The widget will get
  32. * at least this width, and will often be given more, depending on the host.
  33. */
  34. int getSpanX();
  35. /**
  36. * The default height of the widget when added to a host, in dp. The widget will get
  37. * at least this height, and will often be given more, depending on the host.
  38. */
  39. int getSpanY();
  40. /**
  41. * Minimum width (in dp) which the widget can be resized to. This field has no effect if it
  42. * is greater than minWidth or if horizontal resizing isn't enabled.
  43. */
  44. int getMinSpanX();
  45. /**
  46. * Minimum height (in dp) which the widget can be resized to. This field has no effect if it
  47. * is greater than minHeight or if vertical resizing isn't enabled.
  48. */
  49. int getMinSpanY();
  50. /**
  51. * The rules by which a widget can be resized.
  52. */
  53. int getResizeMode();
  54. /**
  55. * Notify the plugin that container of the widget has been rendered, where the custom widget
  56. * can be attached to.
  57. */
  58. void onViewCreated(AppWidgetHostView parent);
  59. }