Skip to content

Commit cc719a5

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents ffd06b6 + 9377515 commit cc719a5

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

TODO.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Support customization of font size and family?
2+
Support customization of Margins?
3+
Flip back and forth to get to different documents
4+
Search Action
5+
Package for Android Market (Play)

src/com/javaposse/android/zenwriter/AndroidZenWriterActivity.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,7 @@ public static Drawable getDrawable(Context context, String filename) {
282282

283283
BitmapFactory.Options opts = new BitmapFactory.Options();
284284
opts.inSampleSize = 2;
285-
Bitmap backgroundBitmap = BitmapFactory.decodeFile(context
286-
.getFileStreamPath(filename).getAbsolutePath(), opts);
285+
Bitmap backgroundBitmap = BitmapFactory.decodeFile(filename, opts);
287286

288287
if (backgroundBitmap != null) {
289288
BitmapDrawable drawable = new BitmapDrawable(backgroundBitmap);
@@ -314,6 +313,7 @@ public boolean onContextItemSelected(MenuItem item) {
314313
public static final int ACTION_SAVE = 5;
315314
public static final int ACTION_SHARE = 6;
316315
public static final int ACTION_DELETE = 7;
316+
public static final int ACTION_SETTINGS = 8;
317317

318318
// Action Bar
319319
@Override
@@ -358,6 +358,13 @@ public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
358358
com.actionbarsherlock.view.MenuItem.SHOW_AS_ACTION_ALWAYS);
359359

360360

361+
menu.add(com.actionbarsherlock.view.Menu.NONE, ACTION_SETTINGS,
362+
ACTION_SETTINGS, "Settings")
363+
.setIcon(android.R.drawable.ic_menu_preferences)
364+
.setShowAsAction(
365+
com.actionbarsherlock.view.MenuItem.SHOW_AS_ACTION_IF_ROOM);
366+
367+
361368
return true;
362369
}
363370

@@ -375,6 +382,8 @@ public boolean onOptionsItemSelected(
375382
ret = true;
376383
} else if (itemId == ACTION_SEARCH) {
377384
// TODO: Implement Search
385+
} else if (itemId == ACTION_SETTINGS) {
386+
openThemeSettings(null);
378387
} else if (itemId == ACTION_EDIT) {
379388
AlertDialog.Builder alert = new AlertDialog.Builder(this);
380389

src/com/javaposse/android/zenwriter/PrefsActivity.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ public boolean onPreferenceClick(Preference preference) {
3636
});
3737
SharedPreferences prefs = PreferenceManager
3838
.getDefaultSharedPreferences(this);
39-
backgroundPref.setSummary(prefs.getString("backgroundpref", ""));
39+
if(prefs.getString("backgroundpref", "").length() > 0) {
40+
backgroundPref.setSummary(new File(prefs.getString("backgroundpref", "")).getName());
41+
}
4042
}
4143

4244
public boolean selectBackgroundImage(Preference pref) {
@@ -60,7 +62,7 @@ protected void onActivityResult(int requestCode, int resultCode,
6062
String path = getPath(selectedImage);
6163
Log.i("SelectedImage", "File Path: " + path);
6264
File selectedImageFile = new File(path);
63-
65+
/*
6466
try {
6567
6668
File destFile = getFileStreamPath(selectedImageFile
@@ -97,11 +99,12 @@ protected void onActivityResult(int requestCode, int resultCode,
9799
} catch (Exception e) {
98100
Log.e("SelectedImage", "Failed to Copy Image", e);
99101
}
102+
*/
100103

101104
SharedPreferences prefs = PreferenceManager
102105
.getDefaultSharedPreferences(this);
103106
SharedPreferences.Editor editor = prefs.edit();
104-
editor.putString("backgroundpref", selectedImageFile.getName());
107+
editor.putString("backgroundpref", selectedImageFile.getAbsolutePath());
105108
editor.commit();
106109
Preference backgroundPref = this
107110
.findPreference("backgroundpref");

0 commit comments

Comments
 (0)