Skip to content

Commit

Permalink
Merge pull request #151 from xuexiangjys/dev/1.2.0
Browse files Browse the repository at this point in the history
Dev/1.2.0
  • Loading branch information
xuexiangjys authored Nov 6, 2022
2 parents 9f10d35 + 767209a commit e41f46f
Show file tree
Hide file tree
Showing 227 changed files with 1,555 additions and 670 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Please read the [instruction document](https://github.com/xuexiangjys/XUI/wiki)

| WeChat public number | juejin | zhihu | CSDN | jianshu | segmentfault | bilibili | toutiao
|---------|---------|--------- |---------|---------|---------|---------|---------|
| [我的Android开源之旅](https://ss.im5i.com/2021/06/14/6tqAU.png) | [Click me](https://juejin.im/user/598feef55188257d592e56ed/posts) | [Click me](https://www.zhihu.com/people/xuexiangjys/posts) | [Click me](https://xuexiangjys.blog.csdn.net/) | [Click me](https://www.jianshu.com/u/6bf605575337) | [Click me](https://segmentfault.com/u/xuexiangjys) | [Click me](https://space.bilibili.com/483850585) | [Click me](https://img.rruu.net/image/5ff34ff7b02dd)
| [我的Android开源之旅](https://t.1yb.co/Irse) | [Click me](https://juejin.im/user/598feef55188257d592e56ed/posts) | [Click me](https://www.zhihu.com/people/xuexiangjys/posts) | [Click me](https://xuexiangjys.blog.csdn.net/) | [Click me](https://www.jianshu.com/u/6bf605575337) | [Click me](https://segmentfault.com/u/xuexiangjys) | [Click me](https://space.bilibili.com/483850585) | [Click me](https://img.rruu.net/image/5ff34ff7b02dd)

## Rapid integration of X-Library

Expand Down Expand Up @@ -80,7 +80,7 @@ allprojects {
dependencies {
...
//androidx project
implementation 'com.github.xuexiangjys:XUI:1.1.9'
implementation 'com.github.xuexiangjys:XUI:1.2.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
Expand Down
26 changes: 13 additions & 13 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

| 公众号 | 掘金 | 知乎 | CSDN | 简书 | 思否 | 哔哩哔哩 | 今日头条
|---------|---------|--------- |---------|---------|---------|---------|---------|
| [我的Android开源之旅](https://ss.im5i.com/2021/06/14/6tqAU.png) | [点我](https://juejin.im/user/598feef55188257d592e56ed/posts) | [点我](https://www.zhihu.com/people/xuexiangjys/posts) | [点我](https://xuexiangjys.blog.csdn.net/) | [点我](https://www.jianshu.com/u/6bf605575337) | [点我](https://segmentfault.com/u/xuexiangjys) | [点我](https://space.bilibili.com/483850585) | [点我](https://img.rruu.net/image/5ff34ff7b02dd)
| [我的Android开源之旅](https://t.1yb.co/Irse) | [点我](https://juejin.im/user/598feef55188257d592e56ed/posts) | [点我](https://www.zhihu.com/people/xuexiangjys/posts) | [点我](https://xuexiangjys.blog.csdn.net/) | [点我](https://www.jianshu.com/u/6bf605575337) | [点我](https://segmentfault.com/u/xuexiangjys) | [点我](https://space.bilibili.com/483850585) | [点我](https://img.rruu.net/image/5ff34ff7b02dd)

## X系列库快速集成

Expand Down Expand Up @@ -78,7 +78,7 @@ allprojects {
dependencies {
...
//androidx项目
implementation 'com.github.xuexiangjys:XUI:1.1.9'
implementation 'com.github.xuexiangjys:XUI:1.2.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
Expand Down Expand Up @@ -170,37 +170,37 @@ protected void attachBaseContext(Context newBase) {

### 演示程序截图

![1_splash.png](https://ss.im5i.com/2021/06/14/6uDhR.png)   ![2_main.png](https://ss.im5i.com/2021/06/14/6uzmO.png)   ![3_about.png](https://ss.im5i.com/2021/06/14/6uaJd.png)  
![1_splash.png](./art/1_splash.png)   ![2_main.png](./art/2_main.png)   ![3_about.png](./art/3_about.png)  

![4_menu.png](https://ss.im5i.com/2021/06/14/6u4n4.png)   ![5_dialog.png](https://ss.im5i.com/2021/06/14/6upMW.png)   ![6_bottom_dialog.png](https://ss.im5i.com/2021/06/14/6uMdG.png)  
![4_menu.png](./art/4_menu.png)   ![5_dialog.png](./art/5_dialog.png)   ![6_bottom_dialog.png](./art/6_bottom_dialog.png)  

![7_picker.png](https://ss.im5i.com/2021/06/14/6uOWz.png)   ![8_webview.png](https://ss.im5i.com/2021/06/14/6uk05.png)  ![9_flowlayout.png](https://ss.im5i.com/2021/06/14/65FS6.png)  
![7_picker.png](./art/7_picker.png)   ![8_webview.png](./art/8_webview.png)  ![9_flowlayout.png](./art/9_flowlayout.png)  

![10_ninegrid.png](https://ss.im5i.com/2021/06/14/65Qt8.png)   ![11_radius_imageview.png](https://ss.im5i.com/2021/06/14/65hxU.png)   ![12_badge_view.png](https://ss.im5i.com/2021/06/14/65Cww.png)  
![10_ninegrid.png](./art/10_ninegrid.png)   ![11_radius_imageview.png](./art/11_radius_imageview.png)   ![12_badge_view.png](./art/12_badge_view.png)  

![13_tabview.png](https://ss.im5i.com/2021/06/14/65qJZ.png)   ![14_citypicker.png](https://ss.im5i.com/2021/06/14/65voJ.png)   ![15_refresh_layout.png](https://ss.im5i.com/2021/06/14/656O1.png)  
![13_tabview.png](./art/13_tabview.png)   ![14_citypicker.png](./art/14_citypicker.png)   ![15_refresh_layout.png](./art/15_refresh_layout.png)  

![16_spinner.png](https://ss.im5i.com/2021/06/14/65Sdn.png)  
![16_spinner.png](./art/16_spinner.png)  

### Demo下载

> 演示程序大概18M(主要是demo中集成了一个小视频拍摄的库比较大,大约13M左右,而XUI库目前只有644k大小),项目比较大,推荐使用蒲公英下载。
![xui_size.png](https://ss.im5i.com/2021/06/14/65rcS.png)
![xui_size.png](./art/xui_size.png)

#### 蒲公英下载

> 蒲公英下载的密码: xuexiangjys
[![蒲公英](https://img.shields.io/badge/downloads-蒲公英-blue.svg)](https://www.pgyer.com/XUIDemo)

[![download_pugongying.png](https://ss.im5i.com/2021/06/14/65VuP.png)](https://www.pgyer.com/XUIDemo)
[![download_pugongying.png](./art/download_pugongying.png)](https://www.pgyer.com/XUIDemo)

#### Github下载

[![Github](https://img.shields.io/badge/downloads-Github-blue.svg)](https://github.com/xuexiangjys/XUI/blob/master/apk/xuidemo.apk?raw=true)

[![download_github.png](https://ss.im5i.com/2021/06/14/65PS2.png)](https://github.com/xuexiangjys/XUI/blob/master/apk/xuidemo.apk?raw=true)
[![download_github.png](./art/download_github.png)](https://github.com/xuexiangjys/XUI/blob/master/apk/xuidemo.apk?raw=true)

## 贡献代码

Expand Down Expand Up @@ -240,7 +240,7 @@ protected void attachBaseContext(Context newBase) {

> 你的打赏是我维护的动力,我将会列出所有打赏人员的清单在下方作为凭证,打赏前请留下打赏项目的备注!
![pay.png](https://ss.im5i.com/2021/06/14/6twG6.png)
![pay.png](https://raw.githubusercontent.com/xuexiangjys/Resource/master/img/pay/pay.png)

感谢下面小伙伴的打赏:

Expand Down Expand Up @@ -332,4 +332,4 @@ X*? | 18.88¥ | 微信

[![](https://img.shields.io/badge/XUI开源交流3群-1090612354-blue.svg)](https://qm.qq.com/cgi-bin/qm/qr?k=nOY3GGJY-jiwzhQpR8E06G-yrOUsxCP1)

![](https://ss.im5i.com/2021/06/14/65yoL.jpg)
![](https://s1.ax1x.com/2022/04/27/LbGMJH.jpg)
Binary file modified apk/xuidemo.apk
Binary file not shown.
16 changes: 8 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId "com.xuexiang.xuidemo"
minSdkVersion 17
targetSdkVersion build_versions.target_sdk
versionCode 20
versionName "1.1.9"
versionCode 21
versionName "1.2.0"

multiDexEnabled true
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -103,8 +103,8 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.12.0'

// XUI框架
// implementation project(':xui_lib')
implementation 'com.github.xuexiangjys:XUI:1.1.9'
implementation project(':xui_lib')
// implementation 'com.github.xuexiangjys:XUI:1.1.9'
// implementation 'com.qmuiteam:qmui:1.2.0'

// 工具类
Expand All @@ -113,8 +113,8 @@ dependencies {
// 切片
implementation 'com.github.xuexiangjys.XAOP:xaop-runtime:1.1.0'
// 页面路由
implementation 'com.github.xuexiangjys.XRouter:xrouter-runtime:1.0.1'
annotationProcessor 'com.github.xuexiangjys.XRouter:xrouter-compiler:1.0.1'
implementation 'com.github.xuexiangjys.XRouter:xrouter-runtime:1.1.0'
annotationProcessor 'com.github.xuexiangjys.XRouter:xrouter-compiler:1.1.0'
// XPage页面框架
implementation 'com.github.xuexiangjys.XPage:xpage-lib:3.2.0'
annotationProcessor project(':widget_compiler')
Expand Down Expand Up @@ -168,7 +168,7 @@ dependencies {
implementation 'com.yarolegovich:sliding-root-nav:1.1.0'

// XQRCode二维码扫描
implementation 'com.github.xuexiangjys:XQRCode:1.1.0'
implementation 'com.github.xuexiangjys:XQRCode:1.1.1'
// CityPicker
implementation "com.github.xuexiangjys:CityPicker:1.0.2"
// XFloatView悬浮窗口
Expand Down Expand Up @@ -199,7 +199,7 @@ dependencies {
implementation 'com.alibaba.android:ultraviewpager:1.0.7.8'
implementation 'com.alibaba.android:tangram:3.3.6'
// 版本更新
implementation 'com.github.xuexiangjys:XUpdate:2.1.1'
implementation 'com.github.xuexiangjys:XUpdate:2.1.3'
implementation 'com.zhy:okhttputils:2.6.2'
implementation deps.gson
implementation deps.okhttp3
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<activity
android:name=".activity.SplashActivity"
android:configChanges="screenSize|keyboardHidden|orientation|keyboard"
android:exported="true"
android:theme="@style/XUITheme.Launch.Demo"
android:windowSoftInputMode="adjustPan|stateHidden">
<intent-filter>
Expand Down Expand Up @@ -92,6 +93,7 @@
<activity
android:name=".base.webview.AgentWebActivity"
android:configChanges="screenSize|keyboardHidden|orientation|keyboard"
android:exported="true"
android:hardwareAccelerated="true"
android:label="@string/app_browser_name"
android:launchMode="singleTask"
Expand Down Expand Up @@ -208,14 +210,17 @@
<!--创建快捷方式的广播监听-->
<receiver
android:name=".fragment.utils.shortcut.ShortcutReceiver"
android:exported="true"
android:permission="com.android.launcher.permission.INSTALL_SHORTCUT">
<intent-filter>
<action android:name="com.android.launcher.action.INSTALL_SHORTCUT" />
</intent-filter>
</receiver>

<!--创建快捷方式-->
<activity android:name=".fragment.utils.shortcut.CreateShortcutResultIntentActivity">
<activity
android:name=".fragment.utils.shortcut.CreateShortcutResultIntentActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static List<AdapterItem> getGridItems(Context context) {

private static List<AdapterItem> getGridItems(Context context, int titleArrayId, int iconArrayId) {
List<AdapterItem> list = new ArrayList<>();
String[] titles = ResUtils.getStringArray(titleArrayId);
String[] titles = ResUtils.getStringArray(context, titleArrayId);
Drawable[] icons = ResUtils.getDrawableArray(context, iconArrayId);
for (int i = 0; i < titles.length; i++) {
list.add(new AdapterItem(titles[i], icons[i]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import com.xuexiang.xuidemo.utils.SettingSPUtils;
import com.xuexiang.xuidemo.utils.TokenUtils;
import com.xuexiang.xuidemo.utils.Utils;
import com.xuexiang.xuidemo.utils.XToastUtils;
import com.xuexiang.xui.utils.XToastUtils;
import com.xuexiang.xuidemo.widget.GuideTipsDialog;
import com.xuexiang.xutil.common.ClickUtils;
import com.xuexiang.xutil.system.DeviceUtils;
Expand Down Expand Up @@ -92,7 +92,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

private void initData() {
mMenuTitles = ResUtils.getStringArray(R.array.menu_titles);
mMenuTitles = ResUtils.getStringArray(this, R.array.menu_titles);
mMenuIcons = ResUtils.getDrawableArray(this, R.array.menu_icons);
}

Expand Down Expand Up @@ -183,7 +183,7 @@ public boolean isMenuOpen() {

private void initSlidingMenu(Bundle savedInstanceState) {
mSlidingRootNav = new SlidingRootNavBuilder(this)
.withGravity(ResUtils.isRtl() ? SlideGravity.RIGHT : SlideGravity.LEFT)
.withGravity(ResUtils.isRtl(this) ? SlideGravity.RIGHT : SlideGravity.LEFT)
.withMenuOpened(false)
.withContentClickableWhenMenuOpened(false)
.withSavedState(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import com.xuexiang.xuidemo.R;
import com.xuexiang.xuidemo.base.AppCompatPreferenceActivity;
import com.xuexiang.xuidemo.utils.Utils;
import com.xuexiang.xuidemo.utils.XToastUtils;
import com.xuexiang.xui.utils.XToastUtils;

/**
* 设置页面
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.xuexiang.xui.widget.banner.widget.banner.SimpleImageBanner;
import com.xuexiang.xuidemo.DemoDataProvider;
import com.xuexiang.xuidemo.R;
import com.xuexiang.xuidemo.utils.XToastUtils;
import com.xuexiang.xui.utils.XToastUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.xuexiang.xui.widget.banner.widget.banner.BannerItem;
import com.xuexiang.xui.widget.banner.widget.banner.SimpleImageBanner;
import com.xuexiang.xuidemo.R;
import com.xuexiang.xuidemo.utils.XToastUtils;
import com.xuexiang.xui.utils.XToastUtils;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package com.xuexiang.xuidemo.adapter;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
Expand Down Expand Up @@ -66,11 +67,11 @@ public class UltraPagerAdapter extends PagerAdapter {

private RecyclerViewHolder.OnItemClickListener<BannerItem> mOnItemClickListener;

public UltraPagerAdapter(List<BannerItem> list, float scale) {
public UltraPagerAdapter(@NonNull Context context, List<BannerItem> list, float scale) {
if (list != null && !list.isEmpty()) {
mData.addAll(list);
}
mPlaceHolder = new ColorDrawable(ResUtils.getColor(R.color.default_image_banner_placeholder_color));
mPlaceHolder = new ColorDrawable(ResUtils.getColor(context, R.color.default_image_banner_placeholder_color));
mEnableCache = true;
mScale = scale;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected void registerSlideBack() {
if (isSupportSlideBack()) {
SlideBack.withFixSize(this)
.haveScroll(true)
.edgeMode(ResUtils.isRtl() ? SlideBack.EDGE_RIGHT : SlideBack.EDGE_LEFT)
.edgeMode(ResUtils.isRtl(this) ? SlideBack.EDGE_RIGHT : SlideBack.EDGE_LEFT)
.callBack(this::popPage)
.register();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected TitleBar initTitle() {

@MemoryCache
private Drawable getNavigationBackDrawable(int navigationBackId) {
return DrawableUtils.getSupportRTLDrawable(ThemeUtils.resolveDrawable(getContext(), navigationBackId));
return DrawableUtils.getSupportRTLDrawable(getContext(), ThemeUtils.resolveDrawable(getContext(), navigationBackId));
}

public IMessageLoader getMessageLoader() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void performAction(View view) {

@Override
public int rightPadding() {
return DensityUtils.dp2px(10);
return DensityUtils.dp2px(getContext(), 10);
}
});
titleBar.addAction(new TitleBar.ImageAction(R.drawable.icon_action_about) {
Expand All @@ -97,7 +97,7 @@ protected void initViews() {
}

private void initRecyclerView() {
WidgetUtils.initGridRecyclerView(mRecyclerView, 3, DensityUtils.dp2px(2), ThemeUtils.resolveColor(getContext(), R.attr.xui_config_color_separator_light, ResUtils.getColor(R.color.xui_config_color_separator_light_phone)));
WidgetUtils.initGridRecyclerView(mRecyclerView, 3, DensityUtils.dp2px(getContext(), 2), ThemeUtils.resolveColor(getContext(), R.attr.xui_config_color_separator_light, ResUtils.getColor(getContext(), R.color.xui_config_color_separator_light_phone)));

WidgetItemAdapter mWidgetItemAdapter = new WidgetItemAdapter(sortPageInfo(getPageContents()));
mWidgetItemAdapter.setOnItemClickListener(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected TitleBar initTitle() {

@MemoryCache
private Drawable getNavigationBackDrawable(int navigationBackId) {
return DrawableUtils.getSupportRTLDrawable(ThemeUtils.resolveDrawable(getContext(), navigationBackId));
return DrawableUtils.getSupportRTLDrawable(getContext(), ThemeUtils.resolveDrawable(getContext(), navigationBackId));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected TitleBar initTitle() {

@MemoryCache
private Drawable getNavigationBackDrawable(int navigationBackId) {
return DrawableUtils.getSupportRTLDrawable(ThemeUtils.resolveDrawable(getContext(), navigationBackId));
return DrawableUtils.getSupportRTLDrawable(getContext(), ThemeUtils.resolveDrawable(getContext(), navigationBackId));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.xuexiang.xrouter.annotation.Router;
import com.xuexiang.xrouter.launcher.XRouter;
import com.xuexiang.xuidemo.utils.Utils;
import com.xuexiang.xuidemo.utils.XToastUtils;
import com.xuexiang.xui.utils.XToastUtils;
import com.xuexiang.xutil.common.StringUtils;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import com.xuexiang.xui.widget.slideback.SlideBack;
import com.xuexiang.xuidemo.R;
import com.xuexiang.xuidemo.base.BaseAppCompatActivity;
import com.xuexiang.xuidemo.utils.XToastUtils;
import com.xuexiang.xui.utils.XToastUtils;

import static com.xuexiang.xuidemo.base.webview.AgentWebFragment.KEY_URL;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
import com.xuexiang.xui.utils.DrawableUtils;
import com.xuexiang.xuidemo.R;
import com.xuexiang.xuidemo.utils.Utils;
import com.xuexiang.xuidemo.utils.XToastUtils;
import com.xuexiang.xui.utils.XToastUtils;
import com.xuexiang.xutil.net.JsonUtil;

import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.xuexiang.xuidemo.base.webview;

import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.util.Log;
Expand Down Expand Up @@ -87,7 +88,7 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
url = url.toLowerCase();
if (!hasAd(url)) {
if (!hasAd(view.getContext(), url)) {
//正常加载
return super.shouldInterceptRequest(view, url);
} else {
Expand All @@ -100,7 +101,7 @@ public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
String url = request.getUrl().toString().toLowerCase();
if (!hasAd(url)) {
if (!hasAd(view.getContext(), url)) {
//正常加载
return super.shouldInterceptRequest(view, request);
} else {
Expand All @@ -115,8 +116,8 @@ public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceReque
* @param url
* @return
*/
public static boolean hasAd(String url) {
String[] adUrls = ResUtils.getStringArray(R.array.adBlockUrl);
public static boolean hasAd(Context context, String url) {
String[] adUrls = ResUtils.getStringArray(context, R.array.adBlockUrl);
for (String adUrl : adUrls) {
if (url.contains(adUrl)) {
return true;
Expand Down
Loading

0 comments on commit e41f46f

Please sign in to comment.