Browse Source

Make result strings be result dynamic

pull/515/head
Phillip Dykman 5 years ago
parent
commit
f9de3b095c
  1. 10
      app/src/main/java/org/transdroid/core/gui/DetailsActivity.java
  2. 6
      app/src/main/res/values-ru/strings.xml
  3. 8
      app/src/main/res/values/strings.xml

10
app/src/main/java/org/transdroid/core/gui/DetailsActivity.java

@ -284,9 +284,12 @@ public class DetailsActivity extends AppCompatActivity implements TorrentTasksEx @@ -284,9 +284,12 @@ public class DetailsActivity extends AppCompatActivity implements TorrentTasksEx
@Override
public void toggleSequentialDownload(Torrent torrent, boolean sequentialState) {
torrent.mimicSequentialDownload(sequentialState);
String onState = getString(R.string.result_togglesequential_onstate);
String offState = getString(R.string.result_togglesequential_offstate);
String stateString = sequentialState ? onState : offState;
DaemonTaskResult result = ToggleSequentialDownloadTask.create(currentConnection, torrent).execute(log);
if (result instanceof DaemonTaskSuccessResult) {
onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_togglesequential));
onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_togglesequential, torrent.getName(), stateString));
} else {
onCommunicationError((DaemonTaskFailureResult) result, false);
}
@ -296,9 +299,12 @@ public class DetailsActivity extends AppCompatActivity implements TorrentTasksEx @@ -296,9 +299,12 @@ public class DetailsActivity extends AppCompatActivity implements TorrentTasksEx
@Override
public void toggleFirstLastPieceDownload(Torrent torrent, boolean firstLastPieceState) {
torrent.mimicFirstLastPieceDownload(firstLastPieceState);
String onState = getString(R.string.result_togglefirstlastpiece_onstate);
String offState = getString(R.string.result_togglefirstlastpiece_offstate);
String stateString = firstLastPieceState ? onState : offState;
DaemonTaskResult result = ToggleFirstLastPieceDownloadTask.create(currentConnection, torrent).execute(log);
if (result instanceof DaemonTaskSuccessResult) {
onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_togglefirstlastpiece));
onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_togglefirstlastpiece, torrent.getName(), stateString));
} else {
onCommunicationError((DaemonTaskFailureResult) result, false);
}

6
app/src/main/res/values-ru/strings.xml

@ -170,6 +170,12 @@ @@ -170,6 +170,12 @@
<string name="result_trackersupdated">Трекеры обновлены</string>
<string name="result_labelset">Метка установлена в \'%1$s\'</string>
<string name="result_labelremoved">Метка удалена</string>
<string name="result_togglesequential">%1$s скачивается %2$s</string>
<string name="result_togglesequential_offstate">последовательно</string>
<string name="result_togglesequential_onstate">обычным образом</string>
<string name="result_togglefirstlastpiece">%1$s имеет %2$s</string>
<string name="result_togglefirstlastpiece_onstate">приоритет первого и последнего куска</string>
<string name="result_togglefirstlastpiece_offstate">обычый приоритет кусков</string>
<string name="result_togglesequential">Изменено последовательное скачивание торрента</string>
<string name="result_togglefirstlastpiece">Изменен приоритет скачивания начала и конца торрента</string>
<string name="result_recheckedstarted">Проверка данных %1$s</string>

8
app/src/main/res/values/strings.xml

@ -178,8 +178,12 @@ @@ -178,8 +178,12 @@
<string name="result_trackersupdated">Trackers updated</string>
<string name="result_labelset">Label set to \'%1$s\'</string>
<string name="result_labelremoved">Label removed</string>
<string name="result_togglesequential">Toggled sequential download mode</string>
<string name="result_togglefirstlastpiece">Toggled first and last piece priority</string>
<string name="result_togglesequential">%1$s is downloading %2$s</string>
<string name="result_togglesequential_offstate">normally</string>
<string name="result_togglesequential_onstate">sequentially</string>
<string name="result_togglefirstlastpiece">%1$s has %2$s</string>
<string name="result_togglefirstlastpiece_onstate">first and last piece priority</string>
<string name="result_togglefirstlastpiece_offstate">normal piece priority</string>
<string name="result_recheckedstarted">Checking %1$s data</string>
<string name="result_locationset">Torrent moved to \'%1$s\'</string>
<string name="result_priotitiesset">File priorities updated</string>

Loading…
Cancel
Save