コード例 #1
0
 @Override
 public void onClick(@Nonnull IConstant data, @Nonnull Context context) {
   final String text = data.getValue();
   if (!Strings.isEmpty(text)) {
     if (text == null) throw new AssertionError();
     Locator.getInstance().getClipboard().setText(text);
   }
 }
コード例 #2
0
 @Override
 public void onClick(@Nonnull IConstant data, @Nonnull Context context) {
   final String text =
       Locator.getInstance().getEngine().getVarsRegistry().getDescription(data.getName());
   if (!Strings.isEmpty(text)) {
     if (text == null) throw new AssertionError();
     Locator.getInstance().getClipboard().setText(text);
   }
 }
コード例 #3
0
  @Nonnull
  @Override
  protected List<LabeledMenuItem<IConstant>> getMenuItemsOnLongClick(@Nonnull IConstant item) {
    final List<LabeledMenuItem<IConstant>> result =
        new ArrayList<LabeledMenuItem<IConstant>>(Arrays.asList(LongClickMenuItem.values()));

    if (item.isSystem()) {
      result.remove(LongClickMenuItem.edit);
      result.remove(LongClickMenuItem.remove);
    }

    if (Strings.isEmpty(
        Locator.getInstance().getEngine().getVarsRegistry().getDescription(item.getName()))) {
      result.remove(LongClickMenuItem.copy_description);
    }

    if (Strings.isEmpty(item.getValue())) {
      result.remove(LongClickMenuItem.copy_value);
    }

    return result;
  }