Skip to content

Commit

Permalink
Merge branch 'hotfix/6.2.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
federicoiosue committed May 31, 2023
2 parents 4942ac4 + 05e2e10 commit 0dadca0
Show file tree
Hide file tree
Showing 34 changed files with 161 additions and 207 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
VERSION_NAME=6.2.7
VERSION_CODE=322
VERSION_NAME=6.2.8
VERSION_CODE=323
PACKAGE=it.feio.android.omninotes
MIN_SDK=21
TARGET_SDK=31
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

public class AboutActivity extends BaseActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void requestPassword(final Activity mActivity, List<Note> notes,

boolean askForPassword = false;
for (Note note : notes) {
if (note.isLocked()) {
if (Boolean.TRUE.equals(note.isLocked())) {
askForPassword = true;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ public class BaseFragment extends Fragment {
private static final long OPTIONS_ITEM_CLICK_DELAY_TIME = 1000;
private long mLastClickTime;

@Override
public void onDestroy() {
super.onDestroy();
}

protected boolean isOptionsItemFastClick() {
if (SystemClock.elapsedRealtime() - mLastClickTime < OPTIONS_ITEM_CLICK_DELAY_TIME) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.view.WindowManager;

Expand Down Expand Up @@ -89,7 +90,7 @@ private void resetWindowSize() {
Window window = getWindow();
WindowManager.LayoutParams params = window.getAttributes();
params.width = (int) (screen.x * 0.6);
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
params.height = LayoutParams.WRAP_CONTENT;
window.setAttributes(params);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
import static it.feio.android.omninotes.BaseActivity.TRANSITION_HORIZONTAL;
import static it.feio.android.omninotes.BaseActivity.TRANSITION_VERTICAL;
import static it.feio.android.omninotes.MainActivity.FRAGMENT_DETAIL_TAG;
import static it.feio.android.omninotes.MainActivity.FRAGMENT_SKETCH_TAG;
import static it.feio.android.omninotes.OmniNotes.getAppContext;
import static it.feio.android.omninotes.helpers.GeocodeProviderBaseFactory.checkHighAccuracyLocationProvider;
import static it.feio.android.omninotes.helpers.GeocodeProviderBaseFactory.getProvider;
import static it.feio.android.omninotes.utils.ConstantsBase.ACTION_DISMISS;
import static it.feio.android.omninotes.utils.ConstantsBase.ACTION_FAB_TAKE_PHOTO;
import static it.feio.android.omninotes.utils.ConstantsBase.ACTION_MERGE;
Expand Down Expand Up @@ -116,11 +119,19 @@
import androidx.fragment.app.FragmentTransaction;
import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.LocationSettingsRequest;
import com.google.android.gms.location.LocationSettingsResult;
import com.google.android.gms.tasks.Task;
import com.neopixl.pixlui.components.edittext.EditText;
import com.pixplicity.easyprefs.library.Prefs;
import com.pushbullet.android.extension.MessagingExtension;
import de.greenrobot.event.EventBus;
import de.keyboardsurfer.android.widget.crouton.Style;
import io.nlopez.smartlocation.location.LocationProvider;
import it.feio.android.checklistview.exceptions.ViewNotSupportedException;
import it.feio.android.checklistview.interfaces.CheckListChangedListener;
import it.feio.android.checklistview.models.CheckListView;
Expand Down Expand Up @@ -149,6 +160,7 @@
import it.feio.android.omninotes.models.Category;
import it.feio.android.omninotes.models.Note;
import it.feio.android.omninotes.models.ONStyle;
import it.feio.android.omninotes.models.PasswordValidator.Result;
import it.feio.android.omninotes.models.Tag;
import it.feio.android.omninotes.models.adapters.AttachmentAdapter;
import it.feio.android.omninotes.models.adapters.CategoryRecyclerViewAdapter;
Expand Down Expand Up @@ -241,9 +253,9 @@ public class DetailFragment extends BaseFragment implements OnReminderPickedList
private int contentCursorPosition;
private ArrayList<String> mergedNotesIds;
private MainActivity mainActivity;
TextLinkClickListener textLinkClickListener = new TextLinkClickListener() {
@Override
public void onTextLinkClick(View view, final String clickedString, final String url) {
private boolean activityPausing;

TextLinkClickListener textLinkClickListener = (view, clickedString, url) -> {
new MaterialDialog.Builder(mainActivity)
.content(clickedString)
.negativeColorRes(R.color.colorPrimary)
Expand All @@ -267,16 +279,15 @@ public void onTextLinkClick(View view, final String clickedString, final String
clickedString);
clipboard.setPrimaryClip(clip);
}).build().show();
View clickedView = noteTmp.isChecklist() ? toggleChecklistView : binding.contentWrapper;
View clickedView =
Boolean.TRUE.equals(noteTmp.isChecklist()) ? toggleChecklistView : binding.contentWrapper;
clickedView.clearFocus();
KeyboardUtils.hideKeyboard(clickedView);
new Handler().post(() -> {
View clickedView1 = noteTmp.isChecklist() ? toggleChecklistView : binding.contentWrapper;
View clickedView1 = Boolean.TRUE.equals(noteTmp.isChecklist()) ? toggleChecklistView : binding.contentWrapper;
KeyboardUtils.hideKeyboard(clickedView1);
});
}
};
private boolean activityPausing;

@Override
public void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -419,7 +430,7 @@ private void init() {
noteTmp = new Note(note);
}

if (noteTmp.isLocked() && !noteTmp.isPasswordChecked()) {
if (Boolean.TRUE.equals(noteTmp.isLocked()) && !noteTmp.isPasswordChecked()) {
checkNoteLock(noteTmp);
return;
}
Expand All @@ -432,8 +443,8 @@ private void init() {
*/
private void checkNoteLock(Note note) {
// If note is locked security password will be requested
if (note.isLocked()
&& Prefs.getString(PREF_PASSWORD, null) != null
if (Boolean.TRUE.equals(note.isLocked()
&& Prefs.getString(PREF_PASSWORD, null) != null)
&& !Prefs.getBoolean("settings_password_access", false)) {
PasswordHelper.requestPassword(mainActivity, passwordConfirmed -> {
switch (passwordConfirmed) {
Expand Down Expand Up @@ -720,8 +731,7 @@ private void initViewAttachments() {
mGridView = binding.detailRoot.findViewById(R.id.gridview);

// Some fields can be filled by third party application and are always shown
mAttachmentAdapter = new AttachmentAdapter(mainActivity, noteTmp.getAttachmentsList(),
mGridView);
mAttachmentAdapter = new AttachmentAdapter(mainActivity, noteTmp.getAttachmentsList());

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

public void onLocationNotEnabled(){
mainActivity.showMessage(R.string.location_not_enabled, ONStyle.ALERT);
}
@Override
public void onAddressResolved(String address) {
if (TextUtils.isEmpty(address)) {
Expand Down Expand Up @@ -1364,7 +1374,7 @@ private void takeSketch(Attachment attachment) {
b.putParcelable("base", attachment.getUri());
}
mSketchFragment.setArguments(b);
transaction.replace(R.id.fragment_container, mSketchFragment, mainActivity.FRAGMENT_SKETCH_TAG)
transaction.replace(R.id.fragment_container, mSketchFragment, FRAGMENT_SKETCH_TAG)
.addToBackStack(FRAGMENT_DETAIL_TAG).commit();
}

Expand Down Expand Up @@ -1632,7 +1642,7 @@ private String getNoteTitle() {

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

// Password will be requested here
PasswordHelper.requestPassword(mainActivity, passwordConfirmed -> {
switch (passwordConfirmed) {
case SUCCEED:
lockUnlock();
break;
default:
break;
if (passwordConfirmed == Result.SUCCEED) {
lockUnlock();
}
});
}
Expand Down Expand Up @@ -1996,7 +2002,7 @@ private void removeAttachment(int position) {

private void removeAllAttachments() {
noteTmp.setAttachmentsList(new ArrayList<>());
mAttachmentAdapter = new AttachmentAdapter(mainActivity, new ArrayList<>(), mGridView);
mAttachmentAdapter = new AttachmentAdapter(mainActivity, new ArrayList<>());
mGridView.invalidateViews();
mGridView.setAdapter(mAttachmentAdapter);
}
Expand Down Expand Up @@ -2049,7 +2055,7 @@ public void onCheckListChanged() {
}

private void scrollContent() {
if (noteTmp.isChecklist()) {
if (Boolean.TRUE.equals(noteTmp.isChecklist())) {
if (mChecklistManager.getCount() > contentLineCounter) {
binding.contentWrapper.scrollBy(0, 60);
}
Expand Down Expand Up @@ -2219,7 +2225,10 @@ public void onCoordinatesResolved(Location location, String address) {
public void onLocationUnavailable() {
mainActivityWeakReference.get().showMessage(R.string.location_not_found, ONStyle.ALERT);
}

@Override
public void onLocationNotEnabled(){
mainActivityWeakReference.get().showMessage(R.string.location_not_enabled,ONStyle.ALERT);
}
@Override
public void onLocationRetrieved(Location location) {
if (!checkWeakReferences()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ private void handleIntents() {
}

if (ACTION_RESTART_APP.equals(i.getAction())) {
SystemHelper.restartApp(getApplicationContext(), MainActivity.class);
SystemHelper.restartApp();
}

if (receivedIntent(i)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ R.string.permission_external_storage, getActivity().findViewById(R.id.crouton_ha
+ languageName.substring(1));
lang.setOnPreferenceChangeListener((preference, value) -> {
LanguageHelper.updateLanguage(getActivity(), value.toString());
SystemHelper.restartApp(getActivity().getApplicationContext(), MainActivity.class);
SystemHelper.restartApp();
return false;
});
}
Expand Down Expand Up @@ -528,7 +528,7 @@ R.string.permission_external_storage, getActivity().findViewById(R.id.crouton_ha
File cacheDir = StorageHelper.getCacheDir(getActivity());
StorageHelper.delete(getActivity(), cacheDir.getAbsolutePath());
Prefs.edit().clear().apply();
SystemHelper.restartApp(getActivity().getApplicationContext(), MainActivity.class);
SystemHelper.restartApp();
}).build().show();

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package it.feio.android.omninotes;

import static android.content.Context.LAYOUT_INFLATER_SERVICE;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
Expand Down Expand Up @@ -147,11 +149,11 @@ private void askForErase() {

// Inflate the popup_layout.XML
LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(
AppCompatActivity.LAYOUT_INFLATER_SERVICE);
LAYOUT_INFLATER_SERVICE);
popupLayout = inflater.inflate(R.layout.popup_sketch_stroke, null);
// And the one for eraser
LayoutInflater inflaterEraser = (LayoutInflater) getActivity().getSystemService(
AppCompatActivity.LAYOUT_INFLATER_SERVICE);
LAYOUT_INFLATER_SERVICE);
popupEraserLayout = inflaterEraser.inflate(R.layout.popup_sketch_eraser, null);

// Actual stroke shape size is retrieved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ protected Attachment doInBackground(Void... params) {


@Override
@Deprecated
protected void onPostExecute(Attachment mAttachment) {
if (isAlive()) {
if (mAttachment != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package it.feio.android.omninotes.async;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -59,7 +60,7 @@ protected void onPreExecute() {
super.onPreExecute();
mDrawerList = mainActivity.findViewById(R.id.drawer_nav_list);
LayoutInflater inflater = (LayoutInflater) mainActivity
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

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

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


@Override
@Deprecated
protected void onPostExecute(final List<Category> categories) {
if (isAlive()) {
mDrawerCategoriesList.setAdapter(new CategoryBaseAdapter(mainActivity, categories,
Expand Down
Loading

0 comments on commit 0dadca0

Please sign in to comment.