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:
parent
54820d20f4
commit
6431f5c22d
2 changed files with 13 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
package com.nutomic.syncthingandroid.util;
|
package com.nutomic.syncthingandroid.util;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
@ -49,11 +50,14 @@ public class ConfigXml {
|
||||||
|
|
||||||
private static final int OPEN_CONFIG_MAX_TRIES = 10;
|
private static final int OPEN_CONFIG_MAX_TRIES = 10;
|
||||||
|
|
||||||
|
private final Context mContext;
|
||||||
|
|
||||||
private File mConfigFile;
|
private File mConfigFile;
|
||||||
|
|
||||||
private Document mConfig;
|
private Document mConfig;
|
||||||
|
|
||||||
public ConfigXml(final Context context) throws OpenConfigException {
|
public ConfigXml(Context context) throws OpenConfigException {
|
||||||
|
mContext = context;
|
||||||
mConfigFile = getConfigFile(context);
|
mConfigFile = getConfigFile(context);
|
||||||
boolean isFirstStart = !mConfigFile.exists();
|
boolean isFirstStart = !mConfigFile.exists();
|
||||||
if (isFirstStart) {
|
if (isFirstStart) {
|
||||||
|
@ -213,7 +217,11 @@ public class ConfigXml {
|
||||||
public void changeDefaultFolder() {
|
public void changeDefaultFolder() {
|
||||||
Element folder = (Element) mConfig.getDocumentElement()
|
Element folder = (Element) mConfig.getDocumentElement()
|
||||||
.getElementsByTagName("folder").item(0);
|
.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
|
folder.setAttribute("path", Environment
|
||||||
.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath());
|
.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath());
|
||||||
folder.setAttribute("ro", "true");
|
folder.setAttribute("ro", "true");
|
||||||
|
|
|
@ -396,6 +396,9 @@ Please report any problems you encounter via Github.</string>
|
||||||
<!-- Toast shown if syncthing failed to create a config -->
|
<!-- 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>
|
<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 -->
|
<!-- RestApi -->
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue