• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ListenerMethod类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中butterknife.internal.ListenerMethod的典型用法代码示例。如果您正苦于以下问题:Java ListenerMethod类的具体用法?Java ListenerMethod怎么用?Java ListenerMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ListenerMethod类属于butterknife.internal包,在下文中一共展示了ListenerMethod类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getRequiredBindings

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public List<MemberViewBinding> getRequiredBindings() {
  List<MemberViewBinding> requiredBindings = new ArrayList<>();
  if (fieldBinding != null && fieldBinding.isRequired()) {
    requiredBindings.add(fieldBinding);
  }
  for (Map<ListenerMethod, Set<MethodViewBinding>> methodBinding : methodBindings.values()) {
    for (Set<MethodViewBinding> set : methodBinding.values()) {
      for (MethodViewBinding binding : set) {
        if (binding.isRequired()) {
          requiredBindings.add(binding);
        }
      }
    }
  }
  return requiredBindings;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:ViewBinding.java


示例2: addMethodBinding

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public void addMethodBinding(ListenerClass listener, ListenerMethod method,
    MethodViewBinding binding) {
  Map<ListenerMethod, Set<MethodViewBinding>> methods = methodBindings.get(listener);
  Set<MethodViewBinding> set = null;
  if (methods == null) {
    methods = new LinkedHashMap<>();
    methodBindings.put(listener, methods);
  } else {
    set = methods.get(method);
  }
  if (set == null) {
    set = new LinkedHashSet<>();
    methods.put(method, set);
  }
  set.add(binding);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:ViewBinding.java


示例3: getRequiredBindings

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public List<ViewBinding> getRequiredBindings() {
  List<ViewBinding> requiredViewBindings = new ArrayList<>();
  if (fieldBinding != null && fieldBinding.isRequired()) {
    requiredViewBindings.add(fieldBinding);
  }
  for (Map<ListenerMethod, Set<MethodViewBinding>> methodBinding : methodBindings.values()) {
    for (Set<MethodViewBinding> set : methodBinding.values()) {
      for (MethodViewBinding binding : set) {
        if (binding.isRequired()) {
          requiredViewBindings.add(binding);
        }
      }
    }
  }
  return requiredViewBindings;
}
 
开发者ID:hoangkien0705,项目名称:Android-ButterKinfe,代码行数:17,代码来源:ViewBindings.java


示例4: getRequiredBindings

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
/**
 * 过滤出 元素不为 Nullable 的 method or field 的 ViewBinding
 *
 * @return ViewBinding 集合
 */
public List<MemberViewBinding> getRequiredBindings() {
    List<MemberViewBinding> requiredBindings = new ArrayList<>();
    if (fieldBinding != null && fieldBinding.isRequired()) {
        requiredBindings.add(fieldBinding);
    }
    for (Map<ListenerMethod, Set<MethodViewBinding>> methodBinding : methodBindings.values()) {
        for (Set<MethodViewBinding> set : methodBinding.values()) {
            for (MethodViewBinding binding : set) {
                if (binding.isRequired()) {
                    requiredBindings.add(binding);
                }
            }
        }
    }
    return requiredBindings;
}
 
开发者ID:CaMnter,项目名称:AndroidLife,代码行数:22,代码来源:ViewBinding.java


示例5: addMethodBinding

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public void addMethodBinding(ListenerClass listener, ListenerMethod method,
                             MethodViewBinding binding) {
    Map<ListenerMethod, Set<MethodViewBinding>> methods = methodBindings.get(listener);
    Set<MethodViewBinding> set = null;
    if (methods == null) {
        methods = new LinkedHashMap<>();
        methodBindings.put(listener, methods);
    } else {
        set = methods.get(method);
    }
    if (set == null) {
        set = new LinkedHashSet<>();
        methods.put(method, set);
    }
    set.add(binding);
}
 
开发者ID:CaMnter,项目名称:AndroidLife,代码行数:17,代码来源:ViewBinding.java


示例6: addMethod

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
boolean addMethod(
    Id id,
    ListenerClass listener,
    ListenerMethod method,
    MethodViewBinding binding) {
  ViewBinding.Builder viewBinding = getOrCreateViewBindings(id);
  if (viewBinding.hasMethodBinding(listener, method) && !"void".equals(method.returnType())) {
    return false;
  }
  viewBinding.addMethodBinding(listener, method, binding);
  return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:BindingSet.java


示例7: addMethod

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
boolean addMethod(
        Id id,
        ListenerClass listener,
        ListenerMethod method,
        MethodViewBinding binding) {
    ViewBinding.Builder viewBinding = getOrCreateViewBindings(id);
    if (viewBinding.hasMethodBinding(listener, method) && !"void".equals(method.returnType())) {
        return false;
    }
    viewBinding.addMethodBinding(listener, method, binding);
    return true;
}
 
开发者ID:qq542391099,项目名称:butterknife-parent,代码行数:13,代码来源:BindingSet.java


示例8: addMethod

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
boolean addMethod(
    Id id,
    ListenerClass listener,
    ListenerMethod method,
    MethodViewBinding binding) {
  ViewBindings viewBindings = getOrCreateViewBindings(id);
  if (viewBindings.hasMethodBinding(listener, method) && !"void".equals(method.returnType())) {
    return false;
  }
  viewBindings.addMethodBinding(listener, method, binding);
  return true;
}
 
开发者ID:hoangkien0705,项目名称:Android-ButterKinfe,代码行数:13,代码来源:BindingClass.java


示例9: addMethod

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
boolean addMethod(
    Id id,
    ListenerClass listener,
    ListenerMethod method,
    MethodViewBinding binding) {
    ViewBinding.Builder viewBinding = getOrCreateViewBindings(id);
    if (viewBinding.hasMethodBinding(listener, method) &&
        !"void".equals(method.returnType())) {
        return false;
    }
    viewBinding.addMethodBinding(listener, method, binding);
    return true;
}
 
开发者ID:CaMnter,项目名称:AndroidLife,代码行数:14,代码来源:BindingSet.java


示例10: ViewBinding

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
ViewBinding(Id id, Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> methodBindings,
    FieldViewBinding fieldBinding) {
  this.id = id;
  this.methodBindings = methodBindings;
  this.fieldBinding = fieldBinding;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:ViewBinding.java


示例11: getMethodBindings

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> getMethodBindings() {
  return methodBindings;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:ViewBinding.java


示例12: hasMethodBinding

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public boolean hasMethodBinding(ListenerClass listener, ListenerMethod method) {
  Map<ListenerMethod, Set<MethodViewBinding>> methods = methodBindings.get(listener);
  return methods != null && methods.containsKey(method);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:ViewBinding.java


示例13: addFieldAndUnbindStatement

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
private void addFieldAndUnbindStatement(TypeSpec.Builder result, MethodSpec.Builder unbindMethod,
    ViewBinding bindings) {
  // Only add fields to the binding if there are method bindings.
  Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> classMethodBindings =
      bindings.getMethodBindings();
  if (classMethodBindings.isEmpty()) {
    return;
  }

  String fieldName = bindings.isBoundToRoot() ? "viewSource" : "view" + bindings.getId().value;
  result.addField(VIEW, fieldName, PRIVATE);

  // We only need to emit the null check if there are zero required bindings.
  boolean needsNullChecked = bindings.getRequiredBindings().isEmpty();
  if (needsNullChecked) {
    unbindMethod.beginControlFlow("if ($N != null)", fieldName);
  }

  for (ListenerClass listenerClass : classMethodBindings.keySet()) {
    // We need to keep a reference to the listener
    // in case we need to unbind it via a remove method.
    boolean requiresRemoval = !"".equals(listenerClass.remover());
    String listenerField = "null";
    if (requiresRemoval) {
      TypeName listenerClassName = bestGuess(listenerClass.type());
      listenerField = fieldName + ((ClassName) listenerClassName).simpleName();
      result.addField(listenerClassName, listenerField, PRIVATE);
    }

    if (!VIEW_TYPE.equals(listenerClass.targetType())) {
      unbindMethod.addStatement("(($T) $N).$N($N)", bestGuess(listenerClass.targetType()),
          fieldName, removerOrSetter(listenerClass, requiresRemoval), listenerField);
    } else {
      unbindMethod.addStatement("$N.$N($N)", fieldName,
          removerOrSetter(listenerClass, requiresRemoval), listenerField);
    }

    if (requiresRemoval) {
      unbindMethod.addStatement("$N = null", listenerField);
    }
  }

  unbindMethod.addStatement("$N = null", fieldName);

  if (needsNullChecked) {
    unbindMethod.endControlFlow();
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:49,代码来源:BindingSet.java


示例14: addFieldAndUnbindStatement

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
private void addFieldAndUnbindStatement(TypeSpec.Builder result, MethodSpec.Builder unbindMethod,
                                        ViewBinding bindings) {
    // Only add fields to the binding if there are method bindings.
    Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> classMethodBindings =
            bindings.getMethodBindings();
    if (classMethodBindings.isEmpty()) {
        return;
    }

    String fieldName = bindings.isBoundToRoot() ? "viewSource" : "view" + bindings.getId().value;
    result.addField(VIEW, fieldName, PRIVATE);

    // We only need to emit the null check if there are zero required bindings.
    boolean needsNullChecked = bindings.getRequiredBindings().isEmpty();
    if (needsNullChecked) {
        unbindMethod.beginControlFlow("if ($N != null)", fieldName);
    }

    for (ListenerClass listenerClass : classMethodBindings.keySet()) {
        // We need to keep a reference to the listener
        // in case we need to unbind it via a remove method.
        boolean requiresRemoval = !"".equals(listenerClass.remover());
        String listenerField = "null";
        if (requiresRemoval) {
            TypeName listenerClassName = bestGuess(listenerClass.type());
            listenerField = fieldName + ((ClassName) listenerClassName).simpleName();
            result.addField(listenerClassName, listenerField, PRIVATE);
        }

        if (!VIEW_TYPE.equals(listenerClass.targetType())) {
            unbindMethod.addStatement("(($T) $N).$N($N)", bestGuess(listenerClass.targetType()),
                    fieldName, removerOrSetter(listenerClass, requiresRemoval), listenerField);
        } else {
            unbindMethod.addStatement("$N.$N($N)", fieldName,
                    removerOrSetter(listenerClass, requiresRemoval), listenerField);
        }

        if (requiresRemoval) {
            unbindMethod.addStatement("$N = null", listenerField);
        }
    }

    unbindMethod.addStatement("$N = null", fieldName);

    if (needsNullChecked) {
        unbindMethod.endControlFlow();
    }
}
 
开发者ID:qq542391099,项目名称:butterknife-parent,代码行数:49,代码来源:BindingSet.java


示例15: addFieldAndUnbindStatement

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
private void addFieldAndUnbindStatement(TypeSpec.Builder result, MethodSpec.Builder unbindMethod,
    ViewBindings bindings) {
  // Only add fields to the binding if there are method bindings.
  Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> classMethodBindings =
      bindings.getMethodBindings();
  if (classMethodBindings.isEmpty()) {
    return;
  }

  String fieldName = bindings.isBoundToRoot() ? "viewSource" : "view" + bindings.getId().value;
  result.addField(VIEW, fieldName, PRIVATE);

  // We only need to emit the null check if there are zero required bindings.
  boolean needsNullChecked = bindings.getRequiredBindings().isEmpty();
  if (needsNullChecked) {
    unbindMethod.beginControlFlow("if ($N != null)", fieldName);
  }

  for (ListenerClass listenerClass : classMethodBindings.keySet()) {
    // We need to keep a reference to the listener
    // in case we need to unbind it via a remove method.
    boolean requiresRemoval = !"".equals(listenerClass.remover());
    String listenerField = "null";
    if (requiresRemoval) {
      TypeName listenerClassName = bestGuess(listenerClass.type());
      listenerField = fieldName + ((ClassName) listenerClassName).simpleName();
      result.addField(listenerClassName, listenerField, PRIVATE);
    }

    if (!VIEW_TYPE.equals(listenerClass.targetType())) {
      unbindMethod.addStatement("(($T) $N).$N($N)", bestGuess(listenerClass.targetType()),
          fieldName, removerOrSetter(listenerClass, requiresRemoval), listenerField);
    } else {
      unbindMethod.addStatement("$N.$N($N)", fieldName,
          removerOrSetter(listenerClass, requiresRemoval), listenerField);
    }

    if (requiresRemoval) {
      unbindMethod.addStatement("$N = null", listenerField);
    }
  }

  unbindMethod.addStatement("$N = null", fieldName);

  if (needsNullChecked) {
    unbindMethod.endControlFlow();
  }
}
 
开发者ID:hoangkien0705,项目名称:Android-ButterKinfe,代码行数:49,代码来源:BindingClass.java


示例16: ViewBinding

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
ViewBinding(Id id, Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> methodBindings,
            FieldViewBinding fieldBinding) {
    this.id = id;
    this.methodBindings = methodBindings;
    this.fieldBinding = fieldBinding;
}
 
开发者ID:CaMnter,项目名称:AndroidLife,代码行数:7,代码来源:ViewBinding.java


示例17: getMethodBindings

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> getMethodBindings() {
    return methodBindings;
}
 
开发者ID:CaMnter,项目名称:AndroidLife,代码行数:4,代码来源:ViewBinding.java


示例18: hasMethodBinding

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public boolean hasMethodBinding(ListenerClass listener, ListenerMethod method) {
    Map<ListenerMethod, Set<MethodViewBinding>> methods = methodBindings.get(listener);
    return methods != null && methods.containsKey(method);
}
 
开发者ID:CaMnter,项目名称:AndroidLife,代码行数:5,代码来源:ViewBinding.java


示例19: addFieldAndUnbindStatement

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
/**
 * unbind 部分 - method 相关置空
 *
 * @param result TypeSpec.Builder
 * @param unbindMethod MethodSpec.Builder
 * @param bindings ViewBinding
 */
private void addFieldAndUnbindStatement(TypeSpec.Builder result, MethodSpec.Builder unbindMethod,
                                        ViewBinding bindings) {
    // Only add fields to the binding if there are method bindings.
    Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> classMethodBindings =
        bindings.getMethodBindings();
    if (classMethodBindings.isEmpty()) {
        return;
    }

    String fieldName = bindings.isBoundToRoot()
                       ? "viewSource"
                       : "view" + bindings.getId().value;
    result.addField(VIEW, fieldName, PRIVATE);

    // We only need to emit the null check if there are zero required bindings.
    boolean needsNullChecked = bindings.getRequiredBindings().isEmpty();
    if (needsNullChecked) {
        unbindMethod.beginControlFlow("if ($N != null)", fieldName);
    }

    for (ListenerClass listenerClass : classMethodBindings.keySet()) {
        // We need to keep a reference to the listener
        // in case we need to unbind it via a remove method.
        boolean requiresRemoval = !"".equals(listenerClass.remover());
        String listenerField = "null";
        if (requiresRemoval) {
            TypeName listenerClassName = bestGuess(listenerClass.type());
            listenerField = fieldName + ((ClassName) listenerClassName).simpleName();
            result.addField(listenerClassName, listenerField, PRIVATE);
        }

        if (!VIEW_TYPE.equals(listenerClass.targetType())) {
            unbindMethod.addStatement("(($T) $N).$N($N)", bestGuess(listenerClass.targetType()),
                fieldName, removerOrSetter(listenerClass, requiresRemoval), listenerField);
        } else {
            unbindMethod.addStatement("$N.$N($N)", fieldName,
                removerOrSetter(listenerClass, requiresRemoval), listenerField);
        }

        if (requiresRemoval) {
            unbindMethod.addStatement("$N = null", listenerField);
        }
    }

    unbindMethod.addStatement("$N = null", fieldName);

    if (needsNullChecked) {
        unbindMethod.endControlFlow();
    }
}
 
开发者ID:CaMnter,项目名称:AndroidLife,代码行数:58,代码来源:BindingSet.java


示例20: addFieldAndUnbindStatement

import butterknife.internal.ListenerMethod; //导入依赖的package包/类
private void addFieldAndUnbindStatement(TypeSpec.Builder result, MethodSpec.Builder unbindMethod,
    ViewBinding bindings) {
  // Only add fields to the binding if there are method bindings.
  Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> classMethodBindings =
      bindings.getMethodBindings();
  if (classMethodBindings.isEmpty()) {
    return;
  }

  String fieldName =
      bindings.isBoundToRoot()
          ? "viewSource"
          : "view" + Integer.toHexString(bindings.getId().value);
  result.addField(VIEW, fieldName, PRIVATE);

  // We only need to emit the null check if there are zero required bindings.
  boolean needsNullChecked = bindings.getRequiredBindings().isEmpty();
  if (needsNullChecked) {
    unbindMethod.beginControlFlow("if ($N != null)", fieldName);
  }

  for (ListenerClass listenerClass : classMethodBindings.keySet()) {
    // We need to keep a reference to the listener
    // in case we need to unbind it via a remove method.
    boolean requiresRemoval = !"".equals(listenerClass.remover());
    String listenerField = "null";
    if (requiresRemoval) {
      TypeName listenerClassName = bestGuess(listenerClass.type());
      listenerField = fieldName + ((ClassName) listenerClassName).simpleName();
      result.addField(listenerClassName, listenerField, PRIVATE);
    }

    if (!VIEW_TYPE.equals(listenerClass.targetType())) {
      unbindMethod.addStatement("(($T) $N).$N($N)", bestGuess(listenerClass.targetType()),
          fieldName, removerOrSetter(listenerClass, requiresRemoval), listenerField);
    } else {
      unbindMethod.addStatement("$N.$N($N)", fieldName,
          removerOrSetter(listenerClass, requiresRemoval), listenerField);
    }

    if (requiresRemoval) {
      unbindMethod.addStatement("$N = null", listenerField);
    }
  }

  unbindMethod.addStatement("$N = null", fieldName);

  if (needsNullChecked) {
    unbindMethod.endControlFlow();
  }
}
 
开发者ID:JakeWharton,项目名称:butterknife,代码行数:52,代码来源:BindingSet.java



注:本文中的butterknife.internal.ListenerMethod类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Bolt类代码示例发布时间:2022-05-22
下一篇:
Java TileEntityBeacon类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap