本文整理汇总了Java中com.arellomobile.mvp.MvpView类的典型用法代码示例。如果您正苦于以下问题:Java MvpView类的具体用法?Java MvpView怎么用?Java MvpView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MvpView类属于com.arellomobile.mvp包,在下文中一共展示了MvpView类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: beforeApply
import com.arellomobile.mvp.MvpView; //导入依赖的package包/类
@Override
public <View extends MvpView> void beforeApply(List<ViewCommand<View>> currentState, ViewCommand<View> incomingCommand) {
Iterator<ViewCommand<View>> iterator = currentState.iterator();
while (iterator.hasNext()) {
ViewCommand<View> entry = iterator.next();
if (entry.getClass() == incomingCommand.getClass()) {
iterator.remove();
break;
}
}
currentState.add(incomingCommand);
}
示例2: shouldExecuteCommandAndRemoveIt
import com.arellomobile.mvp.MvpView; //导入依赖的package包/类
@Test
public void shouldExecuteCommandAndRemoveIt() {
final List<ViewCommand<MvpView>> currentState = new ArrayList<>();
final ViewCommand<MvpView> incomingCommand = mock(ViewCommand.class);
strategy.beforeApply(currentState, incomingCommand);
assertEquals(1, currentState.size());
assertEquals(incomingCommand, currentState.get(0));
strategy.afterApply(currentState, incomingCommand);
assertEquals(0, currentState.size());
}
示例3: getViewClassFromGeneric
import com.arellomobile.mvp.MvpView; //导入依赖的package包/类
private String getViewClassFromGeneric(TypeElement typeElement, DeclaredType declaredType) {
TypeMirror superclass = declaredType;
Map<TypeParameterElement, TypeMirror> mTypedMap = Collections.emptyMap();
if (!typeElement.getTypeParameters().isEmpty()) {
mTypedMap = getChildInstanceOfClassFromGeneric(typeElement, MvpView.class);
}
Map<String, String> parentTypes = Collections.emptyMap();
List<? extends TypeMirror> totalTypeArguments = new ArrayList<>(((DeclaredType) superclass).getTypeArguments());
while (superclass.getKind() != TypeKind.NONE) {
TypeElement superclassElement = (TypeElement) ((DeclaredType) superclass).asElement();
List<? extends TypeMirror> typeArguments = ((DeclaredType) superclass).getTypeArguments();
totalTypeArguments.retainAll(typeArguments);
final List<? extends TypeParameterElement> typeParameters = superclassElement.getTypeParameters();
Map<String, String> types = new HashMap<>();
for (int i = 0; i < typeArguments.size(); i++) {
types.put(typeParameters.get(i).toString(), fillGenerics(parentTypes, typeArguments.get(i)));
}
if (superclassElement.toString().equals(MvpPresenter.class.getCanonicalName())) {
if (!typeArguments.isEmpty()) {
TypeMirror typeMirror = typeArguments.get(0);
if (typeMirror instanceof TypeVariable) {
Element key = ((TypeVariable) typeMirror).asElement();
for (Map.Entry<TypeParameterElement, TypeMirror> entry : mTypedMap.entrySet()) {
if (entry.getKey().toString().equals(key.toString())) {
return Util.getFullClassName(entry.getValue());
}
}
}
}
if (typeArguments.isEmpty() && typeParameters.isEmpty()) {
return ((DeclaredType) superclass).asElement().getSimpleName().toString();
}
// MvpPresenter is typed only on View class
return fillGenerics(parentTypes, typeArguments);
}
parentTypes = types;
superclass = superclassElement.getSuperclass();
}
return "";
}
示例4: afterApply
import com.arellomobile.mvp.MvpView; //导入依赖的package包/类
@Override
public <View extends MvpView> void afterApply(List<ViewCommand<View>> currentState, ViewCommand<View> incomingCommand) {
// pass
}
示例5: beforeApply
import com.arellomobile.mvp.MvpView; //导入依赖的package包/类
@Override
public <View extends MvpView> void beforeApply(List<ViewCommand<View>> currentState, ViewCommand<View> incomingCommand) {
currentState.add(incomingCommand);
}
示例6: beforeApply
import com.arellomobile.mvp.MvpView; //导入依赖的package包/类
@Override
public <View extends MvpView> void beforeApply(List<ViewCommand<View>> currentState, ViewCommand<View> incomingCommand) {
//do nothing to skip
}
示例7: afterApply
import com.arellomobile.mvp.MvpView; //导入依赖的package包/类
@Override
public <View extends MvpView> void afterApply(List<ViewCommand<View>> currentState, ViewCommand<View> incomingCommand) {
currentState.remove(incomingCommand);
}
示例8: beforeApply
import com.arellomobile.mvp.MvpView; //导入依赖的package包/类
@Override
public <View extends MvpView> void beforeApply(List<ViewCommand<View>> currentState, ViewCommand<View> incomingCommand) {
currentState.clear();
currentState.add(incomingCommand);
}
示例9: beforeApply
import com.arellomobile.mvp.MvpView; //导入依赖的package包/类
@Override
public <View extends MvpView> void beforeApply(final List<ViewCommand<View>> currentState,
final ViewCommand<View> incomingCommand) {
currentState.clear();
currentState.add(incomingCommand);
}
示例10: afterApply
import com.arellomobile.mvp.MvpView; //导入依赖的package包/类
@Override
public <View extends MvpView> void afterApply(final List<ViewCommand<View>> currentState,
final ViewCommand<View> incomingCommand) {
currentState.remove(incomingCommand);
}
示例11: beforeApply
import com.arellomobile.mvp.MvpView; //导入依赖的package包/类
/**
* Called immediately after
* {@link com.arellomobile.mvp.viewstate.MvpViewState} receive some
* command. Will not be called before re-apply to some other
* {@link MvpView}
*
* @param currentState current state of
* {@link com.arellomobile.mvp.viewstate.MvpViewState}. Each {@link ViewCommand}
* contains self parameters.
* @param incomingCommand command for apply to {@link MvpView} This
* {@link ViewCommand} contains params of this command.
* @param <View> type of incoming view
*/
<View extends MvpView> void beforeApply(List<ViewCommand<View>> currentState, ViewCommand<View> incomingCommand);
示例12: afterApply
import com.arellomobile.mvp.MvpView; //导入依赖的package包/类
/**
* Called immediately after command applied to {@link MvpView}. Also called
* after re-apply to other views.
*
* @param currentState current state of
* {@link com.arellomobile.mvp.viewstate.MvpViewState}. Each {@link ViewCommand}
* contains self parameters.
* @param incomingCommand applied command to {@link MvpView} This
* {@link ViewCommand} contains params of this command.
* @param <View> type of incoming view
*/
<View extends MvpView> void afterApply(List<ViewCommand<View>> currentState, ViewCommand<View> incomingCommand);