Loading app/build.gradle +6 −4 Original line number Diff line number Diff line Loading @@ -8,8 +8,8 @@ android { applicationId "it.niedermann.owncloud.notes" minSdkVersion 14 targetSdkVersion 27 versionCode 28 versionName "0.16.1" versionCode 32 versionName "0.20.0" } buildTypes { release { Loading @@ -26,8 +26,10 @@ android { dependencies { implementation project(':cert4android') implementation 'com.yydcdut:rxmarkdown:0.1.1-beta' implementation 'io.reactivex:rxandroid:1.2.0' implementation 'io.reactivex:rxjava:1.1.5' implementation 'com.yydcdut:markdown-processor:0.1.3' implementation 'com.yydcdut:rxmarkdown-wrapper:0.1.3' implementation 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' Loading app/src/main/java/it/niedermann/owncloud/notes/android/activity/EditNoteActivity.java +1 −5 Original line number Diff line number Diff line Loading @@ -149,7 +149,6 @@ public class EditNoteActivity extends AppCompatActivity implements BaseNoteFragm @Override public void onBackPressed() { fragment.onPrepareClose(); close(); } Loading @@ -163,15 +162,12 @@ public class EditNoteActivity extends AppCompatActivity implements BaseNoteFragm public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: fragment.onPrepareClose(); close(); return true; case R.id.menu_preview: fragment.onPrepareClose(); launchExistingNote(getNoteId(), false); return true; case R.id.menu_edit: fragment.onPrepareClose(); launchExistingNote(getNoteId(), true); return true; default: Loading @@ -194,7 +190,7 @@ public class EditNoteActivity extends AppCompatActivity implements BaseNoteFragm } else { preferences.edit().putString(prefKeyLastMode, getString(R.string.pref_value_mode_preview)).apply(); } fragment.onFinalClose(); fragment.onCloseNote(); finish(); } Loading app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java +38 −20 Original line number Diff line number Diff line Loading @@ -2,11 +2,14 @@ package it.niedermann.owncloud.notes.android.activity; import android.app.SearchManager; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.graphics.Canvas; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; Loading Loading @@ -331,10 +334,12 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap } private void setupNavigationMenu() { final NavigationAdapter.NavigationItem itemTrashbin = new NavigationAdapter.NavigationItem("trashbin", getString(R.string.action_trashbin), null, R.drawable.ic_delete_grey600_24dp); final NavigationAdapter.NavigationItem itemSettings = new NavigationAdapter.NavigationItem("settings", getString(R.string.action_settings), null, R.drawable.ic_settings_grey600_24dp); final NavigationAdapter.NavigationItem itemAbout = new NavigationAdapter.NavigationItem("about", getString(R.string.simple_about), null, R.drawable.ic_info_outline_grey600_24dp); ArrayList<NavigationAdapter.NavigationItem> itemsMenu = new ArrayList<>(); itemsMenu.add(itemTrashbin); itemsMenu.add(itemSettings); itemsMenu.add(itemAbout); Loading @@ -347,6 +352,10 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap } else if (item == itemAbout) { Intent aboutIntent = new Intent(getApplicationContext(), AboutActivity.class); startActivityForResult(aboutIntent, about); } else if (item == itemTrashbin) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); String url = preferences.getString(SettingsActivity.SETTINGS_URL, SettingsActivity.DEFAULT_SETTINGS); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url + "index.php/apps/files/?dir=/&view=trashbin"))); } } Loading Loading @@ -390,13 +399,14 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap */ @Override public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { if (direction == ItemTouchHelper.LEFT || direction == ItemTouchHelper.RIGHT) { switch(direction) { case ItemTouchHelper.LEFT: { final DBNote dbNote = (DBNote) adapter.getItem(viewHolder.getAdapterPosition()); db.deleteNoteAndSync((dbNote).getId()); adapter.remove(dbNote); refreshLists(); Log.v("Note", "Item deleted through swipe ----------------------------------------------"); Snackbar.make(swipeRefreshLayout, R.string.action_note_deleted, 7 * 1000) Snackbar.make(swipeRefreshLayout, R.string.action_note_deleted, Snackbar.LENGTH_LONG) .setAction(R.string.action_undo, new View.OnClickListener() { @Override public void onClick(View v) { Loading @@ -407,14 +417,22 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap } }) .show(); break; } case ItemTouchHelper.RIGHT: { final DBNote dbNote = (DBNote) adapter.getItem(viewHolder.getAdapterPosition()); db.toggleFavorite(dbNote, null); refreshLists(); break; } } } @Override public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) { ItemAdapter.NoteViewHolder noteViewHolder = (ItemAdapter.NoteViewHolder) viewHolder; // show delete icon on the right side noteViewHolder.showSwipeDelete(dX > 0); // show swipe icon on the side noteViewHolder.showSwipe(dX>0); // move only swipeable part of item (not leave-behind) getDefaultUIUtil().onDraw(c, recyclerView, noteViewHolder.noteSwipeable, dX, dY, actionState, isCurrentlyActive); } Loading Loading @@ -558,7 +576,6 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap db = NoteSQLiteOpenHelper.getInstance(this); if (db.getNoteServerSyncHelper().isSyncPossible()) { adapter.removeAll(); swipeRefreshLayout.setRefreshing(true); synchronize(); } else { Toast.makeText(getApplicationContext(), getString(R.string.error_sync, getString(NotesClientUtil.LoginStatus.NO_NETWORK.str)), Toast.LENGTH_LONG).show(); Loading Loading @@ -633,6 +650,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap } private void synchronize() { swipeRefreshLayout.setRefreshing(true); db.getNoteServerSyncHelper().addCallbackPull(syncCallBack); db.getNoteServerSyncHelper().scheduleSync(false); } Loading app/src/main/java/it/niedermann/owncloud/notes/android/activity/SettingsActivity.java +8 −9 Original line number Diff line number Diff line Loading @@ -76,6 +76,13 @@ public class SettingsActivity extends AppCompatActivity { } } field_url.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { new URLValidatorAsyncTask().execute(NotesClientUtil.formatURL(field_url.getText().toString())); } }); field_url.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { Loading @@ -83,15 +90,7 @@ public class SettingsActivity extends AppCompatActivity { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { String url = field_url.getText().toString().trim(); if (!url.endsWith("/")) { url += "/"; } if (!url.startsWith("http://") && !url.startsWith("https://")) { url = "https://" + url; } new URLValidatorAsyncTask().execute(url); String url = NotesClientUtil.formatURL(field_url.getText().toString()); if (NotesClientUtil.isHttp(url)) { urlWarnHttp.setVisibility(View.VISIBLE); Loading app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidget.java +4 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ public class NoteListWidget extends AppWidgetProvider { @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); for (int appWidgetId : appWidgetIds) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); Loading Loading @@ -62,7 +63,7 @@ public class NoteListWidget extends AppWidgetProvider { 0, templateIntent, PendingIntent.FLAG_UPDATE_CURRENT); if (displayMode == 2) { if (displayMode == NLW_DISPLAY_CATEGORY) { serviceIntent.putExtra(NoteListWidget.WIDGET_CATEGORY_KEY + appWidgetId, category); } serviceIntent.setData(Uri.parse(serviceIntent.toUri(Intent.URI_INTENT_SCHEME))); Loading @@ -71,12 +72,12 @@ public class NoteListWidget extends AppWidgetProvider { views.setEmptyView(R.id.note_list_widget_lv, R.id.widget_note_list_placeholder_tv); appWidgetManager.updateAppWidget(appWidgetId, views); } super.onUpdate(context, appWidgetManager, appWidgetIds); } @Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); AppWidgetManager awm = AppWidgetManager.getInstance(context); int appWidgetIds[] = awm.getAppWidgetIds(new ComponentName(context, NoteListWidget.class)); Loading @@ -85,8 +86,6 @@ public class NoteListWidget extends AppWidgetProvider { awm.notifyAppWidgetViewDataChanged(appWidgetId, R.id.note_list_widget_lv); } } super.onReceive(context, intent); } @Override Loading Loading
app/build.gradle +6 −4 Original line number Diff line number Diff line Loading @@ -8,8 +8,8 @@ android { applicationId "it.niedermann.owncloud.notes" minSdkVersion 14 targetSdkVersion 27 versionCode 28 versionName "0.16.1" versionCode 32 versionName "0.20.0" } buildTypes { release { Loading @@ -26,8 +26,10 @@ android { dependencies { implementation project(':cert4android') implementation 'com.yydcdut:rxmarkdown:0.1.1-beta' implementation 'io.reactivex:rxandroid:1.2.0' implementation 'io.reactivex:rxjava:1.1.5' implementation 'com.yydcdut:markdown-processor:0.1.3' implementation 'com.yydcdut:rxmarkdown-wrapper:0.1.3' implementation 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' Loading
app/src/main/java/it/niedermann/owncloud/notes/android/activity/EditNoteActivity.java +1 −5 Original line number Diff line number Diff line Loading @@ -149,7 +149,6 @@ public class EditNoteActivity extends AppCompatActivity implements BaseNoteFragm @Override public void onBackPressed() { fragment.onPrepareClose(); close(); } Loading @@ -163,15 +162,12 @@ public class EditNoteActivity extends AppCompatActivity implements BaseNoteFragm public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: fragment.onPrepareClose(); close(); return true; case R.id.menu_preview: fragment.onPrepareClose(); launchExistingNote(getNoteId(), false); return true; case R.id.menu_edit: fragment.onPrepareClose(); launchExistingNote(getNoteId(), true); return true; default: Loading @@ -194,7 +190,7 @@ public class EditNoteActivity extends AppCompatActivity implements BaseNoteFragm } else { preferences.edit().putString(prefKeyLastMode, getString(R.string.pref_value_mode_preview)).apply(); } fragment.onFinalClose(); fragment.onCloseNote(); finish(); } Loading
app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java +38 −20 Original line number Diff line number Diff line Loading @@ -2,11 +2,14 @@ package it.niedermann.owncloud.notes.android.activity; import android.app.SearchManager; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.graphics.Canvas; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; Loading Loading @@ -331,10 +334,12 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap } private void setupNavigationMenu() { final NavigationAdapter.NavigationItem itemTrashbin = new NavigationAdapter.NavigationItem("trashbin", getString(R.string.action_trashbin), null, R.drawable.ic_delete_grey600_24dp); final NavigationAdapter.NavigationItem itemSettings = new NavigationAdapter.NavigationItem("settings", getString(R.string.action_settings), null, R.drawable.ic_settings_grey600_24dp); final NavigationAdapter.NavigationItem itemAbout = new NavigationAdapter.NavigationItem("about", getString(R.string.simple_about), null, R.drawable.ic_info_outline_grey600_24dp); ArrayList<NavigationAdapter.NavigationItem> itemsMenu = new ArrayList<>(); itemsMenu.add(itemTrashbin); itemsMenu.add(itemSettings); itemsMenu.add(itemAbout); Loading @@ -347,6 +352,10 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap } else if (item == itemAbout) { Intent aboutIntent = new Intent(getApplicationContext(), AboutActivity.class); startActivityForResult(aboutIntent, about); } else if (item == itemTrashbin) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); String url = preferences.getString(SettingsActivity.SETTINGS_URL, SettingsActivity.DEFAULT_SETTINGS); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url + "index.php/apps/files/?dir=/&view=trashbin"))); } } Loading Loading @@ -390,13 +399,14 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap */ @Override public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { if (direction == ItemTouchHelper.LEFT || direction == ItemTouchHelper.RIGHT) { switch(direction) { case ItemTouchHelper.LEFT: { final DBNote dbNote = (DBNote) adapter.getItem(viewHolder.getAdapterPosition()); db.deleteNoteAndSync((dbNote).getId()); adapter.remove(dbNote); refreshLists(); Log.v("Note", "Item deleted through swipe ----------------------------------------------"); Snackbar.make(swipeRefreshLayout, R.string.action_note_deleted, 7 * 1000) Snackbar.make(swipeRefreshLayout, R.string.action_note_deleted, Snackbar.LENGTH_LONG) .setAction(R.string.action_undo, new View.OnClickListener() { @Override public void onClick(View v) { Loading @@ -407,14 +417,22 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap } }) .show(); break; } case ItemTouchHelper.RIGHT: { final DBNote dbNote = (DBNote) adapter.getItem(viewHolder.getAdapterPosition()); db.toggleFavorite(dbNote, null); refreshLists(); break; } } } @Override public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) { ItemAdapter.NoteViewHolder noteViewHolder = (ItemAdapter.NoteViewHolder) viewHolder; // show delete icon on the right side noteViewHolder.showSwipeDelete(dX > 0); // show swipe icon on the side noteViewHolder.showSwipe(dX>0); // move only swipeable part of item (not leave-behind) getDefaultUIUtil().onDraw(c, recyclerView, noteViewHolder.noteSwipeable, dX, dY, actionState, isCurrentlyActive); } Loading Loading @@ -558,7 +576,6 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap db = NoteSQLiteOpenHelper.getInstance(this); if (db.getNoteServerSyncHelper().isSyncPossible()) { adapter.removeAll(); swipeRefreshLayout.setRefreshing(true); synchronize(); } else { Toast.makeText(getApplicationContext(), getString(R.string.error_sync, getString(NotesClientUtil.LoginStatus.NO_NETWORK.str)), Toast.LENGTH_LONG).show(); Loading Loading @@ -633,6 +650,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap } private void synchronize() { swipeRefreshLayout.setRefreshing(true); db.getNoteServerSyncHelper().addCallbackPull(syncCallBack); db.getNoteServerSyncHelper().scheduleSync(false); } Loading
app/src/main/java/it/niedermann/owncloud/notes/android/activity/SettingsActivity.java +8 −9 Original line number Diff line number Diff line Loading @@ -76,6 +76,13 @@ public class SettingsActivity extends AppCompatActivity { } } field_url.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { new URLValidatorAsyncTask().execute(NotesClientUtil.formatURL(field_url.getText().toString())); } }); field_url.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { Loading @@ -83,15 +90,7 @@ public class SettingsActivity extends AppCompatActivity { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { String url = field_url.getText().toString().trim(); if (!url.endsWith("/")) { url += "/"; } if (!url.startsWith("http://") && !url.startsWith("https://")) { url = "https://" + url; } new URLValidatorAsyncTask().execute(url); String url = NotesClientUtil.formatURL(field_url.getText().toString()); if (NotesClientUtil.isHttp(url)) { urlWarnHttp.setVisibility(View.VISIBLE); Loading
app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidget.java +4 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ public class NoteListWidget extends AppWidgetProvider { @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); for (int appWidgetId : appWidgetIds) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); Loading Loading @@ -62,7 +63,7 @@ public class NoteListWidget extends AppWidgetProvider { 0, templateIntent, PendingIntent.FLAG_UPDATE_CURRENT); if (displayMode == 2) { if (displayMode == NLW_DISPLAY_CATEGORY) { serviceIntent.putExtra(NoteListWidget.WIDGET_CATEGORY_KEY + appWidgetId, category); } serviceIntent.setData(Uri.parse(serviceIntent.toUri(Intent.URI_INTENT_SCHEME))); Loading @@ -71,12 +72,12 @@ public class NoteListWidget extends AppWidgetProvider { views.setEmptyView(R.id.note_list_widget_lv, R.id.widget_note_list_placeholder_tv); appWidgetManager.updateAppWidget(appWidgetId, views); } super.onUpdate(context, appWidgetManager, appWidgetIds); } @Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); AppWidgetManager awm = AppWidgetManager.getInstance(context); int appWidgetIds[] = awm.getAppWidgetIds(new ComponentName(context, NoteListWidget.class)); Loading @@ -85,8 +86,6 @@ public class NoteListWidget extends AppWidgetProvider { awm.notifyAppWidgetViewDataChanged(appWidgetId, R.id.note_list_widget_lv); } } super.onReceive(context, intent); } @Override Loading