Skip to content

Commit

Permalink
Merge pull request getodk#3628 from andrewsiew2/fix-3618
Browse files Browse the repository at this point in the history
Move .settings file out of Import/Export and rename to Configure via QR Code
  • Loading branch information
seadowg authored Feb 11, 2020
2 parents fbc3d18 + 139f931 commit f16b42a
Show file tree
Hide file tree
Showing 49 changed files with 46 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,9 @@
import org.odk.collect.android.application.Collect;
import org.odk.collect.android.listeners.ActionListener;
import org.odk.collect.android.listeners.PermissionListener;
import org.odk.collect.android.preferences.AdminPreferencesActivity;
import org.odk.collect.android.preferences.AdminSharedPreferences;
import org.odk.collect.android.preferences.GeneralSharedPreferences;
import org.odk.collect.android.preferences.PreferenceSaver;
import org.odk.collect.android.storage.StoragePathProvider;
import org.odk.collect.android.storage.StorageSubdirectory;
import org.odk.collect.android.utilities.CompressionUtils;
import org.odk.collect.android.utilities.FileUtils;
import org.odk.collect.android.utilities.LocaleHelper;
Expand Down Expand Up @@ -305,25 +302,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
startActivity(Intent.createChooser(shareIntent, getString(R.string.share_qrcode)));
}
return true;
case R.id.menu_save_preferences:
File writeDir = new File(new StoragePathProvider().getDirPath(StorageSubdirectory.SETTINGS));
if (!writeDir.exists()) {
if (!writeDir.mkdirs()) {
ToastUtils.showShortToast("Error creating directory "
+ writeDir.getAbsolutePath());
return false;
}
}

