Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
dskyuno committed May 28, 2021
2 parents 20d96f0 + 3fb8f72 commit 1b82bf2
Show file tree
Hide file tree
Showing 43 changed files with 654 additions and 324 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,27 @@ Gif录制的有些卡顿,真机预览效果更佳。扫描二维码下载Demo
如果二维码图片不可见,[点我下载Demo体验](http://d.7short.com/2q63)

## Gradle
**由于jcenter跑路,从2.2.24版本开始,转为jitpack了。**
[![](https://jitpack.io/v/li-xiaojun/XPopup.svg)](https://jitpack.io/#li-xiaojun/XPopup)
```
implementation 'com.github.li-xiaojun:XPopup:版本号看上面'
```
jitpack还要求在工程根目录的`build.gradle`中添加如下:
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```

**2.2.23之前的地址请暂时使用下面的地址,但是jcenter只保证能用到2022年初**
![](https://api.bintray.com/packages/li-xiaojun/jrepo/xpopup/images/download.svg)
```groovy
implementation 'com.lxj:xpopup:最新版本'
implementation 'com.lxj:xpopup:最新版本' //jcenter跑路,预计到2022年初就无法访问
```

其中编译版本必须 >= 29:
```
compileSdkVersion 29
Expand All @@ -105,7 +122,7 @@ implementation 'androidx.recyclerview:recyclerview:1.1.0'
- [如何自定义弹窗](https://github.com/li-xiaojun/XPopup/wiki/3.-%E8%87%AA%E5%AE%9A%E4%B9%89%E5%BC%B9%E7%AA%97)
- [如何自定义动画](https://github.com/li-xiaojun/XPopup/wiki/4.-%E8%87%AA%E5%AE%9A%E4%B9%89%E5%8A%A8%E7%94%BB)
- [弹窗常用设置](https://github.com/li-xiaojun/XPopup/wiki/5.-%E5%B8%B8%E7%94%A8%E8%AE%BE%E7%BD%AE)
- [常见问题](https://github.com/li-xiaojun/XPopup/wiki/6.-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)
- [常见问题(必看)](https://github.com/li-xiaojun/XPopup/wiki/6.-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98(%E5%BF%85%E7%9C%8B))
- [也许你想要这些效果](https://github.com/li-xiaojun/XPopup/wiki/7.-%E4%B9%9F%E8%AE%B8%E4%BD%A0%E6%83%B3%E8%A6%81%E8%BF%99%E4%BA%9B%E6%95%88%E6%9E%9C)
- [一行代码在应用后台弹出弹窗](https://github.com/li-xiaojun/XPopup/wiki/8.-%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%9C%A8%E5%BA%94%E7%94%A8%E5%90%8E%E5%8F%B0%E5%BC%B9%E5%87%BA%E5%BC%B9%E7%AA%97)
- [时间选择器和城市选择器](https://github.com/li-xiaojun/XPopup/wiki/9.-%E6%88%91%E6%83%B3%E8%A6%81%E6%97%B6%E9%97%B4%E9%80%89%E6%8B%A9%E5%99%A8%E6%88%96%E5%9F%8E%E5%B8%82%E9%80%89%E6%8B%A9%E5%99%A8%E5%BC%B9%E7%AA%97)
Expand Down Expand Up @@ -181,6 +198,11 @@ implementation 'androidx.recyclerview:recyclerview:1.1.0'
- 我爱赚钱(下载地址: https://sj.qq.com/myapp/detail.htm?apkName=me.tx.taskhunter&info=532BB35B65D9FFA7F497DEFA6E27F663)
- 海信智学平台
- 饭友视频聊天交友(下载地址:https://android.myapp.com/myapp/detail.htm?apkName=com.quanmai.findu&info=519DFF1F69A45EAF33B4D2C51A7AC2D3)
- 皮皮陪玩 游戏陪玩语音直播app https://app.apeiwan.com/
- 你我有谱(app名)
- Bookista(https://play.google.com/store/apps/details?id=com.latinoriente.bookista)
- 伊的家商城项目
- 点点日记(常州市宏域网络有限公司)


## 打个赏
Expand Down
14 changes: 8 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ android {
versionName xpopup_version
ndk {
// 设置支持的SO库架构
abiFilters 'armeabi-v7a' //'x86', 'x86_64' , 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
// abiFilters 'armeabi-v7a'
//'x86', 'x86_64' , 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
}
// dataBinding {
// enabled = true
Expand Down Expand Up @@ -55,17 +56,18 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.lxj:easyadapter:1.2.3'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.github.li-xiaojun:EasyAdapter:1.2.4'
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation project(':library')
implementation 'com.blankj:utilcode:1.30.5'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.6'
implementation 'com.blankj:utilcode:1.30.6'
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.6'
implementation "androidx.cardview:cardview:1.0.0"
implementation 'com.lxj:statelayout:1.1.8'
implementation 'com.github.li-xiaojun:StateLayout:1.2.3'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.3.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.tencent.bugly:crashreport:3.2.3'
implementation "androidx.viewpager2:viewpager2:1.0.0"

}

2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.lxj.xpopupdemo">

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Expand All @@ -24,6 +25,7 @@
<activity android:name="com.lxj.xpopupdemo.MainActivity"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustNothing"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
15 changes: 10 additions & 5 deletions app/src/main/java/com/lxj/xpopupdemo/DemoActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.enums.PopupAnimation;
import com.lxj.xpopup.enums.PopupPosition;
import com.lxj.xpopup.interfaces.OnConfirmListener;
import com.lxj.xpopup.interfaces.OnSelectListener;
import com.lxj.xpopupdemo.fragment.ImageViewerDemo;
Expand All @@ -24,6 +25,7 @@
public class DemoActivity extends AppCompatActivity {
EditText editText;
RecyclerView recyclerView;
BasePopupView attachPopup;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -38,10 +40,13 @@ public void onClick(View v) {
});
showMultiPopup();

final BasePopupView popupView = new XPopup.Builder(this)
attachPopup = new XPopup.Builder(this)
.atView(editText)
.isRequestFocus(false) //要设置这个,否则Activity内的输入框会无法获取焦点
.isViewMode(true) //开启View实现
.isRequestFocus(false) //不强制焦点
.isClickThrough(true) //点击透传
.hasShadowBg(false)
.positionByWindowCenter(true)
.popupAnimation(PopupAnimation.ScaleAlphaFromCenter)
.asAttachList(new String[]{"联想到的内容 - 1", "联想到的内容 - 2", "联想到的内容 - 333"}, null, new OnSelectListener() {
@Override
Expand All @@ -57,11 +62,11 @@ public void onTextChanged(CharSequence s, int start, int before, int count) { }
@Override
public void afterTextChanged(Editable s) {
if(s.toString().isEmpty()){
popupView.dismiss();
attachPopup.dismiss();
return;
}
if(popupView.isDismiss()){
popupView.show();
if(attachPopup.isDismiss()){
attachPopup.show();
}
}
});
Expand Down
34 changes: 13 additions & 21 deletions app/src/main/java/com/lxj/xpopupdemo/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
package com.lxj.xpopupdemo;

import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.WindowManager;

import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;

import com.blankj.utilcode.util.BarUtils;
import com.blankj.utilcode.util.RomUtils;
import com.google.android.material.tabs.TabLayout;
import com.lxj.xpopup.XPopup;
Expand All @@ -40,7 +36,6 @@ public class MainActivity extends AppCompatActivity {
TabLayout tabLayout;
public ViewPager viewPager;

LoadingPopupView loadingPopupView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -49,7 +44,6 @@ protected void onCreate(Bundle savedInstanceState) {
// BarUtils.setStatusBarLightMode(this, true);
// BarUtils.setNavBarColor(this, Color.RED);


ActionBar actionBar = getSupportActionBar();
actionBar.setTitle(actionBar.getTitle() + "-" + BuildConfig.VERSION_NAME);

Expand All @@ -63,26 +57,24 @@ protected void onCreate(Bundle savedInstanceState) {
// XPopup.setAnimationDuration(1000);
// XPopup.setPrimaryColor(Color.RED);
// ScreenUtils.setLandscape(this);
loadingPopupView = new XPopup.Builder(this)
LoadingPopupView loadingPopupView = new XPopup.Builder(this)
.isDestroyOnDismiss(true)
.asLoading("嘻嘻嘻嘻嘻");
loadingPopupView.show();
loadingPopupView.delayDismiss(1200);

// BarUtils.setStatusBarVisibility(this, false);
// BarUtils.setNavBarVisibility(this, false);

// ToastUtils.showLong(FuckRomUtils.getRomInfo().getName() + FuckRomUtils.getRomInfo().getVersion());
// ToastUtils.showLong(android.os.Build.MODEL);
// String str = RomUtils.getRomInfo().toString() + " " + "nav可见:" + XPopupUtils.isNavBarVisible(getWindow()) + " navHeight: "+ XPopupUtils.getNavBarHeight();
int windowHeight = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getHeight();
String str = RomUtils.getRomInfo().toString() + " " + "deviceHeight:" + XPopupUtils.getScreenHeight(this)
+ " getAppHeight: "+ XPopupUtils.getAppHeight(this)
+ " statusHeight: "+ XPopupUtils.getStatusBarHeight()
+ " navHeight: "+ XPopupUtils.getNavBarHeight()
+ " hasNav: "+ XPopupUtils.isNavBarVisible(getWindow());
new Handler().post(new Runnable() {
@Override
public void run() {
String str = RomUtils.getRomInfo().toString() + " " + "deviceHeight:" + XPopupUtils.getScreenHeight(MainActivity.this)
+ " getAppHeight: "+ XPopupUtils.getAppHeight(MainActivity.this)
+ " statusHeight: "+ XPopupUtils.getStatusBarHeight()
+ " navHeight: "+ XPopupUtils.getNavBarHeight()
+ " hasNav: "+ XPopupUtils.isNavBarVisible(getWindow());
// ToastUtils.showLong(str);
Log.e("tag", str);
Log.e("tag", str);
}
});
}

class MainAdapter extends FragmentPagerAdapter {
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/java/com/lxj/xpopupdemo/XPopupApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

import android.app.Application;
import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;

import com.blankj.utilcode.util.ToastUtils;
import com.blankj.utilcode.util.Utils;
import com.tencent.bugly.crashreport.CrashReport;

/**
Expand All @@ -14,6 +19,10 @@ public class XPopupApp extends Application {
public void onCreate() {
super.onCreate();
context = this;

ToastUtils.getDefaultMaker().setGravity(Gravity.CENTER, 0 , 0);
ToastUtils.getDefaultMaker().setBgResource(R.drawable.bg_toast);
ToastUtils.getDefaultMaker().setTextColor(Color.WHITE);
// CrashReport.initCrashReport(getApplicationContext(), "e494d36dcc", false);
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package com.lxj.xpopupdemo.custom;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.lxj.easyadapter.EasyAdapter;
import com.lxj.easyadapter.ViewHolder;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.DrawerPopupView;
import com.lxj.xpopup.interfaces.OnConfirmListener;
import com.lxj.xpopup.widget.VerticalRecyclerView;
import com.lxj.xpopupdemo.R;

Expand Down Expand Up @@ -67,6 +71,19 @@ protected void bind(ViewHolder viewHolder, Object o, int i) {
}
}
});
findViewById(R.id.btnMe).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
new XPopup.Builder(getContext()).isDestroyOnDismiss(true)
.asConfirm("提示", "确定要退出吗?", new OnConfirmListener() {
@Override
public void onConfirm() {
((Activity)getContext()).finish();
dismiss();
}
}).show();
}
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
import androidx.annotation.NonNull;
import android.view.View;
import android.widget.EditText;

import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BottomPopupView;
import com.lxj.xpopup.interfaces.OnInputConfirmListener;
import com.lxj.xpopupdemo.R;
import com.lxj.xpopupdemo.fragment.QuickStartDemo;

/**
* Description: 自定义带有输入框的Bottom弹窗
Expand Down
Loading

0 comments on commit 1b82bf2

Please sign in to comment.