aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/export/FieldnoteExport.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/export/FieldnoteExport.java')
-rw-r--r--main/src/cgeo/geocaching/export/FieldnoteExport.java26
1 files changed, 18 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/export/FieldnoteExport.java b/main/src/cgeo/geocaching/export/FieldnoteExport.java
index 7d3e07e..f6f27c6 100644
--- a/main/src/cgeo/geocaching/export/FieldnoteExport.java
+++ b/main/src/cgeo/geocaching/export/FieldnoteExport.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.export;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.LogEntry;
@@ -16,7 +18,10 @@ import cgeo.geocaching.utils.Log;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
+import android.content.Context;
import android.content.DialogInterface;
+import android.os.Build.VERSION;
+import android.os.Build.VERSION_CODES;
import android.os.Environment;
import android.view.ContextThemeWrapper;
import android.view.View;
@@ -29,11 +34,11 @@ import java.util.List;
* Exports offline logs in the Groundspeak Field Note format.
*
*/
-class FieldnoteExport extends AbstractExport {
+public class FieldnoteExport extends AbstractExport {
private static final File exportLocation = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/field-notes");
private static int fieldNotesCount = 0;
- protected FieldnoteExport() {
+ public FieldnoteExport() {
super(getString(R.string.export_fieldnotes));
}
@@ -53,13 +58,18 @@ class FieldnoteExport extends AbstractExport {
private Dialog getExportOptionsDialog(final Geocache[] caches, final Activity activity) {
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
- // AlertDialog has always dark style, so we have to apply it as well always
- final View layout = View.inflate(new ContextThemeWrapper(activity, R.style.dark), R.layout.fieldnote_export_dialog, null);
+ final Context themedContext;
+ if (Settings.isLightSkin() && VERSION.SDK_INT < VERSION_CODES.HONEYCOMB)
+ themedContext = new ContextThemeWrapper(activity, R.style.dark);
+ else
+ themedContext = activity;
+ final View layout = View.inflate(themedContext, R.layout.fieldnote_export_dialog, null);
+
builder.setView(layout);
- final CheckBox uploadOption = (CheckBox) layout.findViewById(R.id.upload);
+ final CheckBox uploadOption = ButterKnife.findById(layout, R.id.upload);
uploadOption.setChecked(Settings.getFieldNoteExportUpload());
- final CheckBox onlyNewOption = (CheckBox) layout.findViewById(R.id.onlynew);
+ final CheckBox onlyNewOption = ButterKnife.findById(layout, R.id.onlynew);
onlyNewOption.setChecked(Settings.getFieldNoteExportOnlyNew());
if (Settings.getFieldnoteExportDate() > 0) {
@@ -110,7 +120,7 @@ class FieldnoteExport extends AbstractExport {
@Override
protected Boolean doInBackgroundInternal(final Geocache[] caches) {
// export field notes separately for each connector, so the file can be uploaded to the respective site afterwards
- for (IConnector connector : ConnectorFactory.getConnectors()) {
+ for (final IConnector connector : ConnectorFactory.getConnectors()) {
if (connector instanceof FieldNotesCapability) {
exportFieldNotes((FieldNotesCapability) connector, caches);
}
@@ -118,7 +128,7 @@ class FieldnoteExport extends AbstractExport {
return true;
}
- private boolean exportFieldNotes(final FieldNotesCapability connector, Geocache[] caches) {
+ private boolean exportFieldNotes(final FieldNotesCapability connector, final Geocache[] caches) {
final FieldNotes fieldNotes = new FieldNotes();
try {
int i = 0;