Skip to content

Commit

Permalink
NClientV2 3.0.2
Browse files Browse the repository at this point in the history
* Bug fixes
  • Loading branch information
Dar9586 committed Jul 14, 2023
1 parent 9388c69 commit b189f00
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 20 deletions.
12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ android {
applicationId "com.dar.nclientv2"
minSdkVersion 14
targetSdkVersion 33
versionCode 301
versionCode 302
multiDexEnabled true
versionName "3.0.1-stable"
versionName "3.0.2-stable"
vectorDrawables.useSupportLibrary true
proguardFiles 'proguard-rules.pro'
}
Expand Down Expand Up @@ -47,20 +47,20 @@ dependencies {
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'com.google.android.material:material:1.8.0'
implementation 'com.google.android.material:material:1.9.0'

// Other
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.12.12'//Because of min SDK
implementation 'com.github.franmontiel:PersistentCookieJar:v1.0.1'
//implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'org.jsoup:jsoup:1.15.4'
implementation 'org.jsoup:jsoup:1.16.1'
implementation 'ch.acra:acra-core:5.7.0'
implementation('com.github.bumptech.glide:glide:4.15.0') {
implementation('com.github.bumptech.glide:glide:4.15.1') {
exclude group: "com.android.support"
}
implementation "androidx.multidex:multidex:2.0.1"
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.15.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1'
implementation 'com.github.yukuku:ambilwarna:2.0.1'
implementation 'me.zhanghai.android.fastscroll:library:1.2.0'

Expand Down
18 changes: 8 additions & 10 deletions app/src/main/java/com/dar/nclientv2/adapters/LocalAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,10 @@ public class LocalAdapter extends MultichoiceAdapter<Object, LocalAdapter.ViewHo
boolean b1 = o1 instanceof LocalGallery;
boolean b2 = o2 instanceof LocalGallery;
//downloading manga are newer
if (b1 && !b2) return -1;
if (!b1 && b2) return 1;
if (b1/*&&b2*/) {
long res = ((LocalGallery) o1).getDirectory().lastModified() - ((LocalGallery) o2).getDirectory().lastModified();
if (res != 0) return res < 0 ? -1 : 1;
}
String s1 = b1 ? ((LocalGallery) o1).getTitle() : ((GalleryDownloaderV2) o1).getPathTitle();
String s2 = b2 ? ((LocalGallery) o2).getTitle() : ((GalleryDownloaderV2) o2).getPathTitle();
return s1.compareTo(s2);
long d1 = b1 ? ((LocalGallery) o1).getDirectory().lastModified() : Long.MAX_VALUE;
long d2 = b2 ? ((LocalGallery) o2).getDirectory().lastModified() : Long.MAX_VALUE;
if (d1 != d2) return Long.compare(d1, d2);
return comparatorByName.compare(o1, o2);
};

private List<Object> filter;
Expand Down Expand Up @@ -190,7 +185,10 @@ private void sortItems(ArrayList<Object> arr) {
if (type.type == LocalSortType.Type.RANDOM) {
Collections.shuffle(arr, Utility.RANDOM);
} else {
Collections.sort(arr, getComparator(type.type));
try {
Collections.sort(arr, getComparator(type.type));
} catch (IllegalArgumentException ignore) {
}
if (type.descending) Collections.reverse(arr);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
class Importer {
private static void importSharedPreferences(Context context, String sharedName, InputStream stream) throws IOException {
JsonReader reader = new JsonReader(new InputStreamReader(stream));
if (sharedName.contains("/")) {
String[] names = sharedName.split("/");
sharedName = names[names.length - 1];
}
SharedPreferences.Editor editor = context.getSharedPreferences(sharedName, 0).edit();
reader.beginObject();
while (reader.hasNext()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public abstract class GeneralActivity extends AppCompatActivity {

public static @Nullable
CFTokenView getLastCFView() {
if (lastActivity == null) return null;
GeneralActivity activity = lastActivity.get();
if (activity != null) {
activity.runOnUiThread(activity::inflateWebView);
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/java/com/dar/nclientv2/settings/Global.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public class Global {
private static boolean infiniteScrollMain, infiniteScrollFavorite, exactTagMatch;
private static int defaultZoom, offscreenLimit;
private static Point screenSize;
private static String userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:110.0) Gecko/20100101 Firefox/110.0";
private static final String DEFAULT_USER_AGENT = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N)";
private static String userAgent = DEFAULT_USER_AGENT;

public static long recursiveSize(File path) {
if (path.isFile()) return path.length();
Expand Down Expand Up @@ -157,8 +158,10 @@ public static boolean isDestroyed(Activity activity) {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed();
}

@NonNull
public static String getUserAgent() {
return userAgent;
String agent = userAgent == null ? DEFAULT_USER_AGENT : userAgent;
return agent.replace("\n", " ").trim();
}

public static String getDefaultFileParent(Context context) {
Expand Down Expand Up @@ -317,7 +320,7 @@ public static void initFromShared(@NonNull Context context) {
colPortStat = shared.getInt(context.getString(R.string.key_column_port_stat), 2);
colLandStat = shared.getInt(context.getString(R.string.key_column_land_stat), 4);
zoomOneColumn = shared.getBoolean(context.getString(R.string.key_zoom_one_column), false);
userAgent = shared.getString(context.getString(R.string.key_user_agent),context.getString(R.string.default_user_agent));
userAgent = shared.getString(context.getString(R.string.key_user_agent), DEFAULT_USER_AGENT);
int x = Math.max(0, shared.getInt(context.getString(R.string.key_only_language), Language.ALL.ordinal()));
sortType = SortType.values()[shared.getInt(context.getString(R.string.key_by_popular), SortType.RECENT_ALL_TIME.ordinal())];
usageMobile = DataUsageType.values()[shared.getInt(context.getString(R.string.key_mobile_usage), DataUsageType.FULL.ordinal())];
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<string name="key_change_page_buttons" translatable="false">change_page_buttons</string>
<string name="dash" translatable="false">-</string>
<string name="slash" translatable="false">/</string>
<string name="default_user_agent" translatable="false">Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:110.0) Gecko/20100101 Firefox/110.0</string>
<string name="default_user_agent" translatable="false">Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N)</string>
<string name="setting_on_ignore_tags">Other tags won\'t be queried when a tag is selected from the gallery menu (except language)</string>
<string name="setting_off_ignore_tags">Other tags will be queried when a tag is selected from the gallery menu</string>
<string name="setting_on_use_account_tag">Use the account tags into the search query (Local tags will have priority)</string>
Expand Down

0 comments on commit b189f00

Please sign in to comment.