mirror of https://github.com/kurisufriend/Clover
parent
62d1f4052d
commit
a2561ff860
@ -0,0 +1,67 @@ |
||||
package org.floens.chan.controller; |
||||
|
||||
import android.view.ViewGroup; |
||||
|
||||
import org.floens.chan.utils.AndroidUtils; |
||||
|
||||
public class ControllerLogic { |
||||
public static void attach(Controller controller, ViewGroup view, boolean over) { |
||||
if (over) { |
||||
view.addView(controller.view, |
||||
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) |
||||
); |
||||
} else { |
||||
view.addView(controller.view, 0, |
||||
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) |
||||
); |
||||
} |
||||
} |
||||
|
||||
public static void detach(Controller controller) { |
||||
AndroidUtils.removeFromParentView(controller.view); |
||||
} |
||||
|
||||
public static void transition(Controller from, Controller to, boolean destroyFrom, boolean createTo, ViewGroup toView, boolean viewOver) { |
||||
if (createTo) { |
||||
to.onCreate(); |
||||
} |
||||
|
||||
attach(to, toView, viewOver); |
||||
to.onShow(); |
||||
|
||||
if (from != null) { |
||||
from.onHide(); |
||||
detach(from); |
||||
|
||||
if (destroyFrom) { |
||||
from.onDestroy(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static void startTransition(Controller from, Controller to, boolean destroyFrom, boolean createTo, ViewGroup toView, boolean viewOver, ControllerTransition transition) { |
||||
transition.destroyFrom = destroyFrom; |
||||
transition.from = from; |
||||
transition.to = to; |
||||
|
||||
if (createTo) { |
||||
to.onCreate(); |
||||
} |
||||
|
||||
attach(to, toView, viewOver); |
||||
to.onShow(); |
||||
|
||||
transition.perform(); |
||||
} |
||||
|
||||
public static void finishTransition(ControllerTransition transition) { |
||||
if (transition.from != null) { |
||||
transition.from.onHide(); |
||||
detach(transition.from); |
||||
|
||||
if (transition.destroyFrom) { |
||||
transition.from.onDestroy(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,17 @@ |
||||
package org.floens.chan.core.model; |
||||
|
||||
public class PostImage { |
||||
public String thumbnailUrl; |
||||
public String imageUrl; |
||||
public String filename; |
||||
public int imageWidth; |
||||
public int imageHeight; |
||||
|
||||
public PostImage(String thumbnailUrl, String imageUrl, String filename, int imageWidth, int imageHeight) { |
||||
this.thumbnailUrl = thumbnailUrl; |
||||
this.imageUrl = imageUrl; |
||||
this.filename = filename; |
||||
this.imageWidth = imageWidth; |
||||
this.imageHeight = imageHeight; |
||||
} |
||||
} |
Loading…
Reference in new issue