Commit fbe78c09 by gao.chao

web页面(获取定位未完成)

parent 1882698c
...@@ -25,5 +25,7 @@ dependencies { ...@@ -25,5 +25,7 @@ dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
api "com.tencent.bugly:crashreport_upgrade:1.3.4"
api 'com.tencent.bugly:nativecrashreport:3.6.0.1'
api project(':fastDevelop') api project(':fastDevelop')
} }
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppThemeNoActionBar" >
<activity android:name=".MainActivity"> <activity android:name=".MainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
<activity android:name=".DownLoadAPKActivity"/> <activity android:name=".DownLoadAPKActivity"/>
<activity android:name=".FragmentInteractiveActivity"/> <activity android:name=".FragmentInteractiveActivity"/>
<activity android:name=".FragmentInteractiveActivity2"/> <activity android:name=".FragmentInteractiveActivity2"/>
<activity android:name=".PageActivity"/>
</application> </application>
<!-- 配置APP ID --> <!-- 配置APP ID -->
......
...@@ -36,6 +36,13 @@ public class MainActivity extends BaseActivity { ...@@ -36,6 +36,13 @@ public class MainActivity extends BaseActivity {
gotoActivity(FunctionActivity.class); gotoActivity(FunctionActivity.class);
} }
})); }));
list.add(new ItemBean("常用页面", new View.OnClickListener() {
@Override
public void onClick(View v) {
gotoActivity(PageActivity.class);
}
}));
listView.setAdapter(new RecyclerView.Adapter<MyViewHolder>() { listView.setAdapter(new RecyclerView.Adapter<MyViewHolder>() {
@NonNull @NonNull
@Override @Override
......
package com.mayi.demo;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import com.mayi.fastdevelop.base.BaseActivity;
import com.mayi.fastdevelop.commonpage.WebActivity;
import com.mayi.fastdevelop.view.OnMultiClickListener;
public class PageActivity extends BaseActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_page);
findViewById(R.id.b1).setOnClickListener(new OnMultiClickListener() {
@Override
public void onMultiClick(View v) {
Bundle bundle=new Bundle();
bundle.putString("url","https://customer.kujiatech.com/#/?token=8427db8972dd09105a00d62d8bc7cfd5&username=18001874470&v="+System.currentTimeMillis());
gotoActivity(WebActivity.class,bundle);
}
});
findViewById(R.id.b2).setOnClickListener(new OnMultiClickListener() {
@Override
public void onMultiClick(View v) {
Bundle bundle=new Bundle();
bundle.putString("url","https://customer.kujiatech.com/#/?token=8427db8972dd09105a00d62d8bc7cfd5" +
"&username=18001874470&v="+System.currentTimeMillis()+"&isNeedBackButton=true&userAppTitle=潜客");
gotoActivity(WebActivity.class,bundle);
}
});
findViewById(R.id.b3).setOnClickListener(new OnMultiClickListener() {
@Override
public void onMultiClick(View v) {
gotoActivity(DownLoadAPKActivity.class);
}
});
findViewById(R.id.b4).setOnClickListener(new OnMultiClickListener() {
@Override
public void onMultiClick(View v) {
gotoActivity(FragmentInteractiveActivity.class);
}
});
findViewById(R.id.b5).setOnClickListener(new OnMultiClickListener() {
@Override
public void onMultiClick(View v) {
gotoActivity(FragmentInteractiveActivity2.class);
}
});
}
}
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="web页面" />
<Button
android:id="@+id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="web页面,显示标题" />
<Button
android:id="@+id/b3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="下载安装APP" />
<Button
android:id="@+id/b4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Activity与Fragment之间交互\n可以左右滑动" />
<Button
android:id="@+id/b5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Activity与Fragment之间交互\n不可以左右滑动" />
</LinearLayout>
</ScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout <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">
...@@ -11,34 +8,31 @@ ...@@ -11,34 +8,31 @@
<com.mayi.fastdevelop.view.CustomTitleBar <com.mayi.fastdevelop.view.CustomTitleBar
android:id="@+id/title1" android:id="@+id/title1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/im_dp_50"
android:layout_marginTop="@dimen/im_dp_20" /> android:layout_marginTop="@dimen/im_dp_20" />
<com.mayi.fastdevelop.view.CustomTitleBar <com.mayi.fastdevelop.view.CustomTitleBar
android:id="@+id/title2" android:id="@+id/title2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/im_dp_50"
android:layout_marginTop="@dimen/im_dp_20" /> android:layout_marginTop="@dimen/im_dp_20" />
<com.mayi.fastdevelop.view.CustomTitleBar <com.mayi.fastdevelop.view.CustomTitleBar
android:id="@+id/title3" android:id="@+id/title3"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/im_dp_50"
android:layout_marginTop="@dimen/im_dp_20" /> android:layout_marginTop="@dimen/im_dp_20" />
<com.mayi.fastdevelop.view.CustomTitleBar <com.mayi.fastdevelop.view.CustomTitleBar
android:id="@+id/title4" android:id="@+id/title4"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/im_dp_50"
android:layout_marginTop="@dimen/im_dp_20" /> android:layout_marginTop="@dimen/im_dp_20" />
<com.mayi.fastdevelop.view.CustomTitleBar <com.mayi.fastdevelop.view.CustomTitleBar
android:id="@+id/title5" android:id="@+id/title5"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/im_dp_50"
android:layout_marginTop="@dimen/im_dp_20" /> android:layout_marginTop="@dimen/im_dp_20" />
</LinearLayout>
</LinearLayout>
</ScrollView>
\ No newline at end of file
...@@ -29,8 +29,6 @@ dependencies { ...@@ -29,8 +29,6 @@ dependencies {
api 'com.yanzhenjie:permission:2.0.0-rc12'//权限申请 api 'com.yanzhenjie:permission:2.0.0-rc12'//权限申请
api 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.3'//下拉刷新,加载更多 api 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.3'//下拉刷新,加载更多
api 'com.youth.banner:banner:1.4.10' //图片轮播控件 api 'com.youth.banner:banner:1.4.10' //图片轮播控件
api "com.tencent.bugly:crashreport_upgrade:1.3.4"
api 'com.tencent.bugly:nativecrashreport:3.6.0.1'
api 'com.squareup.okhttp3:okhttp:3.10.0' api 'com.squareup.okhttp3:okhttp:3.10.0'
api 'com.squareup.picasso:picasso:2.5.2'//图片加载 api 'com.squareup.picasso:picasso:2.5.2'//图片加载
api 'com.tencent.bugly:crashreport_upgrade:1.3.4' api 'com.tencent.bugly:crashreport_upgrade:1.3.4'
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.mayi.fastdevelop"> package="com.mayi.fastdevelop">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" /> <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
...@@ -12,4 +12,21 @@ ...@@ -12,4 +12,21 @@
<uses-permission <uses-permission
android:name="android.permission.READ_LOGS" android:name="android.permission.READ_LOGS"
tools:ignore="ProtectedPermissions" /> tools:ignore="ProtectedPermissions" />
<application>
<activity android:name=".commonpage.WebActivity" />
<!-- 解决 Android N 7.0 上 报错:android.os.FileUriExposedException -->
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.mayi.fastdevelop"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest> </manifest>
...@@ -24,7 +24,7 @@ import com.mayi.fastdevelop.view.installapk.AppUpgradeManager; ...@@ -24,7 +24,7 @@ import com.mayi.fastdevelop.view.installapk.AppUpgradeManager;
/** /**
* 下载安装Activity * 下载安装Activity
*/ */
public abstract class UpdateDownLoadAPKActvity extends BaseActivity { public class UpdateDownLoadAPKActvity extends BaseActivity {
private ApkInstallReceiver receiver; private ApkInstallReceiver receiver;
......
...@@ -2,4 +2,7 @@ package com.mayi.fastdevelop.comnon; ...@@ -2,4 +2,7 @@ package com.mayi.fastdevelop.comnon;
public class RequestCode { public class RequestCode {
public static final int REQUEST_CODE_APP_INSTALL = 0x00; public static final int REQUEST_CODE_APP_INSTALL = 0x00;
public static final int REQUEST_CODE_PERMISSION_CAMERA = 0x01;
public static final int REQUEST_CODE_CAMERA = 0x02;
public static final int REQUEST_CODE_ALBUM = 0x03;
} }
...@@ -58,11 +58,9 @@ public class BitmapUtil { ...@@ -58,11 +58,9 @@ public class BitmapUtil {
} else if (quality > 100) { } else if (quality > 100) {
quality = 100; quality = 100;
} }
BitmapFactory.Options options = new BitmapFactory.Options(); BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 1;
options.inJustDecodeBounds = false; options.inJustDecodeBounds = false;
options.inSampleSize = 1;
Bitmap inBitmap = BitmapFactory.decodeFile(in, options); Bitmap inBitmap = BitmapFactory.decodeFile(in, options);
File of = new File(out); File of = new File(out);
...@@ -94,6 +92,62 @@ public class BitmapUtil { ...@@ -94,6 +92,62 @@ public class BitmapUtil {
return false; return false;
} }
/**
*根据宽度对图片进行缩小,再压缩,最好保存到文件
*
* @param in 需要压缩的图片绝对路径
* @param out 压缩后保存的文件绝对路径
* @param format 输出格式(默认JEPG):Bitmap.CompressFormat.JEPG,Bitmap.CompressFormat.PNG,Bitmap.CompressFormat.WEBP
* @param maxwidth 图片最大宽
* @return 成功true, 不成功false
*/
public static boolean zoomsInImageFile(String in, String out, Bitmap.CompressFormat format, int maxwidth,int quality) {
if (!new File(in).exists()) {
return false;
}
if (format == null) {
format = Bitmap.CompressFormat.JPEG;
}
Bitmap inBitmap = loadBitmapFromFile(in,maxwidth);
File of = new File(out);
FileOutputStream fos = null;
try {
if (!of.exists()) {
boolean created = of.createNewFile();
if (!created) {
return false;
}
}
fos = new FileOutputStream(of);
inBitmap.compress(format, quality, fos);
return true;
} catch (IOException e) {
e.printStackTrace();
} finally {
if (inBitmap != null) {
inBitmap.recycle();
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return false;
}
private static int getinSampleSize(int bitmapHeight, int height) {
double proportion = ArithUtil.div(bitmapHeight, height);
if (proportion >= 2) {
return (int) proportion;
}
return 2;
}
/** /**
* 根据宽高加载图片 * 根据宽高加载图片
* *
...@@ -190,7 +244,6 @@ public class BitmapUtil { ...@@ -190,7 +244,6 @@ public class BitmapUtil {
* @return bitmap * @return bitmap
*/ */
public static Bitmap loadBitmapFromFile(String path) { public static Bitmap loadBitmapFromFile(String path) {
return BitmapFactory.decodeFile(path); return BitmapFactory.decodeFile(path);
} }
...@@ -298,7 +351,6 @@ public class BitmapUtil { ...@@ -298,7 +351,6 @@ public class BitmapUtil {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return null; return null;
} }
......
...@@ -68,6 +68,41 @@ public class DialogUtils { ...@@ -68,6 +68,41 @@ public class DialogUtils {
.show(); .show();
} }
/**
* 选择图片dialog
* @param context
* @param dialogListener
* @return
*/
public static BaseDialog showSelectPicturesDialog(Context context, final DefaultDialogListener dialogListener) {
return new BaseDialog(context, R.layout.dialog_select_pictures) {
@Override
public void convert(DialogViewHolder holder) {
holder.setOnClick(R.id.tv_album, new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
if (dialogListener != null) {
dialogListener.onClickRight();
}
}
});
holder.setOnClick(R.id.tv_photograph, new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
if (dialogListener != null) {
dialogListener.onClickLeft();
}
}
});
}
}.setCanceledOnTouchOutside(true)
.setCancelAble(true)
.show();
}
public interface TipsDialogListener { public interface TipsDialogListener {
void onClickOK(); void onClickOK();
} }
......
<?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="match_parent"
android:orientation="vertical">
<com.mayi.fastdevelop.view.CustomTitleBar
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="@dimen/im_dp_50" />
<com.tencent.smtt.sdk.WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<?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="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/bg_dialog_shape">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/im_dp_15"
android:text="请选择图片上传方式"
android:textColor="@color/color_333333"
android:textSize="@dimen/txt_size_32px" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/im_dp_0.5"
android:layout_below="@+id/tv_title"
android:background="@color/color_666666" />
<TextView
android:id="@+id/tv_album"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_title"
android:layout_marginLeft="@dimen/im_dp_10"
android:padding="@dimen/im_dp_10"
android:text="@string/album"
android:textColor="@color/color_333333"
android:textSize="@dimen/txt_size_32px" />
<TextView
android:id="@+id/tv_photograph"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_album"
android:layout_marginLeft="@dimen/im_dp_10"
android:padding="@dimen/im_dp_10"
android:text="@string/photograph"
android:textColor="@color/color_333333"
android:textSize="@dimen/txt_size_32px" />
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppThemeNoActionBar" parent="FastdevelopAppTheme">
<item name="android:windowBackground">@color/background_quanju</item>
</style>
</resources>
\ No newline at end of file
...@@ -12,4 +12,7 @@ ...@@ -12,4 +12,7 @@
<string name="downloading">正在下载</string> <string name="downloading">正在下载</string>
<string name="install_apk_error">安装APK错误</string> <string name="install_apk_error">安装APK错误</string>
<string name="go_browsers">跳转浏览器,下载安装APK</string> <string name="go_browsers">跳转浏览器,下载安装APK</string>
<string name="album">相册</string>
<string name="photograph">拍照</string>
</resources> </resources>
...@@ -90,4 +90,15 @@ ...@@ -90,4 +90,15 @@
<item name="android:textSize">@dimen/txt_size_28px</item> <item name="android:textSize">@dimen/txt_size_28px</item>
</style> </style>
<style name="AppThemeNoActionBar" parent="FastdevelopAppTheme">
<item name="android:windowBackground">@color/white</item>
</style>
<style name="FastdevelopAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<!--去除滑动时 顶部和底部的阴影-->
<item name="android:overScrollMode">never</item>
</style>
</resources> </resources>
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path path="Android/data/com.mayi.fastdevelop/" name="files_root" />
<external-path path="." name="external_storage_root" />
<files-path name="download" path="." />
<external-path name="external_storage_download" path="Download"/>
</paths>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment