Skip to content

Commit 0dadca0

Browse files
committed
Merge branch 'hotfix/6.2.8'
2 parents 4942ac4 + 05e2e10 commit 0dadca0

34 files changed

+161
-207
lines changed

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
# You should have received a copy of the GNU General Public License
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
#
17-
VERSION_NAME=6.2.7
18-
VERSION_CODE=322
17+
VERSION_NAME=6.2.8
18+
VERSION_CODE=323
1919
PACKAGE=it.feio.android.omninotes
2020
MIN_SDK=21
2121
TARGET_SDK=31

omniNotes/src/androidTest/java/it/feio/android/omninotes/utils/SecurityTest.java

Lines changed: 0 additions & 65 deletions
This file was deleted.

omniNotes/src/main/java/it/feio/android/omninotes/AboutActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
public class AboutActivity extends BaseActivity {
2525

26+
@Override
2627
protected void onCreate(Bundle savedInstanceState) {
2728
super.onCreate(savedInstanceState);
2829
setContentView(R.layout.activity_about);

omniNotes/src/main/java/it/feio/android/omninotes/BaseActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void requestPassword(final Activity mActivity, List<Note> notes,
9696

9797
boolean askForPassword = false;
9898
for (Note note : notes) {
99-
if (note.isLocked()) {
99+
if (Boolean.TRUE.equals(note.isLocked())) {
100100
askForPassword = true;
101101
break;
102102
}

omniNotes/src/main/java/it/feio/android/omninotes/BaseFragment.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ public class BaseFragment extends Fragment {
2626
private static final long OPTIONS_ITEM_CLICK_DELAY_TIME = 1000;
2727
private long mLastClickTime;
2828

29-
@Override
30-
public void onDestroy() {
31-
super.onDestroy();
32-
}
33-
3429
protected boolean isOptionsItemFastClick() {
3530
if (SystemClock.elapsedRealtime() - mLastClickTime < OPTIONS_ITEM_CLICK_DELAY_TIME) {
3631
return true;

omniNotes/src/main/java/it/feio/android/omninotes/CategoryActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import android.os.Bundle;
2727
import android.text.TextUtils;
2828
import android.view.View;
29+
import android.view.ViewGroup.LayoutParams;
2930
import android.view.Window;
3031
import android.view.WindowManager;
3132

@@ -89,7 +90,7 @@ private void resetWindowSize() {
8990
Window window = getWindow();
9091
WindowManager.LayoutParams params = window.getAttributes();
9192
params.width = (int) (screen.x * 0.6);
92-
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
93+
params.height = LayoutParams.WRAP_CONTENT;
9394
window.setAttributes(params);
9495
}
9596

omniNotes/src/main/java/it/feio/android/omninotes/DetailFragment.java

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
import static it.feio.android.omninotes.BaseActivity.TRANSITION_HORIZONTAL;
2424
import static it.feio.android.omninotes.BaseActivity.TRANSITION_VERTICAL;
2525
import static it.feio.android.omninotes.MainActivity.FRAGMENT_DETAIL_TAG;
26+
import static it.feio.android.omninotes.MainActivity.FRAGMENT_SKETCH_TAG;
2627
import static it.feio.android.omninotes.OmniNotes.getAppContext;
28+
import static it.feio.android.omninotes.helpers.GeocodeProviderBaseFactory.checkHighAccuracyLocationProvider;
29+
import static it.feio.android.omninotes.helpers.GeocodeProviderBaseFactory.getProvider;
2730
import static it.feio.android.omninotes.utils.ConstantsBase.ACTION_DISMISS;
2831
import static it.feio.android.omninotes.utils.ConstantsBase.ACTION_FAB_TAKE_PHOTO;
2932
import static it.feio.android.omninotes.utils.ConstantsBase.ACTION_MERGE;
@@ -116,11 +119,19 @@
116119
import androidx.fragment.app.FragmentTransaction;
117120
import com.afollestad.materialdialogs.DialogAction;
118121
import com.afollestad.materialdialogs.MaterialDialog;
122+
import com.google.android.gms.common.api.GoogleApiClient;
123+
import com.google.android.gms.common.api.PendingResult;
124+
import com.google.android.gms.location.LocationRequest;
125+
import com.google.android.gms.location.LocationServices;
126+
import com.google.android.gms.location.LocationSettingsRequest;
127+
import com.google.android.gms.location.LocationSettingsResult;
128+
import com.google.android.gms.tasks.Task;
119129
import com.neopixl.pixlui.components.edittext.EditText;
120130
import com.pixplicity.easyprefs.library.Prefs;
121131
import com.pushbullet.android.extension.MessagingExtension;
122132
import de.greenrobot.event.EventBus;
123133
import de.keyboardsurfer.android.widget.crouton.Style;
134+
import io.nlopez.smartlocation.location.LocationProvider;
124135
import it.feio.android.checklistview.exceptions.ViewNotSupportedException;
125136
import it.feio.android.checklistview.interfaces.CheckListChangedListener;
126137
import it.feio.android.checklistview.models.CheckListView;
@@ -149,6 +160,7 @@
149160
import it.feio.android.omninotes.models.Category;
150161
import it.feio.android.omninotes.models.Note;
151162
import it.feio.android.omninotes.models.ONStyle;
163+
import it.feio.android.omninotes.models.PasswordValidator.Result;
152164
import it.feio.android.omninotes.models.Tag;
153165
import it.feio.android.omninotes.models.adapters.AttachmentAdapter;
154166
import it.feio.android.omninotes.models.adapters.CategoryRecyclerViewAdapter;
@@ -241,9 +253,9 @@ public class DetailFragment extends BaseFragment implements OnReminderPickedList
241253
private int contentCursorPosition;
242254
private ArrayList<String> mergedNotesIds;
243255
private MainActivity mainActivity;
244-
TextLinkClickListener textLinkClickListener = new TextLinkClickListener() {
245-
@Override
246-
public void onTextLinkClick(View view, final String clickedString, final String url) {
256+
private boolean activityPausing;
257+
258+
TextLinkClickListener textLinkClickListener = (view, clickedString, url) -> {
247259
new MaterialDialog.Builder(mainActivity)
248260
.content(clickedString)
249261
.negativeColorRes(R.color.colorPrimary)
@@ -267,16 +279,15 @@ public void onTextLinkClick(View view, final String clickedString, final String
267279
clickedString);
268280
clipboard.setPrimaryClip(clip);
269281
}).build().show();
270-
View clickedView = noteTmp.isChecklist() ? toggleChecklistView : binding.contentWrapper;
282+
View clickedView =
283+
Boolean.TRUE.equals(noteTmp.isChecklist()) ? toggleChecklistView : binding.contentWrapper;
271284
clickedView.clearFocus();
272285
KeyboardUtils.hideKeyboard(clickedView);
273286
new Handler().post(() -> {
274-
View clickedView1 = noteTmp.isChecklist() ? toggleChecklistView : binding.contentWrapper;
287+
View clickedView1 = Boolean.TRUE.equals(noteTmp.isChecklist()) ? toggleChecklistView : binding.contentWrapper;
275288
KeyboardUtils.hideKeyboard(clickedView1);
276289
});
277-
}
278290
};
279-
private boolean activityPausing;
280291

281292
@Override
282293
public void onCreate(Bundle savedInstanceState) {
@@ -419,7 +430,7 @@ private void init() {
419430
noteTmp = new Note(note);
420431
}
421432

422-
if (noteTmp.isLocked() && !noteTmp.isPasswordChecked()) {
433+
if (Boolean.TRUE.equals(noteTmp.isLocked()) && !noteTmp.isPasswordChecked()) {
423434
checkNoteLock(noteTmp);
424435
return;
425436
}
@@ -432,8 +443,8 @@ private void init() {
432443
*/
433444
private void checkNoteLock(Note note) {
434445
// If note is locked security password will be requested
435-
if (note.isLocked()
436-
&& Prefs.getString(PREF_PASSWORD, null) != null
446+
if (Boolean.TRUE.equals(note.isLocked()
447+
&& Prefs.getString(PREF_PASSWORD, null) != null)
437448
&& !Prefs.getBoolean("settings_password_access", false)) {
438449
PasswordHelper.requestPassword(mainActivity, passwordConfirmed -> {
439450
switch (passwordConfirmed) {
@@ -720,8 +731,7 @@ private void initViewAttachments() {
720731
mGridView = binding.detailRoot.findViewById(R.id.gridview);
721732

722733
// Some fields can be filled by third party application and are always shown
723-
mAttachmentAdapter = new AttachmentAdapter(mainActivity, noteTmp.getAttachmentsList(),
724-
mGridView);
734+
mAttachmentAdapter = new AttachmentAdapter(mainActivity, noteTmp.getAttachmentsList());
725735

726736
// Initialzation of gridview for images
727737
mGridView.setAdapter(mAttachmentAdapter);
@@ -855,10 +865,7 @@ private void initViewTitle() {
855865
binding.detailTitle.gatherLinksForText();
856866
binding.detailTitle.setOnTextLinkClickListener(textLinkClickListener);
857867
// To avoid dropping here the dragged checklist items
858-
binding.detailTitle.setOnDragListener((v, event) -> {
859-
// ((View)event.getLocalState()).setVisibility(View.VISIBLE);
860-
return true;
861-
});
868+
binding.detailTitle.setOnDragListener((v, event) -> true);
862869
//When editor action is pressed focus is moved to last character in content field
863870
binding.detailTitle.setOnEditorActionListener((v, actionId, event) -> {
864871
binding.fragmentDetailContent.detailContent.requestFocus();
@@ -954,6 +961,9 @@ public void onLocationUnavailable() {
954961
mainActivity.showMessage(R.string.location_not_found, ONStyle.ALERT);
955962
}
956963

964+
public void onLocationNotEnabled(){
965+
mainActivity.showMessage(R.string.location_not_enabled, ONStyle.ALERT);
966+
}
957967
@Override
958968
public void onAddressResolved(String address) {
959969
if (TextUtils.isEmpty(address)) {
@@ -1364,7 +1374,7 @@ private void takeSketch(Attachment attachment) {
13641374
b.putParcelable("base", attachment.getUri());
13651375
}
13661376
mSketchFragment.setArguments(b);
1367-
transaction.replace(R.id.fragment_container, mSketchFragment, mainActivity.FRAGMENT_SKETCH_TAG)
1377+
transaction.replace(R.id.fragment_container, mSketchFragment, FRAGMENT_SKETCH_TAG)
13681378
.addToBackStack(FRAGMENT_DETAIL_TAG).commit();
13691379
}
13701380

@@ -1632,7 +1642,7 @@ private String getNoteTitle() {
16321642

16331643
private String getNoteContent() {
16341644
String contentText = "";
1635-
if (!noteTmp.isChecklist()) {
1645+
if (Boolean.FALSE.equals(noteTmp.isChecklist())) {
16361646
// Due to checklist library introduction the returned EditText class is no more a
16371647
// com.neopixl.pixlui.components.edittext.EditText but a standard android.widget.EditText
16381648
View contentView = binding.detailRoot.findViewById(R.id.detail_content);
@@ -1681,12 +1691,8 @@ private void lockNote() {
16811691

16821692
// Password will be requested here
16831693
PasswordHelper.requestPassword(mainActivity, passwordConfirmed -> {
1684-
switch (passwordConfirmed) {
1685-
case SUCCEED:
1686-
lockUnlock();
1687-
break;
1688-
default:
1689-
break;
1694+
if (passwordConfirmed == Result.SUCCEED) {
1695+
lockUnlock();
16901696
}
16911697
});
16921698
}
@@ -1996,7 +2002,7 @@ private void removeAttachment(int position) {
19962002

19972003
private void removeAllAttachments() {
19982004
noteTmp.setAttachmentsList(new ArrayList<>());
1999-
mAttachmentAdapter = new AttachmentAdapter(mainActivity, new ArrayList<>(), mGridView);
2005+
mAttachmentAdapter = new AttachmentAdapter(mainActivity, new ArrayList<>());
20002006
mGridView.invalidateViews();
20012007
mGridView.setAdapter(mAttachmentAdapter);
20022008
}
@@ -2049,7 +2055,7 @@ public void onCheckListChanged() {
20492055
}
20502056

20512057
private void scrollContent() {
2052-
if (noteTmp.isChecklist()) {
2058+
if (Boolean.TRUE.equals(noteTmp.isChecklist())) {
20532059
if (mChecklistManager.getCount() > contentLineCounter) {
20542060
binding.contentWrapper.scrollBy(0, 60);
20552061
}
@@ -2219,7 +2225,10 @@ public void onCoordinatesResolved(Location location, String address) {
22192225
public void onLocationUnavailable() {
22202226
mainActivityWeakReference.get().showMessage(R.string.location_not_found, ONStyle.ALERT);
22212227
}
2222-
2228+
@Override
2229+
public void onLocationNotEnabled(){
2230+
mainActivityWeakReference.get().showMessage(R.string.location_not_enabled,ONStyle.ALERT);
2231+
}
22232232
@Override
22242233
public void onLocationRetrieved(Location location) {
22252234
if (!checkWeakReferences()) {

omniNotes/src/main/java/it/feio/android/omninotes/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ private void handleIntents() {
387387
}
388388

389389
if (ACTION_RESTART_APP.equals(i.getAction())) {
390-
SystemHelper.restartApp(getApplicationContext(), MainActivity.class);
390+
SystemHelper.restartApp();
391391
}
392392

393393
if (receivedIntent(i)) {

omniNotes/src/main/java/it/feio/android/omninotes/SettingsFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ R.string.permission_external_storage, getActivity().findViewById(R.id.crouton_ha
384384
+ languageName.substring(1));
385385
lang.setOnPreferenceChangeListener((preference, value) -> {
386386
LanguageHelper.updateLanguage(getActivity(), value.toString());
387-
SystemHelper.restartApp(getActivity().getApplicationContext(), MainActivity.class);
387+
SystemHelper.restartApp();
388388
return false;
389389
});
390390
}
@@ -528,7 +528,7 @@ R.string.permission_external_storage, getActivity().findViewById(R.id.crouton_ha
528528
File cacheDir = StorageHelper.getCacheDir(getActivity());
529529
StorageHelper.delete(getActivity(), cacheDir.getAbsolutePath());
530530
Prefs.edit().clear().apply();
531-
SystemHelper.restartApp(getActivity().getApplicationContext(), MainActivity.class);
531+
SystemHelper.restartApp();
532532
}).build().show();
533533

534534
return false;

omniNotes/src/main/java/it/feio/android/omninotes/SketchFragment.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package it.feio.android.omninotes;
1919

20+
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
21+
2022
import android.graphics.Bitmap;
2123
import android.graphics.BitmapFactory;
2224
import android.graphics.drawable.BitmapDrawable;
@@ -147,11 +149,11 @@ private void askForErase() {
147149

148150
// Inflate the popup_layout.XML
149151
LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(
150-
AppCompatActivity.LAYOUT_INFLATER_SERVICE);
152+
LAYOUT_INFLATER_SERVICE);
151153
popupLayout = inflater.inflate(R.layout.popup_sketch_stroke, null);
152154
// And the one for eraser
153155
LayoutInflater inflaterEraser = (LayoutInflater) getActivity().getSystemService(
154-
AppCompatActivity.LAYOUT_INFLATER_SERVICE);
156+
LAYOUT_INFLATER_SERVICE);
155157
popupEraserLayout = inflaterEraser.inflate(R.layout.popup_sketch_eraser, null);
156158

157159
// Actual stroke shape size is retrieved

omniNotes/src/main/java/it/feio/android/omninotes/async/AttachmentTask.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ protected Attachment doInBackground(Void... params) {
6262

6363

6464
@Override
65+
@Deprecated
6566
protected void onPostExecute(Attachment mAttachment) {
6667
if (isAlive()) {
6768
if (mAttachment != null) {

omniNotes/src/main/java/it/feio/android/omninotes/async/CategoryMenuTask.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package it.feio.android.omninotes.async;
1919

2020
import android.app.Activity;
21+
import android.content.Context;
2122
import android.content.Intent;
2223
import android.os.AsyncTask;
2324
import android.view.LayoutInflater;
@@ -59,7 +60,7 @@ protected void onPreExecute() {
5960
super.onPreExecute();
6061
mDrawerList = mainActivity.findViewById(R.id.drawer_nav_list);
6162
LayoutInflater inflater = (LayoutInflater) mainActivity
62-
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
63+
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
6364

6465
settingsView = mainActivity.findViewById(R.id.settings_view);
6566

@@ -88,6 +89,7 @@ protected List<Category> doInBackground(Void... params) {
8889

8990

9091
@Override
92+
@Deprecated
9193
protected void onPostExecute(final List<Category> categories) {
9294
if (isAlive()) {
9395
mDrawerCategoriesList.setAdapter(new CategoryBaseAdapter(mainActivity, categories,

0 commit comments

Comments
 (0)