mirror of https://codeberg.org/gitnex/GitNex.git
Switch to qwerty287/Prism4j (#1030)
* use qwerty287/Prism4j and qwerty287/markwonprism4j * use androidx nullability annotations instead of jetbrains ones (were included in old prism4j lib) * update some dependencies * I had to update the SDK versions because the markwon plugin seems to be not compatible with older ones - I hope that's fine Closes #853 Co-authored-by: qwerty287 <ndev@web.de> Co-authored-by: M M Arif <mmarif@noreply.codeberg.org> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1030 Reviewed-by: M M Arif <mmarif@noreply.codeberg.org> Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org> Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
This commit is contained in:
parent
3791a7344e
commit
c378588a6d
|
@ -1,11 +1,11 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
compileSdkVersion 31
|
||||
defaultConfig {
|
||||
applicationId "org.mian.gitnex"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
targetSdkVersion 31
|
||||
versionCode 415
|
||||
versionName "4.2.0"
|
||||
multiDexEnabled true
|
||||
|
@ -54,23 +54,23 @@ configurations {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
def lifecycle_version = '2.3.1'
|
||||
def lifecycle_version = '2.4.0'
|
||||
def markwon_version = '4.6.2'
|
||||
def work_version = "2.7.0-alpha05"
|
||||
def acra = "5.7.0"
|
||||
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'androidx.appcompat:appcompat:1.4.0-alpha03'
|
||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test:runner:1.4.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.2'
|
||||
implementation "com.google.code.gson:gson:2.8.6"
|
||||
implementation "com.google.code.gson:gson:2.8.9"
|
||||
implementation "com.squareup.picasso:picasso:2.71828"
|
||||
implementation 'jp.wasabeef:picasso-transformations:2.4.0'
|
||||
implementation 'jp.co.cyberagent.android:gpuimage:2.1.0'
|
||||
|
@ -79,7 +79,7 @@ dependencies {
|
|||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
|
||||
implementation 'org.ocpsoft.prettytime:prettytime:5.0.0.Final'
|
||||
implementation 'org.ocpsoft.prettytime:prettytime:5.0.2.Final'
|
||||
implementation "com.pes.materialcolorpicker:library:1.2.5"
|
||||
implementation "io.noties.markwon:core:$markwon_version"
|
||||
implementation "io.noties.markwon:ext-latex:$markwon_version"
|
||||
|
@ -93,10 +93,10 @@ dependencies {
|
|||
implementation "io.noties.markwon:recycler:$markwon_version"
|
||||
implementation "io.noties.markwon:recycler-table:$markwon_version"
|
||||
implementation "io.noties.markwon:simple-ext:$markwon_version"
|
||||
implementation "io.noties.markwon:syntax-highlight:$markwon_version"
|
||||
implementation 'org.codeberg.qwerty287:markwonprism4j:9d3ef078cd'
|
||||
implementation 'org.codeberg.qwerty287:Prism4j:3.0.0'
|
||||
implementation 'com.google.guava:guava:29.0-android'
|
||||
implementation "io.noties.markwon:image-picasso:$markwon_version"
|
||||
implementation "io.noties:prism4j:2.0.0"
|
||||
annotationProcessor "io.noties:prism4j-bundler:2.0.0"
|
||||
implementation "com.github.HamidrezaAmz:BreadcrumbsView:0.2.9"
|
||||
implementation "commons-io:commons-io:20030203.000550"
|
||||
implementation 'org.apache.commons:commons-lang3:3.12.0'
|
||||
|
@ -104,8 +104,8 @@ dependencies {
|
|||
implementation "ch.acra:acra-mail:$acra"
|
||||
implementation "ch.acra:acra-limiter:$acra"
|
||||
implementation "ch.acra:acra-notification:$acra"
|
||||
implementation 'androidx.room:room-runtime:2.3.0'
|
||||
annotationProcessor 'androidx.room:room-compiler:2.3.0'
|
||||
implementation 'androidx.room:room-runtime:2.4.1'
|
||||
annotationProcessor 'androidx.room:room-compiler:2.4.1'
|
||||
implementation "androidx.work:work-runtime:$work_version"
|
||||
implementation "io.mikael:urlbuilder:2.0.9"
|
||||
implementation "org.codeberg.gitnex-garage:emoji-java:v5.1.2"
|
||||
|
@ -113,6 +113,6 @@ dependencies {
|
|||
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
|
||||
implementation 'androidx.biometric:biometric:1.1.0'
|
||||
implementation 'com.github.chrisvest:stormpot:2.4.2'
|
||||
implementation 'androidx.browser:browser:1.3.0'
|
||||
implementation 'androidx.browser:browser:1.4.0'
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.gitnex.tea4j.models.Organization;
|
|||
import org.gitnex.tea4j.models.PullRequests;
|
||||
import org.gitnex.tea4j.models.UserInfo;
|
||||
import org.gitnex.tea4j.models.UserRepositories;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.database.api.BaseApi;
|
||||
|
@ -527,7 +526,7 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
call.enqueue(new Callback<Organization>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NotNull Call<Organization> call, @NotNull Response<Organization> response) {
|
||||
public void onResponse(@NonNull Call<Organization> call, @NonNull Response<Organization> response) {
|
||||
if(response.code() == 404) { // org doesn't exist or it's a user user
|
||||
Log.d("getUserOrOrg-404", String.valueOf(response.code()));
|
||||
getUser(url, instanceToken, userOrgName);
|
||||
|
@ -552,7 +551,7 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull Call<Organization> call, @NotNull Throwable t) {
|
||||
public void onFailure(@NonNull Call<Organization> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure-getUserOrOrg", t.toString());
|
||||
}
|
||||
});
|
||||
|
@ -564,7 +563,7 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
call.enqueue(new Callback<UserInfo>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NotNull Call<UserInfo> call, @NotNull Response<UserInfo> response) {
|
||||
public void onResponse(@NonNull Call<UserInfo> call, @NonNull Response<UserInfo> response) {
|
||||
if(response.code() == 200) {
|
||||
assert response.body() != null;
|
||||
userIntent.putExtra("username", response.body().getLogin());
|
||||
|
@ -578,7 +577,7 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull Call<UserInfo> call, @NotNull Throwable t) {
|
||||
public void onFailure(@NonNull Call<UserInfo> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure-getUser", t.toString());
|
||||
ctx.startActivity(mainIntent);
|
||||
finish();
|
||||
|
@ -592,7 +591,7 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
call.enqueue(new Callback<Files>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NotNull Call<Files> call, @NotNull Response<Files> response) {
|
||||
public void onResponse(@NonNull Call<Files> call, @NonNull Response<Files> response) {
|
||||
if(response.code() == 200) {
|
||||
// check if file and open file/dir
|
||||
Files file = response.body();
|
||||
|
@ -611,7 +610,7 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull Call<Files> call, @NotNull Throwable t) {
|
||||
public void onFailure(@NonNull Call<Files> call, @NonNull Throwable t) {
|
||||
Log.e("getFile-onFailure", t.toString());
|
||||
// maybe it's a directory
|
||||
getDir(url, instanceToken, owner, repo, filePath, branch);
|
||||
|
|
|
@ -8,10 +8,10 @@ import android.view.View;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TimePicker;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.databinding.ActivitySettingsAppearanceBinding;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
|
@ -204,7 +204,7 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||
|
||||
TinyDB db = TinyDB.getInstance(getContext());
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
int hour = db.getInt("lightThemeTimeHour");
|
||||
|
@ -229,7 +229,7 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||
|
||||
TinyDB db = TinyDB.getInstance(getContext());
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
int hour = db.getInt("darkThemeTimeHour");
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
package org.mian.gitnex.core;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import androidx.annotation.NonNull;
|
||||
import java.util.Set;
|
||||
import io.noties.prism4j.DefaultGrammarLocator;
|
||||
import io.noties.prism4j.Grammar;
|
||||
import io.noties.prism4j.GrammarLocator;
|
||||
import io.noties.prism4j.Prism4j;
|
||||
import io.noties.prism4j.annotations.PrismBundle;
|
||||
|
||||
/**
|
||||
* @author opyale
|
||||
*/
|
||||
|
||||
@PrismBundle(
|
||||
includeAll = true,
|
||||
grammarLocatorClassName = ".DefaultGrammarLocator"
|
||||
)
|
||||
public class MainGrammarLocator implements GrammarLocator {
|
||||
|
||||
public static final String DEFAULT_FALLBACK_LANGUAGE = "clike";
|
||||
|
@ -109,14 +105,13 @@ public class MainGrammarLocator implements GrammarLocator {
|
|||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Prism4j.Grammar grammar(@NotNull Prism4j prism4j, @NotNull String language) {
|
||||
public Grammar grammar(@NonNull Prism4j prism4j, @NonNull String language) {
|
||||
|
||||
return defaultGrammarLocator.grammar(prism4j, language);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
@Override
|
||||
public Set<String> languages() {
|
||||
|
||||
|
|
|
@ -43,10 +43,10 @@ import io.noties.markwon.recycler.MarkwonAdapter;
|
|||
import io.noties.markwon.recycler.SimpleEntry;
|
||||
import io.noties.markwon.recycler.table.TableEntry;
|
||||
import io.noties.markwon.recycler.table.TableEntryPlugin;
|
||||
import io.noties.markwon.syntax.Prism4jTheme;
|
||||
import io.noties.markwon.syntax.Prism4jThemeDarkula;
|
||||
import io.noties.markwon.syntax.Prism4jThemeDefault;
|
||||
import io.noties.markwon.syntax.SyntaxHighlightPlugin;
|
||||
import de.qwerty287.markwonprism4j.Prism4jTheme;
|
||||
import de.qwerty287.markwonprism4j.Prism4jThemeDarkula;
|
||||
import de.qwerty287.markwonprism4j.Prism4jThemeDefault;
|
||||
import de.qwerty287.markwonprism4j.SyntaxHighlightPlugin;
|
||||
import io.noties.prism4j.Prism4j;
|
||||
import stormpot.Allocator;
|
||||
import stormpot.BlazePool;
|
||||
|
|
|
@ -19,10 +19,10 @@ import androidx.annotation.Nullable;
|
|||
import org.mian.gitnex.core.MainGrammarLocator;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import io.noties.markwon.syntax.Prism4jSyntaxHighlight;
|
||||
import io.noties.markwon.syntax.Prism4jTheme;
|
||||
import io.noties.markwon.syntax.Prism4jThemeDarkula;
|
||||
import io.noties.markwon.syntax.Prism4jThemeDefault;
|
||||
import de.qwerty287.markwonprism4j.Prism4jSyntaxHighlight;
|
||||
import de.qwerty287.markwonprism4j.Prism4jTheme;
|
||||
import de.qwerty287.markwonprism4j.Prism4jThemeDarkula;
|
||||
import de.qwerty287.markwonprism4j.Prism4jThemeDefault;
|
||||
import io.noties.prism4j.Prism4j;
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,6 @@ import androidx.lifecycle.LiveData;
|
|||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import org.gitnex.tea4j.models.Labels;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import java.util.List;
|
||||
import retrofit2.Call;
|
||||
|
@ -57,7 +56,7 @@ public class OrganizationLabelsViewModel extends ViewModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Labels>> call, @NotNull Throwable t) {
|
||||
public void onFailure(@NonNull Call<List<Labels>> call, @NonNull Throwable t) {
|
||||
Log.i("onFailure", t.toString());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue