1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-23 12:51:16 +00:00

Change name of default folder to *device*-photos (fixes #418).

This commit is contained in:
Felix Ableitner 2015-07-07 14:33:09 +02:00
parent 54820d20f4
commit 6431f5c22d
2 changed files with 13 additions and 2 deletions

View file

@ -1,6 +1,7 @@
package com.nutomic.syncthingandroid.util;
import android.content.Context;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
@ -49,11 +50,14 @@ public class ConfigXml {
private static final int OPEN_CONFIG_MAX_TRIES = 10;
private final Context mContext;
private File mConfigFile;
private Document mConfig;
public ConfigXml(final Context context) throws OpenConfigException {
public ConfigXml(Context context) throws OpenConfigException {
mContext = context;
mConfigFile = getConfigFile(context);
boolean isFirstStart = !mConfigFile.exists();
if (isFirstStart) {
@ -213,7 +217,11 @@ public class ConfigXml {
public void changeDefaultFolder() {
Element folder = (Element) mConfig.getDocumentElement()
.getElementsByTagName("folder").item(0);
folder.setAttribute("id", "camera");
String model = Build.MODEL
.replace(" ", "_")
.toLowerCase()
.replaceAll("[^a-z0-9_-]", "");
folder.setAttribute("id", mContext.getString(R.string.default_folder_id, model));
folder.setAttribute("path", Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath());
folder.setAttribute("ro", "true");

View file

@ -396,6 +396,9 @@ Please report any problems you encounter via Github.</string>
<!-- Toast shown if syncthing failed to create a config -->
<string name="config_create_failed">Failed to create a Syncthing config. Please check the logs.</string>
<!-- ID of the default folder created on first start (camera folder). Must only contain 'a-z0-9_-'. Parameter is the device name-->
<string name="default_folder_id">%1$s-photos</string>
<!-- RestApi -->