mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 11:21:29 +00:00
Set proper default name for local device
This commit is contained in:
parent
1df103cb0f
commit
0539d0b5a0
1 changed files with 18 additions and 0 deletions
|
@ -72,6 +72,7 @@ public class ConfigXml {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFirstStart) {
|
if (isFirstStart) {
|
||||||
|
changeLocalDeviceName();
|
||||||
changeDefaultFolder();
|
changeDefaultFolder();
|
||||||
generateLoginInfo();
|
generateLoginInfo();
|
||||||
}
|
}
|
||||||
|
@ -174,6 +175,23 @@ public class ConfigXml {
|
||||||
.getElementsByTagName("gui").item(0);
|
.getElementsByTagName("gui").item(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set model name as device name for Syncthing.
|
||||||
|
*
|
||||||
|
* We need to iterate through XML nodes manually, as mConfig.getDocumentElement() will also
|
||||||
|
* return nested elements inside folder element.
|
||||||
|
*/
|
||||||
|
private void changeLocalDeviceName() {
|
||||||
|
NodeList childNodes = mConfig.getDocumentElement().getChildNodes();
|
||||||
|
for (int i = 0; i < childNodes.getLength(); i++) {
|
||||||
|
Node node = childNodes.item(i);
|
||||||
|
if (node.getNodeName().equals("device")) {
|
||||||
|
((Element) node).setAttribute("name", Build.MODEL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
saveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change default folder id to camera and path to camera folder path.
|
* Change default folder id to camera and path to camera folder path.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue