123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627 |
- package epson.print.screen;
- import android.content.ContentValues;
- import android.content.Context;
- import android.content.SharedPreferences;
- import android.database.Cursor;
- import android.net.Uri;
- import com.box.androidsdk.content.requests.BoxRequestsMetadata;
- import com.epson.mobilephone.common.EpLog;
- import com.epson.mobilephone.common.PrintingLib.define.Constants;
- import com.epson.mobilephone.common.escpr.MediaInfo;
- import epson.common.Constants;
- import epson.print.IprintApplication;
- import epson.print.Util.EPLog;
- import epson.provider.SharedPreferencesProvider;
- import java.util.Enumeration;
- import java.util.HashMap;
- import java.util.Locale;
- import java.util.Map;
- public class PrintSetting {
- private static final String[] CAMERA_COPY_KEYS = {Constants.PREFS_INFO_SIZETYPESET_CAMERACOPY, Constants.PAPER_SOURCE_CAMERACOPY, Constants.COLOR_CAMERACOPY, Constants.LAYOUT_CAMERACOPY, Constants.PAPER_TYPE_CAMERACOPY, Constants.PAPER_SIZE_CAMERACOPY, Constants.QUALITY_CAMERACOPY, Constants.FEED_DIRECTION_CAMERACOPY};
- public static final int EMPTY_PRE_VALUE = -1;
- private static final String TAG = "PrintSetting";
- Map<String, Object> allValueFromContentProvider = new HashMap();
- public int brightnessValue = 0;
- public int colorValue;
- Context context;
- public int contrastValue = 0;
- public int copiesValue = 1;
- public int duplexValue;
- public int endValue = 1;
- public int feedDirectionValue;
- private Kind kind;
- public int layoutMultiPageValue;
- public int layoutValue;
- public int paperSizeValue;
- public int paperSourceValue;
- public int paperTypeValue;
- public int photoApfValueForLocalPrinter = 0;
- public boolean printAll = true;
- public int printdate = 0;
- public int qualityValue;
- public int saturationValue = 0;
- SharedPreferences settings = null;
- public int sharpnessForPhoto = 0;
- public int startValue = 1;
- public enum Kind {
- document,
- photo,
- cameracopy,
- NotSet
- }
- public Kind getKind() {
- return this.kind;
- }
- public PrintSetting(Context context2, Kind kind2) {
- if (SharedPreferencesProvider.checkPackageUseSharedPreferencesProvider(context2)) {
- this.context = null;
- this.settings = null;
- } else {
- this.context = context2;
- this.settings = context2.getSharedPreferences("PrintSetting", 0);
- }
- if (kind2 != null) {
- this.kind = kind2;
- } else {
- this.kind = Kind.NotSet;
- }
- }
- public static PrintSetting getInstance(Context context2, String str) {
- Kind kind2 = Kind.photo;
- try {
- kind2 = Kind.valueOf(str);
- } catch (Exception e) {
- EPLog.m306e("Exception " + e);
- }
- return new PrintSetting(context2, kind2);
- }
- public void loadSettings() {
- preparateSettings();
- this.paperSizeValue = getPaperSize();
- this.paperTypeValue = getPaperType();
- this.layoutValue = getLayout();
- this.layoutMultiPageValue = getLayoutMultiPage();
- this.qualityValue = getQuality();
- this.paperSourceValue = getPaperSorce();
- this.colorValue = getColor();
- this.duplexValue = getDuplex();
- this.feedDirectionValue = getFeedDirection();
- switch (this.kind) {
- case document:
- SharedPreferences sharedPreferences = this.settings;
- if (sharedPreferences != null) {
- this.printAll = sharedPreferences.getBoolean(Constants.PRINT_ALL, true);
- this.startValue = this.settings.getInt(Constants.START_PAGE, 1);
- this.endValue = this.settings.getInt(Constants.END_PAGE, 1);
- break;
- } else {
- this.printAll = getSettingBoolean(Constants.PRINT_ALL, true);
- this.startValue = getSetting(Constants.START_PAGE, (String) null, 1);
- this.endValue = getSetting(Constants.END_PAGE, (String) null, 1);
- break;
- }
- case photo:
- SharedPreferences sharedPreferences2 = this.settings;
- if (sharedPreferences2 != null) {
- this.printdate = sharedPreferences2.getInt(Constants.PRINTDATE, 0);
- this.photoApfValueForLocalPrinter = this.settings.getInt(Constants.APF_PHOTO, 1);
- this.sharpnessForPhoto = this.settings.getInt(Constants.SHARPNESS_PHOTO, 1);
- break;
- } else {
- this.printdate = getSetting(Constants.PRINTDATE, (String) null, 0);
- this.photoApfValueForLocalPrinter = getSetting(Constants.APF_PHOTO, (String) null, 1);
- this.sharpnessForPhoto = getSetting(Constants.SHARPNESS_PHOTO, (String) null, 1);
- break;
- }
- }
- SharedPreferences sharedPreferences3 = this.settings;
- if (sharedPreferences3 == null) {
- this.copiesValue = getSetting(Constants.COPIES, (String) null, 1);
- } else {
- this.copiesValue = sharedPreferences3.getInt(Constants.COPIES, 1);
- }
- this.brightnessValue = 0;
- this.contrastValue = 0;
- this.saturationValue = 0;
- }
- private void preparateSettings() {
- if (this.settings == null) {
- Cursor query = IprintApplication.getInstance().getContentResolver().query(Uri.parse("content://epson.print.provider.SharedPreferences/"), (String[]) null, (String) null, (String[]) null, (String) null);
- query.moveToFirst();
- this.allValueFromContentProvider.clear();
- EpLog.i();
- String str = null;
- Object obj = null;
- do {
- for (int i = 0; i < query.getColumnCount(); i++) {
- String columnName = query.getColumnName(i);
- if (columnName.equals("key")) {
- str = query.getString(i);
- } else if (columnName.equals(BoxRequestsMetadata.UpdateItemMetadata.BoxMetadataUpdateTask.VALUE)) {
- EpLog.i("さーびす", "PUT key: " + str + " getType: " + query.getType(i));
- query.getType(i);
- int type = query.getType(i);
- if (type == 1) {
- obj = Integer.valueOf(query.getInt(i));
- } else if (type == 3) {
- obj = query.getString(i);
- }
- } else {
- str = null;
- }
- }
- if (str != null) {
- if (!(obj instanceof String) || (!obj.equals("true") && !obj.equals("false"))) {
- this.allValueFromContentProvider.put(str, obj);
- } else {
- this.allValueFromContentProvider.put(str, Boolean.valueOf((String) obj));
- }
- str = null;
- }
- } while (query.moveToNext());
- query.close();
- }
- }
- public void saveSettings() {
- ContentValues contentValues;
- SharedPreferences.Editor editor;
- EPLog.d("PrintSetting", "saveSettings() " + this.kind.name());
- SharedPreferences sharedPreferences = this.settings;
- if (sharedPreferences == null) {
- contentValues = new ContentValues();
- editor = null;
- } else {
- editor = sharedPreferences.edit();
- contentValues = null;
- }
- switch (this.kind) {
- case document:
- if (editor != null) {
- editor.putInt(Constants.PAPER_SIZE, this.paperSizeValue);
- editor.putInt(Constants.PAPER_TYPE, this.paperTypeValue);
- editor.putInt(Constants.LAYOUT, this.layoutValue);
- editor.putInt(Constants.LAYOUT_MULTIPAGE, this.layoutMultiPageValue);
- editor.putInt(Constants.QUALITY, this.qualityValue);
- editor.putInt(Constants.PAPER_SOURCE, this.paperSourceValue);
- editor.putInt(Constants.COLOR, this.colorValue);
- editor.putInt(Constants.DUPLEX, this.duplexValue);
- editor.putInt(Constants.FEED_DIRECTION, this.feedDirectionValue);
- editor.putBoolean(Constants.PRINT_ALL, this.printAll);
- editor.putInt(Constants.START_PAGE, this.startValue);
- editor.putInt(Constants.END_PAGE, this.endValue);
- break;
- } else {
- contentValues.put(Constants.PAPER_SIZE, Integer.valueOf(this.paperSizeValue));
- contentValues.put(Constants.PAPER_TYPE, Integer.valueOf(this.paperTypeValue));
- contentValues.put(Constants.LAYOUT, Integer.valueOf(this.layoutValue));
- contentValues.put(Constants.LAYOUT_MULTIPAGE, Integer.valueOf(this.layoutMultiPageValue));
- contentValues.put(Constants.QUALITY, Integer.valueOf(this.qualityValue));
- contentValues.put(Constants.PAPER_SOURCE, Integer.valueOf(this.paperSourceValue));
- contentValues.put(Constants.COLOR, Integer.valueOf(this.colorValue));
- contentValues.put(Constants.DUPLEX, Integer.valueOf(this.duplexValue));
- contentValues.put(Constants.FEED_DIRECTION, Integer.valueOf(this.feedDirectionValue));
- contentValues.put(Constants.PRINT_ALL, Boolean.valueOf(this.printAll));
- contentValues.put(Constants.START_PAGE, Integer.valueOf(this.startValue));
- contentValues.put(Constants.END_PAGE, Integer.valueOf(this.endValue));
- break;
- }
- case photo:
- if (editor != null) {
- editor.putInt(Constants.PAPER_SIZE_PHOTO, this.paperSizeValue);
- editor.putInt(Constants.PAPER_TYPE_PHOTO, this.paperTypeValue);
- editor.putInt(Constants.LAYOUT_PHOTO, this.layoutValue);
- editor.putInt(Constants.LAYOUT_MULTIPAGE_PHOTO, this.layoutMultiPageValue);
- editor.putInt(Constants.QUALITY_PHOTO, this.qualityValue);
- editor.putInt(Constants.PAPER_SOURCE_PHOTO, this.paperSourceValue);
- editor.putInt(Constants.COLOR_PHOTO, this.colorValue);
- editor.putInt(Constants.DUPLEX_PHOTO, this.duplexValue);
- editor.putInt(Constants.FEED_DIRECTION_PHOTO, this.feedDirectionValue);
- editor.putInt(Constants.PRINTDATE, this.printdate);
- editor.putInt(Constants.APF_PHOTO, this.photoApfValueForLocalPrinter);
- editor.putInt(Constants.SHARPNESS_PHOTO, this.sharpnessForPhoto);
- break;
- } else {
- contentValues.put(Constants.PAPER_SIZE_PHOTO, Integer.valueOf(this.paperSizeValue));
- contentValues.put(Constants.PAPER_TYPE_PHOTO, Integer.valueOf(this.paperTypeValue));
- contentValues.put(Constants.LAYOUT_PHOTO, Integer.valueOf(this.layoutValue));
- contentValues.put(Constants.LAYOUT_MULTIPAGE_PHOTO, Integer.valueOf(this.layoutMultiPageValue));
- contentValues.put(Constants.QUALITY_PHOTO, Integer.valueOf(this.qualityValue));
- contentValues.put(Constants.PAPER_SOURCE_PHOTO, Integer.valueOf(this.paperSourceValue));
- contentValues.put(Constants.COLOR_PHOTO, Integer.valueOf(this.colorValue));
- contentValues.put(Constants.DUPLEX_PHOTO, Integer.valueOf(this.duplexValue));
- contentValues.put(Constants.FEED_DIRECTION_PHOTO, Integer.valueOf(this.feedDirectionValue));
- contentValues.put(Constants.PRINTDATE, Integer.valueOf(this.printdate));
- contentValues.put(Constants.APF_PHOTO, Integer.valueOf(this.photoApfValueForLocalPrinter));
- contentValues.put(Constants.SHARPNESS_PHOTO, Integer.valueOf(this.sharpnessForPhoto));
- break;
- }
- case cameracopy:
- if (editor != null) {
- editor.putInt(Constants.PAPER_SIZE_CAMERACOPY, this.paperSizeValue);
- editor.putInt(Constants.PAPER_TYPE_CAMERACOPY, this.paperTypeValue);
- editor.putInt(Constants.LAYOUT_CAMERACOPY, this.layoutValue);
- editor.putInt(Constants.QUALITY_CAMERACOPY, this.qualityValue);
- editor.putInt(Constants.PAPER_SOURCE_CAMERACOPY, this.paperSourceValue);
- editor.putInt(Constants.COLOR_CAMERACOPY, this.colorValue);
- editor.putInt(Constants.FEED_DIRECTION_CAMERACOPY, this.feedDirectionValue);
- break;
- } else {
- contentValues.put(Constants.PAPER_SIZE_CAMERACOPY, Integer.valueOf(this.paperSizeValue));
- contentValues.put(Constants.PAPER_TYPE_CAMERACOPY, Integer.valueOf(this.paperTypeValue));
- contentValues.put(Constants.LAYOUT_CAMERACOPY, Integer.valueOf(this.layoutValue));
- contentValues.put(Constants.QUALITY_CAMERACOPY, Integer.valueOf(this.qualityValue));
- contentValues.put(Constants.PAPER_SOURCE_CAMERACOPY, Integer.valueOf(this.paperSourceValue));
- contentValues.put(Constants.COLOR_CAMERACOPY, Integer.valueOf(this.colorValue));
- contentValues.put(Constants.FEED_DIRECTION_CAMERACOPY, Integer.valueOf(this.feedDirectionValue));
- break;
- }
- }
- if (editor == null) {
- contentValues.put(Constants.COPIES, Integer.valueOf(this.copiesValue));
- contentValues.put(Constants.BRIGHTNESS, Integer.valueOf(this.brightnessValue));
- contentValues.put(Constants.CONTRAST, Integer.valueOf(this.contrastValue));
- contentValues.put(Constants.SATURATION, Integer.valueOf(this.saturationValue));
- } else {
- editor.putInt(Constants.COPIES, this.copiesValue);
- editor.putInt(Constants.BRIGHTNESS, this.brightnessValue);
- editor.putInt(Constants.CONTRAST, this.contrastValue);
- editor.putInt(Constants.SATURATION, this.saturationValue);
- }
- if (this.settings == null) {
- IprintApplication.getInstance().getContentResolver().update(Uri.parse("content://epson.print.provider.SharedPreferences/"), contentValues, (String) null, (String[]) null);
- return;
- }
- editor.commit();
- }
- public int getDefaultPaperSize() {
- int code = Constants.PaperName.EPS_MSID_A4.getCode();
- String country = Locale.getDefault().getCountry();
- switch (this.kind) {
- case document:
- case cameracopy:
- return (country.equals(Locale.US.getCountry()) || country.equals(Locale.CANADA.getCountry())) ? Constants.PaperName.EPS_MSID_LETTER.getCode() : Constants.PaperName.EPS_MSID_A4.getCode();
- case photo:
- int code2 = Constants.PaperName.EPS_MSID_4X6.getCode();
- if (country.equals(Locale.JAPAN.getCountry())) {
- return Constants.PaperName.EPS_MSID_L.getCode();
- }
- return code2;
- default:
- return code;
- }
- }
- private int getPaperSize() {
- int defaultPaperSize = getDefaultPaperSize();
- switch (this.kind) {
- case document:
- return getSetting(epson.common.Constants.PAPER_SIZE, (String) null, defaultPaperSize);
- case photo:
- return getSetting(epson.common.Constants.PAPER_SIZE_PHOTO, (String) null, defaultPaperSize);
- case cameracopy:
- return getSetting(epson.common.Constants.PAPER_SIZE_CAMERACOPY, (String) null, defaultPaperSize);
- default:
- return defaultPaperSize;
- }
- }
- public int getDefaultPaperType() {
- switch (this.kind) {
- case document:
- case cameracopy:
- return Constants.MediaName.EPS_MTID_PLAIN.getCode();
- case photo:
- return Constants.MediaName.EPS_MTID_PGPHOTO.getCode();
- default:
- return 0;
- }
- }
- private int getPaperType() {
- int defaultPaperType = getDefaultPaperType();
- switch (this.kind) {
- case document:
- return getSetting(epson.common.Constants.PAPER_TYPE, (String) null, defaultPaperType);
- case photo:
- return getSetting(epson.common.Constants.PAPER_TYPE_PHOTO, (String) null, defaultPaperType);
- case cameracopy:
- return getSetting(epson.common.Constants.PAPER_TYPE_CAMERACOPY, (String) null, defaultPaperType);
- default:
- return defaultPaperType;
- }
- }
- private int getLayout() {
- int i;
- switch (this.kind) {
- case photo:
- i = getSetting(epson.common.Constants.LAYOUT_PHOTO, (String) null, 1);
- break;
- case cameracopy:
- i = getSetting(epson.common.Constants.LAYOUT_CAMERACOPY, (String) null, 2);
- break;
- default:
- i = 2;
- break;
- }
- if (i == 8) {
- return 2;
- }
- return i;
- }
- private int getLayoutMultiPage() {
- switch (this.kind) {
- case document:
- return getSetting(epson.common.Constants.LAYOUT_MULTIPAGE, (String) null, 0);
- case photo:
- return getSetting(epson.common.Constants.LAYOUT_MULTIPAGE_PHOTO, (String) null, 0);
- default:
- return 0;
- }
- }
- private int getQuality() {
- switch (this.kind) {
- case document:
- return getSetting(epson.common.Constants.QUALITY, (String) null, 2);
- case photo:
- return getSetting(epson.common.Constants.QUALITY_PHOTO, (String) null, 2);
- case cameracopy:
- return getSetting(epson.common.Constants.QUALITY_CAMERACOPY, (String) null, 2);
- default:
- return 2;
- }
- }
- private int getPaperSorce() {
- int i;
- switch (this.kind) {
- case document:
- i = getSetting(epson.common.Constants.PAPER_SOURCE, (String) null, 128);
- break;
- case photo:
- i = getSetting(epson.common.Constants.PAPER_SOURCE_PHOTO, (String) null, 128);
- break;
- case cameracopy:
- i = getSetting(epson.common.Constants.PAPER_SOURCE_CAMERACOPY, (String) null, 128);
- break;
- default:
- i = 128;
- break;
- }
- if (i == 0) {
- return 128;
- }
- return i;
- }
- private int getDuplex() {
- switch (this.kind) {
- case document:
- return getSetting(epson.common.Constants.DUPLEX, (String) null, 0);
- case photo:
- return getSetting(epson.common.Constants.DUPLEX_PHOTO, (String) null, 0);
- default:
- return 0;
- }
- }
- private int getFeedDirection() {
- switch (this.kind) {
- case document:
- return getSetting(epson.common.Constants.FEED_DIRECTION, (String) null, 0);
- case photo:
- return getSetting(epson.common.Constants.FEED_DIRECTION_PHOTO, (String) null, 0);
- case cameracopy:
- return getSetting(epson.common.Constants.FEED_DIRECTION_CAMERACOPY, (String) null, 0);
- default:
- return 0;
- }
- }
- private int getColor() {
- switch (this.kind) {
- case document:
- return getSetting(epson.common.Constants.COLOR, (String) null, 0);
- case photo:
- return getSetting(epson.common.Constants.COLOR_PHOTO, (String) null, 0);
- case cameracopy:
- return getSetting(epson.common.Constants.COLOR_CAMERACOPY, (String) null, 0);
- default:
- return 0;
- }
- }
- public String getPrinterName() {
- return getSettingString(epson.common.Constants.PRINTER_NAME, (String) null);
- }
- public String getPrinterID() {
- return getSettingString(epson.common.Constants.PRINTER_ID, (String) null);
- }
- public String getIP() {
- return getSettingString(epson.common.Constants.PRINTER_IP, (String) null);
- }
- public String getSrialNo() {
- return getSettingString(epson.common.Constants.PRINTER_SERIAL_NO, (String) null);
- }
- public String getEmailAddress() {
- return getSettingString(epson.common.Constants.PRINTER_EMAIL_ADDRESS, (String) null);
- }
- public int getLocation() {
- return getSetting(epson.common.Constants.PRINTER_LOCATION, (String) null, 0);
- }
- public int getLang() {
- return getSetting(epson.common.Constants.LANG, (String) null, 1);
- }
- private int getSetting(String str, String str2, int i) {
- SharedPreferences sharedPreferences = this.settings;
- if (sharedPreferences == null) {
- if (this.allValueFromContentProvider.containsKey(str)) {
- this.allValueFromContentProvider.get(str);
- return ((Integer) this.allValueFromContentProvider.get(str)).intValue();
- } else if (str2 != null && this.allValueFromContentProvider.containsKey(str2)) {
- return ((Integer) this.allValueFromContentProvider.get(str2)).intValue();
- } else {
- return i;
- }
- } else if (sharedPreferences.getAll().containsKey(str) || str2 == null) {
- return this.settings.getInt(str, i);
- } else {
- return this.settings.getInt(str2, i);
- }
- }
- private String getSettingString(String str, String str2) {
- SharedPreferences sharedPreferences = this.settings;
- if (sharedPreferences != null) {
- return sharedPreferences.getAll().containsKey(str) ? this.settings.getString(str, str2) : str2;
- }
- if (!this.allValueFromContentProvider.containsKey(str) || this.allValueFromContentProvider.get(str) == null) {
- return str2;
- }
- return (String) this.allValueFromContentProvider.get(str);
- }
- private boolean getSettingBoolean(String str, boolean z) {
- if (this.settings != null || !this.allValueFromContentProvider.containsKey(str)) {
- return z;
- }
- this.allValueFromContentProvider.get(str);
- return ((Boolean) this.allValueFromContentProvider.get(str)).booleanValue();
- }
- public int getEcClientLibSourceType() {
- return C23321.$SwitchMap$epson$print$screen$PrintSetting$Kind[this.kind.ordinal()] != 1 ? 2 : 1;
- }
- private SharedPreferences getPaperSizeTypePreferences() {
- String str;
- switch (this.kind) {
- case document:
- str = epson.common.Constants.PREFS_INFO_SIZETYPESET;
- break;
- case photo:
- str = epson.common.Constants.PREFS_INFO_SIZETYPESET_PHOTO;
- break;
- case cameracopy:
- str = epson.common.Constants.PREFS_INFO_SIZETYPESET_CAMERACOPY;
- break;
- default:
- str = null;
- break;
- }
- return this.context.getSharedPreferences(str, 0);
- }
- public MediaInfo.PaperSizeType loadPaperSizeTypePear() {
- MediaInfo.PaperSizeType paperSizeType = new MediaInfo.PaperSizeType();
- SharedPreferences paperSizeTypePreferences = getPaperSizeTypePreferences();
- Enumeration keys = paperSizeType.getKeys();
- while (keys.hasMoreElements()) {
- int intValue = ((Integer) keys.nextElement()).intValue();
- int i = paperSizeTypePreferences.getInt(Integer.toString(intValue), -1);
- if (i != -1) {
- paperSizeType.putID(intValue, i);
- }
- }
- return paperSizeType;
- }
- public void savePaperSizeTypePear(MediaInfo.PaperSizeType paperSizeType) {
- SharedPreferences.Editor edit = getPaperSizeTypePreferences().edit();
- Enumeration keys = paperSizeType.getKeys();
- while (keys.hasMoreElements()) {
- int intValue = ((Integer) keys.nextElement()).intValue();
- edit.putInt(Integer.toString(intValue), paperSizeType.getID(intValue));
- }
- edit.commit();
- }
- public void resetPageRange(int i, int i2) {
- EPLog.d("PrintSetting", "resetPrintSettings()");
- SharedPreferences.Editor edit = this.settings.edit();
- this.printAll = true;
- this.startValue = i;
- this.endValue = i2;
- edit.putBoolean(epson.common.Constants.PRINT_ALL, this.printAll);
- edit.putInt(epson.common.Constants.START_PAGE, this.startValue);
- edit.putInt(epson.common.Constants.END_PAGE, this.endValue);
- edit.commit();
- }
- public void resetPrintSettings() {
- EPLog.d("PrintSetting", "resetPrintSettings()");
- SharedPreferences.Editor edit = this.settings.edit();
- edit.putInt(epson.common.Constants.COPIES, 1);
- edit.putInt(epson.common.Constants.BRIGHTNESS, 0);
- edit.putInt(epson.common.Constants.CONTRAST, 0);
- edit.putInt(epson.common.Constants.SATURATION, 0);
- edit.commit();
- }
- public int getUpdateSettingsRemoteSourceType() {
- switch (this.kind) {
- case photo:
- return 2;
- case cameracopy:
- return 2;
- default:
- return 1;
- }
- }
- public void clearSettings() {
- EPLog.d("PrintSetting", "clearSettings()");
- SharedPreferences.Editor edit = this.settings.edit();
- edit.remove(epson.common.Constants.PAPER_SIZE);
- edit.remove(epson.common.Constants.PAPER_TYPE);
- edit.remove(epson.common.Constants.LAYOUT);
- edit.remove(epson.common.Constants.QUALITY);
- edit.remove(epson.common.Constants.PAPER_SOURCE);
- edit.remove(epson.common.Constants.COLOR);
- edit.remove(epson.common.Constants.DUPLEX);
- edit.remove(epson.common.Constants.FEED_DIRECTION);
- edit.remove(epson.common.Constants.PAPER_SIZE_PHOTO);
- edit.remove(epson.common.Constants.PAPER_TYPE_PHOTO);
- edit.remove(epson.common.Constants.LAYOUT_PHOTO);
- edit.remove(epson.common.Constants.QUALITY_PHOTO);
- edit.remove(epson.common.Constants.PAPER_SOURCE_PHOTO);
- edit.remove(epson.common.Constants.COLOR_PHOTO);
- edit.remove(epson.common.Constants.DUPLEX_PHOTO);
- edit.remove(epson.common.Constants.FEED_DIRECTION_PHOTO);
- edit.remove(epson.common.Constants.PRINT_ALL);
- edit.remove(epson.common.Constants.START_PAGE);
- edit.remove(epson.common.Constants.END_PAGE);
- edit.remove(epson.common.Constants.PRINTDATE);
- edit.remove(epson.common.Constants.APF_PHOTO);
- edit.remove(epson.common.Constants.COPIES);
- edit.remove(epson.common.Constants.BRIGHTNESS);
- edit.remove(epson.common.Constants.CONTRAST);
- edit.remove(epson.common.Constants.SATURATION);
- for (String remove : CAMERA_COPY_KEYS) {
- edit.remove(remove);
- }
- edit.commit();
- this.context.getSharedPreferences(epson.common.Constants.PREFS_INFO_SIZETYPESET, 0).edit().clear().commit();
- this.context.getSharedPreferences(epson.common.Constants.PREFS_INFO_SIZETYPESET_PHOTO, 0).edit().clear().commit();
- this.context.getSharedPreferences(epson.common.Constants.PREFS_INFO_SIZETYPESET_CAMERACOPY, 0).edit().clear().commit();
- }
- }
|