Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #5 from mouyase/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mouyase authored Oct 24, 2019
2 parents c6ba304 + 01df018 commit 5afb2d3
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 69 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,5 @@ lint/reports/
/debug
/release

keystore.properties
keystore.properties
bugly.properties
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "tech.yojigen.pivisionm"
minSdkVersion 19
targetSdkVersion 29
versionCode 443000
versionName '4.4.3'
versionCode 443002
versionName '4.4.3(443002)'
vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
}
Expand Down Expand Up @@ -85,4 +85,15 @@ dependencies {

implementation 'com.tencent.bugly:crashreport_upgrade:1.4.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}

apply plugin: 'bugly'

bugly {
def buglyProperties = new Properties()
def buglyPropertiesFile = project.rootProject.file("bugly.properties")
buglyProperties.load(new FileInputStream(buglyPropertiesFile))

appId = buglyProperties['APP_ID']
appKey = buglyProperties['APP_KEY']
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
android:label="@string/app_name"
android:largeHeap="true"
android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true"
android:resizeableActivity="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
Expand Down
11 changes: 9 additions & 2 deletions app/src/main/java/com/reiya/pixiv/base/BaseApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
Expand Down Expand Up @@ -125,7 +126,7 @@ private static String getDeviceInfo() {
}

public static String getUA() {
return "PixivAndroidApp/5.0.156 " + getDeviceInfo();
return "PixivAndroidApp/5.0.164 " + getDeviceInfo();
}

public static String getAppVersionName(Context context) {
Expand Down Expand Up @@ -153,7 +154,13 @@ public void onCreate() {
super.onCreate();
sInstance = this;

Bugly.init(getApplicationContext(), "0fc124925c", true);
//判断是否为Debug版本
ApplicationInfo applicationInfo = getApplicationInfo();
if ((applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
Bugly.init(getApplicationContext(), "0fc124925c", true);
} else {
Bugly.init(getApplicationContext(), "0fc124925c", false);
}

HttpClient.init(this);

Expand Down
62 changes: 28 additions & 34 deletions app/src/main/java/com/reiya/pixiv/network/fuckgfw/PixivDNS.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,37 @@ public class PixivDNS implements Dns {
private static PixivDNS mPixivDNS = null;
private static List<InetAddress> newDns = new ArrayList<>();
private static final String[] addresses = {
/*主站IP*/
"210.140.131.203",
"210.140.131.204",
"210.140.131.205",
"210.140.131.206",
"210.140.131.207",
"210.140.131.208",
"210.140.131.209",
"210.140.131.210",
"210.140.131.211",
"210.140.131.212",
"18.211.61.121",
"210.140.131.213",
"210.140.131.214",
"210.140.131.215",
"210.140.131.216",
"210.140.131.217",
"66.6.32.22",
"210.140.131.218",
"210.140.131.224",
"210.140.131.219",
"122.208.114.218",
"13.35.19.186",
"210.140.131.220",
"13.35.19.88",
"210.140.131.222",
"210.140.131.223",
"210.140.131.224",
"210.140.131.225",
"210.140.131.226",
"13.35.19.46",
"210.140.131.180",
"52.219.68.134",
"210.140.131.181",
"54.192.151.59",
"54.192.151.106",
"54.192.151.22",
"54.192.151.42",
"122.208.114.218",
"210.140.131.182",
"210.140.131.183",
"210.140.131.184"};
"52.219.0.208",
"52.84.225.11",
"52.84.225.87",
"52.84.225.95",
"52.84.225.186",
"66.6.32.22",
"66.6.33.22",
"52.84.225.193",
"52.84.225.8",
"52.84.225.131",
"52.84.225.132",
"52.84.225.230",
"52.84.225.206",
"52.84.225.214",
"52.84.225.221",
"210.140.170.179",
"210.140.174.37",
"210.140.175.130",
"210.140.131.153",
"210.140.131.144",
"210.140.131.145",
"210.140.131.147"
};

private PixivDNS() {
for (String address : addresses) {
Expand Down
24 changes: 19 additions & 5 deletions app/src/main/java/com/reiya/pixiv/other/SettingsActivity.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.reiya.pixiv.other;

import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;
Expand All @@ -12,7 +14,9 @@
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

Expand Down Expand Up @@ -53,6 +57,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
public static class MyPreferenceFragment extends PreferenceFragment {
Preference preferenceCache;

@SuppressLint("SetTextI18n")
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -70,13 +75,22 @@ public void onCreate(final Bundle savedInstanceState) {
});
findPreference(getString(R.string.key_connect_mode)).setOnPreferenceChangeListener((preference, newValue) -> {
int connectMode = Integer.parseInt(String.valueOf(newValue));
Toast toast = Toast.makeText(getActivity(), "当前已设置为 " + getActivity().getResources().getStringArray(R.array.pref_connect_mode_strings)[connectMode] + " 模式\n重启后生效", Toast.LENGTH_LONG);
int tvToastId = Resources.getSystem().getIdentifier("message", "id", "android");
TextView tvToast = toast.getView().findViewById(tvToastId);
if (tvToast != null) {
tvToast.setGravity(Gravity.CENTER);
//解决 Toast Exception : java.lang.IllegalStateException: View has already been added to the window manager.
//原因 布局复用
Toast toast = new Toast(getActivity());
LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
int layoutId = Resources.getSystem().getIdentifier("transient_notification", "layout", "android");
View view = inflater.inflate(layoutId, null);
int textViewId = Resources.getSystem().getIdentifier("message", "id", "android");
TextView textView = view.findViewById(textViewId);
if (textView != null) {
textView.setText("当前已设置为 " + getActivity().getResources().getStringArray(R.array.pref_connect_mode_strings)[connectMode] + " 模式\n重启后生效");
textView.setGravity(Gravity.CENTER);
}
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(view);
toast.show();
//结束
return true;
});
}
Expand Down
8 changes: 1 addition & 7 deletions app/src/main/java/com/reiya/pixiv/util/ItemOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ public static void addBookmark(final FragmentActivity activity, final Work work)
String defaultType = PreferenceManager.getDefaultSharedPreferences(activity).getString(activity.getString(R.string.key_favorite_work_option), "query");
if (defaultType.equals("query")) {
FavoriteWorkDialog favoriteWorkDialog = new FavoriteWorkDialog();
favoriteWorkDialog.setToAdd(new FavoriteWorkDialog.ToAdd() {
@Override
public void add(String type) {
addBookmark(activity, work.getId(), type);
}
});
favoriteWorkDialog.setToAdd(type -> addBookmark(activity, work.getId(), type));
favoriteWorkDialog.show(activity.getSupportFragmentManager(), "FavoriteWork");
} else {
addBookmark(activity, work.getId(), defaultType);
Expand Down Expand Up @@ -369,7 +364,6 @@ public void onError(Throwable e) {
@Override
public void onNext(ResponseBody responseBody) {
HttpClient.writeFileFromRequestBody(responseBody, file);

timer.cancel();
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
Uri uri = Uri.fromFile(file);
Expand Down
Binary file removed app/src/main/res/ic_launcher-web.png
Binary file not shown.
14 changes: 14 additions & 0 deletions app/src/main/res/xml-v25/shortcuts.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/ic_search_white_24px"
android:shortcutId="search"
android:shortcutLongLabel="@string/search"
android:shortcutShortLabel="@string/search">
<intent
android:action="android.intent.action.VIEW"
android:targetClass=".search.SearchActivity"
android:targetPackage=".Search"/>
</shortcut>
</shortcuts>
19 changes: 2 additions & 17 deletions app/src/main/res/xml/shortcuts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,10 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/ic_search_white_24px"
android:shortcutId="search"
android:shortcutLongLabel="@string/search"
android:shortcutShortLabel="@string/search">
android:icon="@drawable/ic_search_white_24px">
<intent
android:action="android.intent.action.VIEW"
android:targetClass=".search.SearchActivity"
android:targetPackage=".Search"/>
android:targetPackage=".Search" />
</shortcut>
<!--<shortcut-->
<!--android:enabled="true"-->
<!--android:icon="@drawable/ic_share_24dp"-->
<!--android:shortcutDisabledMessage="@string/shortcut_disabled_message1"-->
<!--android:shortcutId="shortcutId2"-->
<!--android:shortcutLongLabel="@string/shortcut_long_label2"-->
<!--android:shortcutShortLabel="@string/shortcut_short_label2">-->
<!--<intent-->
<!--android:action="action2"-->
<!--android:targetClass="com.wuxiaolong.designsupportlibrarysample.BottomNavigationActivity"-->
<!--android:targetPackage="com.wuxiaolong.designsupportlibrarysample"/>-->
<!--</shortcut>-->
</shortcuts>
2 changes: 2 additions & 0 deletions bugly.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
APP_ID=0fc124925c
APP_KEY=95c2e997-cf8d-488a-841e-ce412816eff4
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'

classpath 'com.tencent.bugly:symtabfileuploader:latest.release'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down

0 comments on commit 5afb2d3

Please sign in to comment.