This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package cn.sintoon.common.util; | |
| import android.app.Activity; | |
| import android.content.Context; | |
| import android.content.pm.ActivityInfo; | |
| import android.hardware.SensorManager; | |
| import android.view.OrientationEventListener; | |
| import java.lang.ref.WeakReference; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void showContent(String content) { | |
| window = new PopupWindow(this); | |
| View view = getLayoutInflater().inflate(R.layout.layout_popup_map, null); | |
| TextView tv = (TextView) view.findViewById(R.id.content); | |
| tv.setText(content); | |
| //测量未显示的view 宽高 | |
| int widthM = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED); | |
| int heightM = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //获取文件的md5摘要 | |
| public static String getDigest(File file) { | |
| FileInputStream fis = null; | |
| MessageDigest digest = null; | |
| if (null == file) return null; | |
| if (!file.isFile()) return null; | |
| if (!file.exists()) return null; | |
| try { | |
| fis = new FileInputStream(file); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package cn.sintoon.livedemo.utils.net; | |
| import android.content.BroadcastReceiver; | |
| import android.content.Context; | |
| import android.content.Intent; | |
| import android.net.ConnectivityManager; | |
| import android.net.Network; | |
| import android.net.NetworkInfo; | |
| import android.os.Build; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 将位置信息保存到图片头部 | |
| * @param path | |
| * @param gps | |
| */ | |
| public static void savePosition(String path,Gps gps){ | |
| try { | |
| ExifInterface exif = new ExifInterface(path); | |
| float[] position = new float[2]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package cn.sintoon.gongluyanghu.widget; | |
| import android.content.Context; | |
| import android.support.v4.view.ViewCompat; | |
| import android.support.v4.widget.ViewDragHelper; | |
| import android.util.AttributeSet; | |
| import android.util.Log; | |
| import android.view.MotionEvent; | |
| import android.view.View; | |
| import android.widget.LinearLayout; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //解压 | |
| FileOutputStream fileOut = null; | |
| Archive archive = new Archive(rarFile); | |
| int total =archive.getFileHeaders().size(); | |
| FileHeader fh = null; | |
| for (int i=0;i<total;i++){ | |
| fh = archive.getFileHeaders().get(i); | |
| String entrypath = ""; | |
| if (fh.isUnicode()) {//解決中文乱码 | |
| entrypath = fh.getFileNameW().trim(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 是否开启GPS | |
| * @return | |
| */ | |
| public static boolean gpsEnable(){ | |
| LocationManager locationManager = (LocationManager) ApplicationUtil.application.getSystemService(Context.LOCATION_SERVICE); | |
| boolean enable = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); | |
| return enable; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 使用 gzip压缩 | |
| * @param src 需要压缩的字符串 | |
| * @return 压缩后的字符串 并结合 Base64编码 | |
| */ | |
| public static String gzip(String src){ | |
| String dest = null; | |
| if (TextUtils.isEmpty(src)){ | |
| return dest; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 将 数据库从 assets 复制到 databases下 | |
| */ | |
| private void copyDB() { | |
| //data/data/packageName/databases/ | |
| File mkdir = new File(getFilesDir().getParent(),"databases"); | |
| //创建 databases文件夹 | |
| if (!mkdir.exists()) mkdir.mkdirs(); | |
| Log.e(TAG, "copyDb: mkdir="+mkdir.getPath()); | |
| //数据库文件 |
NewerOlder