Skip to content

Commit

Permalink
修改WebViewActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
sdwfqin committed Jun 19, 2018
1 parent fbf1a7a commit a51db15
Show file tree
Hide file tree
Showing 23 changed files with 505 additions and 240 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

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

1 change: 1 addition & 0 deletions .idea/modules.xml

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

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### 如果你看到这个仓库,非常荣幸,如果想要用于您的项目中,建议先看源码,因为这是我用来做外包用来快速开发的库,里面很多内容适合我的项目但不一定适合您的项目,当然,如果需要,您可以clone源码中的部分代码用于您的项目中,如有雷同,不甚荣幸

// 主模块
implementation 'com.sdwfqin.quicklib:quicklib:1.3.0'
implementation 'com.sdwfqin.quicklib:quicklib:1.3.1'
// 支付模块(可以不依赖quicklib单独引入)
implementation 'com.sdwfqin.quicklib:paylib:1.0.1'
// 如果使用butterknife请添加【可选】
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
</activity>
<activity android:name=".ui.home.PayPwdInputActivity">
</activity>
<activity android:name=".ui.home.CustomWebviewActivity">
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.sdwfqin.quickseed.ui.home;

import com.sdwfqin.quicklib.module.webview.BaseWebView;

/**
* 描述:自定义Webview
*
* @author zhangqin
* @date 2018/6/19
*/
public class CustomWebviewActivity extends BaseWebView {

@Override
public String getUrl() {
return "https://www.sdwfqin.com";
}

@Override
public String getActivityTitle() {
return "sdwfqin.com";
}
}
156 changes: 86 additions & 70 deletions app/src/main/java/com/sdwfqin/quickseed/ui/home/HomeFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
import android.support.design.widget.BottomSheetDialogFragment;
import android.support.v4.app.FragmentManager;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.qmuiteam.qmui.widget.QMUITopBar;
import com.sdwfqin.quicklib.base.BaseFragment;
import com.sdwfqin.quicklib.module.webview.WebViewActivity;
import com.sdwfqin.quicklib.module.qrbarscan.QrBarScanActivity;
import com.sdwfqin.quicklib.module.seeimage.SeeImageActivity;
import com.sdwfqin.quicklib.module.webview.WebViewActivity;
import com.sdwfqin.quicklib.view.dialog.BottomDialogPhotoFragment;
import com.sdwfqin.quicklib.view.dialog.HintDialog;
import com.sdwfqin.quickseed.R;
Expand All @@ -22,7 +23,6 @@
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

import static android.app.Activity.RESULT_OK;

