use of sugar.free.sightremote.utils.FixedSizeProfileBlock in project SightRemote by TebbeUbben.
the class EditBRProfileActivity method onBlockChange.
@Override
public void onBlockChange(FixedSizeProfileBlock changedBlock, int endTime, double amount) {
changedBlock.setAmount(amount);
changedBlock.setEndTime(endTime);
for (FixedSizeProfileBlock block : new ArrayList<>(profileBlocks)) {
if (block == changedBlock)
continue;
if (block.getEndTime() <= changedBlock.getStartTime())
continue;
if (block.getEndTime() <= endTime)
profileBlocks.remove(block);
else if (block.getStartTime() <= endTime)
block.setStartTime(endTime);
}
FixedSizeProfileBlock latest = profileBlocks.get(profileBlocks.size() - 1);
if (latest.getEndTime() < 24 * 60)
profileBlocks.add(new FixedSizeProfileBlock(latest.getEndTime(), 24 * 60, latest.getAmount()));
adapter.notifyDataSetChanged();
}
use of sugar.free.sightremote.utils.FixedSizeProfileBlock in project SightRemote by TebbeUbben.
the class EditBRProfileActivity method onClick.
@Override
public void onClick(int position) {
FixedSizeProfileBlock profileBlock = profileBlocks.get(position);
EditBRBlockDialog.showDialog(this, this, profileBlocks.get(position), position == 23, position != profileBlocks.size() - 1 ? profileBlock.getEndTime() : profileBlock.getStartTime() + 15, minBRAmount, maxBRAmount);
}
Aggregations