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

Commit

Permalink
changed repeatAmoung to repetitionAmount, now represents the real amo…
Browse files Browse the repository at this point in the history
…unt of network signals (n) instead of repeats (n-1)
  • Loading branch information
markusressel committed May 3, 2016
1 parent 16e4e30 commit d62a441
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion Shared/src/main/res/values-de/strings_receiver.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

<string name="button">Button</string>

<string name="repeat_amount">Wiederholungen</string>
<string name="amount_of_repetition_of_network_signals">Anzahl der Signalwiederholungen</string>

<string name="action_not_supported_by_receiver">Der Empfänger unterstützt diese Aktion nicht!</string>
<string name="gateway_not_supported_by_receiver">Der Empfänger unterstützt dieses Gateway nicht!</string>
Expand Down
2 changes: 1 addition & 1 deletion Shared/src/main/res/values/strings_receiver.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

<string name="button">Button</string>

<string name="repeat_amount">Repeat Amount</string>
<string name="amount_of_repetition_of_network_signals">Repetition Amount of Network Signal</string>

<string name="action_not_supported_by_receiver">Action not supported by Receiver!</string>
<string name="gateway_not_supported_by_receiver">Gateway not supported by Receiver!</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private static void executeReceiverAction(@NonNull Context context, @NonNull Rec
if (gateway.isActive()) {
NetworkPackage networkPackage = getNetworkPackage(apartment, gateway, receiver, button);

for (int i = 0; i < receiver.getRepeatAmount() + 1; i++) {
for (int i = 0; i < receiver.getRepetitionAmount(); i++) {
networkPackages.add(networkPackage);
}
}
Expand Down Expand Up @@ -244,7 +244,7 @@ private static void executeRoomAction(@NonNull Context context, @NonNull Room ro
try {
NetworkPackage networkPackage = getNetworkPackage(apartment, gateway, receiver, button);

for (int i = 0; i < receiver.getRepeatAmount() + 1; i++) {
for (int i = 0; i < receiver.getRepetitionAmount(); i++) {
networkPackages.add(networkPackage);
}

Expand Down Expand Up @@ -330,7 +330,7 @@ private static void executeRoomAction(@NonNull Context context, @NonNull Room ro
if (gateway.isActive()) {
try {
NetworkPackage networkPackage = getNetworkPackage(apartment, gateway, receiver, button);
for (int i = 0; i < receiver.getRepeatAmount() + 1; i++) {
for (int i = 0; i < receiver.getRepetitionAmount(); i++) {
networkPackages.add(networkPackage);
}
} catch (ActionNotSupportedException e) {
Expand Down Expand Up @@ -436,7 +436,7 @@ private static void executeScene(@NonNull Context context, @NonNull Scene scene)
if (gateway.isActive()) {
NetworkPackage networkPackage = getNetworkPackage(apartment, gateway, sceneItem.getReceiver(), sceneItem.getActiveButton());

for (int i = 0; i < receiver.getRepeatAmount() + 1; i++) {
for (int i = 0; i < receiver.getRepetitionAmount(); i++) {
networkPackages.add(networkPackage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected static void add(Receiver receiver) throws Exception {
values.put(ReceiverTable.COLUMN_CLASSNAME, receiver.getClass().getName());
values.put(ReceiverTable.COLUMN_TYPE, receiver.getType().toString());
values.put(ReceiverTable.COLUMN_POSITION_IN_ROOM, RoomHandler.get(receiver.getRoomId()).getReceivers().size());
values.put(ReceiverTable.COLUMN_REPEAT_AMOUNT, receiver.getRepeatAmount());
values.put(ReceiverTable.COLUMN_REPETITION_AMOUNT, receiver.getRepetitionAmount());

Long receiverId = DatabaseHandler.database.insert(ReceiverTable.TABLE_NAME, null, values);

Expand Down Expand Up @@ -118,7 +118,7 @@ protected static void update(Receiver receiver) throws Exception {
values.put(ReceiverTable.COLUMN_MODEL, receiver.getModel());
values.put(ReceiverTable.COLUMN_CLASSNAME, receiver.getClass().getName());
values.put(ReceiverTable.COLUMN_TYPE, receiver.getType().toString());
values.put(ReceiverTable.COLUMN_REPEAT_AMOUNT, receiver.getRepeatAmount());
values.put(ReceiverTable.COLUMN_REPETITION_AMOUNT, receiver.getRepetitionAmount());

DatabaseHandler.database.update(ReceiverTable.TABLE_NAME, values,
ReceiverTable.COLUMN_ID + "=" + receiver.getId(), null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static Receiver fromDatabase(Context context, Cursor cursor) throws Excep
break;
}

receiver.setRepeatAmount(repeatAmount);
receiver.setRepetitionAmount(repeatAmount);

receiver.setPositionInRoom(positionInRoom);
receiver.setLastActivatedButtonId(lastActivatedButtonId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public class ReceiverTable {
public static final String COLUMN_ROOM_ID = "room";
public static final String COLUMN_POSITION_IN_ROOM = "positionInRoom";
public static final String COLUMN_LAST_ACTIVATED_BUTTON_ID = "lastActivatedButton";
public static final String COLUMN_REPEAT_AMOUNT = "repeatAmount";
public static final String COLUMN_REPETITION_AMOUNT = "repetitionAmount";

public static final String[] ALL_COLUMNS = {
COLUMN_ID, COLUMN_NAME, COLUMN_MODEL, COLUMN_TYPE, COLUMN_CLASSNAME, COLUMN_ROOM_ID,
COLUMN_POSITION_IN_ROOM, COLUMN_LAST_ACTIVATED_BUTTON_ID, COLUMN_REPEAT_AMOUNT};
COLUMN_POSITION_IN_ROOM, COLUMN_LAST_ACTIVATED_BUTTON_ID, COLUMN_REPETITION_AMOUNT};

//@formatter:off
private static final String TABLE_CREATE = "CREATE TABLE " + TABLE_NAME + "(" +
Expand All @@ -56,7 +56,7 @@ public class ReceiverTable {
COLUMN_ROOM_ID + " integer not null," +
COLUMN_POSITION_IN_ROOM + " integer," +
COLUMN_LAST_ACTIVATED_BUTTON_ID + " integer," +
COLUMN_REPEAT_AMOUNT + " integer not null," +
COLUMN_REPETITION_AMOUNT + " integer not null," +
"FOREIGN KEY(" + COLUMN_ROOM_ID + ") REFERENCES " +
RoomTable.TABLE_NAME + "(" + RoomTable.COLUMN_ID +
")" +
Expand Down Expand Up @@ -119,7 +119,7 @@ public static void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
case 15:
case 16:
case 17:
db.execSQL("ALTER TABLE " + TABLE_NAME + " ADD COLUMN " + COLUMN_REPEAT_AMOUNT + " int not null DEFAULT 0;");
db.execSQL("ALTER TABLE " + TABLE_NAME + " ADD COLUMN " + COLUMN_REPETITION_AMOUNT + " int not null DEFAULT 1;");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@
*/
public class ConfigureReceiverDialogPage4GatewayFragment extends ConfigurationDialogFragment {

public static final String KEY_REPEAT_AMOUNT = "repeatAmount";
public static final String KEY_REPEAT_AMOUNT = "repetitionAmount";
public static final String KEY_ASSOCIATED_GATEWAYS = "associatedGateways";

private View rootView;

private int repeatAmount = 0;
private int repetitionAmount = 0;
private List<Gateway> gateways = new ArrayList<>();

private BroadcastReceiver broadcastReceiver;
private TextView textView_repeatAmount;
private TextView textView_repetitionAmount;
private Button buttonPlus;
private Button buttonMinus;
private LinearLayout linearLayoutOfApartmentGateways;
Expand Down Expand Up @@ -114,48 +114,48 @@ public void onReceive(Context context, Intent intent) {
// ArrayList<Gateway> newGateways = intent.getStringArrayListExtra(AddGatewayDialog.KEY_SSID);
// gateways.addAll(newGateways);
// gatewayInfoRecyclerViewAdapter.notifyDataSetChanged();
sendGatewayDetailsChangedBroadcast(getContext(), repeatAmount, gateways);
sendGatewayDetailsChangedBroadcast(getContext(), repetitionAmount, gateways);
} else if (LocalBroadcastConstants.INTENT_NAME_ROOM_CHANGED.equals(intent.getAction())) {
room = apartment.getRoom(intent.getStringExtra(ConfigureReceiverDialogPage1NameFragment.KEY_ROOM_NAME));
updateGatewayViews();
}
}
};

textView_repeatAmount = (TextView) rootView.findViewById(R.id.textView_repeatAmount);
textView_repeatAmount.setText(String.valueOf(repeatAmount));
textView_repetitionAmount = (TextView) rootView.findViewById(R.id.textView_repeatAmount);
textView_repetitionAmount.setText(String.valueOf(repetitionAmount));

buttonPlus = (Button) rootView.findViewById(R.id.button_plus);
buttonPlus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
repeatAmount++;
textView_repeatAmount.setText(String.valueOf(repeatAmount));
repetitionAmount++;
textView_repetitionAmount.setText(String.valueOf(repetitionAmount));

buttonMinus.setEnabled(true);

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

sendGatewayDetailsChangedBroadcast(getContext(), repeatAmount, getCheckedGateways());
sendGatewayDetailsChangedBroadcast(getContext(), repetitionAmount, getCheckedGateways());
}
});

buttonMinus = (Button) rootView.findViewById(R.id.button_minus);
buttonMinus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
repeatAmount--;
textView_repeatAmount.setText(String.valueOf(repeatAmount));
repetitionAmount--;
textView_repetitionAmount.setText(String.valueOf(repetitionAmount));

buttonPlus.setEnabled(true);

if (repeatAmount <= 0) {
if (repetitionAmount <= 1) {
buttonMinus.setEnabled(false);
}

sendGatewayDetailsChangedBroadcast(getContext(), repeatAmount, getCheckedGateways());
sendGatewayDetailsChangedBroadcast(getContext(), repetitionAmount, getCheckedGateways());
}
});

Expand All @@ -165,7 +165,7 @@ public void onClick(View v) {
public void onCheckedChangedByUser(CompoundButton buttonView, boolean isChecked) {
updateCustomGatewaySelectionVisibility();

sendGatewayDetailsChangedBroadcast(getContext(), repeatAmount, getCheckedGateways());
sendGatewayDetailsChangedBroadcast(getContext(), repetitionAmount, getCheckedGateways());
}
};
checkBoxUseCustomGatewaySelection.setOnCheckedChangeListener(checkBoxInteractionListener);
Expand Down Expand Up @@ -204,8 +204,8 @@ public void onCheckedChangedByUser(CompoundButton buttonView, boolean isChecked)
private void initializeReceiverData(long receiverId) {
try {
Receiver receiver = DatabaseHandler.getReceiver(receiverId);
repeatAmount = receiver.getRepeatAmount();
textView_repeatAmount.setText(String.valueOf(repeatAmount));
repetitionAmount = receiver.getRepetitionAmount();
textView_repetitionAmount.setText(String.valueOf(repetitionAmount));

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

Expand Down Expand Up @@ -258,7 +258,7 @@ private void updateGatewayViews() {
CheckBoxInteractionListener checkBoxInteractionListener = new CheckBoxInteractionListener() {
@Override
public void onCheckedChangedByUser(CompoundButton buttonView, boolean isChecked) {
sendGatewayDetailsChangedBroadcast(getContext(), repeatAmount, getCheckedGateways());
sendGatewayDetailsChangedBroadcast(getContext(), repetitionAmount, getCheckedGateways());
}
};
checkBox.setOnTouchListener(checkBoxInteractionListener);
Expand All @@ -278,7 +278,7 @@ public void onClick(View v) {

updateCustomGatewaySelectionVisibility();

sendGatewayDetailsChangedBroadcast(getContext(), repeatAmount, getCheckedGateways());
sendGatewayDetailsChangedBroadcast(getContext(), repetitionAmount, getCheckedGateways());
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class ConfigureReceiverDialogPage5TabbedSummaryFragment extends Configura
private int currentSlave;
private long currentSeed;
private List<UniversalButton> currentUniversalButtons = new ArrayList<>();
private int currentRepeatAmount;
private int currentRepetitionAmount;
private List<Gateway> currentAssociatedGateways = new ArrayList<>();

private BroadcastReceiver broadcastReceiver;
Expand Down Expand Up @@ -150,7 +150,7 @@ public void onReceive(Context context, Intent intent) {
int repeatAmount = intent.getIntExtra(ConfigureReceiverDialogPage4GatewayFragment.KEY_REPEAT_AMOUNT, 0);
ArrayList<Gateway> associatedGateways = (ArrayList<Gateway>) intent.getSerializableExtra(ConfigureReceiverDialogPage4GatewayFragment.KEY_ASSOCIATED_GATEWAYS);

currentRepeatAmount = repeatAmount;
currentRepetitionAmount = repeatAmount;
currentAssociatedGateways = associatedGateways;
}

Expand Down Expand Up @@ -396,7 +396,7 @@ public void saveCurrentConfigurationToDatabase() throws Exception {
break;
}

receiver.setRepeatAmount(currentRepeatAmount);
receiver.setRepetitionAmount(currentRepetitionAmount);


if (currentId == -1) {
Expand Down
20 changes: 10 additions & 10 deletions Smartphone/src/main/java/eu/power_switch/obj/receiver/Receiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ public abstract class Receiver {
protected Long lastActivatedButtonId = (long) -1;

/**
* Amount of repeats for sending Network Signals
* Amount of repetitions for sending Network Signals
*/
protected int repeatAmount;
protected int repetitionAmount;

/**
* List of Gateways this Receiver is associated with
Expand Down Expand Up @@ -325,21 +325,21 @@ public void setLastActivatedButtonId(Long lastActivatedButtonId) {
}

/**
* Get amount of repeats for sending network signals
* Get amount of repetitions for sending network signals
*
* @return amount of repeats
* @return amount of repetitions
*/
public int getRepeatAmount() {
return repeatAmount;
public int getRepetitionAmount() {
return repetitionAmount;
}

/**
* Set amount of repeats for sending network signals
* Set amount of repetitions for sending network signals
*
* @param repeatAmount amount of repeats
* @param repetitionAmount amount of repetitions
*/
public void setRepeatAmount(int repeatAmount) {
this.repeatAmount = repeatAmount;
public void setRepetitionAmount(int repetitionAmount) {
this.repetitionAmount = repetitionAmount;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
android:layout_marginTop="@dimen/title_margin_top"
android:gravity="bottom"
android:paddingLeft="@dimen/dialog_horizontal_margin"
android:text="@string/repeat_amount"/>
android:text="@string/amount_of_repetition_of_network_signals"/>

<LinearLayout
android:layout_width="wrap_content"
Expand Down

0 comments on commit d62a441

Please sign in to comment.