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

修复3.8.3解析authorid异常 #176

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
eecfc38
Merge pull request #106 from ymback/master
Justwen Jul 24, 2022
5cd0ad3
支持在用户信息界面显示ip地址
Justwen Jul 24, 2022
1a0b388
请求UA不再固定,以系统为准
Justwen Jul 24, 2022
e24356a
更新说明移动到xml里
Justwen Jul 24, 2022
3046c0d
3.7.7发版
Justwen Jul 24, 2022
5b1166f
优化UA相关逻辑
Justwen Jul 24, 2022
af3f7d1
优化加载逻辑,避免短时间多次请求接口,被NGA后台屏蔽
Justwen Aug 16, 2022
e03b2d0
3078发版
Justwen Aug 16, 2022
21a2add
外链用外部浏览器打开
Justwen Sep 30, 2022
1caf115
3079发版
Justwen Sep 30, 2022
4afc9d7
增加外置浏览器打开选项
Justwen Sep 30, 2022
172aedb
增加自定义UA功能
Justwen Oct 4, 2022
dd260e0
3080发版
Justwen Oct 4, 2022
41c6902
提升最小支持android版本
Justwen Oct 4, 2022
b806e55
迁移不规范sp名字
Justwen Oct 4, 2022
dd8722e
使用androidx的Preference包
Justwen Oct 5, 2022
4412221
webview界面也支持自定义ua
Justwen Oct 5, 2022
86cfec7
3.8.1发版
Justwen Oct 5, 2022
2d4399c
解决8.0以下设备崩溃问题
Justwen Oct 7, 2022
6e90fd4
修复并优化内置浏览器逻辑
sunfkny Oct 7, 2022
875acdd
为回复详情添加tid
sunfkny Oct 8, 2022
e0844f1
修复侧滑返回开关失效
sunfkny Oct 8, 2022
0ee6e0a
Merge pull request #112 from sunfkny/fix-browser
Justwen Oct 10, 2022
22fb68c
Merge pull request #114 from sunfkny/fix-swipe
Justwen Oct 10, 2022
64fed5d
Merge pull request #113 from sunfkny/reply-tid
Justwen Oct 10, 2022
e7640ce
修复一些bug
Justwen Oct 7, 2022
4f89c9b
3.8.2发版
Justwen Oct 7, 2022
c121b96
3.8.3发版
Justwen Oct 10, 2022
320478c
解决178域名下部分链接跳转浏览器的问题
Justwen Oct 11, 2022
90aff36
优化用户信息链接数组的初始化方式
sunfkny Oct 11, 2022
d326ba0
为回复添加tid(漏了另外一种匹配)
sunfkny Oct 12, 2022
1dff2c6
Merge pull request #117 from sunfkny/fix-reply-to
Justwen Oct 15, 2022
ee8d282
Merge pull request #115 from sunfkny/fix-user-profile
Justwen Oct 15, 2022
ceb78bc
修复authorId解析
acer-xhy Dec 5, 2022
8fb892f
图片改webp 移除v7支持
acer-xhy Dec 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 11 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
ext {
jks_path = '../keystore/nga.jks'
}// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
mavenCentral()
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://oss.sonatype.org/content/repositories/snapshots' }

maven {url 'https://maven.aliyun.com/repository/google'}
maven { url "https://www.jitpack.io" }
maven { url 'https://repo1.maven.org/maven2/' }

Expand All @@ -22,6 +26,7 @@ allprojects {
google()
mavenCentral()
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven {url 'https://maven.aliyun.com/repository/google'}
maven { url "https://www.jitpack.io" }
maven { url 'https://repo1.maven.org/maven2/' }
flatDir {
Expand All @@ -35,11 +40,11 @@ task clean(type: Delete) {
}

project.ext {
minSdkVersion = 23
minSdkVersion = 24
targetSdkVersion = 30
compileSdkVersion = 30
appVersionName = '3.7.6'
appVersionCode = 3076
appVersionName = '3.8.4'
appVersionCode = 3084

fastJson = '1.1.71.android'
rxAndroid = '2.1.1'
Expand All @@ -50,4 +55,6 @@ project.ext {
androidxMaterial = '1.2.0'

room_version = "2.4.1"

preference_version = "1.1.1"
}
3 changes: 3 additions & 0 deletions lib_common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@ dependencies {

//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.3.0'

//noinspection KtxExtensionAvailable
implementation "androidx.preference:preference:$preference_version"
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,62 @@
package gov.anzong.androidnga.base.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;

import androidx.preference.PreferenceManager;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
* @author Justwen
*/
public class PreferenceUtils {

@Deprecated
private static final String PREFERENCE_DEPRECATED = "perference";

private static SharedPreferences sPreferences;

static {
sPreferences = ContextUtils.getDefaultSharedPreferences();
}

public static void transfer(Context context) {
SharedPreferences oldPref = context.getSharedPreferences(PREFERENCE_DEPRECATED, Context.MODE_PRIVATE);
Map<String, ?> oldMap = oldPref.getAll();
if (!oldMap.isEmpty()) {
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit();
for (Map.Entry<String, ?> entry : oldMap.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (TextUtils.isEmpty(key)) {
continue;
}
if (value instanceof Integer) {
editor.putInt(key, (Integer) value);
} else if (value instanceof Boolean) {
editor.putBoolean(key, (Boolean) value);
} else if (value instanceof String) {
editor.putString(key, (String) value);
} else if (value instanceof Long) {
editor.putLong(key, (Long) value);
} else if (value instanceof Float) {
editor.putFloat(key, (Float) value);
} else if (value instanceof Set<?>) {
editor.putStringSet(key, (Set<String>) value);
}
}
oldPref.edit().clear().apply();
editor.apply();
}
}

public static void putData(String key, String value) {
sPreferences.edit().putString(key, value).apply();
}
Expand Down Expand Up @@ -67,7 +105,7 @@ public static Set<String> getData(String key, Set<String> defValue) {
return sPreferences.getStringSet(key, defValue);
}

public static void putData(String key, List list) {
public static void putData(String key, List<?> list) {
sPreferences.edit().putString(key, JSON.toJSONString(list)).apply();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package gov.anzong.androidnga.base.widget;

import android.content.Context;

import androidx.viewpager.widget.ViewPager;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

import com.nshmura.recyclertablayout.RecyclerTabLayout;

Expand Down Expand Up @@ -47,6 +50,18 @@ public TabAdapter(ViewPager viewPager) {
super(viewPager);
}

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
ViewHolder holder = super.onCreateViewHolder(parent, viewType);
holder.itemView.setOnClickListener(v -> {
int pos = holder.getAdapterPosition();
if (pos != NO_POSITION) {
getViewPager().setCurrentItem(pos, false);
}
});
return holder;
}

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
super.onBindViewHolder(holder, position);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package gov.anzong.androidnga.common;

import android.preference.PreferenceManager;

import gov.anzong.androidnga.base.util.ContextUtils;

public class PreferenceKey {
Expand All @@ -8,7 +10,8 @@ public class PreferenceKey {

public static final String PREFERENCE_SETTINGS = "perference";

public static final String PERFERENCE = "perference";
@Deprecated
public static final String PERFERENCE = PreferenceManager.getDefaultSharedPreferencesName(ContextUtils.getContext());

String DOWNLOAD_IMG_QUALITY_NO_WIFI = "download_img_quality_without_wifi";
public static final String ENABLE_NOTIFIACTION = "enableNotification";
Expand Down Expand Up @@ -113,4 +116,6 @@ public class PreferenceKey {
@Deprecated
public static final String DOWNLOAD_IMG_NO_WIFI = "down_load_without_wifi";

public static final String USER_AGENT = "preference_key_ua";

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ public String decode(String content, HtmlData htmlData) {
content = StringUtils.replaceAll(content,
ignoreCaseTag
+ "\\[b\\]Reply to \\[pid=(.+?),(.+?),(.+?)\\]Reply\\[/pid\\] (.+?)\\[/b\\]",
"[quote]Reply to [b]<a href='" + htmlData.getNGAHost() + "read.php?searchpost=1&pid=$1' style='font-weight: bold;color:#3181f4'>[Reply]</a> $4[/b][/quote]");
"[quote]Reply to [b]<a href='" + htmlData.getNGAHost() + "read.php?searchpost=1&pid=$1&tid=$2' style='font-weight: bold;color:#3181f4'>[Reply]</a> $4[/b][/quote]");

content = StringUtils.replaceAll(content,
ignoreCaseTag + "\\[pid=(.+?),(.+?),(.+?)\\]Reply\\[/pid\\]",
"<a href='" + htmlData.getNGAHost() + "read.php?searchpost=1&pid=$1' style='font-weight: bold;color:#3181f4'>[Reply]</a>");
"<a href='" + htmlData.getNGAHost() + "read.php?searchpost=1&pid=$1&tid=$2' style='font-weight: bold;color:#3181f4'>[Reply]</a>");

// 某些帖子会导致这个方法卡住, 暂时不清楚原因, 和这个方法的作用.... by elrond
/*content = StringUtils.replaceAll(content,
Expand Down
25 changes: 10 additions & 15 deletions nga_phone_base_3.0/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,15 @@ def static getDate() {

}

def isJenkins() {
return project.hasProperty('IS_JENKINS') && IS_JENKINS == 'true'
}

android {
compileSdkVersion project.compileSdkVersion

signingConfigs {
signingConfig {
if (isJenkins()) {
storeFile file('../../android19910914.keystore')
} else {
storeFile file('..\\keystore\\android19910914.keystore')
}
storePassword '19910914'
keyAlias 'android.keystore'
keyPassword '19910914'
release {
keyAlias 'jgw'
keyPassword '123456'
storeFile file(jks_path)
storePassword '123456'
}
}

Expand All @@ -52,7 +44,7 @@ android {
}

ndk {
abiFilters 'armeabi-v7a','arm64-v8a'
abiFilters 'arm64-v8a'
}
}
compileOptions {
Expand All @@ -68,7 +60,7 @@ android {
pseudoLocalesEnabled false
minifyEnabled false
zipAlignEnabled true
signingConfig signingConfigs.signingConfig
signingConfig signingConfigs.release
}
debug {
debuggable true
Expand Down Expand Up @@ -140,6 +132,9 @@ dependencies {
// kotlin
implementation "androidx.core:core-ktx:1.3.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

//noinspection KtxExtensionAvailable
implementation "androidx.preference:preference:$preference_version"
}

repositories {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package android.preference;
package androidx.preference;

import android.content.Context;
import android.preference.ListPreference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

/**
* Created by Justwen on 2017/7/16.
*/
import androidx.annotation.NonNull;

public class ListSummaryPreference extends ListPreference {

Expand All @@ -21,9 +18,9 @@ public ListSummaryPreference(Context context) {
}

@Override
protected void onBindView(View view) {
super.onBindView(view);
TextView summaryView = (TextView) view.findViewById(android.R.id.summary);
public void onBindViewHolder(@NonNull PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
TextView summaryView = holder.itemView.findViewById(android.R.id.summary);
summaryView.setVisibility(View.VISIBLE);
summaryView.setText(getEntry());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class NgaClientApp extends Application {
public void onCreate() {
NLog.w(TAG, "app nga android start");
ContextUtils.setApplication(this);
PreferenceUtils.transfer(this);
checkNewVersion();
VersionUpgradeHelper.upgrade();
AppDatabase.init(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package gov.anzong.androidnga.activity;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
Expand Down Expand Up @@ -45,7 +44,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
mConfig = PhoneConfiguration.getInstance();
updateWindowFlag();
updateThemeUi();
setSwipeBackEnable(getSharedPreferences(PreferenceKey.PREFERENCE_SETTINGS, Context.MODE_PRIVATE).getBoolean(PreferenceKey.KEY_SWIPE_BACK, false));
setSwipeBackEnable(PreferenceUtils.getData(PreferenceKey.KEY_SWIPE_BACK, false));
onCreateBeforeSuper(savedInstanceState);
super.onCreate(savedInstanceState);
onCreateAfterSuper(savedInstanceState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ private void loadBasicProfile(ProfileData profileInfo) {
mUserEmailTv.setText(profileInfo.getEmailAddress());
mUserTelTv.setText(profileInfo.getPhoneNumber());
mUserGroupTv.setText(profileInfo.getMemberGroup());
TextView ipLocView = findViewById(R.id.tv_user_iploc);
if (ipLocView != null && profileInfo.ipLoc != null) {
ipLocView.setText(profileInfo.ipLoc);
}
if (mCurrentUser) {
mModifySignBtn.setVisibility(View.VISIBLE);
} else {
Expand Down
Loading