当前位置: 首页>>代码示例>>Java>>正文


Java ListenerMethod类代码示例

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


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


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