Skip to content

Commit

Permalink
NClientV2 3.0.0
Browse files Browse the repository at this point in the history
* Updated libraries
* Updated gradle
+ Added change user agent string
  • Loading branch information
Dar9586 committed Mar 18, 2023
1 parent daa01a8 commit 9e2d2d4
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 190 deletions.
3 changes: 2 additions & 1 deletion app/build.gradle
Expand Up @@ -35,6 +35,7 @@ android {
abortOnError false
checkReleaseBuilds false
}
namespace 'com.dar.nclientv2'
}

dependencies {
Expand All @@ -45,7 +46,7 @@ dependencies {
implementation 'androidx.fragment:fragment:1.5.5'
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'com.google.android.material:material:1.8.0'

// Other
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.dar.nclientv2">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Expand Down
Expand Up @@ -6,8 +6,10 @@
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -77,6 +79,8 @@ private void forceAcceptCookies() {

@SuppressLint("SetJavaScriptEnabled")
private void applyWebViewSettings() {
setWebChromeClient(new WebChromeClient());
setWebViewClient(new WebViewClient());
WebSettings webSettings = getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
Expand All @@ -88,6 +92,7 @@ private void applyWebViewSettings() {
webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false);
webSettings.setUserAgentString(Global.getUserAgent());
webSettings.setAllowContentAccess(true);
}

}
Expand Down

This file was deleted.

This file was deleted.

5 changes: 3 additions & 2 deletions app/src/main/java/com/dar/nclientv2/settings/Global.java
Expand Up @@ -86,7 +86,7 @@ public class Global {
private static boolean invertFix, buttonChangePage, hideMultitask, enableBeta, volumeOverride, zoomOneColumn, keepHistory, lockScreen, onlyTag, showTitles, removeAvoidedGalleries, useRtl;
private static ThemeScheme theme;
private static DataUsageType usageMobile, usageWifi;
private static String lastVersion, mirror;
private static String lastVersion, mirror, userAgent;
private static int maxHistory, columnCount, maxId, galleryWidth = -1, galleryHeight = -1;
private static int colPortStat, colLandStat, colPortHist, colLandHist, colPortMain, colLandMain, colPortDownload, colLandDownload, colLandFavorite, colPortFavorite;
private static boolean infiniteScrollMain, infiniteScrollFavorite, exactTagMatch;
Expand Down Expand Up @@ -157,7 +157,7 @@ public static boolean isDestroyed(Activity activity) {
}

public static String getUserAgent() {
return "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Mobile Safari/537.36";
return userAgent;
}

public static String getDefaultFileParent(Context context) {
Expand Down Expand Up @@ -316,6 +316,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));
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: 2 additions & 0 deletions app/src/main/res/values-ar-rSA/strings.xml
Expand Up @@ -302,6 +302,8 @@
<string name="exact_title_match_title">Exact tag match only</string>
<string name="exact_title_match_summary">Hide galleries which would appear in the site but doesn\'t contains all the tags searched</string>
<string name="hide">Hide</string>
<string name="title_user_agent">Change User-Agent</string>

<string-array name="scroll_type">
<item>أفقي</item>
<item>عمودي</item>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-de-rDE/strings.xml
Expand Up @@ -302,6 +302,8 @@
<string name="exact_title_match_title">Exact tag match only</string>
<string name="exact_title_match_summary">Hide galleries which would appear in the site but doesn\'t contains all the tags searched</string>
<string name="hide">Hide</string>
<string name="title_user_agent">Change User-Agent</string>

<string-array name="scroll_type">
<item>Horizontal</item>
<item>Vertikal</item>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-es-rES/strings.xml
Expand Up @@ -302,6 +302,8 @@
<string name="exact_title_match_title">Exact tag match only</string>
<string name="exact_title_match_summary">Hide galleries which would appear in the site but doesn\'t contains all the tags searched</string>
<string name="hide">Hide</string>
<string name="title_user_agent">Change User-Agent</string>

<string-array name="scroll_type">
<item>Horizontal</item>
<item>Vertical</item>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-fr-rFR/strings.xml
Expand Up @@ -302,6 +302,8 @@
<string name="exact_title_match_title">Exact tag match only</string>
<string name="exact_title_match_summary">Hide galleries which would appear in the site but doesn\'t contains all the tags searched</string>
<string name="hide">Hide</string>
<string name="title_user_agent">Change User-Agent</string>

<string-array name="scroll_type">
<item>Horizontal</item>
<item>Vertical</item>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-it-rIT/strings.xml
Expand Up @@ -302,6 +302,8 @@
<string name="exact_title_match_title">Exact tag match only</string>
<string name="exact_title_match_summary">Hide galleries which would appear in the site but doesn\'t contains all the tags searched</string>
<string name="hide">Hide</string>
<string name="title_user_agent">Cambia User-Agent</string>

<string-array name="scroll_type">
<item>Orizzontale</item>
<item>Verticale</item>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-ja-rJP/strings.xml
Expand Up @@ -302,6 +302,8 @@
<string name="exact_title_match_title">Exact tag match only</string>
<string name="exact_title_match_summary">Hide galleries which would appear in the site but doesn\'t contains all the tags searched</string>
<string name="hide">Hide</string>
<string name="title_user_agent">Change User-Agent</string>

<string-array name="scroll_type">
<item>水平</item>
<item>垂直</item>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-ru-rRU/strings.xml
Expand Up @@ -302,6 +302,8 @@
<string name="exact_title_match_title">Exact tag match only</string>
<string name="exact_title_match_summary">Hide galleries which would appear in the site but doesn\'t contains all the tags searched</string>
<string name="hide">Hide</string>
<string name="title_user_agent">Change User-Agent</string>

<string-array name="scroll_type">
<item>Горизонтальный</item>
<item>Вертикальный</item>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-tr-rTR/strings.xml
Expand Up @@ -302,6 +302,8 @@
<string name="exact_title_match_title">Exact tag match only</string>
<string name="exact_title_match_summary">Hide galleries which would appear in the site but doesn\'t contains all the tags searched</string>
<string name="hide">Hide</string>
<string name="title_user_agent">Change User-Agent</string>

<string-array name="scroll_type">
<item>Horizontal</item>
<item>Vertical</item>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-uk-rUA/strings.xml
Expand Up @@ -302,6 +302,8 @@
<string name="exact_title_match_title">Exact tag match only</string>
<string name="exact_title_match_summary">Hide galleries which would appear in the site but doesn\'t contains all the tags searched</string>
<string name="hide">Hide</string>
<string name="title_user_agent">Change User-Agent</string>

<string-array name="scroll_type">
<item>Горизонтально</item>
<item>Вертикально</item>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Expand Up @@ -302,6 +302,8 @@
<string name="exact_title_match_title">Exact tag match only</string>
<string name="exact_title_match_summary">Hide galleries which would appear in the site but doesn\'t contains all the tags searched</string>
<string name="hide">Hide</string>
<string name="title_user_agent">Change User-Agent</string>

<string-array name="scroll_type">
<item>水平</item>
<item>垂直</item>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Expand Up @@ -302,6 +302,8 @@
<string name="exact_title_match_title">Exact tag match only</string>
<string name="exact_title_match_summary">Hide galleries which would appear in the site but doesn\'t contains all the tags searched</string>
<string name="hide">Hide</string>
<string name="title_user_agent">Change User-Agent</string>

<string-array name="scroll_type">
<item>水準</item>
<item>垂直</item>
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Expand Up @@ -7,6 +7,7 @@
<string name="key_save_path" translatable="false">save_path</string>
<string name="key_fake_icon" translatable="false">fake_icon</string>
<string name="key_local_sort" translatable="false">local_sort_type</string>
<string name="key_user_agent" translatable="false">setting_user_agent</string>
<string name="key_title_type" translatable="false">title_type_str</string>
<string name="key_by_popular" translatable="false">is_by_popular</string>
<string name="key_column_count" translatable="false">column_count</string>
Expand Down Expand Up @@ -61,6 +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="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 Expand Up @@ -363,6 +365,9 @@
<string name="exact_title_match_title">Exact tag match only</string>
<string name="exact_title_match_summary">Hide galleries which would appear in the site but doesn\'t contains all the tags searched</string>
<string name="hide">Hide</string>
<string name="title_user_agent">Change User-Agent</string>


<string-array name="scroll_type">
<item>Horizontal</item>
<item>Vertical</item>
Expand Down

0 comments on commit 9e2d2d4

Please sign in to comment.