use of com.marshalchen.common.uimodule.tileView.layouts.ScalingLayout in project UltimateAndroid by cymcsg.
the class TileManager method clear.
public void clear() {
// suppress and cancel renders
suppressRender();
cancelRender();
// destroy all tiles
for (Tile m : scheduledToRender) {
m.destroy();
}
scheduledToRender.clear();
for (Tile m : alreadyRendered) {
m.destroy();
}
alreadyRendered.clear();
// the above should clear everything, but let's be redundant
for (ScalingLayout tileGroup : tileGroups.values()) {
int totalChildren = tileGroup.getChildCount();
for (int i = 0; i < totalChildren; i++) {
View child = tileGroup.getChildAt(i);
if (child instanceof ImageView) {
ImageView imageView = (ImageView) child;
imageView.setImageBitmap(null);
}
}
tileGroup.removeAllViews();
}
// clear the cache
if (cache != null) {
cache.clear();
}
}
use of com.marshalchen.common.uimodule.tileView.layouts.ScalingLayout in project UltimateAndroid by cymcsg.
the class TileManager method cleanup.
private void cleanup() {
// start with all rendered tiles...
LinkedList<Tile> condemned = new LinkedList<Tile>(alreadyRendered);
// now remove all those that were just qualified
condemned.removeAll(scheduledToRender);
// for whatever's left, destroy and remove from list
for (Tile m : condemned) {
m.destroy();
alreadyRendered.remove(m);
}
// hide all other groups
for (ScalingLayout tileGroup : tileGroups.values()) {
if (currentTileGroup == tileGroup) {
continue;
}
tileGroup.setVisibility(View.GONE);
}
}
use of com.marshalchen.common.uimodule.tileView.layouts.ScalingLayout in project UltimateAndroid by cymcsg.
the class TileManager method getCurrentTileGroup.
private ScalingLayout getCurrentTileGroup() {
// get the registered scale for the active detail level
double levelScale = detailManager.getCurrentDetailLevelScale();
// if a tile group has already been created and registered...
if (tileGroups.containsKey(levelScale)) {
// ... we're done. return cached level.
return tileGroups.get(levelScale);
}
// otherwise create one
ScalingLayout tileGroup = new ScalingLayout(getContext());
// scale it to the inverse of the levels scale (so 0.25 levels are shown at 400%)
tileGroup.setScale(1 / levelScale);
// register it scale (key) for re-use
tileGroups.put(levelScale, tileGroup);
// add it to the view tree
// MATCH_PARENT should work here but doesn't, roll back if reverting to FrameLayout
addView(tileGroup, new LayoutParams(detailManager.getWidth(), detailManager.getHeight()));
// send it off
return tileGroup;
}
Aggregations