Add new setting to freeze orientation on startup rather than switch between landscape orientations

This commit is contained in:
Sean Owen 2014-03-15 10:44:15 -07:00
parent c5837ebe81
commit b27b6c3d55
35 changed files with 64 additions and 10 deletions

View file

@ -59,7 +59,6 @@
android:screenOrientation="sensorLandscape"
android:clearTaskOnLaunch="true"
android:stateNotNeeded="true"
android:configChanges="orientation|screenSize|keyboardHidden"
android:theme="@style/CaptureTheme"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
@ -124,8 +123,7 @@
<activity android:name=".book.SearchBookContentsActivity"
android:label="@string/sbc_name"
android:stateNotNeeded="true"
android:screenOrientation="sensorLandscape"
android:configChanges="orientation|keyboardHidden">
android:screenOrientation="sensorLandscape">
<intent-filter>
<action android:name="com.google.zxing.client.android.SEARCH_BOOK_CONTENTS"/>
<category android:name="android.intent.category.DEFAULT"/>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">مسح الباركود لأبيض على خلفية سوداء. لا تتوفر على بعض الأجهزة.</string>
<string name="preferences_invert_scan_title">عكس المسح الضوئي</string>
<string name="preferences_name">إعدادات</string>
<string name="preferences_orientation_title">أي التناوب التلقائي</string>
<string name="preferences_play_beep_title">صوت تنبيه</string>
<string name="preferences_remember_duplicates_summary">بفحص مخزن متعددة من نفس الباركود في التاريخ</string>
<string name="preferences_remember_duplicates_title">تذكر التكرارات</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Сканиране за бели баркодове на черен фон. Не е на разположение на някои устройства.</string>
<string name="preferences_invert_scan_title">Обръщане на сканиране</string>
<string name="preferences_name">Настройки</string>
<string name="preferences_orientation_title">Без автоматично завъртане</string>
<string name="preferences_play_beep_title">Издаване на звук</string>
<string name="preferences_remember_duplicates_summary">Записвай множество сканирания на един и същи баркод в историята</string>
<string name="preferences_remember_duplicates_title">Запомняне на повторенията</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Escanejar codis de barres blanques sobre fons negre. No disponible en alguns dispositius.</string>
<string name="preferences_invert_scan_title">Invertir exploració</string>
<string name="preferences_name">Configuració</string>
<string name="preferences_orientation_title">No hi ha rotació automàtica</string>
<string name="preferences_play_beep_title">Beep</string>
<string name="preferences_remember_duplicates_summary">Desa diversos escanejos del mateix codi de barres a l\'historial</string>
<string name="preferences_remember_duplicates_title">Recorda els duplicats</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Skenování čárových kódů pro bílé na černém pozadí. Není k dispozici v některých zařízeních.</string>
<string name="preferences_invert_scan_title">Obrátit skenování</string>
<string name="preferences_name">Nastavení</string>
<string name="preferences_orientation_title">Žádné automatické otáčení</string>
<string name="preferences_play_beep_title">Zvuky</string>
<string name="preferences_remember_duplicates_summary">Duplikáty čárových kódú v historii ukládat samostatně, nebo jako jeden čárový kód</string>
<string name="preferences_remember_duplicates_title">Pamatovat všechny duplikáty</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Scan for hvide stregkoder på sort baggrund. Ikke tilgængelig på nogle enheder.</string>
<string name="preferences_invert_scan_title">Inverter scanning</string>
<string name="preferences_name">Indstillinger</string>
<string name="preferences_orientation_title">Ingen automatisk rotation</string>
<string name="preferences_play_beep_title">Bip</string>
<string name="preferences_remember_duplicates_summary">Gem flere scanninger af de samme stregkoder i Historik</string>
<string name="preferences_remember_duplicates_title">Husk dubletter</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Für weiße Barcodes auf schwarzem Hintergrund. Nicht bei allen Geräten verfügbar.</string>
<string name="preferences_invert_scan_title">Negativ-Scan</string>
<string name="preferences_name">Einstellungen</string>
<string name="preferences_orientation_title">Nicht automatisch drehen</string>
<string name="preferences_play_beep_title">Piepsen</string>
<string name="preferences_remember_duplicates_summary">Speichern mehrerer Scans des gleichen Barcodes im Verlauf</string>
<string name="preferences_remember_duplicates_title">Duplikate speichern</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Σάρωση για τη λευκή barcodes σε μαύρο φόντο. Δεν διατίθεται σε ορισμένες συσκευές.</string>
<string name="preferences_invert_scan_title">Αντιστροφή της σάρωσης</string>
<string name="preferences_name">Ρυθμίσεις</string>
<string name="preferences_orientation_title">Όχι αυτόματη περιστροφή</string>
<string name="preferences_play_beep_title">Μπιπ</string>
<string name="preferences_remember_duplicates_summary">Αποθήκευση πολλαπλών σκαναρισμάτων του ίδιου barcode στο ιστορικό</string>
<string name="preferences_remember_duplicates_title">Απομνημόνευση διπλότυπων</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Escanear códigos de barras blancas sobre fondo negro. No disponible en algunos dispositivos.</string>
<string name="preferences_invert_scan_title">Invertir exploración</string>
<string name="preferences_name">Configuración</string>
<string name="preferences_orientation_title">Sin rotación automática</string>
<string name="preferences_play_beep_title">Bip</string>
<string name="preferences_remember_duplicates_summary">Almacenar múltiples escáneres del mismo código de barras en el Historial.</string>
<string name="preferences_remember_duplicates_title">Recuerde duplicados</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Atzeko plano beltzean kodeak zuri eskaneatzeko. Zenbait gailuk ez dago eskuragarri.</string>
<string name="preferences_invert_scan_title">Alderantzikatu eskaneatzeko</string>
<string name="preferences_name">Ezarpenak</string>
<string name="preferences_orientation_title">Biraketa No automatikoa</string>
<string name="preferences_play_beep_title">Soinu-seinalea</string>
<string name="preferences_remember_duplicates_summary">Gorde barra-kode beraren hainbat eskaneatze Historian</string>
<string name="preferences_remember_duplicates_title">Gogoratu errepikatuak</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Etsi valkoisia viivakoodeja mustalla taustalla. Ei toimi kaikilla laitteilla.</string>
<string name="preferences_invert_scan_title">Käänteinen (negatiivin) skannaus</string>
<string name="preferences_name">Asetukset</string>
<string name="preferences_orientation_title">Ei automaattista kiertoa</string>
<string name="preferences_play_beep_title">Piippaus</string>
<string name="preferences_remember_duplicates_summary">Jos sama viivakoodi skannetaan useasti, tallenna jokainen skannauskerta historiaan</string>
<string name="preferences_remember_duplicates_title">Muista kaksoiskappaleet</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Scanner des codes-barres blancs sur fond noir. Pas disponible sur certains appareils.</string>
<string name="preferences_invert_scan_title">Scan négatif</string>
<string name="preferences_name">Paramètres</string>
<string name="preferences_orientation_title">Pas de rotation automatique</string>
<string name="preferences_play_beep_title">Bip</string>
<string name="preferences_remember_duplicates_summary">Enregistrer dans l\'historique les lectures multiples d\'un même code-barres</string>
<string name="preferences_remember_duplicates_title">Enregistrer les doublons</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">סרוק ברקודים לבן על רקע שחור. לא זמין על התקנים מסוימים.</string>
<string name="preferences_invert_scan_title">היפוך לסרוק</string>
<string name="preferences_name">הגדרות</string>
<string name="preferences_orientation_title">סיבוב לא אוטומטי</string>
<string name="preferences_play_beep_title">צפצוף</string>
<string name="preferences_remember_duplicates_summary">אחסן מספר סריקות של אותו הברקוד בהיסטוריה</string>
<string name="preferences_remember_duplicates_title">זכור כפילויות</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">काली पृष्ठभूमि पर सफेद बारकोड के लिए स्कैन करें. कुछ उपकरणों पर उपलब्ध नहीं है.</string>
<string name="preferences_invert_scan_title">स्कैन उलटें</string>
<string name="preferences_name">सेटिंग्स</string>
<string name="preferences_orientation_title">कोई स्वचालित रोटेशन</string>
<string name="preferences_play_beep_title">भोंपू</string>
<string name="preferences_remember_duplicates_summary">इतिहास में एक ही बारकोड के स्टोर एकाधिक स्कैन</string>
<string name="preferences_remember_duplicates_title">डुप्लिकेट याद रखें</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Scan fehér vonalkódok a fekete háttér. Nem csak egyes eszközöket.</string>
<string name="preferences_invert_scan_title">Invert szkennelés</string>
<string name="preferences_name">Beállítások</string>
<string name="preferences_orientation_title">Nincs automatikus forgatás</string>
<string name="preferences_play_beep_title">Sípolás</string>
<string name="preferences_remember_duplicates_summary">Ugyanannak a vonalkódnak több szkennelt képét is tárolja az Előzményekben</string>
<string name="preferences_remember_duplicates_title">Duplikációk megjegyzése</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Memindai barcode putih pada latar belakang hitam. Tidak tersedia pada beberapa perangkat.</string>
<string name="preferences_invert_scan_title">Balikkan memindai</string>
<string name="preferences_name">Pengaturan</string>
<string name="preferences_orientation_title">Tidak ada rotasi otomatis</string>
<string name="preferences_play_beep_title">Beep</string>
<string name="preferences_remember_duplicates_summary">Simpan beberapa pindaian dari barcode yang sama di dalam Riwayat</string>
<string name="preferences_remember_duplicates_title">Ingat duplikasi</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Scansione dei codici a barre bianche su sfondo nero. Non disponibile su alcuni dispositivi.</string>
<string name="preferences_invert_scan_title">Invertire la scansione</string>
<string name="preferences_name">Impostazioni</string>
<string name="preferences_orientation_title">Nessuna rotazione automatica</string>
<string name="preferences_play_beep_title">Suona</string>
<string name="preferences_remember_duplicates_summary">Mantieni scansioni multiple del codice a barre nella stessa Cronologia</string>
<string name="preferences_remember_duplicates_title">Ricorda duplicati</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">黒地に白のバーコードをスキャン。一部のデバイスでは使用できません。</string>
<string name="preferences_invert_scan_title">スキャンを反転</string>
<string name="preferences_name">設定</string>
<string name="preferences_orientation_title">自動回転しない</string>
<string name="preferences_play_beep_title">通知音</string>
<string name="preferences_remember_duplicates_summary">同じ内容でも重複して履歴に記録します</string>
<string name="preferences_remember_duplicates_title">重複するスキャン結果の記録</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">검정 바탕에 흰색 바코드에 대한 스캔. 일부 장치에서 사용할 수 없습니다.</string>
<string name="preferences_invert_scan_title">스캔 반전</string>
<string name="preferences_name">설정</string>
<string name="preferences_orientation_title">아무도 자동 회전 없습니다</string>
<string name="preferences_play_beep_title">전자음</string>
<string name="preferences_remember_duplicates_summary">복수의 같은 바코드를 기록에 저장</string>
<string name="preferences_remember_duplicates_title">중복된 바코드 저장</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Scan naar witte barcodes op een zwarte achtergrond. Niet beschikbaar op sommige apparaten.</string>
<string name="preferences_invert_scan_title">Scan omkeren</string>
<string name="preferences_name">Instellingen</string>
<string name="preferences_orientation_title">Niet automatisch draaien</string>
<string name="preferences_play_beep_title">Piepen</string>
<string name="preferences_remember_duplicates_summary">Meerdere scans van dezelfde barcode opslaan in de geschiedenis</string>
<string name="preferences_remember_duplicates_title">Dubbele onthouden</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Skanowanie białych kodów kreskowych na czarnym tle. Nie dostępne w niektórych urządzeniach.</string>
<string name="preferences_invert_scan_title">Odwróć skanowania</string>
<string name="preferences_name">Ustawienia</string>
<string name="preferences_orientation_title">Brak automatycznego obracania</string>
<string name="preferences_play_beep_title">Piszcz</string>
<string name="preferences_remember_duplicates_summary">Przechowuj zaskanowane kody w tej samej historii</string>
<string name="preferences_remember_duplicates_title">Pamiętaj, duplikaty</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Procurar por códigos de barras brancos em fundo preto. Não disponível em certos dispositivos.</string>
<string name="preferences_invert_scan_title">Inverter leitura</string>
<string name="preferences_name">Definições</string>
<string name="preferences_orientation_title">Sem rotação automática</string>
<string name="preferences_play_beep_title">Apitar</string>
<string name="preferences_remember_duplicates_summary">Guardar pesquisas múltiplas do mesmo código de barras no histórico</string>
<string name="preferences_remember_duplicates_title">Lembrar duplicados</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Scanează coduri de bară albe pe fundal negru. Indisponibil pe unele aparate.</string>
<string name="preferences_invert_scan_title">Scanare în negativ</string>
<string name="preferences_name">Configurări</string>
<string name="preferences_orientation_title">Fără rotire automată</string>
<string name="preferences_play_beep_title">Sună</string>
<string name="preferences_remember_duplicates_summary">Înregistrează în Istoric, scanări multiple ale aceluiași cod de bare</string>
<string name="preferences_remember_duplicates_title">Reține scanările duplicat</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Сканирование белых штрих-кодов на черном фоне. Не работает на некоторых устройствах.</string>
<string name="preferences_invert_scan_title">Инвертировать</string>
<string name="preferences_name">Настройки</string>
<string name="preferences_orientation_title">Нет автоматического поворота</string>
<string name="preferences_play_beep_title">Пищать</string>
<string name="preferences_remember_duplicates_summary">Сохранять в истории результат сканирования одного и того же штрих-кода</string>
<string name="preferences_remember_duplicates_title">Запоминать дубликаты</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Skenovať biele čiarové kódy na čiernom pozadí. Nie je k dispozícii na všetkých zariadeniach.</string>
<string name="preferences_invert_scan_title">Invertované skenovanie</string>
<string name="preferences_name">Nastavenia</string>
<string name="preferences_orientation_title">Neotáčať automaticky</string>
<string name="preferences_play_beep_title">Zvuková signalizácia</string>
<string name="preferences_remember_duplicates_summary">Uložiť viacnásobné skenovanie do jednej histórie čiarového kódu</string>
<string name="preferences_remember_duplicates_title">Zapamätať si duplikáty</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Scan za beli črtne kode na črni podlagi. Ni na voljo na nekaterih napravah.</string>
<string name="preferences_invert_scan_title">Obrni skeniranje</string>
<string name="preferences_name">Nastavitve</string>
<string name="preferences_orientation_title">Št avtomatsko rotacijo</string>
<string name="preferences_play_beep_title">Pisk</string>
<string name="preferences_remember_duplicates_summary">Shranjevanje več skandiranje iste črtne kode v zgodovini</string>
<string name="preferences_remember_duplicates_title">Zapomni si dvojnikov</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Skanna in vita streckkoder mot svart bakgrund. Ej tillgängligt på vissa enheter. </string>
<string name="preferences_invert_scan_title">Invertera inskanning</string>
<string name="preferences_name">Inställningar</string>
<string name="preferences_orientation_title">Ingen automatisk rotering</string>
<string name="preferences_play_beep_title">Ton</string>
<string name="preferences_remember_duplicates_summary">Lagra flera inskanningar av samma streckkod i historik</string>
<string name="preferences_remember_duplicates_title">Kom ihåg dubletter</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Siyah zemin üzerine beyaz barkod tarama. Bazı cihazlar mevcut değildir.</string>
<string name="preferences_invert_scan_title">Tarama haricindekileri</string>
<string name="preferences_name">Ayarlar</string>
<string name="preferences_orientation_title">Otomatik rotasyon yok</string>
<string name="preferences_play_beep_title">Bip</string>
<string name="preferences_remember_duplicates_summary">Aynı barkoda ait farklı taramaları kayıtlarda depola</string>
<string name="preferences_remember_duplicates_title">Aynı barkodları hatırla</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">Сканування білих штрих-кодів на чорному фоні. Не працює на деяких пристроях.</string>
<string name="preferences_invert_scan_title">Інвертувати</string>
<string name="preferences_name">Налаштування</string>
<string name="preferences_orientation_title">Немає автоматичного повороту</string>
<string name="preferences_play_beep_title">Пищати</string>
<string name="preferences_remember_duplicates_summary">Зберігати результати сканування однакових штрих-кодів</string>
<string name="preferences_remember_duplicates_title">Запом\'ятовувати дублікати</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">黑色背景上的白色条形码扫描。在某些设备上。</string>
<string name="preferences_invert_scan_title">反向扫描</string>
<string name="preferences_name">设置</string>
<string name="preferences_orientation_title">没有自动旋转</string>
<string name="preferences_play_beep_title">提示音</string>
<string name="preferences_remember_duplicates_summary">在历史记录中保存重复记录</string>
<string name="preferences_remember_duplicates_title">记住重复</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_summary">掃描黑底白字的條碼(某些設備上無法使用)</string>
<string name="preferences_invert_scan_title">黑底白字掃描</string>
<string name="preferences_name">設定</string>
<string name="preferences_orientation_title">沒有自動旋轉</string>
<string name="preferences_play_beep_title">嗶一聲</string>
<string name="preferences_remember_duplicates_summary">在記錄中重複儲存相同的條碼</string>
<string name="preferences_remember_duplicates_title">記錄重複的條碼</string>

View file

@ -114,6 +114,7 @@
<string name="preferences_invert_scan_title">Invert scan</string>
<string name="preferences_invert_scan_summary">Scan for white barcodes on black background. Not available on some devices.</string>
<string name="preferences_name">Settings</string>
<string name="preferences_orientation_title">No automatic rotation</string>
<string name="preferences_play_beep_title">Beep</string>
<string name="preferences_remember_duplicates_summary">Store multiple scans of the same barcode in History</string>
<string name="preferences_remember_duplicates_title">Remember duplicates</string>

View file

@ -65,12 +65,6 @@
android:title="@string/preferences_supplemental_title"
android:summary="@string/preferences_supplemental_summary"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences_result_title">
<EditTextPreference
android:key="preferences_custom_product_search"
android:title="@string/preferences_custom_product_search_title"
android:summary="@string/preferences_custom_product_search_summary"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences_general_title">
<ListPreference
android:entries="@array/preferences_front_light_options"
@ -93,6 +87,16 @@
android:defaultValue="false"
android:title="@string/preferences_bulk_mode_title"
android:summary="@string/preferences_bulk_mode_summary"/>
<CheckBoxPreference
android:key="preferences_orientation"
android:defaultValue="true"
android:title="@string/preferences_orientation_title"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences_result_title">
<EditTextPreference
android:key="preferences_custom_product_search"
android:title="@string/preferences_custom_product_search_title"
android:summary="@string/preferences_custom_product_search_summary"/>
<ListPreference
android:key="preferences_search_country"
android:defaultValue="-"