Expand All @@ -34,12 +34,22 @@
*/
public class HomeFragment extends BaseFragment {

@BindView(R.id.list)
ListView list;
@BindView(R.id.status_view)
View mStatusView;
@BindView(R.id.home_msg)
ImageView mHomeMsg;
@BindView(R.id.home_title_tv)
TextView mHomeTitleTv;
@BindView(R.id.topbar)
QMUITopBar mTopbar;

private String[] mTitle = new String[]{"跳转网页",
"扫描二维码",
"颤抖的按钮",
"图片预览",
"底部弹窗",
"上传图片九宫格",
"自定义验证码/密码View",
"自定义Webview",
};

@Override
protected int getLayout() {
Expand All @@ -55,79 +65,85 @@ protected void initEventAndData() {
mStatusView.getLayoutParams().height = Constants.STATUS_HEIGHT;
}

mHomeTitleTv.setText("首页");
mTopbar.setTitle("首页");

list.setAdapter(new ArrayAdapter<>(mContext, R.layout.item_list, R.id.tv_items, mTitle));
initListener();
}

@Override
protected void lazyLoadShow(boolean isLoad) {
private void initListener() {
list.setOnItemClickListener((adapterView, view, i, l) -> {
switch (i) {
case 0:
WebViewActivity.launch(mContext, "https://www.baidu.com");
break;
case 1:
startActivityForResult(new Intent(mContext, QrBarScanActivity.class), Constants.RESULT_CODE_1);
break;
case 2:
HintDialog hintDialog = new HintDialog(mContext);
hintDialog.show();
hintDialog.setTitle("啊啊啊啊啊啊");
hintDialog.hideRight();
hintDialog.setLeftText("取消");
hintDialog.setOnClickListener(new HintDialog.OnDialogClickListener() {
@Override
public void left() {
showMsg("您点击了取消!");
}

@Override
public void right() {

}
});
break;
case 3:
List<String> strings = new ArrayList<>();
strings.add("http://pic4.nipic.com/20091217/3885730_124701000519_2.jpg");
strings.add("http://img.taopic.com/uploads/allimg/140729/240450-140HZP45790.jpg");
SeeImageActivity.launch(mContext, strings);
break;
case 4:
BottomDialogPhotoFragment.Builder builder = new BottomDialogPhotoFragment.Builder();
BottomSheetDialogFragment bottomSheetDialogFragment = builder.setOnClickListener(new BottomDialogPhotoFragment.OnDialogClickListener() {
@Override
public void xiangce() {

}
}

@OnClick({R.id.a, R.id.b, R.id.c, R.id.d, R.id.e, R.id.f, R.id.g})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.a:
WebViewActivity.launch(mContext, "https://www.baidu.com");
break;
case R.id.b:
startActivityForResult(new Intent(mContext, QrBarScanActivity.class), Constants.RESULT_CODE_1);
break;
case R.id.c:
HintDialog hintDialog = new HintDialog(mContext);
hintDialog.show();
hintDialog.setTitle("啊啊啊啊啊啊");
hintDialog.hideRight();
hintDialog.setLeftText("取消");
hintDialog.setOnClickListener(new HintDialog.OnDialogClickListener() {
@Override
public void left() {
showMsg("您点击了取消!");
}
@Override
public void paizhao() {

@Override
public void right() {
}

}
});
break;
case R.id.d:
List<String> strings = new ArrayList<>();
strings.add("http://pic4.nipic.com/20091217/3885730_124701000519_2.jpg");
strings.add("http://img.taopic.com/uploads/allimg/140729/240450-140HZP45790.jpg");
SeeImageActivity.launch(mContext, strings);
break;
case R.id.e:
BottomDialogPhotoFragment.Builder builder = new BottomDialogPhotoFragment.Builder();
BottomSheetDialogFragment bottomSheetDialogFragment = builder.setOnClickListener(new BottomDialogPhotoFragment.OnDialogClickListener() {
@Override
public void xiangce() {

}

@Override
public void paizhao() {
@Override
public void exit() {

}
}).builder();
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
bottomSheetDialogFragment.show(fragmentManager, "dialog");
}
break;
case 5:
startActivity(new Intent(mContext, PictureUploadActivity.class));
break;
case 6:
startActivity(new Intent(mContext, PayPwdInputActivity.class));
break;
case 7:
startActivity(new Intent(mContext, CustomWebviewActivity.class));
break;
default:
}
});
}

@Override
public void exit() {
@Override
protected void lazyLoadShow(boolean isLoad) {

}
}).builder();
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
bottomSheetDialogFragment.show(fragmentManager, "dialog");
}
break;
case R.id.f:
startActivity(new Intent(mContext, PictureUploadActivity.class));
break;
case R.id.g:
startActivity(new Intent(mContext, PayPwdInputActivity.class));
break;
default:
}
}

@Override
Expand Down
57 changes: 8 additions & 49 deletions app/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
Expand All @@ -10,54 +9,14 @@
android:layout_height="25dp"
android:background="@color/white"/>

<include layout="@layout/home_title"/>

<Button
android:id="@+id/a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="跳转网页"/>

<Button
android:id="@+id/b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="扫描二维码"/>

<com.sdwfqin.quicklib.view.TrembleButton
android:id="@+id/c"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@mipmap/quicklib_launcher"
android:gravity="center"
android:text="颤抖的button"
app:durationMax="6000"
app:durationMin="5000"
app:translationMax="20"
app:translationMin="15"/>

<Button
android:id="@+id/d"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="图片预览"/>

<Button
android:id="@+id/e"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="选择图片弹窗"/>

<Button
android:id="@+id/f"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="上传图片九宫格"/>
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/topbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

<Button
android:id="@+id/g"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="自定义输入密码验证码"/>
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</LinearLayout>
14 changes: 14 additions & 0 deletions app/src/main/res/layout/item_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/tv_items"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:textSize="25sp"/>

</LinearLayout>
32 changes: 1 addition & 31 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

apply from: "config.gradle"
buildscript {

ext.kotlin_version = '1.2.50'
Expand Down Expand Up @@ -38,32 +37,3 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}

ext {
// Sdk and tools
minSdkVersion = 18
targetSdkVersion = 27
compileSdkVersion = 27
buildToolsVersion = '27.0.3'

support = '27.1.1'
constraint = '1.1.2'
glide = '4.7.1'
butterknife = '8.8.1'
vlayout = '1.2.15'
quicklib = '1.2.7'
qmui = '1.1.5'
brvah = '2.9.40'
banner = '1.4.10'
utilcode = '1.16.4'
eventbus = '3.1.1'
rxjava = '2.1.14'
rxandroid = '2.0.2'
agentweb = '4.0.2'
okhttp = '3.10.0'
retrofit = '2.4.0'
PhotoView = '2.0.0'
gson = '2.8.2'
zxing = '3.3.3'
wechat = '5.1.4'
}
Loading

0 comments on commit a51db15

Please sign in to comment.