Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

NotifyMyAndroidPlugin.java 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) 2006-2014 DMDirc Developers
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package com.dmdirc.addons.nma;
  23. import com.dmdirc.config.prefs.PluginPreferencesCategory;
  24. import com.dmdirc.config.prefs.PreferencesCategory;
  25. import com.dmdirc.config.prefs.PreferencesDialogModel;
  26. import com.dmdirc.config.prefs.PreferencesSetting;
  27. import com.dmdirc.config.prefs.PreferencesType;
  28. import com.dmdirc.plugins.PluginInfo;
  29. import com.dmdirc.plugins.implementations.BaseCommandPlugin;
  30. import dagger.ObjectGraph;
  31. /**
  32. * Plugin to allow pushing notifications to NotifyMyAndroid.
  33. */
  34. public class NotifyMyAndroidPlugin extends BaseCommandPlugin {
  35. /** Our info object. */
  36. private final PluginInfo pluginInfo;
  37. /**
  38. * Creates a new instance of the {@link NotifyMyAndroidPlugin}.
  39. *
  40. * @param pluginInfo The plugin info object for this plugin.
  41. */
  42. public NotifyMyAndroidPlugin(final PluginInfo pluginInfo) {
  43. this.pluginInfo = pluginInfo;
  44. }
  45. @Override
  46. public void load(final PluginInfo pluginInfo, final ObjectGraph graph) {
  47. super.load(pluginInfo, graph);
  48. setObjectGraph(graph.plus(new NotifyMyAndroidModule(pluginInfo)));
  49. }
  50. @Override
  51. public void showConfig(final PreferencesDialogModel manager) {
  52. final PreferencesCategory category = new PluginPreferencesCategory(
  53. pluginInfo, "Notify My Android",
  54. "General configuration for Notify My Android plugin.");
  55. category.addSetting(new PreferencesSetting(
  56. PreferencesType.TEXT, pluginInfo.getDomain(), "apikey",
  57. "API Key", "Comma-separated list of NotifyMyAndroid API keys"
  58. + " to be notified when the command is used.",
  59. manager.getConfigManager(), manager.getIdentity()));
  60. category.addSetting(new PreferencesSetting(
  61. PreferencesType.TEXT, pluginInfo.getDomain(), "application",
  62. "Application", "Name of the application to report to "
  63. + "NotifyMyAndroid",
  64. manager.getConfigManager(), manager.getIdentity()));
  65. manager.getCategory("Plugins").addSubCategory(category);
  66. }
  67. }