1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-26 14:21:16 +00:00

Rename "repository" to "repo" in code, missing strings from last commit.

This commit is contained in:
Felix Ableitner 2014-06-25 20:43:43 +02:00
parent c42f8c4ccb
commit f5249f8918
8 changed files with 47 additions and 45 deletions

View file

@ -266,7 +266,7 @@ public class MainActivity extends ActionBarActivity
} }
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.add_repository: case R.id.add_repo:
Intent intent = new Intent(this, RepoSettingsActivity.class); Intent intent = new Intent(this, RepoSettingsActivity.class);
intent.setAction(RepoSettingsActivity.ACTION_CREATE); intent.setAction(RepoSettingsActivity.ACTION_CREATE);
startActivity(intent); startActivity(intent);

View file

@ -37,7 +37,7 @@ public class RepoSettingsActivity extends PreferenceActivity
public static final String ACTION_EDIT = "edit"; public static final String ACTION_EDIT = "edit";
public static final String KEY_REPO_ID = "repository_id"; public static final String KEY_REPO_ID = "repo_id";
private static final String KEY_NODE_SHARED = "node_shared"; private static final String KEY_NODE_SHARED = "node_shared";
@ -56,13 +56,13 @@ public class RepoSettingsActivity extends PreferenceActivity
} }
}; };
private RestApi.Repository mRepo; private RestApi.Repo mRepo;
private EditTextPreference mRepositoryId; private EditTextPreference mRepoId;
private EditTextPreference mDirectory; private EditTextPreference mDirectory;
private CheckBoxPreference mRepositoryMaster; private CheckBoxPreference mRepoMaster;
private PreferenceScreen mNodes; private PreferenceScreen mNodes;
@ -83,12 +83,12 @@ public class RepoSettingsActivity extends PreferenceActivity
addPreferencesFromResource(R.xml.repo_settings_edit); addPreferencesFromResource(R.xml.repo_settings_edit);
} }
mRepositoryId = (EditTextPreference) findPreference("repository_id"); mRepoId = (EditTextPreference) findPreference("repo_id");
mRepositoryId.setOnPreferenceChangeListener(this); mRepoId.setOnPreferenceChangeListener(this);
mDirectory = (EditTextPreference) findPreference("directory"); mDirectory = (EditTextPreference) findPreference("directory");
mDirectory.setOnPreferenceChangeListener(this); mDirectory.setOnPreferenceChangeListener(this);
mRepositoryMaster = (CheckBoxPreference) findPreference("repository_master"); mRepoMaster = (CheckBoxPreference) findPreference("repo_master");
mRepositoryMaster.setOnPreferenceChangeListener(this); mRepoMaster.setOnPreferenceChangeListener(this);
mNodes = (PreferenceScreen) findPreference("nodes"); mNodes = (PreferenceScreen) findPreference("nodes");
mVersioning = (CheckBoxPreference) findPreference("versioning"); mVersioning = (CheckBoxPreference) findPreference("versioning");
mVersioning.setOnPreferenceChangeListener(this); mVersioning.setOnPreferenceChangeListener(this);
@ -112,7 +112,7 @@ public class RepoSettingsActivity extends PreferenceActivity
if (getIntent().getAction().equals(ACTION_CREATE)) { if (getIntent().getAction().equals(ACTION_CREATE)) {
setTitle(R.string.create_repo); setTitle(R.string.create_repo);
mRepo = new RestApi.Repository(); mRepo = new RestApi.Repo();
mRepo.ID = ""; mRepo.ID = "";
mRepo.Directory = ""; mRepo.Directory = "";
mRepo.Nodes = new ArrayList<RestApi.Node>(); mRepo.Nodes = new ArrayList<RestApi.Node>();
@ -120,7 +120,7 @@ public class RepoSettingsActivity extends PreferenceActivity
} }
else if (getIntent().getAction().equals(ACTION_EDIT)) { else if (getIntent().getAction().equals(ACTION_EDIT)) {
setTitle(R.string.edit_repo); setTitle(R.string.edit_repo);
List<RestApi.Repository> repos = mSyncthingService.getApi().getRepos(); List<RestApi.Repo> repos = mSyncthingService.getApi().getRepos();
for (int i = 0; i < repos.size(); i++) { for (int i = 0; i < repos.size(); i++) {
if (repos.get(i).ID.equals(getIntent().getStringExtra(KEY_REPO_ID))) { if (repos.get(i).ID.equals(getIntent().getStringExtra(KEY_REPO_ID))) {
mRepo = repos.get(i); mRepo = repos.get(i);
@ -129,11 +129,11 @@ public class RepoSettingsActivity extends PreferenceActivity
} }
} }
mRepositoryId.setText(mRepo.ID); mRepoId.setText(mRepo.ID);
mRepositoryId.setSummary(mRepo.ID); mRepoId.setSummary(mRepo.ID);
mDirectory.setText(mRepo.Directory); mDirectory.setText(mRepo.Directory);
mDirectory.setSummary(mRepo.Directory); mDirectory.setSummary(mRepo.Directory);
mRepositoryMaster.setChecked(mRepo.ReadOnly); mRepoMaster.setChecked(mRepo.ReadOnly);
List<RestApi.Node> nodesList = mSyncthingService.getApi().getNodes(); List<RestApi.Node> nodesList = mSyncthingService.getApi().getNodes();
for (RestApi.Node n : nodesList) { for (RestApi.Node n : nodesList) {
ExtendedCheckBoxPreference cbp = ExtendedCheckBoxPreference cbp =
@ -204,19 +204,19 @@ public class RepoSettingsActivity extends PreferenceActivity
pref.setSummary((String) o); pref.setSummary((String) o);
} }
if (preference.equals(mRepositoryId)) { if (preference.equals(mRepoId)) {
mRepo.ID = (String) o; mRepo.ID = (String) o;
repositoryUpdated(); repoUpdated();
return true; return true;
} }
else if (preference.equals(mDirectory)) { else if (preference.equals(mDirectory)) {
mRepo.Directory = (String) o; mRepo.Directory = (String) o;
repositoryUpdated(); repoUpdated();
return true; return true;
} }
else if (preference.equals(mRepositoryMaster)) { else if (preference.equals(mRepoMaster)) {
mRepo.ReadOnly = (Boolean) o; mRepo.ReadOnly = (Boolean) o;
repositoryUpdated(); repoUpdated();
return true; return true;
} }
else if (preference.getKey().equals(KEY_NODE_SHARED)) { else if (preference.getKey().equals(KEY_NODE_SHARED)) {
@ -232,7 +232,7 @@ public class RepoSettingsActivity extends PreferenceActivity
} }
} }
} }
repositoryUpdated(); repoUpdated();
return true; return true;
} }
else if (preference.equals(mVersioning)) { else if (preference.equals(mVersioning)) {
@ -247,13 +247,13 @@ public class RepoSettingsActivity extends PreferenceActivity
else { else {
mRepo.Versioning = new RestApi.Versioning(); mRepo.Versioning = new RestApi.Versioning();
} }
repositoryUpdated(); repoUpdated();
return true; return true;
} }
else if (preference.equals(mVersioningKeep)) { else if (preference.equals(mVersioningKeep)) {
((RestApi.SimpleVersioning) mRepo.Versioning) ((RestApi.SimpleVersioning) mRepo.Versioning)
.setParams(Integer.parseInt((String) o)); .setParams(Integer.parseInt((String) o));
repositoryUpdated(); repoUpdated();
return true; return true;
} }
@ -279,7 +279,7 @@ public class RepoSettingsActivity extends PreferenceActivity
return false; return false;
} }
private void repositoryUpdated() { private void repoUpdated() {
if (getIntent().getAction().equals(ACTION_EDIT)) { if (getIntent().getAction().equals(ACTION_EDIT)) {
mSyncthingService.getApi().editRepo(mRepo, false); mSyncthingService.getApi().editRepo(mRepo, false);
} }

View file

@ -59,7 +59,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
public long sys; public long sys;
} }
public static class Repository { public static class Repo {
public String Directory; public String Directory;
public String ID; public String ID;
public String Invalid; public String Invalid;
@ -384,17 +384,17 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
/** /**
* Returns a list of all existing repositores. * Returns a list of all existing repositores.
*/ */
public List<Repository> getRepos() { public List<Repo> getRepos() {
if (mConfig == null) if (mConfig == null)
return new ArrayList<Repository>(); return new ArrayList<Repo>();
List<Repository> ret = null; List<Repo> ret = null;
try { try {
JSONArray repos = mConfig.getJSONArray("Repositories"); JSONArray repos = mConfig.getJSONArray("Repositories");
ret = new ArrayList<Repository>(repos.length()); ret = new ArrayList<Repo>(repos.length());
for (int i = 0; i < repos.length(); i++) { for (int i = 0; i < repos.length(); i++) {
JSONObject json = repos.getJSONObject(i); JSONObject json = repos.getJSONObject(i);
Repository r = new Repository(); Repo r = new Repo();
r.Directory = json.getString("Directory"); r.Directory = json.getString("Directory");
r.ID = json.getString("ID"); r.ID = json.getString("ID");
r.Invalid = json.getString("Invalid"); r.Invalid = json.getString("Invalid");
@ -608,7 +608,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
/** /**
* Updates or creates the given node. * Updates or creates the given node.
*/ */
public void editRepo(Repository repo, boolean create) { public void editRepo(Repo repo, boolean create) {
try { try {
JSONArray repos = mConfig.getJSONArray("Repositories"); JSONArray repos = mConfig.getJSONArray("Repositories");
JSONObject r = null; JSONObject r = null;
@ -656,7 +656,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
/** /**
* Deletes the given repository from syncthing. * Deletes the given repository from syncthing.
*/ */
public void deleteRepo(Repository repo) { public void deleteRepo(Repo repo) {
try { try {
JSONArray repos = mConfig.getJSONArray("Repositories"); JSONArray repos = mConfig.getJSONArray("Repositories");

View file

@ -17,7 +17,7 @@ import java.util.List;
/** /**
* Generates item views for repository items. * Generates item views for repository items.
*/ */
public class ReposAdapter extends ArrayAdapter<RestApi.Repository> public class ReposAdapter extends ArrayAdapter<RestApi.Repo>
implements RestApi.OnReceiveModelListener { implements RestApi.OnReceiveModelListener {
private HashMap<String, RestApi.Model> mModels = new HashMap<String, RestApi.Model>(); private HashMap<String, RestApi.Model> mModels = new HashMap<String, RestApi.Model>();
@ -67,8 +67,8 @@ public class ReposAdapter extends ArrayAdapter<RestApi.Repository>
/** /**
* Replacement for addAll, which is not implemented on lower API levels. * Replacement for addAll, which is not implemented on lower API levels.
*/ */
public void add(List<RestApi.Repository> nodes) { public void add(List<RestApi.Repo> nodes) {
for (RestApi.Repository r : nodes) { for (RestApi.Repo r : nodes) {
add(r); add(r);
} }
} }

View file

@ -10,7 +10,7 @@
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
<item <item
android:id="@+id/add_repository" android:id="@+id/add_repo"
android:title="@string/add_repo" android:title="@string/add_repo"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />

View file

@ -98,6 +98,8 @@
<!-- Setting title --> <!-- Setting title -->
<string name="keep_versions">Keep Versions</string> <string name="keep_versions">Keep Versions</string>
<string name="delete_repo">Delete Repository</string>
<!-- Title for RepoSettingsActivity in create mode --> <!-- Title for RepoSettingsActivity in create mode -->
<string name="create_repo">Create Repository</string> <string name="create_repo">Create Repository</string>

View file

@ -3,7 +3,7 @@
android:persistent="false" > android:persistent="false" >
<EditTextPreference <EditTextPreference
android:key="repository_id" android:key="repo_id"
android:title="@string/repo_id" /> android:title="@string/repo_id" />
<EditTextPreference <EditTextPreference
@ -11,7 +11,7 @@
android:title="@string/directory" /> android:title="@string/directory" />
<CheckBoxPreference <CheckBoxPreference
android:key="repository_master" android:key="repo_master"
android:title="@string/repo_master" /> android:title="@string/repo_master" />
<PreferenceScreen <PreferenceScreen

View file

@ -3,22 +3,22 @@
android:persistent="false" > android:persistent="false" >
<EditTextPreference <EditTextPreference
android:key="repository_id" android:key="repo_id"
android:title="Repository ID" android:title="@string/repo_id"
android:enabled="false" android:enabled="false"
style="?android:preferenceInformationStyle" /> style="?android:preferenceInformationStyle" />
<EditTextPreference <EditTextPreference
android:key="directory" android:key="directory"
android:title="Directory" /> android:title="@string/directory" />
<CheckBoxPreference <CheckBoxPreference
android:key="repository_master" android:key="repo_master"
android:title="Repository Master" /> android:title="@string/repo_master" />
<PreferenceScreen <PreferenceScreen
android:key="nodes" android:key="nodes"
android:title="Nodes" /> android:title="@string/nodes" />
<CheckBoxPreference <CheckBoxPreference
android:key="versioning" android:key="versioning"
@ -26,11 +26,11 @@
<EditTextPreference <EditTextPreference
android:key="versioning_keep" android:key="versioning_keep"
android:title="Keep Versions" android:title="@string/keep_versions"
android:inputType="numberDecimal" /> android:inputType="numberDecimal" />
<Preference <Preference
android:key="delete" android:key="delete"
android:title="Delete Repository" /> android:title="@string/delete_repo" />
</PreferenceScreen> </PreferenceScreen>