View file

@ -36,6 +36,7 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@ -51,6 +52,7 @@ import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
@ -162,6 +164,14 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
handler = null;
lastResult = null;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (prefs.getBoolean(PreferencesActivity.KEY_DISABLE_AUTO_ORIENTATION, true)) {
setRequestedOrientation(getCurrentOrientation());
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
}
resetStatusView();
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
@ -182,7 +192,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
Intent intent = getIntent();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
copyToClipboard = prefs.getBoolean(PreferencesActivity.KEY_COPY_TO_CLIPBOARD, true)
&& (intent == null || intent.getBooleanExtra(Intents.Scan.SAVE_HISTORY, true));
@ -242,6 +251,17 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
}
}
private int getCurrentOrientation() {
int rotation = getWindowManager().getDefaultDisplay().getRotation();
switch (rotation) {
case Surface.ROTATION_0:
case Surface.ROTATION_90:
return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
default:
return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
}
}
private static boolean isZXingURL(String dataString) {
if (dataString == null) {

View file

@ -46,6 +46,7 @@ public final class PreferencesActivity extends Activity {
public static final String KEY_AUTO_FOCUS = "preferences_auto_focus";
public static final String KEY_INVERT_SCAN = "preferences_invert_scan";
public static final String KEY_SEARCH_COUNTRY = "preferences_search_country";
public static final String KEY_DISABLE_AUTO_ORIENTATION = "preferences_orientation";
public static final String KEY_DISABLE_CONTINUOUS_FOCUS = "preferences_disable_continuous_focus";
public static final String KEY_DISABLE_EXPOSURE = "preferences_disable_exposure";