File dst = new File(writeDir.getAbsolutePath() + "/collect.settings");
boolean success = AdminPreferencesActivity.saveSharedPreferencesToFile(dst, getActivity());
if (success) {
ToastUtils.showLongToast("Settings successfully written to "
+ dst.getAbsolutePath());
} else {
ToastUtils.showLongToast("Error writing settings to " + dst.getAbsolutePath());
}
return true;
}
return super.onOptionsItemSelected(item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@
import org.odk.collect.android.fragments.ShowQRCodeFragment;
import org.odk.collect.android.fragments.dialogs.MovingBackwardsDialog;
import org.odk.collect.android.fragments.dialogs.SimpleDialog;
import org.odk.collect.android.storage.StoragePathProvider;
import org.odk.collect.android.storage.StorageSubdirectory;
import org.odk.collect.android.utilities.ToastUtils;

import java.io.File;

import static android.content.Context.MODE_PRIVATE;
import static org.odk.collect.android.fragments.dialogs.MovingBackwardsDialog.MOVING_BACKWARDS_DIALOG_TAG;
import static org.odk.collect.android.preferences.AdminKeys.ALLOW_OTHER_WAYS_OF_EDITING_FORM;
Expand Down Expand Up @@ -63,6 +67,7 @@ public void onCreate(final Bundle savedInstanceState) {
findPreference("main_menu").setOnPreferenceClickListener(this);
findPreference("user_settings").setOnPreferenceClickListener(this);
findPreference("form_entry").setOnPreferenceClickListener(this);
findPreference("save_legacy_settings").setOnPreferenceClickListener(this);
}

@Override
Expand Down Expand Up @@ -130,7 +135,25 @@ public void onClick(DialogInterface dialog, int which) {
case KEY_IMPORT_SETTINGS:
fragment = new ShowQRCodeFragment();
break;
case "save_legacy_settings":
File writeDir = new File(new StoragePathProvider().getDirPath(StorageSubdirectory.SETTINGS));
if (!writeDir.exists()) {
if (!writeDir.mkdirs()) {
ToastUtils.showShortToast("Error creating directory "
+ writeDir.getAbsolutePath());
return false;
}
}

File dst = new File(writeDir.getAbsolutePath() + "/collect.settings");
boolean success = AdminPreferencesActivity.saveSharedPreferencesToFile(dst, getActivity());
if (success) {
ToastUtils.showLongToast("Settings successfully written to "
+ dst.getAbsolutePath());
} else {
ToastUtils.showLongToast("Error writing settings to " + dst.getAbsolutePath());
}
return true;
case "main_menu":
fragment = new MainMenuAccessPreferences();
break;
Expand Down
5 changes: 0 additions & 5 deletions collect_app/src/main/res/menu/settings_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,4 @@
android:title="@string/share"
android:icon="@drawable/ic_menu_share"
app:showAsAction="always" />
<item
android:id="@+id/menu_save_preferences"
android:title="@string/save_preferences"
android:icon="@drawable/ic_save"
app:showAsAction="always" />
</menu>
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-af/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@
<string name="enter_admin_password">Voer Admin wagwoord in</string>
<string name="found_in_main">Deselekteer om van Hoofkieslys af te haal</string>
<string name="found_in_settings">Deselekteer om van Algemene Verstellings af te haal</string>
<string name="save_preferences">Stoor Verstellings op Skyf</string>
<string name="form_forward">Volgende</string>
<string name="navigation">Navigasie</string>
<string name="swipe_navigation">Gebruik horisontale swipes</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-am/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@
<string name="change_admin_password">የአስተዳዳሪ የይለፍ ቃል ለውጥ</string>
<string name="found_in_main">ከመደበኛው ምናሌ ለመደበቅ አትምረጥ</string>
<string name="found_in_settings">ከጠቅላላ ቅንብሮች ለመደበቅ አትምረጥ</string>
<string name="save_preferences">ቅንብሮችን ዲስክ ላይ አስቀምጥ</string>
<string name="form_forward">ቀጣይ</string>
<string name="navigation">ዳሰሳ</string>
<string name="swipe_navigation">አግድም ማጠፊያዎችን ይጠቀሙ</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
<string name="autosend">الإرسال التلقائي</string>
<string name="found_in_main">الغاء القفل للاخفاء من القائمة الرئيسية</string>
<string name="found_in_settings">الغاء القفل للاخفاء من الاعدادات الرئيسية</string>
<string name="save_preferences">حفظ الاعدادات في القرص</string>
<string name="form_forward">التالي</string>
<string name="form_backward">رجوع</string>
<string name="navigation">التنقل</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-ca/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@
<string name="change_admin_password">Canviar clau d\'administrador</string>
<string name="found_in_main">Desmarcar per amagar en el Menú Principal</string>
<string name="found_in_settings">Desmarcar per amagar en Configuració General</string>
<string name="save_preferences">Salve Configuració a disc</string>
<string name="form_forward">Següent</string>
<string name="navigation">Navegació</string>
<string name="swipe_navigation">Usar desplaçament horizontal</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@
<string name="autosend">Automatické odeslání</string>
<string name="found_in_main">Zobrazit v Hlavní nabídce</string>
<string name="found_in_settings">Zobrazit v Obecném nastavení</string>
<string name="save_preferences">Uložit nastavení na Disk</string>
<string name="form_forward">Další</string>
<string name="form_backward">Zpět</string>
<string name="navigation">Navigace</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
<string name="autosend">Auto-Send</string>
<string name="found_in_main">Deaktivieren, um aus dem Haupt-Menü auszublenden</string>
<string name="found_in_settings">Deaktivieren, um aus dem Einstellungen-Menü auszublenden</string>
<string name="save_preferences">Einstellungen auf Speicherkarte speichern</string>
<string name="form_forward">Weiter</string>
<string name="form_backward">Zurück</string>
<string name="navigation">Navigation</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@
<string name="autosend">Envío Automático</string>
<string name="found_in_main">Desmarque para ocultar del Menú Principal</string>
<string name="found_in_settings">Desmarque para ocultar de la Configuración General</string>
<string name="save_preferences">Guardar configuración en disco</string>
<string name="form_forward">Sig.</string>
<string name="form_backward">Retroceder</string>
<string name="navigation">Navegación</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-et/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@
<string name="change_admin_password">Muuda administraatori salasõna</string>
<string name="found_in_main">Peamenüüst eemaldamiseks puhasta väli</string>
<string name="found_in_settings">Üldseadetest eemaldamiseks puhasta väli </string>
<string name="save_preferences">Salvesta seaded mäluseadmele</string>
<string name="form_forward">Järgmine</string>
<string name="navigation">Rakenduses liikumine</string>
<string name="swipe_navigation">Liikumiseks kasuta libistamist (swipe) käeliigutust</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@
<string name="admin_password_disabled">پسورد Admin غیر فعال گردید</string>
<string name="admin_password_incorrect">ببخشید، پسورد نادرست است</string>
<string name="autosend">ارسال خودکار</string>
<string name="save_preferences">ذخیره تغییرات روی دیسک</string>
<string name="form_forward">بعدی</string>
<string name="form_backward">قبلی</string>
<string name="navigation">جهت یابی</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-fi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
<string name="autosend">Automaattinen lähetys</string>
<string name="found_in_main">Poista rasti piilottaaksesi päävalikosta</string>
<string name="found_in_settings">Poista rasti piilottaaksesi yleisasetuksista</string>
<string name="save_preferences">Tallenna asetukset</string>
<string name="form_forward">Seuraava</string>
<string name="form_backward">Takaisin</string>
<string name="navigation">Navigointi</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
<string name="autosend">Envoi automatique</string>
<string name="found_in_main">Désélectionner pour cacher sur le menu principal</string>
<string name="found_in_settings">Désélectionner pour cacher dans les Paramètres</string>
<string name="save_preferences">Enregistrer les paramètres sur le disque</string>
<string name="form_forward">Suiv.</string>
<string name="form_backward">Retour</string>
<string name="navigation">Navigation</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@
<string name="autosend">स्वतः भेजें</string>
<string name="found_in_main">मुख्य मेनू से छुपाने के लिए अनचेक करें</string>
<string name="found_in_settings">सामान्य सेटिंग्स से छुपाने के लिए अनचेक करें</string>
<string name="save_preferences">सेटिंग्स डिस्क पर संरक्षित करे</string>
<string name="form_forward">आगामी</string>
<string name="navigation">पथ प्रदर्शन</string>
<string name="swipe_navigation">क्षैतिज स्वाइप प्रयोग करें</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@
<string name="autosend">Kirim otomatis</string>
<string name="found_in_main">Hapus centang untuk menyembunyikan dari Menu Utama</string>
<string name="found_in_settings">Hapus centang untuk menyembunyikan dari Pengaturan Umum</string>
<string name="save_preferences">Simpan Pengaturan ke Disk</string>
<string name="form_forward">Lanjut</string>
<string name="navigation">Navigasi</string>
<string name="swipe_navigation">Gunakan sapuan mendatar</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
<string name="autosend">Invio automatico</string>
<string name="found_in_main">Deseleziona per nascondere dal Menu Principale</string>
<string name="found_in_settings">Deseleziona per nascondere da Impostazioni Generali</string>
<string name="save_preferences">Salvataggio Impostazioni su Disco</string>
<string name="form_forward">Prossimo</string>
<string name="form_backward">Indietro</string>
<string name="navigation">Navigazione</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@
<string name="autosend">自動送信</string>
<string name="found_in_main">チェックを外すとメインメニューから非表示にします</string>
<string name="found_in_settings">チェックを外すと全般設定から非表示にします</string>
<string name="save_preferences">設定をディスクに保存する</string>
<string name="form_forward">次へ</string>
<string name="form_backward">戻る</string>
<string name="navigation">ナビゲーション</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-ka/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@
<string name="change_admin_password">ადმინისტრატორის პაროლის შეცვლა</string>
<string name="found_in_main">გამორთეთ მთავარი მენიუდან დასამალად</string>
<string name="found_in_settings">გამორთეთ ძირითადი პარამეტრებიდან დასამალად</string>
<string name="save_preferences">პარამეტრების დისკზე შენახვა</string>
<string name="form_forward">შემდეგი</string>
<string name="navigation">ნავიგაცია</string>
<string name="swipe_navigation">ჰორიზონტალური გასრიალების გამოყენება</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-km/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@
<string name="autosend">ផ្ញើចេញ​ដោយ​ស្វ័យ​ប្រវត្តិ</string>
<string name="found_in_main">ដោះ​ធីក​ដើម្បី​លាក់ចេញ​ពី​ម៉ឺនុយមេ</string>
<string name="found_in_settings">ដោះធីក​ដើម្បី​លាក់ចេញ​ពីការ​កំណត់ទូទៅ</string>
<string name="save_preferences">រក្សាទុកការកំណត់ទៅកាន់ថាស</string>
<string name="form_forward">បន្ទាប់</string>
<string name="form_backward">ត្រឡប់ក្រោយ</string>
<string name="navigation">ការ​ស្វែង​រកផ្លូវ</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-lo-rLA/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@
<string name="enter_admin_password">ປ້ອນລະຫັດຜ່ານຜູ້ຄວບຄຸມລະບົບ</string>
<string name="found_in_main">ຍົກເລີກການ​ເລືອກ​ ເພື່ອເຊື່ອງຈາກເມນູຫລັກ</string>
<string name="found_in_settings">ຍົກເລີກການ​ເລືອກ​ ເພື່ອເຊື່ອງຈາກການຕັ້ງຄ່າທົ່ວໄປ</string>
<string name="save_preferences">ບັນທຶກການຕັ້ງຄ່າ</string>
<string name="form_forward">ເລື່ອນຕໍ່ໄປ</string>
<string name="navigation">ຄົ້ນຫາ</string>
<string name="swipe_navigation">ໃຊ້ການເລື່ອນໜ້າຈໍໄປທາງຂ້າງ</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-lt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@
<string name="enter_admin_password">Įveskite administratoriaus slaptažodį</string>
<string name="found_in_main">Uncheck to hide from Main Menu</string>
<string name="found_in_settings">Uncheck to hide from General Settings</string>
<string name="save_preferences">Save Settings to Disk</string>
<string name="form_forward">Next</string>
<string name="navigation">Navigation</string>
<string name="swipe_navigation">Use horizontal swipes</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-mr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@
<string name="autosend">स्वयं पाठवा</string>
<string name="found_in_main">मुख्य मेनूमधून लपविण्यासाठी अनचेक करा</string>
<string name="found_in_settings">मुख्य मेनूमधून लपविण्यासाठी अनचेक करा</string>
<string name="save_preferences">डिस्कवर सेटिंग्ज जतन करा</string>
<string name="form_forward">पुढे</string>
<string name="navigation">नेव्हिगेशन</string>
<string name="swipe_navigation">क्षैतिज स्वाइप वापरा</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-my/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@
<string name="enter_admin_password">စီမံခန့္ခြဲမွုလ်ိဳ့၀ွက္နံပါတ္အား ထည့္သြင္းရန္</string>
<string name="found_in_main">Uncheck to hide from Main Menu</string>
<string name="found_in_settings">Uncheck to hide from General Settings</string>
<string name="save_preferences">Save Settings to Disk</string>
<string name="form_forward">Next</string>
<string name="navigation">Navigation</string>
<string name="swipe_navigation">Use horizontal swipes</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-ne-rNP/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@
<string name="autosend">स्वत: प्रेषण</string>
<string name="found_in_main">मूल मेनु मा नदेखाउनको लागि ठिक चिन्ह हटाउनुहोस् </string>
<string name="found_in_settings">जेनेरल सेटिंगमा नदेखाउनको लागि ठीक चिन्ह हटाउनुहोस् </string>
<string name="save_preferences">सेटिङ्सलाई डिस्कमा सेभ गर्नुहोस्</string>
<string name="form_forward">अघि</string>
<string name="form_backward">पछाडि</string>
<string name="navigation">संचालन</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@
<string name="autosend">Automatisch versturen</string>
<string name="found_in_main">Uitvinken om te verbergen in hoofdmenu</string>
<string name="found_in_settings">Uitvinken om te verbergen in algemene instellingen</string>
<string name="save_preferences">Bewaar instellingen op schijf</string>
<string name="form_forward">Verder</string>
<string name="navigation">Navigatie</string>
<string name="swipe_navigation">Horizontaal vegen</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-no/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@
<string name="enter_admin_password">Enter Admin Password</string>
<string name="found_in_main">Uncheck to hide from Main Menu</string>
<string name="found_in_settings">Uncheck to hide from General Settings</string>
<string name="save_preferences">Save Settings to Disk</string>
<string name="form_forward">Next</string>
<string name="navigation">Navigation</string>
<string name="swipe_navigation">Use horizontal swipes</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
<string name="autosend">Automatyczne wysyłanie</string>
<string name="found_in_main">Odznacz aby ukryć w Głównym Menu</string>
<string name="found_in_settings">Odznacz aby ukryć w Ogólnych Ustawieniach</string>
<string name="save_preferences">Zapisz Ustawienia na Dysk</string>
<string name="form_forward">Następny</string>
<string name="form_backward">Powrót</string>
<string name="navigation">Nawigacja</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ Escolher Imagem</string>
<string name="autosend">Enviar automaticamente</string>
<string name="found_in_main">Desmarque para esconder no Menu Principal</string>
<string name="found_in_settings">Desmarque para não exibir nas Configurações Gerais </string>
<string name="save_preferences">Salvar configurações no disco</string>
<string name="form_forward">Próximo</string>
<string name="navigation">Navegação</string>
<string name="swipe_navigation">Use swipes horizontais</string>
Expand Down
1 change: 0 additions & 1 deletion collect_app/src/main/res/values-ro/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@
<string name="change_admin_password">Schimbați parola administratorului</string>
<string name="found_in_main">Deselectați pentru a ascunde din Meniul principal</string>
<string name="found_in_settings">Deselectați pentru a ascunde din Setări generale</string>
<string name="save_preferences">Salvați setările pe disk</string>
<string name="form_forward">Următor</string>
<string name="navigation">Navigare</string>
<string name="swipe_navigation">Utilizați gesturi orizontale</string>
Expand Down
Loading

0 comments on commit f16b42a

Please sign in to comment.