diff --git a/app/app.iml b/app/app.iml index 20f6a24..2f5f3da 100644 --- a/app/app.iml +++ b/app/app.iml @@ -87,7 +87,6 @@ - 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 fdf84cb..397909e 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 @@ -3,13 +3,19 @@ import android.app.Activity; import android.app.AlertDialog; import android.app.Fragment; +import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.net.Uri; +import android.os.Build; import android.os.Bundle; +import android.print.PrintAttributes; +import android.print.PrintDocumentAdapter; +import android.print.PrintJob; +import android.print.PrintManager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.text.Html; @@ -164,7 +170,7 @@ public void onActivityCreated(Bundle savedInstanceState) { if(useRicheditor) { editor = (RichEditor) activity.findViewById(R.id.detail_description); editor.setVisibility(View.VISIBLE); - editor.setBackgroundColor(getResources().getColor(R.color.background_material_light)); + editor.setBackgroundColor(Color.TRANSPARENT); editor.setEditorHeight(300); editor.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override @@ -746,11 +752,20 @@ public boolean shareNote(Intent shareIntent) { if(!TextUtils.isEmpty(descriptionValue)) { startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to))); }else{ - Toast.makeText(activity,R.string.empty_note,Toast.LENGTH_LONG).show(); + Toast.makeText(activity, R.string.empty_note, Toast.LENGTH_LONG).show(); } return false; } + @Override + public void onPrepareOptionsMenu(Menu menu) { + super.onPrepareOptionsMenu(menu); + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { + menu.findItem(R.id.print).setVisible(false); + } + } + @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ @@ -778,6 +793,9 @@ public boolean onOptionsItemSelected(MenuItem item) { shareIntent.setType("text/html"); shareNote(shareIntent); break; + case R.id.print: + printNote(); + break; } return true; } @@ -1327,12 +1345,19 @@ public boolean checkDifferences(){ return differences; } + private void printNote() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + PrintManager printManager = (PrintManager) activity.getSystemService(Context.PRINT_SERVICE); + String jobName = getString(R.string.app_name) + " Document"; + PrintDocumentAdapter printAdapter = editor.createPrintDocumentAdapter(); + PrintJob printJob = printManager.print(jobName, printAdapter, new PrintAttributes.Builder().build()); + } + } + private void goBack(){ Intent returnIntent = new Intent(); returnIntent.putExtra("selectedNotebookName",givenNotebook); ((OnFragmentCallback)activity).fragmentFinished(returnIntent, OnFragmentCallback.ResultCode.BACK); } - - } 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 cdad611..aebc802 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 @@ -19,7 +19,6 @@ import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; -import android.os.Environment; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; @@ -42,7 +41,6 @@ import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; -import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; @@ -85,7 +83,6 @@ import org.kore.kolabnotes.android.setting.SettingsActivity; import java.io.File; -import java.io.IOException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Arrays; diff --git a/app/src/main/res/menu/detail_toolbar.xml b/app/src/main/res/menu/detail_toolbar.xml index 02ae07f..bb7224b 100644 --- a/app/src/main/res/menu/detail_toolbar.xml +++ b/app/src/main/res/menu/detail_toolbar.xml @@ -37,4 +37,9 @@ app:showAsAction="always" android:icon="@drawable/ic_action_accept" android:title="@string/title_ok" /> + + \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index d03d776..e3cbaef 100755 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -185,4 +185,5 @@ Noitizbuch importiert Richtexteditor aktivieren Aktiviert den Richtexteditor zum Erstellen von formattierten Notizen + Drucken diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 4651c98..12b246c 100755 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -171,4 +171,5 @@ Notebook importés Activer RichTextEditor Active le RichTextEditor pour les notes formatées + Imprimer diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 975ab83..97f385e 100755 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -188,4 +188,5 @@ Notebook importati Abilita RichTextEditor Attiva la RichTextEditor per le note formattati + Stampa diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 8fbd380..bc33dd7 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -107,6 +107,7 @@ Выберите учетную запись Выбрать Другие варианты + Печать День Час diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index b09be1d..f9c5acb 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -194,4 +194,5 @@ Máy tính xách tay nhập khẩu Kích hoạt tính năng RichTextEditor Cho phép các RichTextEditor cho các ghi chú được định dạng + In diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 57cf913..08d9b79 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -128,6 +128,7 @@ Settings Deleted Undo + Print Move