Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

Commit

Permalink
refactored max/min repetitions to receiver constant
Browse files Browse the repository at this point in the history
fixed incorrectly initialized repetition buttons when editing receiver
  • Loading branch information
markusressel committed May 3, 2016
1 parent d62a441 commit 6094027
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void onClick(View v) {

buttonMinus.setEnabled(true);

if (repetitionAmount >= 3) {
if (repetitionAmount >= Receiver.MAX_REPETITIONS) {
buttonPlus.setEnabled(false);
}

Expand All @@ -151,7 +151,7 @@ public void onClick(View v) {

buttonPlus.setEnabled(true);

if (repetitionAmount <= 1) {
if (repetitionAmount <= Receiver.MIN_REPETITIONS) {
buttonMinus.setEnabled(false);
}

Expand Down Expand Up @@ -206,6 +206,13 @@ private void initializeReceiverData(long receiverId) {
Receiver receiver = DatabaseHandler.getReceiver(receiverId);
repetitionAmount = receiver.getRepetitionAmount();
textView_repetitionAmount.setText(String.valueOf(repetitionAmount));
if (repetitionAmount >= Receiver.MAX_REPETITIONS) {
buttonPlus.setEnabled(false);
}
if (repetitionAmount <= Receiver.MIN_REPETITIONS) {
buttonMinus.setEnabled(false);
}


room = DatabaseHandler.getRoom(receiver.getRoomId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ public abstract class Receiver {
}
};

/**
* Maximum value for network signal repetitions
*/
public static final int MAX_REPETITIONS = 3;

/**
* Minimum value for network signal repetitions
*/
public static final int MIN_REPETITIONS = 1;

protected Context context;
/**
* ID of this Receiver
Expand Down

0 comments on commit 6094027

Please sign in to comment.