From 442d0dac4f57443f4226c63f1bcd2bf55ea365cd Mon Sep 17 00:00:00 2001 From: Konrad Renner Date: Fri, 18 Mar 2016 14:20:01 +0100 Subject: [PATCH] print support for notes --- app/app.iml | 31 +++++++++-------- app/build.gradle | 17 +++++----- .../android/fragment/DetailFragment.java | 4 +++ .../android/fragment/OverviewFragment.java | 32 +++++++++++++++--- .../res/drawable-hdpi/ic_print_white_48dp.png | Bin 0 -> 270 bytes .../res/drawable-mdpi/ic_print_white_48dp.png | Bin 0 -> 207 bytes .../drawable-xhdpi/ic_print_white_48dp.png | Bin 0 -> 352 bytes .../drawable-xxhdpi/ic_print_white_48dp.png | Bin 0 -> 524 bytes .../drawable-xxxhdpi/ic_print_white_48dp.png | Bin 0 -> 710 bytes 9 files changed, 57 insertions(+), 27 deletions(-) create mode 100644 app/src/main/res/drawable-hdpi/ic_print_white_48dp.png create mode 100644 app/src/main/res/drawable-mdpi/ic_print_white_48dp.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_print_white_48dp.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_print_white_48dp.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_print_white_48dp.png diff --git a/app/app.iml b/app/app.iml index 2f5f3da..58f9eab 100644 --- a/app/app.iml +++ b/app/app.iml @@ -74,19 +74,20 @@ - - - - - - - + + + + + + + + @@ -101,22 +102,22 @@ - - + - - - - + + + + + - - + + diff --git a/app/build.gradle b/app/build.gradle index 317049d..aae0d06 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "org.kore.kolabnotes.android" minSdkVersion 16 targetSdkVersion 23 - versionCode 61 - versionName "1.9.0" + versionCode 62 + versionName "1.10.0" //Running test testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -27,6 +27,7 @@ android { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } + } dependencies { @@ -38,14 +39,14 @@ dependencies { compile 'jp.wasabeef:richeditor-android:1.2.0' //Android support libraries - compile 'com.android.support:support-v4:23.2.0' - compile 'com.android.support:appcompat-v7:23.2.0' - compile 'com.android.support:recyclerview-v7:23.2.0' - compile 'com.android.support:cardview-v7:23.2.0' - compile 'com.android.support:design:23.2.0' + compile 'com.android.support:support-v4:23.2.1' + compile 'com.android.support:appcompat-v7:23.2.1' + compile 'com.android.support:recyclerview-v7:23.2.1' + compile 'com.android.support:cardview-v7:23.2.1' + compile 'com.android.support:design:23.2.1' // Add dependency for UI test androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1' androidTestCompile 'com.android.support.test:runner:0.4.1' - androidTestCompile 'com.android.support:support-annotations:23.2.0' + androidTestCompile 'com.android.support:support-annotations:23.2.1' } diff --git a/app/src/main/java/org/kore/kolabnotes/android/fragment/DetailFragment.java b/app/src/main/java/org/kore/kolabnotes/android/fragment/DetailFragment.java index 397909e..a1572b6 100644 --- a/app/src/main/java/org/kore/kolabnotes/android/fragment/DetailFragment.java +++ b/app/src/main/java/org/kore/kolabnotes/android/fragment/DetailFragment.java @@ -292,6 +292,10 @@ public void onClick(View v) { String descriptionValue = initImageMap(savedInstanceState.getString(EDITOR)); setHtml(descriptionValue); } + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { + activity.findViewById(R.id.action_insert_image).setVisibility(View.GONE); + } } void setToolbarColor(){ diff --git a/app/src/main/java/org/kore/kolabnotes/android/fragment/OverviewFragment.java b/app/src/main/java/org/kore/kolabnotes/android/fragment/OverviewFragment.java index aebc802..4cbbc74 100644 --- a/app/src/main/java/org/kore/kolabnotes/android/fragment/OverviewFragment.java +++ b/app/src/main/java/org/kore/kolabnotes/android/fragment/OverviewFragment.java @@ -12,6 +12,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.database.Cursor; import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; @@ -19,6 +20,8 @@ import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; +import android.provider.OpenableColumns; +import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; @@ -1057,6 +1060,10 @@ private void searchNotes(String keyWord) { @Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { + menu.findItem(R.id.export_menu).setVisible(false); + menu.findItem(R.id.import_menu).setVisible(false); + } } @Override @@ -1129,11 +1136,17 @@ public void onActivityResult(int requestCode, int resultCode, ActiveAccount activeAccount = activeAccountRepository.getActiveAccount(); + Cursor cursor = getActivity().getContentResolver().query(uri,null, null, null, null, null); + String notebookName; - if(path.endsWith(".zip") || path.endsWith(".ZIP")) { - notebookName = path.substring(path.lastIndexOf("/") + 1, path.length() - 4); - }else{ - notebookName = path.substring(path.lastIndexOf("/") + 1); + + if(cursor != null && cursor.moveToFirst()){ + notebookName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)); + + notebookName = withouFileEnding(notebookName); + }else { + + notebookName = withouFileEnding(path.substring(path.lastIndexOf("/") + 1)); } @@ -1141,6 +1154,17 @@ public void onActivityResult(int requestCode, int resultCode, } } + @NonNull + private String withouFileEnding(String notebookName) { + //if there already existed a file with that name + if(notebookName.lastIndexOf('(') > 0){ + notebookName = notebookName.substring(0, notebookName.lastIndexOf('(')); + }else if (notebookName.endsWith(".zip") || notebookName.endsWith(".ZIP")) { + notebookName = notebookName.substring(0, notebookName.length() - 4); + } + return notebookName; + } + class ImportNotebook extends AsyncTask{ private final Context context; diff --git a/app/src/main/res/drawable-hdpi/ic_print_white_48dp.png b/app/src/main/res/drawable-hdpi/ic_print_white_48dp.png new file mode 100644 index 0000000000000000000000000000000000000000..61c0c3bc0f64e5aa6f17ec5983494f03332e98b2 GIT binary patch literal 270 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY0wn)GsXhawu6nvShEy=VJ$Ep()j^~+G1no- zd5u!a$3xk!5*wBXWOE*r5}JLX_3^Xw(Jx=EnsLU5>AC&u(|4i3p zEJ7X%){QJ)`?J%Tp5A#W5y3I>dAE7ox#p~@q%V%8Y+uf}tZ|#y=U^&qD82HVgQe}p z>if)hJujYRD{aYLwy@&N!<$uG9hnoeule__^_Sivur29t$R^X<3X>W<*o$5-|CZli z)Awnk*nGJZ^$8A4Gmoc#+waK4sWQRgTF+yF?LgLrexMT?FZn9~-J)GXJo2lD7ZDfv8%E3 zz;0GOnH$drX8EwDXXB%2AfLy8XY1{+b(V@>2JIw#k2VF zOnZY%mkK|zJ^I7Q_$`S^z#(llqxX517gn!k|6^8oz-Z+at5Pv}b{Wux44$rjF6*2U FngEqsP0s)T literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_print_white_48dp.png b/app/src/main/res/drawable-xhdpi/ic_print_white_48dp.png new file mode 100644 index 0000000000000000000000000000000000000000..b735c2674c781d678777d1559ebbba2f10972dc3 GIT binary patch literal 352 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD0wg^q?%&M7z^Lx&;uuoF`1Y2)ACseu`^UAB zN4QsV}0|O(Fb>csZiZ!G2vnx3_KHh(OBjB?`sm+2UN9R{k^LE&< z86*pe2RPLsd!ETp|yK+A{rPNnOHak6dbTIJSSZ_yJ_y^m}gp#?<}A4?}_`q zXSMfIs;8PnTb|Qc`dxATrmbA_7T;N>d-qAkPK(gC%;>`*ryo_$I-i+5|5J{ojd^DF zb#CFMSubDC{ATDc#w@k$?cUfoXRo%#o%w&a_%`Q)*OvRci{`BRQe?LvFulR;^WB}N z-lzL*o?iFs=J`mq|1)du$-G!nF)#mS<%Ww2Et?T<)%(0?; zC050&KhJupf41>hEA!j4cU~<>tGXleVqd|6y0cd^%l3EwS1dT{@KWx=zcXw37=5j0 z@4U*oAagR0+}ka);~V~!exIPR`)8c}9oGdZlRnEV@tS%#=F0qe@0d(cL**7r$f-Z;;-4%ip$iFk&nWkLM#gsulN7EsBm!fZ!PC{xWt~$( F697m8+K>PM literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_print_white_48dp.png b/app/src/main/res/drawable-xxxhdpi/ic_print_white_48dp.png new file mode 100644 index 0000000000000000000000000000000000000000..7930a117f1f42d18c53746a5ea600fe6ec8becb6 GIT binary patch literal 710 zcmeAS@N?(olHy`uVBq!ia0vp^2SAvE1xWt5x}=AJfvMNi#WAGf*4sM=y+jHbju$px zDt7XWP5mh8RK>C|_=#shVc-RC7h9Jp`+PR!3q-!Mt!e%+A@f4g-(764-n=T~mnw1w>JbA@`m9a0HZ$sdYbI&HM-XF$pk!k6$ykPE9 z#qj#odg3pvAy)pd{asLF>A9Oggv2WmyrsHaW(OeP6ZWgBSw# ze%6WKdFJvT76Z+ucS~pcuRrsL;niz{*^#GWo^6`4_EUTygTYhWv2ywU@fEmbk!7|B zE_f+_;U@z_fgJ