Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Option to render MD by default and other improvements/fixes #27

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.biometric.BiometricManager;
import com.swatian.nexnotes.helpers.AppSettingsInit;
import com.swatian.nexnotes.helpers.Utils;

Expand Down Expand Up @@ -50,14 +51,19 @@ private String getCurrentLocaleFromPreferences(Context context) {
public void onResume() {
super.onResume();

if (Boolean.parseBoolean(
AppSettingsInit.getSettingsValue(ctx, AppSettingsInit.APP_BIOMETRIC_KEY))
&& !Boolean.parseBoolean(
AppSettingsInit.getSettingsValue(
ctx, AppSettingsInit.APP_BIOMETRIC_LIFE_CYCLE_KEY))) {

Intent unlockIntent = new Intent(ctx, BiometricLockActivity.class);
ctx.startActivity(unlockIntent);
if (BiometricManager.from(ctx)
.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_WEAK)
== BiometricManager.BIOMETRIC_SUCCESS) {
if (Boolean.parseBoolean(
AppSettingsInit.getSettingsValue(
ctx, AppSettingsInit.APP_BIOMETRIC_KEY))
&& !Boolean.parseBoolean(
AppSettingsInit.getSettingsValue(
ctx, AppSettingsInit.APP_BIOMETRIC_LIFE_CYCLE_KEY))) {

Intent unlockIntent = new Intent(ctx, BiometricLockActivity.class);
ctx.startActivity(unlockIntent);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.swatian.nexnotes.activities;

import android.content.Context;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
Expand All @@ -16,8 +15,6 @@
*/
public class BiometricLockActivity extends AppCompatActivity {

protected Context ctx = this;

@Override
public void onCreate(Bundle savedInstanceState) {

Expand Down Expand Up @@ -45,7 +42,7 @@ public void onAuthenticationError(

super.onAuthenticationError(errorCode, errString);

// Authentication error, close the app
MainActivity.closeActivity = true;
finish();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
public class MainActivity extends BaseActivity implements BottomSheetListener {

private ActivityMainBinding binding;
public static boolean closeActivity = false;

@Override
public void onCreate(Bundle savedInstanceState) {
Expand All @@ -33,4 +34,14 @@ public void onCreate(Bundle savedInstanceState) {

@Override
public void onClickedAction(String text) {}

@Override
public void onResume() {
super.onResume();

if (closeActivity) {
finishAndRemoveTask();
closeActivity = false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ protected BaseApi(Context context) {
nexNotesDatabase = NexNotesDatabase.getDatabaseInstance(context);
}

@SuppressWarnings("unchecked")
public static <T extends BaseApi> T getInstance(
@NonNull Context context, @NonNull Class<T> clazz) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import androidx.room.Insert;
import androidx.room.Query;
import com.swatian.nexnotes.datastore.models.NoteTopics;
import com.swatian.nexnotes.datastore.models.Topics;
import java.util.List;

/**
Expand All @@ -17,9 +16,6 @@ public interface NoteTopicDao {
@Insert
long insertNoteTopic(NoteTopics noteTopics);

@Query("SELECT * FROM NoteTopics WHERE ntId = :ntId")
Topics fetchNoteTopicById(int ntId);

@Query("SELECT * FROM NoteTopics WHERE noteId = :noteId")
NoteTopics fetchNoteTopicByNoteId(int noteId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ public View onCreateView(
requireActivity(),
requireActivity().findViewById(R.id.nav_view),
getResources().getString(R.string.link_patreon)));
binding.supportBmcFrame.setOnClickListener(
v12 ->
Utils.openUrlInBrowser(
requireContext(),
requireActivity(),
requireActivity().findViewById(R.id.nav_view),
getResources().getString(R.string.link_buy_me_a_coffee)));
binding.crowdinFrame.setOnClickListener(
v13 ->
Utils.openUrlInBrowser(
Expand Down
49 changes: 0 additions & 49 deletions app/src/main/res/layout/fragment_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -353,55 +353,6 @@

</LinearLayout>

<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="@dimen/dimen2dp"
app:dividerColor="?attr/divider"
android:layout_marginTop="@dimen/dimen12dp"
android:layout_marginBottom="@dimen/dimen12dp"
android:background="?android:attr/listDivider" />

<LinearLayout
android:id="@+id/support_bmc_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">

<ImageView
android:layout_width="@dimen/dimen24dp"
android:layout_height="@dimen/dimen24dp"
android:contentDescription="@string/support_text_buy_me_a_coffee"
android:layout_marginEnd="@dimen/dimen16dp"
app:srcCompat="@drawable/ic_bmc" />

<LinearLayout
android:id="@+id/support_bmc_selection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">

<TextView
android:id="@+id/support_bmc_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/support_text_buy_me_a_coffee"
android:textSize="@dimen/dimen16sp" />

<ImageView
android:id="@+id/support_bmc"
android:layout_width="@dimen/dimen24dp"
android:layout_height="@dimen/dimen24dp"
android:contentDescription="@string/support_text_buy_me_a_coffee"
app:srcCompat="@drawable/ic_external_link" />

</LinearLayout>

</LinearLayout>

<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="@dimen/dimen2dp"
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
<string name="app_name" translatable="false">Nex Notes</string>
<string name="patreon" translatable="false">Patreon</string>
<string name="link_patreon" translatable="false">https://www.patreon.com/mmarif</string>
<string name="buy_me_a_coffee" translatable="false">Buy Me a Coffee</string>
<string name="link_buy_me_a_coffee" translatable="false">https://www.buymeacoffee.com/mmarif</string>
<string name="app_website_link" translatable="false">https://nexnotes.swatian.com</string>
<string name="zero" translatable="false">0</string>
<string name="support_text_patreon" translatable="false">Patreon</string>
<string name="support_text_buy_me_a_coffee" translatable="false">Buy Me a Coffee</string>
<string name="crowd_in_text" translatable="false">Crowdin</string>
<string name="crowd_in_link" translatable="false">https://crowdin.com/project/nexnotes</string>
<string name="source_code_link" translatable="false">https://github.com/Swatian/nexnotes</string>
Expand Down
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
agp = "8.4.2"
agp = "8.7.1"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
Expand All @@ -8,13 +8,13 @@ material = "1.12.0"
constraintlayout = "2.1.4"
lifecycleLivedataKtx = "2.8.6"
lifecycleViewmodelKtx = "2.8.6"
navigationFragment = "2.8.2"
navigationUi = "2.8.2"
navigationFragment = "2.8.3"
navigationUi = "2.8.3"
notiesMarkwon = "4.6.2"
prettytime = "5.0.7.Final"
roomDB = "2.6.1"
biometric = "1.1.0"
annotation = "1.8.2"
annotation = "1.9.0"
swiperefreshlayout = "1.1.0"
desugar_jdk_libs = "2.1.2"
emoji-java = "v5.1.2"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Jun 22 12:31:43 PKT 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists