-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #299 from novoda/tpbot/save_last_server
Tpbot/save last server
- Loading branch information
Showing
13 changed files
with
143 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
TelepresenceBot/core/src/main/java/com/novoda/tpbot/controls/LastServerPersistence.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.novoda.tpbot.controls; | ||
|
||
public interface LastServerPersistence { | ||
|
||
void saveLastConnectedServer(String serverAddress); | ||
|
||
boolean containsLastConnectedServer(); | ||
|
||
String getLastConnectedServer(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
TelepresenceBot/mobile/src/main/java/com/novoda/tpbot/controls/LastServerPreferences.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.novoda.tpbot.controls; | ||
|
||
import android.content.SharedPreferences; | ||
|
||
public class LastServerPreferences implements LastServerPersistence { | ||
|
||
private static final String KEY_LAST_SERVER = "last_server"; | ||
|
||
private final SharedPreferences preferences; | ||
|
||
public LastServerPreferences(SharedPreferences preferences) { | ||
this.preferences = preferences; | ||
} | ||
|
||
@Override | ||
public void saveLastConnectedServer(String serverAddress) { | ||
preferences.edit() | ||
.putString(KEY_LAST_SERVER, serverAddress) | ||
.apply(); | ||
} | ||
|
||
@Override | ||
public boolean containsLastConnectedServer() { | ||
return preferences.contains(KEY_LAST_SERVER); | ||
} | ||
|
||
@Override | ||
public String getLastConnectedServer() { | ||
return preferences.getString(KEY_LAST_SERVER, ""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
TelepresenceBot/mobile/src/main/res/layout/switchable_server_declaration.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.