Merge branch 'master' of C:\Users\wds81\StudioProjects\NavinfoOutDoorDataCollect with conflicts.
This commit is contained in:
parent
e5d85ac72f
commit
3ff0d534b8
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
@ -26,5 +26,10 @@
|
|||||||
<option name="name" value="maven" />
|
<option name="name" value="maven" />
|
||||||
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
|
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven" />
|
||||||
|
<option name="name" value="maven" />
|
||||||
|
<option name="url" value="https://jitpack.io" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
@ -6,7 +6,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.example.myapplication"
|
applicationId "com.example.myapplication"
|
||||||
minSdkVersion 16
|
minSdkVersion 23
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
@ -52,19 +52,23 @@ dependencies {
|
|||||||
implementation 'com.google.code.gson:gson:2.8.5'
|
implementation 'com.google.code.gson:gson:2.8.5'
|
||||||
|
|
||||||
|
|
||||||
//retrofit+rxjava
|
//retrofit+rxJava
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
|
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
|
||||||
//转换器,请求结果转换成Model
|
//转换器,请求结果转换成Model
|
||||||
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
|
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
|
||||||
//配合Rxjava 使用
|
//配合RxJava 使用
|
||||||
implementation 'io.reactivex.rxjava2:rxjava:2.2.7'
|
implementation 'io.reactivex.rxjava2:rxjava:2.2.7'
|
||||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||||
|
//EventBus
|
||||||
|
implementation 'org.greenrobot:eventbus:3.1.1'
|
||||||
|
|
||||||
|
/* //加载html
|
||||||
|
implementation 'com.github.sendtion:XRichText:1.9.4'*/
|
||||||
//加载图片的依赖包
|
//加载图片的依赖包
|
||||||
implementation 'com.github.bumptech.glide:glide:4.8.0'
|
implementation 'com.github.bumptech.glide:glide:4.8.0'
|
||||||
|
//弹窗 https://github.com/kongzue/DialogV3
|
||||||
|
implementation 'com.kongzue.dialog_v3x:dialog:3.2.4'
|
||||||
//xRecyclerview下拉刷新控件
|
//xRecyclerview下拉刷新控件
|
||||||
implementation project(':xrecyclerview')
|
implementation project(':xrecyclerview')
|
||||||
|
|
||||||
|
@ -30,7 +30,8 @@
|
|||||||
<activity android:name=".activity.LoginActivity"></activity>
|
<activity android:name=".activity.LoginActivity"></activity>
|
||||||
<activity android:name=".activity.HomeActivity"></activity>
|
<activity android:name=".activity.HomeActivity"></activity>
|
||||||
<activity android:name=".activity.WebActivity"></activity>
|
<activity android:name=".activity.WebActivity"></activity>
|
||||||
<activity android:name=".activity.FragmentManagement"></activity>
|
<activity android:name=".activity.ManagementActivity"></activity>
|
||||||
|
<activity android:name=".activity.ImageShowActivity"></activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.example.myapplication.activity;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
import com.example.myapplication.adapter.ImagePagerAdapter;
|
||||||
|
import com.example.myapplication.api.UserApplication;
|
||||||
|
import com.example.myapplication.base.BaseActivity;
|
||||||
|
import com.kongzue.dialog.v3.MessageDialog;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击查看大图
|
||||||
|
*/
|
||||||
|
public class ImageShowActivity extends BaseActivity implements View.OnClickListener {
|
||||||
|
private ViewPager image_pager;
|
||||||
|
private TextView page_number;
|
||||||
|
private ImageView download;
|
||||||
|
private ArrayList<String> imgUrl;
|
||||||
|
private ImagePagerAdapter mAdapter;
|
||||||
|
@Override
|
||||||
|
protected int getLayout() {
|
||||||
|
return R.layout.activity_image_show;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initData() {
|
||||||
|
super.initData();
|
||||||
|
imgUrl = getIntent().getStringArrayListExtra("info");
|
||||||
|
Log.d("ImageShowActivity", "initData-----------------: "+imgUrl);
|
||||||
|
page_number.setText("1" + "/" + imgUrl.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
super.initView();
|
||||||
|
image_pager = (ViewPager) findViewById(R.id.image_pager);
|
||||||
|
page_number = (TextView) findViewById(R.id.page_number);
|
||||||
|
download = (ImageView) findViewById(R.id.download);
|
||||||
|
download.setOnClickListener(this);
|
||||||
|
initViewPager();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initViewPager() {
|
||||||
|
if (imgUrl != null && imgUrl.size() != 0) {
|
||||||
|
mAdapter = new ImagePagerAdapter(getApplicationContext(), imgUrl);
|
||||||
|
image_pager.setAdapter(mAdapter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
switch (v.getId()){
|
||||||
|
case R.id.download:
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -46,12 +46,12 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.tv_register:
|
case R.id.tv_register:
|
||||||
Intent register = new Intent(this, FragmentManagement.class);
|
Intent register = new Intent(this, ManagementActivity.class);
|
||||||
register.putExtra("tag", 5);
|
register.putExtra("tag", 5);
|
||||||
startActivity(register);
|
startActivity(register);
|
||||||
break;
|
break;
|
||||||
case R.id.tv_forget_paw:
|
case R.id.tv_forget_paw:
|
||||||
Intent forgetPaw = new Intent(this, FragmentManagement.class);
|
Intent forgetPaw = new Intent(this, ManagementActivity.class);
|
||||||
forgetPaw.putExtra("tag", 6);
|
forgetPaw.putExtra("tag", 6);
|
||||||
startActivity(forgetPaw);
|
startActivity(forgetPaw);
|
||||||
break;
|
break;
|
||||||
|
@ -9,6 +9,7 @@ import android.os.CountDownTimer;
|
|||||||
|
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.example.myapplication.base.BaseActivity;
|
import com.example.myapplication.base.BaseActivity;
|
||||||
|
import com.kongzue.dialog.util.DialogSettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动页
|
* 启动页
|
||||||
@ -35,7 +36,9 @@ public class MainActivity extends BaseActivity {
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
|
//必须全局才可以改变样式
|
||||||
|
DialogSettings.style = (DialogSettings.STYLE.STYLE_KONGZUE);
|
||||||
|
DialogSettings.init();//初始化清空 BaseDialog 队列
|
||||||
}
|
}
|
||||||
private void initPermission() {
|
private void initPermission() {
|
||||||
String[] pers = {
|
String[] pers = {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package com.example.myapplication.activity;
|
package com.example.myapplication.activity;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.example.myapplication.base.BaseActivity;
|
import com.example.myapplication.base.BaseActivity;
|
||||||
import com.example.myapplication.fragment.CapacityMeasurementFragment;
|
|
||||||
import com.example.myapplication.fragment.CapacityEvaluationFragment;
|
import com.example.myapplication.fragment.CapacityEvaluationFragment;
|
||||||
import com.example.myapplication.fragment.CapacityEvaluationFragment2;
|
import com.example.myapplication.fragment.CapacityEvaluationFragment2;
|
||||||
import com.example.myapplication.fragment.EventPrefectureFragment;
|
import com.example.myapplication.fragment.EventPrefectureFragment;
|
||||||
@ -12,7 +13,6 @@ import com.example.myapplication.fragment.FindFragment;
|
|||||||
import com.example.myapplication.fragment.ForgetPawFragment;
|
import com.example.myapplication.fragment.ForgetPawFragment;
|
||||||
import com.example.myapplication.fragment.MineFragment;
|
import com.example.myapplication.fragment.MineFragment;
|
||||||
import com.example.myapplication.fragment.RecordFragment;
|
import com.example.myapplication.fragment.RecordFragment;
|
||||||
import com.example.myapplication.fragment.TaskExWebFragment;
|
|
||||||
import com.example.myapplication.fragment.TaskExplainFragment;
|
import com.example.myapplication.fragment.TaskExplainFragment;
|
||||||
import com.example.myapplication.fragment.TaskExplainFragment2;
|
import com.example.myapplication.fragment.TaskExplainFragment2;
|
||||||
import com.example.myapplication.fragment.TaskPrefectureFragment;
|
import com.example.myapplication.fragment.TaskPrefectureFragment;
|
||||||
@ -270,24 +270,17 @@ public class FragmentManagement extends BaseActivity {
|
|||||||
case 11:
|
case 11:
|
||||||
capacityEvaluationFragment.onActivityResult(requestCode, resultCode, data);
|
capacityEvaluationFragment.onActivityResult(requestCode, resultCode, data);
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
capacityEvaluationFragment2.onActivityResult(requestCode, resultCode, data);
|
capacityEvaluationFragment2.onActivityResult(requestCode, resultCode, data);
|
||||||
break;
|
break;
|
||||||
case 13:
|
|
||||||
taskExWebFragment.onActivityResult(requestCode, resultCode, data);
|
|
||||||
break;
|
|
||||||
case 14:
|
|
||||||
capacityMeasurementFragment.onActivityResult(requestCode, resultCode, data);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setZtlTextColor() {
|
private void setZtlTextColor() {
|
||||||
ImmersionBar.with(this)
|
ImmersionBar.with(this).statusBarDarkFont(true, 0.2f)
|
||||||
.statusBarDarkFont(true, 0.2f) //原理:如果当前设备支持状态栏字体变色,会设置状态栏字体为黑色,如果当前设备不支持状态栏字体变色,会使当前状态栏加上透明度,否则不执行透明度
|
//原理:如果当前设备支持状态栏字体变色,会设置状态栏字体为黑色,如果当前设备不支持状态栏字体变色,会使当前状态栏加上透明度,否则不执行透明度
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,13 +1,23 @@
|
|||||||
package com.example.myapplication.activity;
|
package com.example.myapplication.activity;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
|
import com.example.myapplication.api.UserApplication;
|
||||||
import com.example.myapplication.base.BaseActivity;
|
import com.example.myapplication.base.BaseActivity;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情页
|
* 详情页
|
||||||
*/
|
*/
|
||||||
@ -15,7 +25,21 @@ public class WebActivity extends BaseActivity implements View.OnClickListener {
|
|||||||
|
|
||||||
private ImageView ivIcon;
|
private ImageView ivIcon;
|
||||||
private WebView nWebView;
|
private WebView nWebView;
|
||||||
|
private String content = "<div>\n" +
|
||||||
|
"<h2>定义和用法</h2>\n" +
|
||||||
|
"\n" +
|
||||||
|
"<p>\n" +
|
||||||
|
"\t<img src=\"https://exp-picture.cdn.bcebos.com/560be432939c2cf72dff4caa452c5b1b1fde12e1.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1%2Fformat%2Cf_jpg%2Fquality%2Cq_80\">\n" +
|
||||||
|
"</p>\n" +
|
||||||
|
"\n" +
|
||||||
|
"<p style=\"color: red; margin-left: 20px\"><style> 标签用于为 HTML 文档定义样式信息。</p>\n" +
|
||||||
|
"\n" +
|
||||||
|
"<p style=\"background-color: lightblue; margin-left: 20px\">在 style 中,您可以规定在浏览器中如何呈现 HTML 文档。</p>\n" +
|
||||||
|
"\n" +
|
||||||
|
"<p style=\"font-family: verdana; margin-left: 20px\">type 属性是必需的,定义 style 元素的内容。唯一可能的值是 \"text/css\"。</p>\n" +
|
||||||
|
"\n" +
|
||||||
|
"<p style=\"font-size: 20px; margin-left: 20px\">style 元素位于 head 部分中。</p>\n" +
|
||||||
|
"</div>";
|
||||||
@Override
|
@Override
|
||||||
protected int getLayout() {
|
protected int getLayout() {
|
||||||
return R.layout.activity_web;
|
return R.layout.activity_web;
|
||||||
@ -24,11 +48,33 @@ public class WebActivity extends BaseActivity implements View.OnClickListener {
|
|||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
super.initView();
|
super.initView();
|
||||||
|
|
||||||
|
char A = 65;
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
String title = "选项"+(A++);
|
||||||
|
System.out.println(title);
|
||||||
|
}
|
||||||
|
|
||||||
ImmersionBar.with(this)
|
ImmersionBar.with(this)
|
||||||
.statusBarDarkFont(true, 0.2f)
|
.statusBarDarkFont(true, 0.2f)
|
||||||
//原理:如果当前设备支持状态栏字体变色,会设置状态栏字体为黑色,如果当前设备不支持状态栏字体变色,会使当前状态栏加上透明度,否则不执行透明度
|
//原理:如果当前设备支持状态栏字体变色,会设置状态栏字体为黑色,如果当前设备不支持状态栏字体变色,会使当前状态栏加上透明度,否则不执行透明度
|
||||||
.init();
|
.init();
|
||||||
nWebView = findViewById(R.id.news_webView);
|
nWebView = findViewById(R.id.news_webView);
|
||||||
|
nWebView.getSettings().setBlockNetworkImage(false);
|
||||||
|
WebSettings settings = nWebView.getSettings();
|
||||||
|
settings.setJavaScriptEnabled(true);
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
nWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
nWebView.setWebViewClient(new MyWebViewClient());
|
||||||
|
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||||
|
settings.setSupportZoom(false);//用于设置webView 放大
|
||||||
|
settings.setBuiltInZoomControls(false);
|
||||||
|
nWebView.addJavascriptInterface(new JavascriptInterface(UserApplication.getUserApplication()),"imagelistner");
|
||||||
|
content = content.replace("<img", "<img style='max-width: 100%'");
|
||||||
|
|
||||||
|
nWebView.loadDataWithBaseURL(null, content, "text/html", "utf-8", null);
|
||||||
ivIcon = findViewById(R.id.iv_icon);
|
ivIcon = findViewById(R.id.iv_icon);
|
||||||
ivIcon.setOnClickListener(this::onClick);
|
ivIcon.setOnClickListener(this::onClick);
|
||||||
}
|
}
|
||||||
@ -46,4 +92,79 @@ public class WebActivity extends BaseActivity implements View.OnClickListener {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 注入js函数监听
|
||||||
|
private void addImageClickListener() {
|
||||||
|
Log.d("TAG", "addImageClickListener: 注入代码");
|
||||||
|
// 这段js函数的功能就是,遍历所有的img几点,并添加onclick函数,在还是执行的时候调用本地接口传递url过去
|
||||||
|
nWebView.loadUrl("javascript:(function(){"
|
||||||
|
+ "var objs = document.getElementsByTagName(\"img\");"
|
||||||
|
+ "var imgurl=''; "
|
||||||
|
+ "for(var i=0;i<objs.length;i++) "
|
||||||
|
+ "{"
|
||||||
|
+ "imgurl+=objs[i].src+',';"
|
||||||
|
+ " objs[i].onclick=function() "
|
||||||
|
+ " { "
|
||||||
|
+ " imagelistner.openImage(imgurl); "
|
||||||
|
+ " } " + "}" + "})()");
|
||||||
|
}
|
||||||
|
// js通信接口
|
||||||
|
public class JavascriptInterface {
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
public JavascriptInterface(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
@android.webkit.JavascriptInterface //注解 很重要,必不可少
|
||||||
|
public void openImage(String img) {
|
||||||
|
System.out.println(img);
|
||||||
|
Log.d("TAG", "openImage-------------------------: "+img);
|
||||||
|
String[] imgs = img.split(",");
|
||||||
|
ArrayList<String> imgsUrl = new ArrayList<String>();
|
||||||
|
for (String s : imgs) {
|
||||||
|
imgsUrl.add(s);
|
||||||
|
Log.d("TAG", "openImage-------------------------: "+s);
|
||||||
|
}
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.putStringArrayListExtra("info", imgsUrl);
|
||||||
|
intent.setClass(context, ImageShowActivity.class);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 监听
|
||||||
|
private class MyWebViewClient extends WebViewClient {
|
||||||
|
@Override
|
||||||
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
|
|
||||||
|
return super.shouldOverrideUrlLoading(view, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageFinished(WebView view, String url) {
|
||||||
|
view.getSettings().setJavaScriptEnabled(true);
|
||||||
|
super.onPageFinished(view, url);
|
||||||
|
// html加载完成之后,添加监听图片的点击js函数
|
||||||
|
addImageClickListener();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||||
|
view.getSettings().setJavaScriptEnabled(true);
|
||||||
|
Log.d("TAG", "addImageClickListener: 开始加载");
|
||||||
|
super.onPageStarted(view, url, favicon);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
|
||||||
|
|
||||||
|
super.onReceivedError(view, errorCode, description, failingUrl);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,71 @@
|
|||||||
|
package com.example.myapplication.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.viewpager.widget.PagerAdapter;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片浏览的PagerAdapter
|
||||||
|
*/
|
||||||
|
public class ImagePagerAdapter extends PagerAdapter {
|
||||||
|
Context context;
|
||||||
|
ArrayList<String> imgsUrl;
|
||||||
|
LayoutInflater inflater = null;
|
||||||
|
|
||||||
|
ImageView full_image;
|
||||||
|
public ImagePagerAdapter(Context context, ArrayList<String> imgsUrl) {
|
||||||
|
this.context = context;
|
||||||
|
this.imgsUrl = imgsUrl;
|
||||||
|
inflater = LayoutInflater.from(context);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 动态加载数据 */
|
||||||
|
@Override
|
||||||
|
public void setPrimaryItem(ViewGroup container, int position, Object object) {
|
||||||
|
super.setPrimaryItem(container, position, object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return imgsUrl == null ? 0 : imgsUrl.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isViewFromObject(View arg0, Object arg1) {
|
||||||
|
return arg0 == arg1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemPosition(Object object) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return super.getItemPosition(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object instantiateItem(ViewGroup container, int position) {
|
||||||
|
View view = inflater.from(context).inflate(R.layout.details_imageshow_item, null);
|
||||||
|
full_image = (ImageView)view.findViewById(R.id.full_image);
|
||||||
|
Glide.with(context).load(imgsUrl.get(position)).into(full_image);
|
||||||
|
|
||||||
|
((ViewPager) container).addView(view);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||||
|
((ViewPager) container).removeView((View) object);
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||||||
|
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.example.myapplication.adapter.CapacityEvaluationAdapter;
|
import com.example.myapplication.adapter.CapacityEvaluationAdapter;
|
||||||
import com.example.myapplication.activity.FragmentManagement;
|
import com.example.myapplication.adapter.CapacityEvaluationAdapter;
|
||||||
|
import com.example.myapplication.activity.ManagementActivity;
|
||||||
import com.example.myapplication.base.BaseFragment;
|
import com.example.myapplication.base.BaseFragment;
|
||||||
import com.example.myapplication.bean.CapacityMeasureBean;
|
import com.example.myapplication.bean.CapacityMeasureBean;
|
||||||
import com.example.myapplication.bean.TaskExplainInfo;
|
import com.example.myapplication.bean.TaskExplainInfo;
|
||||||
|
@ -4,14 +4,17 @@ import android.content.Intent;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.example.myapplication.activity.WebActivity;
|
import com.example.myapplication.activity.WebActivity;
|
||||||
import com.example.myapplication.adapter.EventPrefectureAdapter;
|
import com.example.myapplication.adapter.EventPrefectureAdapter;
|
||||||
|
import com.example.myapplication.api.UserApplication;
|
||||||
import com.example.myapplication.base.BaseFragment;
|
import com.example.myapplication.base.BaseFragment;
|
||||||
import com.example.myapplication.bean.EventPrefectureBean;
|
import com.example.myapplication.bean.EventPrefectureBean;
|
||||||
import com.example.myapplication.http.Callback;
|
import com.example.myapplication.http.Callback;
|
||||||
@ -19,6 +22,11 @@ import com.example.myapplication.http.HttpInterface;
|
|||||||
import com.example.myapplication.http.OkGoBuilder;
|
import com.example.myapplication.http.OkGoBuilder;
|
||||||
import com.jcodecraeer.xrecyclerview.ProgressStyle;
|
import com.jcodecraeer.xrecyclerview.ProgressStyle;
|
||||||
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
||||||
|
import com.kongzue.dialog.interfaces.OnBackClickListener;
|
||||||
|
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||||
|
import com.kongzue.dialog.util.BaseDialog;
|
||||||
|
import com.kongzue.dialog.util.DialogSettings;
|
||||||
|
import com.kongzue.dialog.v3.MessageDialog;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import android.widget.LinearLayout;
|
|||||||
|
|
||||||
|
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.example.myapplication.activity.FragmentManagement;
|
import com.example.myapplication.activity.ManagementActivity;
|
||||||
import com.example.myapplication.base.BaseFragment;
|
import com.example.myapplication.base.BaseFragment;
|
||||||
|
|
||||||
|
|
||||||
@ -49,22 +49,22 @@ public class FindFragment extends BaseFragment implements View.OnClickListener{
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.linear_task_prefecture:
|
case R.id.linear_task_prefecture:
|
||||||
Intent prefectureIntent = new Intent(getActivity(), FragmentManagement.class);
|
Intent prefectureIntent = new Intent(getActivity(), ManagementActivity.class);
|
||||||
prefectureIntent.putExtra("tag", 7);
|
prefectureIntent.putExtra("tag", 7);
|
||||||
startActivity(prefectureIntent);
|
startActivity(prefectureIntent);
|
||||||
break;
|
break;
|
||||||
case R.id.linear_task_explain:
|
case R.id.linear_task_explain:
|
||||||
Intent explainIntent = new Intent(getActivity(), FragmentManagement.class);
|
Intent explainIntent = new Intent(getActivity(), ManagementActivity.class);
|
||||||
explainIntent.putExtra("tag", 8);
|
explainIntent.putExtra("tag", 8);
|
||||||
startActivity(explainIntent);
|
startActivity(explainIntent);
|
||||||
break;
|
break;
|
||||||
case R.id.linear_event_prefecture:
|
case R.id.linear_event_prefecture:
|
||||||
Intent eventIntent = new Intent(getActivity(), FragmentManagement.class);
|
Intent eventIntent = new Intent(getActivity(), ManagementActivity.class);
|
||||||
eventIntent.putExtra("tag",9);
|
eventIntent.putExtra("tag",9);
|
||||||
startActivity(eventIntent);
|
startActivity(eventIntent);
|
||||||
break;
|
break;
|
||||||
case R.id.linear_end:
|
case R.id.linear_end:
|
||||||
Intent endIntent = new Intent(getActivity(), FragmentManagement.class);
|
Intent endIntent = new Intent(getActivity(), ManagementActivity.class);
|
||||||
endIntent.putExtra("tag", 11);
|
endIntent.putExtra("tag", 11);
|
||||||
startActivity(endIntent);
|
startActivity(endIntent);
|
||||||
break;
|
break;
|
||||||
|
@ -73,10 +73,9 @@ public class TaskExplainFragment2 extends BaseFragment implements View.OnClickLi
|
|||||||
taskExplainAdapter2.setOnItemClick(new TaskExplainAdapter2.OnItemClick2() {
|
taskExplainAdapter2.setOnItemClick(new TaskExplainAdapter2.OnItemClick2() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick2(int pos) {
|
public void onClick2(int pos) {
|
||||||
final Intent taskExItem = new Intent(getActivity(), FragmentManagement.class);
|
Intent intent = new Intent(getActivity(), WebActivity.class);
|
||||||
taskExItem.putExtra("tag",13);
|
intent.putExtra("int",pos);
|
||||||
startActivity(taskExItem);
|
startActivity(intent);
|
||||||
// Toast.makeText(getContext(), "你猜"+pos, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -100,7 +99,6 @@ public class TaskExplainFragment2 extends BaseFragment implements View.OnClickLi
|
|||||||
dismissLoadingDialog();
|
dismissLoadingDialog();
|
||||||
taskExplainAdapter2.setExplainList2(response.getBody().getData());
|
taskExplainAdapter2.setExplainList2(response.getBody().getData());
|
||||||
Log.d("TAG", "onSuccess: " + response.getMsg() + "sssssssssssss");
|
Log.d("TAG", "onSuccess: " + response.getMsg() + "sssssssssssss");
|
||||||
Toast.makeText(getActivity(), response.getMsg() + "", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,4 +12,7 @@ public class HttpInterface {
|
|||||||
public static final String MSG_CONTENT = IPm4 + "msg_content";//发现 -富文本详情页请求
|
public static final String MSG_CONTENT = IPm4 + "msg_content";//发现 -富文本详情页请求
|
||||||
public static final String EXAM_CONTENT = IPm4 + "exam_content";//发现 -能力测评获取试题接口
|
public static final String EXAM_CONTENT = IPm4 + "exam_content";//发现 -能力测评获取试题接口
|
||||||
public static final String EXAM_SUBMIT = IPm4 + "exam_submit";//发现 -能力测评提交试卷 post
|
public static final String EXAM_SUBMIT = IPm4 + "exam_submit";//发现 -能力测评提交试卷 post
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ public class OkGoBuilder<T> {
|
|||||||
* post请求
|
* post请求
|
||||||
*/
|
*/
|
||||||
public static final int PSOT = 2;
|
public static final int PSOT = 2;
|
||||||
|
public static final int POST = 5;
|
||||||
/**
|
/**
|
||||||
* post请求
|
* post请求
|
||||||
*/
|
*/
|
||||||
@ -160,6 +161,9 @@ public class OkGoBuilder<T> {
|
|||||||
case 4:
|
case 4:
|
||||||
postRequestAloneFile();
|
postRequestAloneFile();
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
postsRequest();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -196,6 +200,38 @@ public class OkGoBuilder<T> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* post请求
|
||||||
|
*/
|
||||||
|
private void postsRequest() {
|
||||||
|
OkGo
|
||||||
|
// 请求方式和请求url
|
||||||
|
.<T>post(url)
|
||||||
|
.params("param", jsonArray.toString())
|
||||||
|
// .upJson(json)
|
||||||
|
// 请求的 tag, 主要用于取消对应的请求
|
||||||
|
.tag(this)
|
||||||
|
// 设置当前请求的缓存key,建议每个不同功能的请求设置一个
|
||||||
|
// .cacheKey("cacheKey")
|
||||||
|
// 缓存模式,详细请看缓存介绍
|
||||||
|
// .cacheMode(CacheMode.DEFAULT)
|
||||||
|
.execute(new DialogCallback<T>(clazz) {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Response<T> response) {
|
||||||
|
callback.onSuccess(response.body(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Response<T> response) {
|
||||||
|
super.onError(response);
|
||||||
|
Throwable throwable = response.getException();
|
||||||
|
if (throwable != null) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
callback.onError(throwable, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get请求
|
* get请求
|
||||||
|
32
app/src/main/res/layout/activity_image_show.xml
Normal file
32
app/src/main/res/layout/activity_image_show.xml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/full_image_root"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:background="#F4EEEE" >
|
||||||
|
|
||||||
|
<androidx.viewpager.widget.ViewPager
|
||||||
|
android:id="@+id/image_pager"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/download"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginBottom="15.0dip"
|
||||||
|
android:layout_marginRight="15.0dip"
|
||||||
|
android:src="@drawable/ic_baseline_arrow_back" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/page_number"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignTop="@id/download"
|
||||||
|
android:layout_marginLeft="15.0dip"
|
||||||
|
android:textColor="#ffeeeeee"
|
||||||
|
android:textSize="12.0sp" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -2,8 +2,7 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical" >
|
||||||
>
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/rl_web"
|
android:id="@+id/rl_web"
|
||||||
@ -18,7 +17,6 @@
|
|||||||
android:layout_height="45dp"
|
android:layout_height="45dp"
|
||||||
android:src="@drawable/ic_baseline_arrow"
|
android:src="@drawable/ic_baseline_arrow"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
|
|
||||||
android:layout_marginLeft="15dp" />
|
android:layout_marginLeft="15dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -29,23 +27,17 @@
|
|||||||
android:layout_toRightOf="@id/iv_icon"
|
android:layout_toRightOf="@id/iv_icon"
|
||||||
android:textColor="#fff" />
|
android:textColor="#fff" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
<WebView
|
||||||
<com.example.myapplication.util.CustomScrollView
|
android:id="@+id/news_webView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
<!-- <com.example.myapplication.util.CustomScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical" >
|
||||||
android:paddingLeft="16dp"
|
|
||||||
android:paddingRight="16dp">
|
|
||||||
|
|
||||||
<WebView
|
|
||||||
android:id="@+id/news_webView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginTop="26dp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</com.example.myapplication.util.CustomScrollView>
|
</com.example.myapplication.util.CustomScrollView>-->
|
||||||
</LinearLayout>
|
</LinearLayout>
|
14
app/src/main/res/layout/details_imageshow_item.xml
Normal file
14
app/src/main/res/layout/details_imageshow_item.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/full_image_root"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:background="#F8F7F7" >
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/full_image"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:scaleType="fitCenter" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -79,7 +79,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="2dp"
|
android:layout_margin="2dp"
|
||||||
android:background="@drawable/icon_task_prefecture" />
|
android:scaleType="centerInside"
|
||||||
|
android:src="@drawable/icon_task_prefecture" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -94,7 +95,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="2dp"
|
android:layout_margin="2dp"
|
||||||
android:background="@drawable/icon_event_prefecture" />
|
android:scaleType="centerInside"
|
||||||
|
android:src="@drawable/icon_event_prefecture" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -159,7 +161,8 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/icon_task_specification"
|
android:scaleType="centerInside"
|
||||||
|
android:src="@drawable/icon_task_specification"
|
||||||
/>
|
/>
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -178,7 +181,8 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/icon_capacity_evaluation"
|
android:scaleType="centerInside"
|
||||||
|
android:src="@drawable/icon_capacity_evaluation"
|
||||||
/>
|
/>
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
android:id="@+id/rl_find"
|
android:id="@+id/rl_find"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="#fff"
|
android:background="#1BA5F1"
|
||||||
android:paddingTop="@dimen/top_pind_sp"
|
android:paddingTop="@dimen/top_pind_sp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@ -31,7 +31,7 @@
|
|||||||
android:layout_toRightOf="@id/iv_find_task"
|
android:layout_toRightOf="@id/iv_find_task"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="任务说明"
|
android:text="任务说明"
|
||||||
android:textColor="#000"
|
android:textColor="#fff"
|
||||||
android:textSize="17sp"
|
android:textSize="17sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -17,6 +17,7 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url 'https://jitpack.io' }
|
||||||
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
|
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user