246个文件已添加
187个文件已修改
13 文件已重命名
314个文件已删除
| | |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| | | package="com.ysh.wpc.appupdate" |
| | | package="com.hanju.update.appupdate" |
| | | android:versionCode="1" |
| | | android:versionName="1.0"> |
| | | |
| | |
| | | android:label="@string/app_name" |
| | | android:theme="@style/AppTheme"> |
| | | |
| | | <service android:name="com.ysh.wpc.appupdate.service.DownLoadFileService"></service> |
| | | <service android:name="com.hanju.update.appupdate.service.DownLoadFileService"></service> |
| | | </application> |
| | | |
| | | </manifest> |
New file |
| | |
| | | /** |
| | | * Automatically generated file. DO NOT MODIFY |
| | | */ |
| | | package com.hanju.update; |
| | | |
| | | public final class BuildConfig { |
| | | public static final boolean DEBUG = Boolean.parseBoolean("true"); |
| | | public static final String APPLICATION_ID = "com.hanju.update.appupdate"; |
| | | public static final String BUILD_TYPE = "debug"; |
| | | public static final String FLAVOR = ""; |
| | | public static final int VERSION_CODE = 1; |
| | | public static final String VERSION_NAME = "1.0"; |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.content.DialogInterface; |
| | | import android.content.DialogInterface.OnClickListener; |
| | | import android.content.Intent; |
| | | import android.content.pm.PackageManager; |
| | | import android.content.pm.PackageManager.NameNotFoundException; |
| | | import android.net.ConnectivityManager; |
| | | import android.net.NetworkInfo; |
| | | import android.os.Bundle; |
| | | import androidx.core.content.ContextCompat; |
| | | import android.telephony.TelephonyManager; |
| | | import android.text.Html; |
| | | import android.widget.Toast; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.JsonSyntaxException; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.loopj.android.http.TextHttpResponseHandler; |
| | | import com.hanju.update.appupdate.api.AppUpdateAPI; |
| | | import com.hanju.update.appupdate.entity.UpdateBean; |
| | | import com.hanju.update.appupdate.service.DownLoadFileService; |
| | | import com.hanju.update.appupdate.util.StringUtils; |
| | | import com.hanju.update.appupdate.view.CustomDialog; |
| | | |
| | | public class AppUpdate { |
| | | |
| | | private static String mKey; |
| | | |
| | | private static Activity mActivity; |
| | | |
| | | private static AppUpdate appUpdate; |
| | | |
| | | private boolean isWifi = false; |
| | | |
| | | private static boolean isCheck = false; |
| | | |
| | | public AppUpdate() { |
| | | ConnectivityManager connectMgr = (ConnectivityManager) mActivity |
| | | .getSystemService(Context.CONNECTIVITY_SERVICE); |
| | | NetworkInfo info = connectMgr.getActiveNetworkInfo(); |
| | | if (info != null) { |
| | | isWifi = info.getType() == ConnectivityManager.TYPE_WIFI; |
| | | } |
| | | getUpdateInfo(); |
| | | } |
| | | |
| | | /** |
| | | * 获取更新信息 |
| | | */ |
| | | private void getUpdateInfo() { |
| | | TelephonyManager manager = (TelephonyManager) mActivity |
| | | .getSystemService(Activity.TELEPHONY_SERVICE); |
| | | String deviceId=""; |
| | | if (ContextCompat.checkSelfPermission(mActivity, android.Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED |
| | | || ContextCompat.checkSelfPermission(mActivity, android.Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) { |
| | | deviceId = manager.getDeviceId();// 获取deviceId |
| | | } |
| | | int versionCode = 1;// 版本号 |
| | | try { |
| | | versionCode = mActivity.getPackageManager().getPackageInfo( |
| | | mActivity.getPackageName(), |
| | | PackageManager.GET_CONFIGURATIONS).versionCode; |
| | | } catch (NameNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | AppUpdateAPI.getAppUpdateInfo(mActivity, deviceId, "Android", mKey, |
| | | versionCode + "", new TextHttpResponseHandler() { |
| | | |
| | | @Override |
| | | public void onSuccess(int statusCode, Header[] headers, |
| | | String responseString) { |
| | | if (StringUtils.isEmpty(responseString)) { |
| | | return; |
| | | } |
| | | JSONObject jsonObject = null; |
| | | try { |
| | | jsonObject = new JSONObject(responseString); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (Integer.parseInt(jsonObject.optString("code")) == 0) { |
| | | Gson gson = new GsonBuilder().setPrettyPrinting() |
| | | .create(); |
| | | UpdateBean info = null; |
| | | try { |
| | | info = gson.fromJson( |
| | | jsonObject.getJSONObject("data") |
| | | .toString(), |
| | | new TypeToken<UpdateBean>() { |
| | | }.getType()); |
| | | } catch (JsonSyntaxException e) { |
| | | e.printStackTrace(); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (info.isSilent() && isWifi) { |
| | | // 自动开始下载 |
| | | try { |
| | | Intent intent = new Intent(mActivity, |
| | | DownLoadFileService.class); |
| | | mActivity.stopService(intent); |
| | | } catch (Exception e) { |
| | | } |
| | | try { |
| | | Bundle bundle = new Bundle(); |
| | | bundle.putString("downloadurl", |
| | | info.getLink()); |
| | | Intent intent = new Intent(mActivity, |
| | | DownLoadFileService.class); |
| | | intent.putExtras(bundle); |
| | | mActivity.startService(intent); |
| | | } catch (Exception e) { |
| | | } |
| | | } else { |
| | | if (!mActivity.isFinishing()) |
| | | updateDialog(info);// 弹出更新提示框 |
| | | } |
| | | } else if (jsonObject.optInt("code") == 1) { |
| | | if (isCheck) |
| | | Toast.makeText(mActivity, "当前版本为最新版本", Toast.LENGTH_LONG).show(); |
| | | } else { |
| | | if (isCheck) |
| | | Toast.makeText(mActivity, jsonObject.optString("msg"), Toast.LENGTH_LONG).show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, |
| | | String responseString, Throwable throwable) { |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private void updateDialog(final UpdateBean info) { |
| | | CustomDialog.Builder builder = new CustomDialog.Builder(mActivity); |
| | | builder.setTitle("软件更新提示"); |
| | | builder.setVersion(info.getVersion()); |
| | | builder.setSize(info.getSize()); |
| | | builder.setMessage(Html.fromHtml(info.getIntroduction()) + ""); |
| | | builder.setNoti_WIFI(isWifi); |
| | | builder.setPositiveButton("立即升级", new OnClickListener() { |
| | | |
| | | @Override |
| | | public void onClick(DialogInterface arg0, int arg1) { |
| | | // 下载 |
| | | try { |
| | | Intent intent = new Intent(mActivity, |
| | | DownLoadFileService.class); |
| | | mActivity.stopService(intent); |
| | | } catch (Exception e) { |
| | | } |
| | | try { |
| | | Bundle bundle = new Bundle(); |
| | | bundle.putString("downloadurl", info.getLink()); |
| | | Intent intent = new Intent(mActivity |
| | | .getApplicationContext(), DownLoadFileService.class); |
| | | intent.putExtras(bundle); |
| | | mActivity.startService(intent); |
| | | } catch (Exception e) { |
| | | } |
| | | arg0.dismiss(); |
| | | } |
| | | }); |
| | | builder.setNegativeButton("暂不升级", new OnClickListener() { |
| | | |
| | | @Override |
| | | public void onClick(DialogInterface arg0, int arg1) { |
| | | if (info.isForce()) { |
| | | mActivity.finish(); |
| | | } |
| | | arg0.dismiss(); |
| | | } |
| | | }); |
| | | builder.create().show(); |
| | | } |
| | | |
| | | /** |
| | | * 获取key |
| | | * |
| | | * @param key |
| | | */ |
| | | public static void setAppUpdateKey(String key) { |
| | | if (key != null && key.length() > 0) { |
| | | mKey = key; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取activity |
| | | * |
| | | * @param activity |
| | | */ |
| | | public static void setAppUpdateActivity(Activity activity, boolean check) { |
| | | if (activity != null) { |
| | | mActivity = activity; |
| | | isCheck = check; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 初始化 |
| | | */ |
| | | public static void initAppUpdate() { |
| | | if (appUpdate == null) { |
| | | appUpdate = new AppUpdate(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 销毁appUpdate |
| | | */ |
| | | public static void destoryAppUpdate() { |
| | | if (appUpdate != null) { |
| | | appUpdate = null; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate; |
| | | |
| | | import android.content.Context; |
| | | |
| | | import com.loopj.android.http.TextHttpResponseHandler; |
| | | import com.hanju.update.appupdate.api.AppUpdateAPI; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2017/9/15. |
| | | */ |
| | | |
| | | public class GoReview { |
| | | /** |
| | | * 获取更新信息 |
| | | */ |
| | | static boolean isReview = false; |
| | | |
| | | public static boolean getGoReview(final Context mActivity, String mKey) { |
| | | |
| | | AppUpdateAPI.getGoReview(mActivity, mKey |
| | | , new TextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccess(int statusCode, Header[] headers, |
| | | String responseString) { |
| | | JSONObject jsonObject = null; |
| | | try { |
| | | jsonObject = new JSONObject(responseString); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (Integer.parseInt(jsonObject.optString("code")) == 0) { |
| | | isReview = !jsonObject.optString("data").equalsIgnoreCase("0"); |
| | | } |
| | | EventBus.getDefault().post(isReview); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, |
| | | String responseString, Throwable throwable) { |
| | | isReview = false; |
| | | } |
| | | }); |
| | | return isReview; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.api; |
| | | |
| | | public class APPUpdateConstant { |
| | | |
| | | public static final String HOST = "http://update.yeshitv.com:8090/";// 外网 |
| | | |
| | | // public static final String HOST = "http://192.168.1.122:8080/"; |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.api; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map.Entry; |
| | | |
| | | import android.content.Context; |
| | | import android.util.Log; |
| | | |
| | | import com.loopj.android.http.AsyncHttpClient; |
| | | import com.loopj.android.http.RequestParams; |
| | | import com.loopj.android.http.ResponseHandlerInterface; |
| | | import com.loopj.android.http.SyncHttpClient; |
| | | import com.hanju.update.appupdate.BuildConfig; |
| | | import com.hanju.update.appupdate.util.MD5Utils; |
| | | import com.hanju.update.appupdate.util.PackageUtils2; |
| | | import com.hanju.update.appupdate.util.StringUtils; |
| | | |
| | | public class AppUpdateAPI { |
| | | |
| | | public static final boolean isDebug = false; |
| | | |
| | | private static final String TAG = "SuperAd"; |
| | | |
| | | public static String ERROR_NOTICE = ""; |
| | | |
| | | public static String BASE_URL = APPUpdateConstant.HOST + "update/"; |
| | | |
| | | private static AsyncHttpClient asyncHttpClient = new AsyncHttpClient(); |
| | | |
| | | private static SyncHttpClient syncHttpClient = new SyncHttpClient(); |
| | | |
| | | static { |
| | | asyncHttpClient.setTimeout(60 * 1000); |
| | | syncHttpClient.setTimeout(60 * 1000); |
| | | asyncHttpClient.setURLEncodingEnabled(false); |
| | | syncHttpClient.setURLEncodingEnabled(false); |
| | | } |
| | | |
| | | public static void getAppUpdateInfo(Context context, String device, |
| | | String platform, String key, String versionCode, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("device", device); |
| | | params.put("platform", "Android"); |
| | | params.put("key", key); |
| | | params.put("system", "1"); |
| | | params.put("device", device); |
| | | params.put("versioncode", versionCode); |
| | | commonPost(context, BASE_URL + "update", params, handler); |
| | | } |
| | | |
| | | public static void getGoReview(Context context, String key, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("platform", "Android"); |
| | | params.put("key", key); |
| | | params.put("method", "getPraise"); |
| | | commonPost(context, BASE_URL + "getConfig", params, handler); |
| | | } |
| | | |
| | | public static LinkedHashMap<String, String> validateParams( |
| | | LinkedHashMap<String, String> params, long time, String packagename) { |
| | | params.put("System", "1"); |
| | | StringBuilder sign = new StringBuilder(); |
| | | // for (Entry<String, String> entry : params.entrySet()) { |
| | | // sign.append(entry.getValue()); |
| | | // } |
| | | sign.append(packagename) |
| | | .append(StringUtils.isEmpty(params.get("uid")) ? params |
| | | .get("device") : params.get("uid")) |
| | | .append(params.get("system")).append(time) |
| | | .append("ViDeo2017xx"); |
| | | if (BuildConfig.DEBUG) { |
| | | Log.i(TAG, "sign: " + sign); |
| | | } |
| | | params.put("Sign", MD5Utils.getMD532(sign.toString())); |
| | | params.put("Platform", "Android"); |
| | | return params; |
| | | } |
| | | |
| | | @SuppressWarnings("unused") |
| | | private static void commonGet(Context context, String url, |
| | | LinkedHashMap<String, String> params, |
| | | ResponseHandlerInterface handler) { |
| | | commonGet(context, url, params, handler, true); |
| | | } |
| | | |
| | | public static void commonGet(Context context, String url, |
| | | LinkedHashMap<String, String> params, |
| | | ResponseHandlerInterface handler, boolean asyn) { |
| | | params.put("package", context.getPackageName()); |
| | | int version = PackageUtils2.getVersionCode(context); |
| | | params.put("version", version + ""); |
| | | long timestamp = System.currentTimeMillis(); |
| | | params.put("timestamp", timestamp + ""); |
| | | LinkedHashMap<String, String> map = validateParams(params, timestamp, |
| | | context.getPackageName()); |
| | | RequestParams requestParams = new RequestParams(map); |
| | | if (BuildConfig.DEBUG) { |
| | | Log.i(TAG, "get url: " + url + "?" + requestParams.toString()); |
| | | } |
| | | if (asyn) { |
| | | (asyncHttpClient).get(context, url, requestParams, handler); |
| | | } else { |
| | | (syncHttpClient).get(context, url, requestParams, handler); |
| | | } |
| | | } |
| | | |
| | | private static void commonPost(Context context, String url, |
| | | LinkedHashMap<String, String> params, |
| | | ResponseHandlerInterface handler) { |
| | | commonPost(context, url, params, null, handler); |
| | | } |
| | | |
| | | private static void commonPost(Context context, String url, |
| | | LinkedHashMap<String, String> params, HashMap<String, File> files, |
| | | ResponseHandlerInterface handler) { |
| | | commonPost(context, url, params, files, handler, true); |
| | | } |
| | | |
| | | private static void commonPost(Context context, String url, |
| | | LinkedHashMap<String, String> params, HashMap<String, File> files, |
| | | ResponseHandlerInterface handler, boolean asyn) { |
| | | params.put("packagename", context.getPackageName()); |
| | | int version = PackageUtils2.getVersionCode(context); |
| | | params.put("version", version + ""); |
| | | long timestamp = System.currentTimeMillis(); |
| | | params.put("timestamp", timestamp + ""); |
| | | LinkedHashMap<String, String> map = validateParams(params, timestamp, |
| | | context.getPackageName()); |
| | | RequestParams requestParams = new RequestParams(map); |
| | | if (BuildConfig.DEBUG) { |
| | | Log.i(TAG, "post url: " + url + "?" + requestParams.toString()); |
| | | } |
| | | if (files != null) { |
| | | for (Entry<String, File> entry : files.entrySet()) { |
| | | try { |
| | | requestParams.put(entry.getKey(), entry.getValue()); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | if (asyn) { |
| | | asyncHttpClient.post(context, url, requestParams, handler); |
| | | } else { |
| | | syncHttpClient.post(context, url, requestParams, handler); |
| | | } |
| | | } |
| | | |
| | | public static void commonGet(Context context, String url, |
| | | RequestParams params, ResponseHandlerInterface handler, boolean asyn) { |
| | | if (asyn) { |
| | | asyncHttpClient.get(context, url, params, handler); |
| | | } else { |
| | | syncHttpClient.get(context, url, params, handler); |
| | | } |
| | | } |
| | | |
| | | public static void commonGet(Context context, String url, |
| | | ResponseHandlerInterface handler, boolean asyn) { |
| | | if (asyn) { |
| | | asyncHttpClient.get(context, url, handler); |
| | | } else { |
| | | syncHttpClient.get(context, url, handler); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.download; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | | import java.net.URLDecoder; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import android.content.ComponentName; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.pm.ApplicationInfo; |
| | | import android.content.pm.PackageManager; |
| | | import android.content.pm.PackageManager.NameNotFoundException; |
| | | |
| | | import com.loopj.android.http.AsyncHttpClient; |
| | | import com.loopj.android.http.JsonHttpResponseHandler; |
| | | import com.loopj.android.http.RequestParams; |
| | | |
| | | public class ApkUtil { |
| | | public static void openApk(Context context, String packageName, |
| | | String mainActivity) { |
| | | try { |
| | | Intent intent = new Intent(); |
| | | ComponentName cmp = new ComponentName(packageName, mainActivity); |
| | | intent.setAction(Intent.ACTION_MAIN); |
| | | intent.addCategory(Intent.CATEGORY_LAUNCHER); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | intent.setComponent(cmp); |
| | | |
| | | context.startActivity(intent); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 检查某个应用是否安装 |
| | | public static boolean checkAPP(Context context, String packageName) { |
| | | if (packageName == null || "".equals(packageName)) |
| | | return false; |
| | | try { |
| | | ApplicationInfo info = context.getPackageManager() |
| | | .getApplicationInfo(packageName, |
| | | PackageManager.GET_UNINSTALLED_PACKAGES); |
| | | return true; |
| | | } catch (NameNotFoundException e) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | // public static void OpenListeners(int id, String type) { |
| | | // final String mType = type; |
| | | // final int mId = id; |
| | | // Map<String, String> params = new HashMap<String, String>(); |
| | | // params.put("Method", "setMoney"); |
| | | // // params.put("Uid", AppContext.userInfo.getId() + ""); |
| | | // params.put("Id", id + ""); |
| | | // params.put("Type", type); |
| | | // // RandomCode = AppContext.userInfo.getRandomCode(); |
| | | // params.put("RCode", RandomCode); |
| | | // params.put("Platform", platform); |
| | | // post("http://123.57.155.55:8080/YouHuiZhuan/API/money", params, null, |
| | | // new JsonHttpResponseHandler() { |
| | | // |
| | | // @Override |
| | | // public void onStart() { |
| | | // super.onStart(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onFinish() { |
| | | // super.onFinish(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onSuccess(int statusCode, Header[] headers, |
| | | // JSONObject response) { |
| | | // // TODO Auto-generated method stub |
| | | // super.onSuccess(statusCode, headers, response); |
| | | // Log.i("tasklist", response.toString()); |
| | | // if (mType.equalsIgnoreCase("1")) { |
| | | // // AppContext.startRecord(mId, 3 + ""); |
| | | // } |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onFailure(int statusCode, Header[] headers, |
| | | // Throwable throwable, JSONArray errorResponse) { |
| | | // super.onFailure(statusCode, headers, throwable, |
| | | // errorResponse); |
| | | // // UIUtils.showToast(context, "请求服务器失败"); |
| | | // } |
| | | // }); |
| | | // } |
| | | |
| | | public static String RandomCode; |
| | | final static String platform = "Android"; |
| | | private static AsyncHttpClient client = new AsyncHttpClient(); |
| | | |
| | | // public static void money(Map<String, String> params, |
| | | // JsonHttpResponseHandler handler) { |
| | | // if (StringUtils.isNullOrEmpty(RandomCode) |
| | | // && AppContext.userInfo != null) { |
| | | // RandomCode = AppContext.userInfo.getRandomCode(); |
| | | // } |
| | | // RandomCode = AppContext.userInfo.getRandomCode(); |
| | | // params.put("RCode", RandomCode); |
| | | // params.put("Platform", platform); |
| | | // post("http://123.57.155.55:8080/YouHuiZhuan/API/money", params, null, |
| | | // handler); |
| | | // } |
| | | |
| | | public static void post(String url, Map<String, String> map, |
| | | HashMap<String, File> fileMap, JsonHttpResponseHandler handler) { |
| | | RequestParams params = new RequestParams(); |
| | | TreeSet<String> treeSet = new TreeSet<String>(); |
| | | Set<String> set = map.keySet(); |
| | | Iterator<String> it = set.iterator(); |
| | | String sign = ""; |
| | | String org = ""; |
| | | JSONObject object = new JSONObject(); |
| | | while (it.hasNext()) { |
| | | String key = it.next(); |
| | | treeSet.add(key); |
| | | } |
| | | it = treeSet.iterator(); |
| | | while (it.hasNext()) { |
| | | String key = it.next(); |
| | | try { |
| | | object.put(key, map.get(key)); |
| | | } catch (JSONException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | // if (!StringUtils.isNullOrEmpty(map.get(key))) |
| | | // org += map.get(key) + "---"; |
| | | } |
| | | |
| | | // sign = StringUtils.MD5(org + "youHUIzhuan2015"); |
| | | try { |
| | | String iSign = URLDecoder.decode(sign, "UTF-8"); |
| | | object.put("Sign", iSign); |
| | | } catch (Exception e2) { |
| | | // TODO Auto-generated catch block |
| | | e2.printStackTrace(); |
| | | } |
| | | params.put("Data", object.toString()); |
| | | if (fileMap != null) { |
| | | Set<String> fileSet = fileMap.keySet(); |
| | | it = fileSet.iterator(); |
| | | |
| | | while (it.hasNext()) { |
| | | String key = it.next(); |
| | | try { |
| | | params.put(key, fileMap.get(key)); |
| | | } catch (FileNotFoundException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | client.post(url, params, handler); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.download; |
| | | |
| | | //常量 |
| | | public class Contents { // 根目�? |
| | | public static String ROOT = "ysad"; |
| | | // 消息缓存目录 |
| | | public final static String CHATINFO = "Chat"; |
| | | // 消息图片缓存目录 |
| | | public final static String CHATIMG = "Image"; |
| | | // 消息声音缓存目录 |
| | | public final static String CHATVOICE = "Voice"; |
| | | // 缩略图缓存目�? |
| | | public final static String THUMBIMAGE = "ThumbImage"; |
| | | // 消息接收过滤�? |
| | | public final static String CHAT_MESSAGE_RECIVER_FILTER = "chat_message_reciver_filter"; |
| | | // 图片缓存 |
| | | public final static String CACHE = "Chche"; |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.download; |
| | | |
| | | import java.io.File; |
| | | |
| | | import com.hanju.update.appupdate.service.DownLoadFileService; |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.net.Uri; |
| | | import android.os.AsyncTask; |
| | | import android.os.Build; |
| | | import androidx.core.content.FileProvider; |
| | | import android.util.Log; |
| | | |
| | | /** |
| | | * @author weikou2015 下载工具类 |
| | | */ |
| | | public class DownLoadApks extends AsyncTask<String, Integer, String> implements |
| | | DownLoadFile.FileProgressListener { |
| | | private static final String TAG = "DownLoadApks"; |
| | | // TextView tv; |
| | | Context context; |
| | | IProgress progress; |
| | | String apkType; |
| | | |
| | | public DownLoadApks(Context context, IProgress progress, String apkType) { |
| | | // this.tv = tv; |
| | | this.context = context; |
| | | this.progress = progress; |
| | | this.apkType = apkType; |
| | | } |
| | | |
| | | @Override |
| | | protected void onProgressUpdate(Integer... values) { |
| | | super.onProgressUpdate(values); |
| | | Log.i(TAG, "我的下载进度:" + values[0]); |
| | | if (progress != null) |
| | | progress.getProgress(values[0]); |
| | | // if (values[0] == 100) { |
| | | // tv.setText("完成"); |
| | | // } else { |
| | | // tv.setText("下载" + values[0] + "%"); |
| | | // } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected String doInBackground(String... params) { |
| | | String url = params[0]; |
| | | // 下载 |
| | | DownLoadFile dl = new DownLoadFile(); |
| | | String[] urls = url.split("/"); |
| | | String name = ""; |
| | | if (urls.length > 0) |
| | | name = FileUtils.getRootPath(context) + File.separator |
| | | + urls[urls.length - 1]; |
| | | else |
| | | name = FileUtils.getRootPath(context) + File.separator |
| | | + System.currentTimeMillis() + ".apk"; |
| | | System.out.println("APK名称:" + name); |
| | | Log.i(TAG, "我的下载进度:" + name); |
| | | try { |
| | | File f = dl.downLoadFile(this, name, url, context); |
| | | return f.getPath(); |
| | | } catch (Exception e) { |
| | | DownLoadFileService.j = -1; |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | // 完成网络请求 |
| | | @Override |
| | | protected void onPostExecute(String result) { |
| | | super.onPostExecute(result); |
| | | if (!ApkUtil.checkAPP(context, apkType)) { |
| | | Intent intent = new Intent(Intent.ACTION_VIEW); |
| | | File file = new File(result); |
| | | |
| | | //判断是否是AndroidN以及更高的版本 |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
| | | intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| | | Uri contentUri = FileProvider.getUriForFile(context.getApplicationContext(), "com.hanju.video.fileprovider", file); |
| | | intent.setDataAndType(contentUri, "application/vnd.android.package-archive"); |
| | | } else { |
| | | Uri uri = Uri.fromFile(file); |
| | | intent.setDataAndType(uri, "application/vnd.android.package-archive"); |
| | | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | } |
| | | context.startActivity(intent); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void update(int progress) { |
| | | publishProgress(progress); |
| | | } |
| | | |
| | | public interface IProgress { |
| | | void getProgress(int p); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.download; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | |
| | | import android.content.Context; |
| | | |
| | | public class DownLoadFile { |
| | | public File downLoadFile(FileProgressListener listener, String filePath, |
| | | String _urlStr, Context context) throws Exception { |
| | | // 准备拼接新的文件名(保存在存储卡后的文件名) |
| | | // String newFilename = _urlStr.substring(_urlStr.lastIndexOf("/") + 1); |
| | | // UIUtils.showMiddleToast(context, "文件开始下载"); |
| | | File file = new File((filePath + "").trim()); |
| | | // 如果目标文件已经存在,则删除。产生覆盖旧文件的效果 |
| | | |
| | | // 构造URL |
| | | URL url = new URL(_urlStr); |
| | | System.out.println("下载地址:" + _urlStr); |
| | | // 打开连接 |
| | | URLConnection con = url.openConnection(); |
| | | // 获得文件的长度 |
| | | int contentLength = con.getContentLength(); |
| | | if (file.exists() && Math.abs(file.length() - contentLength) < 100) { |
| | | return file; |
| | | } else { |
| | | if (file.exists()) |
| | | file.delete(); |
| | | } |
| | | if (file.exists()) { |
| | | // file.delete(); |
| | | } else { |
| | | try { |
| | | file.createNewFile(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | System.out.println("长度 :" + contentLength); |
| | | // 输入流 |
| | | InputStream is = con.getInputStream(); |
| | | // 1K的数据缓冲 |
| | | byte[] bs = new byte[1024]; |
| | | // 读取到的数据长度 |
| | | int len; |
| | | int count = 0; |
| | | // 输出的文件流 |
| | | OutputStream os = new FileOutputStream((filePath + "").trim()); |
| | | if (contentLength < 0) { |
| | | listener.update(1); |
| | | } |
| | | // 开始读取 |
| | | while ((len = is.read(bs)) != -1) { |
| | | os.write(bs, 0, len); |
| | | count += len; |
| | | if (listener != null && contentLength >= 0) |
| | | listener.update((int) ((float) count / contentLength * 100)); |
| | | } |
| | | if (contentLength < 0) { |
| | | listener.update(100); |
| | | } |
| | | // 完毕,关闭所有链接 |
| | | os.close(); |
| | | is.close(); |
| | | |
| | | return file; |
| | | } |
| | | |
| | | public interface FileProgressListener { |
| | | void update(int parent); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.download; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | |
| | | import android.content.Context; |
| | | import android.graphics.Bitmap; |
| | | import android.os.Environment; |
| | | import android.os.StatFs; |
| | | |
| | | import com.hanju.update.appupdate.entity.SDCardEntity; |
| | | import com.hanju.update.appupdate.util.SDCardUtil; |
| | | import com.hanju.update.appupdate.util.StringUtils; |
| | | |
| | | public class FileUtils { |
| | | // 获取sd卡路径 |
| | | public static String getSDCardPath() { |
| | | if (Environment.getExternalStorageState().equals( |
| | | Environment.MEDIA_MOUNTED)) { |
| | | File file = new File(Environment.getExternalStorageDirectory() |
| | | .getPath()); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } else |
| | | return null; |
| | | } |
| | | |
| | | // 获取根目录 |
| | | public static String getRootPath(Context context) { |
| | | |
| | | if (StringUtils.isEmpty(getSDCardPath())) { |
| | | File file = null; |
| | | |
| | | SDCardEntity entity = SDCardUtil.getSDCardPath(context); |
| | | if (entity != null) |
| | | file = new File(entity.getPath() + File.separator |
| | | + Contents.ROOT); |
| | | if (file == null) |
| | | return null; |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } else { |
| | | File file = new File(getSDCardPath() + File.separator |
| | | + Contents.ROOT); |
| | | if (file.getFreeSpace() == 0) { |
| | | SDCardEntity entity = SDCardUtil.getSDCardPath(context); |
| | | if (entity != null) |
| | | file = new File(entity.getPath() + File.separator |
| | | + Contents.ROOT); |
| | | } |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } |
| | | } |
| | | |
| | | // 获取消息缓存文件夹 |
| | | public static String getChatInfoPath(Context context) { |
| | | if (StringUtils.isEmpty(getRootPath(context))) { |
| | | return null; |
| | | } else { |
| | | File file = new File(getRootPath(context) + File.separator |
| | | + Contents.CHATINFO); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 写文本文�?在Android系统中,文件保存�?/data/data/PACKAGE_NAME/files 目录�? |
| | | * |
| | | * @param context |
| | | * @param msg |
| | | */ |
| | | public static void write(Context context, String fileName, String content) { |
| | | if (content == null) |
| | | content = ""; |
| | | |
| | | try { |
| | | FileOutputStream fos = context.openFileOutput(fileName, |
| | | Context.MODE_PRIVATE); |
| | | fos.write(content.getBytes()); |
| | | |
| | | fos.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 读取文本文件 |
| | | * |
| | | * @param context |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static String read(Context context, String fileName) { |
| | | try { |
| | | FileInputStream in = context.openFileInput(fileName); |
| | | return readInStream(in); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | private static String readInStream(FileInputStream inStream) { |
| | | try { |
| | | ByteArrayOutputStream outStream = new ByteArrayOutputStream(); |
| | | byte[] buffer = new byte[512]; |
| | | int length = -1; |
| | | while ((length = inStream.read(buffer)) != -1) { |
| | | outStream.write(buffer, 0, length); |
| | | } |
| | | |
| | | outStream.close(); |
| | | inStream.close(); |
| | | return outStream.toString(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static File createFile(String folderPath, String fileName) { |
| | | File destDir = new File(folderPath); |
| | | if (!destDir.exists()) { |
| | | destDir.mkdirs(); |
| | | } |
| | | return new File(folderPath, fileName + fileName); |
| | | } |
| | | |
| | | public static void copyFile(InputStream in, File file) { |
| | | |
| | | if (!file.exists()) { |
| | | try { |
| | | file.createNewFile(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | if (file.exists()) { |
| | | try { |
| | | FileOutputStream os = new FileOutputStream(file); |
| | | |
| | | byte[] b = new byte[1024]; |
| | | |
| | | int len = -1; |
| | | |
| | | while ((len = in.read(b)) != -1) { |
| | | os.write(b, 0, len); |
| | | } |
| | | |
| | | in.close(); |
| | | os.close(); |
| | | |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 向手机写图片 |
| | | * |
| | | * @param buffer |
| | | * @param folder |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static boolean writeFile(byte[] buffer, String folder, |
| | | String fileName) { |
| | | boolean writeSucc = false; |
| | | |
| | | boolean sdCardExist = Environment.getExternalStorageState().equals( |
| | | android.os.Environment.MEDIA_MOUNTED); |
| | | |
| | | String folderPath = ""; |
| | | if (sdCardExist) { |
| | | folderPath = Environment.getExternalStorageDirectory() |
| | | + File.separator + folder + File.separator; |
| | | } else { |
| | | writeSucc = false; |
| | | } |
| | | |
| | | File fileDir = new File(folderPath); |
| | | if (!fileDir.exists()) { |
| | | fileDir.mkdirs(); |
| | | } |
| | | |
| | | File file = new File(folderPath + fileName); |
| | | FileOutputStream out = null; |
| | | try { |
| | | out = new FileOutputStream(file); |
| | | out.write(buffer); |
| | | writeSucc = true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | out.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | return writeSucc; |
| | | } |
| | | |
| | | /** |
| | | * 根据文件绝对路径获取文件名 |
| | | * |
| | | * @param filePath |
| | | * @return |
| | | */ |
| | | public static String getFileName(String filePath) { |
| | | if (StringUtils.isEmpty(filePath)) |
| | | return ""; |
| | | return filePath.substring(filePath.lastIndexOf(File.separator) + 1); |
| | | } |
| | | |
| | | /** |
| | | * 根据文件的绝对路径获取文件名但不包含扩展名 |
| | | * |
| | | * @param filePath |
| | | * @return |
| | | */ |
| | | public static String getFileNameNoFormat(String filePath) { |
| | | if (StringUtils.isEmpty(filePath)) { |
| | | return ""; |
| | | } |
| | | int point = filePath.lastIndexOf('.'); |
| | | return filePath.substring(filePath.lastIndexOf(File.separator) + 1, |
| | | point); |
| | | } |
| | | |
| | | /** |
| | | * 获取文件扩展名 |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static String getFileFormat(String fileName) { |
| | | if (StringUtils.isEmpty(fileName)) |
| | | return ""; |
| | | |
| | | int point = fileName.lastIndexOf('.'); |
| | | return fileName.substring(point + 1); |
| | | } |
| | | |
| | | /** |
| | | * 获取文件大小 |
| | | * |
| | | * @param filePath |
| | | * @return |
| | | */ |
| | | public static long getFileSize(String filePath) { |
| | | long size = 0; |
| | | |
| | | File file = new File(filePath); |
| | | if (file != null && file.exists()) { |
| | | size = file.length(); |
| | | } |
| | | return size; |
| | | } |
| | | |
| | | /** |
| | | * 获取文件大小 |
| | | * |
| | | * @param size |
| | | * 字节 |
| | | * @return |
| | | */ |
| | | public static String getFileSize(long size) { |
| | | if (size <= 0) |
| | | return "0"; |
| | | java.text.DecimalFormat df = new java.text.DecimalFormat("##.##"); |
| | | float temp = (float) size / 1024; |
| | | if (temp >= 1024) { |
| | | return df.format(temp / 1024) + "M"; |
| | | } else { |
| | | return df.format(temp) + "K"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换文件大小 |
| | | * |
| | | * @param fileS |
| | | * @return B/KB/MB/GB |
| | | */ |
| | | public static String formatFileSize(long fileS) { |
| | | java.text.DecimalFormat df = new java.text.DecimalFormat("#.00"); |
| | | String fileSizeString = ""; |
| | | if (fileS < 1024) { |
| | | fileSizeString = df.format((double) fileS) + "B"; |
| | | } else if (fileS < 1048576) { |
| | | fileSizeString = df.format((double) fileS / 1024) + "KB"; |
| | | } else if (fileS < 1073741824) { |
| | | fileSizeString = df.format((double) fileS / 1048576) + "MB"; |
| | | } else { |
| | | fileSizeString = df.format((double) fileS / 1073741824) + "G"; |
| | | } |
| | | return fileSizeString; |
| | | } |
| | | |
| | | /** |
| | | * 获取目录文件大小 |
| | | * |
| | | * @param dir |
| | | * @return |
| | | */ |
| | | public static long getDirSize(File dir) { |
| | | if (dir == null) { |
| | | return 0; |
| | | } |
| | | if (!dir.isDirectory()) { |
| | | return 0; |
| | | } |
| | | long dirSize = 0; |
| | | File[] files = dir.listFiles(); |
| | | for (File file : files) { |
| | | if (file.isFile()) { |
| | | dirSize += file.length(); |
| | | } else if (file.isDirectory()) { |
| | | dirSize += file.length(); |
| | | dirSize += getDirSize(file); // 递归调用继续统计 |
| | | } |
| | | } |
| | | return dirSize; |
| | | } |
| | | |
| | | /** |
| | | * 获取目录文件个数 |
| | | * |
| | | * @param f |
| | | * @return |
| | | */ |
| | | public long getFileList(File dir) { |
| | | long count = 0; |
| | | File[] files = dir.listFiles(); |
| | | count = files.length; |
| | | for (File file : files) { |
| | | if (file.isDirectory()) { |
| | | count = count + getFileList(file);// 递归 |
| | | count--; |
| | | } |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | public static byte[] toBytes(InputStream in) throws IOException { |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | int ch; |
| | | while ((ch = in.read()) != -1) { |
| | | out.write(ch); |
| | | } |
| | | byte[] buffer = out.toByteArray(); |
| | | out.close(); |
| | | return buffer; |
| | | } |
| | | |
| | | /** |
| | | * �?��文件是否存在 |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public static boolean checkFileExists(String name) { |
| | | boolean status; |
| | | if (!name.equals("")) { |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | File newPath = new File(path.toString() + name); |
| | | status = newPath.exists(); |
| | | } else { |
| | | status = false; |
| | | } |
| | | return status; |
| | | } |
| | | |
| | | public static boolean existFile(String path) { |
| | | |
| | | File file = new File(path); |
| | | |
| | | return file.isFile() && file.exists(); |
| | | } |
| | | |
| | | /** |
| | | * 计算SD卡的剩余空间 |
| | | * |
| | | * @return 返回-1,说明没有安装sd�? |
| | | */ |
| | | public static long getFreeDiskSpace() { |
| | | String status = Environment.getExternalStorageState(); |
| | | long freeSpace = 0; |
| | | if (status.equals(Environment.MEDIA_MOUNTED)) { |
| | | try { |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | StatFs stat = new StatFs(path.getPath()); |
| | | long blockSize = stat.getBlockSize(); |
| | | long availableBlocks = stat.getAvailableBlocks(); |
| | | freeSpace = availableBlocks * blockSize / 1024; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | return -1; |
| | | } |
| | | return (freeSpace); |
| | | } |
| | | |
| | | /** |
| | | * 新建目录 |
| | | * |
| | | * @param directoryName |
| | | * @return |
| | | */ |
| | | public static boolean createDirectory(String directoryName) { |
| | | boolean status; |
| | | if (!directoryName.equals("")) { |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | File newPath = new File(path.toString() + directoryName); |
| | | status = newPath.mkdir(); |
| | | status = true; |
| | | } else |
| | | status = false; |
| | | return status; |
| | | } |
| | | |
| | | /** |
| | | * �?��是否安装SD�? |
| | | * |
| | | * @return |
| | | */ |
| | | public static boolean checkSaveLocationExists() { |
| | | String sDCardStatus = Environment.getExternalStorageState(); |
| | | boolean status; |
| | | status = sDCardStatus.equals(Environment.MEDIA_MOUNTED); |
| | | return status; |
| | | } |
| | | |
| | | /** |
| | | * 删除目录(包括:目录里的所有文�? |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static boolean deleteDirectory(String fileName) { |
| | | boolean status; |
| | | SecurityManager checker = new SecurityManager(); |
| | | |
| | | if (!fileName.equals("")) { |
| | | |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | File newPath = new File(path.toString() + fileName); |
| | | checker.checkDelete(newPath.toString()); |
| | | if (newPath.isDirectory()) { |
| | | String[] listfile = newPath.list(); |
| | | // delete all files within the specified directory and then |
| | | // delete the directory |
| | | try { |
| | | for (int i = 0; i < listfile.length; i++) { |
| | | File deletedFile = new File(newPath.toString() + "/" |
| | | + listfile[i]); |
| | | deletedFile.delete(); |
| | | } |
| | | newPath.delete(); |
| | | |
| | | status = true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | status = false; |
| | | } |
| | | |
| | | } else |
| | | status = false; |
| | | } else |
| | | status = false; |
| | | return status; |
| | | } |
| | | |
| | | /** |
| | | * 删除文件 |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static boolean deleteFile(String fileName) { |
| | | boolean status; |
| | | SecurityManager checker = new SecurityManager(); |
| | | |
| | | if (!fileName.equals("")) { |
| | | |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | File newPath = new File(path.toString() + fileName); |
| | | checker.checkDelete(newPath.toString()); |
| | | if (newPath.isFile()) { |
| | | try { |
| | | |
| | | newPath.delete(); |
| | | status = true; |
| | | } catch (SecurityException se) { |
| | | se.printStackTrace(); |
| | | status = false; |
| | | } |
| | | } else |
| | | status = false; |
| | | } else |
| | | status = false; |
| | | return status; |
| | | } |
| | | |
| | | public static final String getTempFilePath(Context context) { |
| | | |
| | | return context.getCacheDir() + File.separator + "temp"; |
| | | |
| | | } |
| | | |
| | | public static String getSDPath() { |
| | | File sdDir = null; |
| | | boolean sdCardExist = Environment.getExternalStorageState().equals( |
| | | Environment.MEDIA_MOUNTED); // 判断sd卡是否存�? |
| | | if (sdCardExist) { |
| | | sdDir = Environment.getExternalStorageDirectory();// 获取跟目�? |
| | | } |
| | | return sdDir.getPath(); |
| | | } |
| | | |
| | | // 将图片保存到指定的路径 |
| | | public static String savePic(String filePath, String name, Bitmap bitmap) { |
| | | File file = new File(filePath); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | |
| | | File f = new File(filePath + File.separator + name); |
| | | try { |
| | | f.createNewFile(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FileOutputStream fOut = null; |
| | | try { |
| | | fOut = new FileOutputStream(f); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); |
| | | try { |
| | | fOut.flush(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | fOut.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return f.getPath(); |
| | | } |
| | | |
| | | // 将图片保存到指定的路径 |
| | | public static String savePic(String filePath, Bitmap bitmap) { |
| | | File f = new File(filePath); |
| | | try { |
| | | f.createNewFile(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FileOutputStream fOut = null; |
| | | try { |
| | | fOut = new FileOutputStream(f); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); |
| | | try { |
| | | fOut.flush(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | fOut.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return f.getPath(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.entity; |
| | | |
| | | public class SDCardEntity { |
| | | private String path; |
| | | private long totalSize; |
| | | private long availableSize; |
| | | |
| | | public String getPath() { |
| | | return path; |
| | | } |
| | | |
| | | public void setPath(String path) { |
| | | this.path = path; |
| | | } |
| | | |
| | | public long getTotalSize() { |
| | | return totalSize; |
| | | } |
| | | |
| | | public void setTotalSize(long totalSize) { |
| | | this.totalSize = totalSize; |
| | | } |
| | | |
| | | public long getAvailableSize() { |
| | | return availableSize; |
| | | } |
| | | |
| | | public void setAvailableSize(long availableSize) { |
| | | this.availableSize = availableSize; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.entity; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | |
| | | public class UpdateBean { |
| | | private String id; |
| | | @Expose |
| | | private String key; |
| | | @Expose |
| | | private String name; |
| | | private boolean open; |
| | | @Expose |
| | | private boolean force; |
| | | @Expose |
| | | private int versionCode; |
| | | @Expose |
| | | private String version; |
| | | @Expose |
| | | private String size; |
| | | @Expose |
| | | private String link;// 链接 |
| | | @Expose |
| | | private String introduction;// 更新内容 |
| | | |
| | | @Expose |
| | | private boolean showCancel; |
| | | |
| | | @Expose |
| | | private boolean silent;//是否强制更新 |
| | | |
| | | private String createtime; |
| | | |
| | | public boolean isSilent() { |
| | | return silent; |
| | | } |
| | | |
| | | public void setSilent(boolean silent) { |
| | | this.silent = silent; |
| | | } |
| | | |
| | | public String getIntroduction() { |
| | | return introduction; |
| | | } |
| | | |
| | | public void setIntroduction(String introduction) { |
| | | this.introduction = introduction; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getKey() { |
| | | return key; |
| | | } |
| | | |
| | | public void setKey(String key) { |
| | | this.key = key; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public boolean isOpen() { |
| | | return open; |
| | | } |
| | | |
| | | public void setOpen(boolean open) { |
| | | this.open = open; |
| | | } |
| | | |
| | | public boolean isForce() { |
| | | return force; |
| | | } |
| | | |
| | | public void setForce(boolean force) { |
| | | this.force = force; |
| | | } |
| | | |
| | | public int getVersionCode() { |
| | | return versionCode; |
| | | } |
| | | |
| | | public void setVersionCode(int versionCode) { |
| | | this.versionCode = versionCode; |
| | | } |
| | | |
| | | public String getVersion() { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(String version) { |
| | | this.version = version; |
| | | } |
| | | |
| | | public String getSize() { |
| | | return size; |
| | | } |
| | | |
| | | public void setSize(String size) { |
| | | this.size = size; |
| | | } |
| | | |
| | | public String getLink() { |
| | | return link; |
| | | } |
| | | |
| | | public void setLink(String link) { |
| | | this.link = link; |
| | | } |
| | | |
| | | public boolean isShowCancel() { |
| | | return showCancel; |
| | | } |
| | | |
| | | public void setShowCancel(boolean showCancel) { |
| | | this.showCancel = showCancel; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.service; |
| | | |
| | | import android.annotation.SuppressLint; |
| | | import android.app.Notification; |
| | | import android.app.NotificationManager; |
| | | import android.app.Service; |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.os.IBinder; |
| | | import android.os.Message; |
| | | import android.widget.RemoteViews; |
| | | import android.widget.Toast; |
| | | |
| | | import com.hanju.update.appupdate.R; |
| | | import com.hanju.update.appupdate.download.DownLoadApks; |
| | | import com.hanju.update.appupdate.download.DownLoadApks.IProgress; |
| | | |
| | | public class DownLoadFileService extends Service { |
| | | private NotificationManager manager; |
| | | private Notification notif; |
| | | public static int j = -1; |
| | | private String downloadUrl = "";// apk涓嬭浇璺緞 |
| | | private String apkType; |
| | | |
| | | @Override |
| | | public IBinder onBind(Intent intent) { |
| | | return null; |
| | | } |
| | | |
| | | @SuppressLint("NewApi") |
| | | @Override |
| | | public int onStartCommand(Intent intent, int flags, int startId) { |
| | | Bundle bundle = intent.getExtras(); |
| | | downloadUrl = bundle.getString("downloadurl", ""); |
| | | apkType = ""; |
| | | new DownLoadApks(this, new IProgress() { |
| | | |
| | | @Override |
| | | public void getProgress(int p) { |
| | | // stub |
| | | if (p == 100) { |
| | | handler.sendEmptyMessage(1); |
| | | } else { |
| | | if (manager == null || notif == null) { |
| | | Toast.makeText(DownLoadFileService.this, |
| | | "插件开始下载······", Toast.LENGTH_SHORT).show(); |
| | | manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); |
| | | notif = new Notification(); |
| | | // notif.largeIcon |
| | | // ReadAssetsImage image = new ReadAssetsImage(); |
| | | // notif.largeIcon = image.getImageFromAssetsFile( |
| | | // DownLoadFileService.this, "ic_launcher"); |
| | | notif.tickerText = "正在更新中"; |
| | | notif.icon = R.drawable.ic_launcher; |
| | | // 通知栏显示所用到的布局文件 |
| | | notif.contentView = new RemoteViews(getPackageName(), |
| | | R.layout.notify_item); |
| | | } |
| | | Message msg = handler.obtainMessage(); |
| | | if (j != p) { |
| | | msg.what = 0; |
| | | msg.arg1 = p; |
| | | handler.sendMessage(msg); |
| | | } |
| | | j = p; |
| | | } |
| | | } |
| | | }, apkType).execute(downloadUrl); |
| | | return super.onStartCommand(intent, flags, startId); |
| | | } |
| | | |
| | | @Override |
| | | public void onCreate() { |
| | | super.onCreate(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 下载进度推送 |
| | | */ |
| | | private Handler handler = new Handler() { |
| | | @Override |
| | | public void handleMessage(Message msg) { |
| | | super.handleMessage(msg); |
| | | switch (msg.what) { |
| | | case 0: |
| | | notif.contentView.setTextViewText(R.id.content_view_per, |
| | | msg.arg1 + "%"); |
| | | manager.notify(0, notif); |
| | | break; |
| | | case 1: |
| | | notif.contentView |
| | | .setTextViewText(R.id.content_view_per, "下载完成"); |
| | | manager.notify(0, notif); |
| | | j = 100; |
| | | manager.cancelAll(); |
| | | stopSelf(); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | }; |
| | | |
| | | @Override |
| | | public void onStart(Intent intent, int startId) { |
| | | super.onStart(intent, startId); |
| | | } |
| | | |
| | | @Override |
| | | public void onDestroy() { |
| | | super.onDestroy(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.util; |
| | | |
| | | import java.io.File; |
| | | import java.lang.reflect.Method; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Scanner; |
| | | |
| | | import android.content.Context; |
| | | import android.os.Build; |
| | | import android.os.storage.StorageManager; |
| | | |
| | | /** |
| | | * An {@link android.os.Environment} wrapper that adds |
| | | * support for phones that have multiple external storage directories. |
| | | */ |
| | | public class Environment extends android.os.Environment { |
| | | |
| | | /** |
| | | * SDCard File List |
| | | */ |
| | | private static File[] mStorageList; |
| | | |
| | | |
| | | /** |
| | | * List Of The Potential Volume Daemons |
| | | */ |
| | | private static final File[] mVolumeDaemonList = new File[]{ |
| | | new File(getRootDirectory(), "etc/vold.fstab"), |
| | | new File(getRootDirectory(), "etc/vold.conf") |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * Returns an array of files containing the paths to all of the external |
| | | * storage directories (Emulated/Removable). As a fall back, it reads in the volume daemon file |
| | | * and parses the contents. |
| | | * <p/> |
| | | * <b>Note:</b> This method takes advantage of a hidden method inside {@link StorageManager} which |
| | | * was not introduced until API 14 (ICE_CREAM_SANDWICH/4.0.1). |
| | | * <p/> |
| | | * |
| | | * @param context {@link Context} used to get StorageManager |
| | | */ |
| | | public static File[] getExternalStorageList(Context context) { |
| | | mStorageList = null; |
| | | if (mStorageList == null) { |
| | | try { |
| | | mStorageList = (Build.VERSION.SDK_INT >= 14) |
| | | ? getExternalStorageList((StorageManager) context.getSystemService(Context.STORAGE_SERVICE)) |
| | | : getVolumeDaemonExternalStorageList(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return mStorageList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks to see if more than one external storage directory exists. |
| | | * |
| | | * @param context {@link Context} used to get StorageManager |
| | | */ |
| | | public static boolean doesExtraExternalStorageDirectoryExist(Context context) { |
| | | getExternalStorageList(context); |
| | | return mStorageList != null && mStorageList.length >= 2; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns an array of files containing the paths to all of the external |
| | | * storage directories (Emulated/Removable) provided by the volume daemon |
| | | * config file. |
| | | * |
| | | */ |
| | | public static File[] getVolumeDaemonExternalStorageList() { |
| | | for (File daemon : mVolumeDaemonList) { |
| | | try { |
| | | if (daemon.exists() && daemon.canRead()) { |
| | | final String[] stringArray = readFileIntoStringArray(daemon); |
| | | final List<File> fileList = new ArrayList<File>(); |
| | | if (stringArray != null) { |
| | | for (String str : stringArray) { |
| | | final File f = new File(str.split(" ")[2].split(":")[0]); |
| | | if (!doesFileExistInList(fileList, f)) { |
| | | fileList.add(f); |
| | | } |
| | | } |
| | | } |
| | | return (!fileList.isEmpty() ? fileList.toArray(new File[fileList.size()]) : null); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | private static File[] getExternalStorageList(StorageManager storageManager) throws Exception { |
| | | final Method method = storageManager.getClass().getMethod("getVolumePaths"); |
| | | final String[] strList = (String[]) method.invoke(storageManager); |
| | | final List<File> fileList = new ArrayList<File>(); |
| | | |
| | | for (String path : strList) { |
| | | final File file = new File(path); |
| | | if (!doesFileExistInList(fileList, file)) { |
| | | fileList.add(file); |
| | | } |
| | | } |
| | | |
| | | return (!fileList.isEmpty() ? fileList.toArray(new File[fileList.size()]) : null); |
| | | } |
| | | |
| | | private static boolean doesFileExistInList(List<File> fileList, File newFile) { |
| | | if (newFile == null || fileList == null) { |
| | | // File Is Null Or List Is Null |
| | | return true; |
| | | } |
| | | |
| | | if (!newFile.exists()) { |
| | | // The File Doesn't Exist |
| | | return true; |
| | | } |
| | | |
| | | if (!newFile.isDirectory()) { |
| | | // File Is Not A Directory |
| | | return true; |
| | | } |
| | | |
| | | if (!newFile.canRead()) { |
| | | // Can't Read The File |
| | | return true; |
| | | } |
| | | |
| | | if (newFile.getTotalSpace() <= 0) { |
| | | // File Has No Space |
| | | // Filters Usbdisk Out |
| | | return true; |
| | | } |
| | | |
| | | if (newFile.getName().equalsIgnoreCase("tmp")) { |
| | | // This Folder Showed Up On My Droid X, Filter It Out. |
| | | return true; |
| | | } |
| | | |
| | | if (fileList.contains(newFile)) { |
| | | // File Is In The List |
| | | return true; |
| | | } |
| | | |
| | | // Make Sure The File Isn't In The List As A Link Of Some Sort |
| | | // More Of An In Depth Look |
| | | for (File file : fileList) { |
| | | if (file.getFreeSpace() == newFile.getFreeSpace() && file.getUsableSpace() == newFile.getUsableSpace()) { |
| | | // Same Free/Usable Space |
| | | // Must Be Same Files |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | // File Passed All Of My Tests |
| | | return false; |
| | | } |
| | | |
| | | private static String[] readFileIntoStringArray(File file) { |
| | | Scanner scanner = null; |
| | | try { |
| | | scanner = new Scanner(file); |
| | | final List<String> stringList = new ArrayList<String>(); |
| | | while (scanner.hasNext()) { |
| | | final String line = scanner.nextLine(); |
| | | if (line != null) { |
| | | if (line.length() > 0) { |
| | | if (!line.startsWith("#")) { |
| | | stringList.add(line); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return !stringList.isEmpty() ? stringList.toArray(new String[stringList.size()]) : null; |
| | | } catch (Exception e) { |
| | | return null; |
| | | } finally { |
| | | if (scanner != null) { |
| | | scanner.close(); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.util; |
| | | |
| | | import android.util.Log; |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | |
| | | public class MD5Utils { |
| | | |
| | | private static final String TAG = "MD5Util"; |
| | | |
| | | public static String getMD532(String key) { |
| | | String cacheKey = ""; |
| | | try { |
| | | final MessageDigest mDigest = MessageDigest.getInstance("MD5"); |
| | | mDigest.update(key.getBytes()); |
| | | cacheKey = bytesToHexString(mDigest.digest()); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | Log.e(TAG, e.getMessage()); |
| | | } |
| | | return cacheKey; |
| | | } |
| | | |
| | | private static String bytesToHexString(byte[] bytes) { |
| | | // http://stackoverflow.com/questions/332079 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (int i = 0; i < bytes.length; i++) { |
| | | String hex = Integer.toHexString(0xFF & bytes[i]); |
| | | if (hex.length() == 1) { |
| | | sb.append('0'); |
| | | } |
| | | sb.append(hex); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.util; |
| | | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | import android.content.pm.PackageInfo; |
| | | import android.content.pm.PackageManager.NameNotFoundException; |
| | | import android.preference.PreferenceManager; |
| | | |
| | | public class PackageUtils2 { |
| | | |
| | | public static boolean isFirstStartup(Context context) { |
| | | try { |
| | | PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); |
| | | int currentVersion = info.versionCode; |
| | | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); |
| | | int lastVersion = prefs.getInt("version_code", 0); |
| | | if (currentVersion > lastVersion) { // 濡傛灉褰撳墠鐗堟湰澶т簬涓婃鐗堟湰锛岃鐗堟湰灞炰簬绗竴娆″惎鍔? |
| | | // 灏嗗綋鍓嶇増鏈啓鍏reference涓紝鍒欎笅娆″惎鍔ㄧ殑鏃跺?锛屾嵁姝ゅ垽鏂紝涓嶅啀涓洪娆″惎鍔? |
| | | prefs.edit().putInt("version_code", currentVersion).commit(); |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } catch (NameNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 鑾峰彇versionCode |
| | | * |
| | | * @param context |
| | | * @return 鐗堟湰鍙? |
| | | */ |
| | | public static int getVersionCode(Context context) { |
| | | try { |
| | | PackageInfo pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); |
| | | return pi.versionCode; |
| | | } catch (NameNotFoundException e) { |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.util; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import android.annotation.SuppressLint; |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | import android.os.StatFs; |
| | | import android.util.Log; |
| | | import com.hanju.update.appupdate.entity.SDCardEntity; |
| | | |
| | | public class SDCardUtil { |
| | | |
| | | public static long getAvailableInternalMemorySize() { |
| | | File path = Environment.getDataDirectory(); |
| | | StatFs stat = new StatFs(path.getPath()); |
| | | long blockSize = stat.getBlockSize(); |
| | | long availableBlocks = stat.getAvailableBlocks(); |
| | | return availableBlocks * blockSize; |
| | | } |
| | | |
| | | public static long getTotalInternalMemorySize() { |
| | | File path = Environment.getDataDirectory(); |
| | | StatFs stat = new StatFs(path.getPath()); |
| | | long blockSize = stat.getBlockSize(); |
| | | long totalBlocks = stat.getBlockCount(); |
| | | return totalBlocks * blockSize; |
| | | } |
| | | |
| | | public static boolean externalMemoryAvailable() { |
| | | return Environment.getExternalStorageState().equals( |
| | | Environment.MEDIA_MOUNTED); |
| | | } |
| | | |
| | | public static long getAvailableExternalMemorySize() { |
| | | if (externalMemoryAvailable()) { |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | StatFs stat = new StatFs(path.getPath()); |
| | | long blockSize = stat.getBlockSize(); |
| | | long availableBlocks = stat.getAvailableBlocks(); |
| | | return availableBlocks * blockSize; |
| | | } else { |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | public static long getTotalExternalMemorySize() { |
| | | if (externalMemoryAvailable()) { |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | StatFs stat = new StatFs(path.getPath()); |
| | | long blockSize = stat.getBlockSize(); |
| | | long totalBlocks = stat.getBlockCount(); |
| | | return totalBlocks * blockSize; |
| | | } else { |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | public static List getExtSDCardPath() { |
| | | List lResult = new ArrayList(); |
| | | try { |
| | | Runtime rt = Runtime.getRuntime(); |
| | | Process proc = rt.exec("mount"); |
| | | InputStream is = proc.getInputStream(); |
| | | InputStreamReader isr = new InputStreamReader(is); |
| | | BufferedReader br = new BufferedReader(isr); |
| | | String line; |
| | | while ((line = br.readLine()) != null) { |
| | | if (line.contains("extSdCard")) { |
| | | String[] arr = line.split(" "); |
| | | String path = arr[1]; |
| | | File file = new File(path); |
| | | if (file.isDirectory()) { |
| | | lResult.add(path); |
| | | } |
| | | } |
| | | } |
| | | isr.close(); |
| | | } catch (Exception e) { |
| | | } |
| | | return lResult; |
| | | } |
| | | |
| | | public static String getSotrageSize(long size) { |
| | | |
| | | if (size >= 1024) { |
| | | float s = ((float) size / 1024); |
| | | return (new java.text.DecimalFormat("#.00").format(s)) + "GB"; |
| | | } else { |
| | | return size + "MB"; |
| | | } |
| | | } |
| | | |
| | | @SuppressLint("NewApi") |
| | | @SuppressWarnings("deprecation") |
| | | private static SDCardEntity getSDCardEntity(String path) { |
| | | SDCardEntity se = new SDCardEntity(); |
| | | se.setPath(path); |
| | | try { |
| | | File ff = new File(path); |
| | | if (!ff.exists()) |
| | | ff.mkdirs(); |
| | | StatFs stat = new StatFs(path); |
| | | long blockSize = stat.getBlockSize(); |
| | | long availableBlocks = stat.getAvailableBlocks(); |
| | | long totalBlocks = stat.getBlockCount(); |
| | | se.setAvailableSize(availableBlocks * blockSize); |
| | | se.setTotalSize(totalBlocks * blockSize); |
| | | } catch (Exception e) { |
| | | File f = new File(path); |
| | | if (f.exists()) { |
| | | se.setAvailableSize(f.getFreeSpace()); |
| | | se.setTotalSize(f.getTotalSpace()); |
| | | } |
| | | } |
| | | return se; |
| | | } |
| | | |
| | | /** |
| | | * 鑾峰彇澶栭儴瀛樺偍鍗� |
| | | * |
| | | * @param context |
| | | * @return |
| | | */ |
| | | public static SDCardEntity getSDCardPath(Context context) { |
| | | SDCardEntity entity = new SDCardEntity(); |
| | | // if (PackageUtils2.getAndroidOSVersion() > 9) { |
| | | StorageList list = new StorageList(context); |
| | | String[] sts = list.getVolumePaths(); |
| | | if (sts == null || sts.length == 0) |
| | | return null; |
| | | else { |
| | | if (sts[0].equalsIgnoreCase(Environment.MEDIA_MOUNTED)) { |
| | | entity = getSDCardEntity(sts[0]); |
| | | if (entity.getTotalSize() > 0) |
| | | return entity; |
| | | } else if (sts.length > 1) { |
| | | entity.setPath(sts[1]); |
| | | entity = getSDCardEntity(sts[1]); |
| | | if (entity.getTotalSize() > 0) |
| | | return entity; |
| | | } else |
| | | return null; |
| | | } |
| | | /* |
| | | * } else { if (Environment.getStorageState(Environment.) |
| | | * .equals(Environment.MEDIA_MOUNTED)) { // 涓簍rue鐨勮瘽锛屽缃畇d鍗″瓨鍦�} } |
| | | */ |
| | | |
| | | return null; |
| | | } |
| | | |
| | | public static void setDeaultStorage(Context context, int type) { |
| | | SharedPreferences share = context.getSharedPreferences("storagestate", |
| | | Context.MODE_PRIVATE); |
| | | SharedPreferences.Editor editor = share.edit(); |
| | | editor.putInt("stro", type); |
| | | editor.commit(); |
| | | } |
| | | |
| | | public static void initStorage(Context context) { |
| | | SharedPreferences share = context.getSharedPreferences("storagestate", |
| | | Context.MODE_PRIVATE); |
| | | if (!share.getBoolean("StorageSetting", false)) |
| | | return; |
| | | SDCardEntity entity = getSDCardPath(context); |
| | | if (entity != null) { |
| | | if (entity.getAvailableSize() > getAvailableExternalMemorySize()) { |
| | | setDeaultStorage(context, STORAGE_SDCARD); |
| | | } |
| | | } |
| | | SharedPreferences.Editor editor = share.edit(); |
| | | editor.putBoolean("StorageSetting", true); |
| | | editor.commit(); |
| | | |
| | | } |
| | | |
| | | public static int getDeaultStorage(Context context) { |
| | | SharedPreferences share = context.getSharedPreferences("storagestate", |
| | | Context.MODE_PRIVATE); |
| | | return share.getInt("stro", 0); |
| | | } |
| | | |
| | | public static String getDownLoadPath(Context context) { |
| | | File downloadStorage = getDownloadStorage(context); |
| | | File downloadPath = null; |
| | | // Log.i("help", "鎵嬫満鍐呭瓨"); |
| | | if (downloadStorage.equals(Environment.getDataDirectory())) { |
| | | downloadPath = new File(context.getFilesDir(), "video"); |
| | | } else { |
| | | List<File> downloadPaths = Arrays.asList(Environment |
| | | .getExternalStorageList(context)); |
| | | // File[] downloadPaths = |
| | | // ContextCompat.getExternalFilesDirs(context, "video"); |
| | | for (int i = 0; i < downloadPaths.size(); i++) { |
| | | File item = downloadPaths.get(i); |
| | | // Log.i("help", item.getAbsolutePath()+"88888"); |
| | | if (item.getAbsolutePath().startsWith( |
| | | downloadStorage.getAbsolutePath())) { |
| | | downloadPath = item; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (!downloadPath.exists()) { |
| | | if (downloadPath.mkdirs()) { |
| | | Log.e("SDCardUtil", |
| | | "Unable to create external download directory"); |
| | | } |
| | | } |
| | | return downloadPath.getAbsolutePath(); |
| | | |
| | | } |
| | | |
| | | public static File getDownloadStorage(Context context) { |
| | | SharedPreferences settings = context.getSharedPreferences("settings", |
| | | Context.MODE_PRIVATE); |
| | | String downloadRootPath = settings.getString("download_storage", ""); |
| | | File downloadStorage; |
| | | List<File> externalStorages = Arrays.asList(Environment |
| | | .getExternalStorageList(context)); |
| | | File internalStorage = Environment.getDataDirectory(); |
| | | if (externalStorages.isEmpty()) { |
| | | downloadStorage = internalStorage; |
| | | } else { |
| | | downloadStorage = new File(downloadRootPath); |
| | | if (!downloadStorage.equals(internalStorage)) { |
| | | if (!externalStorages.contains(downloadStorage)) { |
| | | downloadStorage = externalStorages.get(0); |
| | | } |
| | | } |
| | | } |
| | | return downloadStorage; |
| | | } |
| | | |
| | | // public static String getDownLoadPath(Context context) { |
| | | // String name = context.getPackageName(); |
| | | // int type = getDeaultStorage(context); |
| | | // if (type == STORAGE_MOBILE) { |
| | | // // 涓嬭浇鏂囦欢瀛樻斁鍒版牴鐩綍 Download鏂囦欢澶逛笅 |
| | | // // File f = Environment |
| | | // // .getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); |
| | | // |
| | | // // 涓嬭浇鏂囦欢瀛樻斁鍒癮pp瀹夎鐩綍涓� |
| | | // File f = context.getExternalFilesDir("鏈ㄧ摐缂撳瓨鏂囦欢"); |
| | | // // File f = context.getExternalCacheDir(); |
| | | // if (!f.exists()) |
| | | // f.mkdirs(); |
| | | // return f.getPath() + "/"; |
| | | // } else if (type == STORAGE_SDCARD) { |
| | | // SDCardEntity entity = getSDCardPath(context); |
| | | // if (entity == null) { |
| | | // File f = Environment |
| | | // .getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); |
| | | // if (!f.exists()) |
| | | // f.mkdirs(); |
| | | // return f.getPath() + "/"; |
| | | // } |
| | | // String root = entity.getPath(); |
| | | // if (!new File(root + File.separator + name).exists()) |
| | | // new File(root + File.separator + name).mkdirs(); |
| | | // if (!new File(root + File.separator + name + File.separator |
| | | // + "video").exists()) |
| | | // new File(root + File.separator + name + File.separator |
| | | // + "video").mkdirs(); |
| | | // return root + File.separator + name + File.separator + "video"; |
| | | // } |
| | | // return ""; |
| | | // } |
| | | |
| | | public static SDCardEntity getDownLoadEntity(Context context) { |
| | | |
| | | String path = getDownLoadPath(context); |
| | | return getSDCardEntity(path); |
| | | } |
| | | |
| | | public final static int STORAGE_SDCARD = 1; |
| | | public final static int STORAGE_MOBILE = 0; |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.util; |
| | | |
| | | import java.lang.reflect.Method; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.os.storage.StorageManager; |
| | | |
| | | public class StorageList { |
| | | private Context context; |
| | | private StorageManager mStorageManager; |
| | | private Method mMethodGetPaths; |
| | | |
| | | public StorageList(Context context) { |
| | | this.context = context; |
| | | if (context != null) { |
| | | mStorageManager = (StorageManager) context |
| | | .getSystemService(Activity.STORAGE_SERVICE); |
| | | try { |
| | | mMethodGetPaths = mStorageManager.getClass().getMethod( |
| | | "getVolumePaths"); |
| | | } catch (NoSuchMethodException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public String[] getVolumePaths() { |
| | | String[] paths = null; |
| | | try { |
| | | |
| | | paths = (String[]) mMethodGetPaths.invoke(mStorageManager); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // catch (IllegalAccessException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (InvocationTargetException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | return paths; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.util; |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.text.DecimalFormat; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.StringTokenizer; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import android.content.Context; |
| | | import android.content.pm.PackageManager; |
| | | import android.os.Build; |
| | | import androidx.core.content.ContextCompat; |
| | | import android.telephony.TelephonyManager; |
| | | import android.text.Spannable; |
| | | import android.text.SpannableStringBuilder; |
| | | import android.text.style.ForegroundColorSpan; |
| | | import android.text.style.RelativeSizeSpan; |
| | | import android.widget.TextView; |
| | | |
| | | /** |
| | | * 瀛楃蹇嵎鏂瑰紡锛氬垽鏂瓧绗︿覆<涓枃瀛楃銆侀偖绠便?鎵嬫満鍙枫?绌哄瓧绗︺?鏁存暟銆佹诞鐐规暟> |
| | | */ |
| | | public class StringUtils { |
| | | public static final String EMPTY_STRING = ""; // 绌哄瓧绗︿覆 |
| | | |
| | | public static String join(String[] strs) { |
| | | StringBuilder result = new StringBuilder(); |
| | | if (strs != null) { |
| | | for (String str : strs) { |
| | | result.append(str).append(","); |
| | | } |
| | | } |
| | | if (result.length() > 0) { |
| | | return result.substring(0, result.length() - 1); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | // 瑙f瀽鐭俊鎺ㄩ?鍐呭 |
| | | public static Map<String, Object> getParameterMap(String data) { |
| | | Map<String, Object> map = null; |
| | | if (data != null) { |
| | | map = new HashMap<String, Object>(); |
| | | String[] params = data.split("&"); |
| | | for (int i = 0; i < params.length; i++) { |
| | | int idx = params[i].indexOf("="); |
| | | if (idx >= 0) { |
| | | map.put(params[i].substring(0, idx), |
| | | params[i].substring(idx + 1)); |
| | | } |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | // 妫?祴瀛楃涓叉槸鍚︾鍚堢敤鎴峰悕 |
| | | public static boolean checkingMsg(int len) { |
| | | boolean isValid = true; |
| | | isValid = 5 >= len || len >= 21; |
| | | return isValid; |
| | | } |
| | | |
| | | // 妫?祴 |
| | | public static boolean isVaild(int len) { |
| | | boolean isValid = true; |
| | | if (1 < len && len < 17) { |
| | | isValid = false; |
| | | } |
| | | return isValid; |
| | | } |
| | | |
| | | // 鍒ゆ柇瀛楃涓叉槸鍚︽槸鏁存暟 |
| | | public static boolean isInteger(String aString) { |
| | | try { |
| | | Integer.parseInt(aString); |
| | | return true; |
| | | } catch (NumberFormatException e) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | // 鍒ゆ柇瀛楃涓叉槸鍚︽槸娴偣鏁? |
| | | public static boolean isDouble(String value) { |
| | | try { |
| | | Double.parseDouble(value); |
| | | return value.contains("."); |
| | | } catch (NumberFormatException e) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | // 妫?祴瀛楃涓叉槸鍚︿负涓枃瀛楃 |
| | | public static boolean isChinesrChar(String str) { |
| | | return str.length() < str.getBytes().length; |
| | | } |
| | | |
| | | // 鍒ゆ柇瀛楃涓叉槸鍚︿负閭 |
| | | public static boolean isEmailVaild(String aEmail) { |
| | | boolean isValid = true; |
| | | Pattern pattern = Pattern |
| | | .compile( |
| | | "^([a-zA-Z0-9]+[_|-|.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|-|.]?)*[a-zA-Z0-9]+\\.[a-zA-Z]{2,3}$", |
| | | Pattern.CASE_INSENSITIVE); |
| | | Matcher matcher = pattern.matcher(aEmail); |
| | | if (matcher.matches()) { |
| | | isValid = false; |
| | | } |
| | | return isValid; |
| | | } |
| | | |
| | | // 鍒ゆ柇瀛楃涓叉槸鍚︿负鎵嬫満鍙风爜 |
| | | public static boolean isMobileNumber(String aTelNumber) { |
| | | Pattern p = Pattern |
| | | .compile("(^1((((3[5-9])|(47)|(5[0-2])|(5[7-9])|(82)|(8[7-8]))\\d{8})|((34[0-8])\\d{7}))$)|(^1((3[0-2])|(5[5-6])|(8[0-6]))\\d{8}$)|(^1((33[0-9])|(349)|(53[0-9])|(80[0-9])|(89[0-9]))\\d{7}$)"); |
| | | Matcher m = p.matcher(aTelNumber); |
| | | return m.matches(); |
| | | } |
| | | |
| | | // 鏍煎紡鍖栨墜鏈哄彿鐮? |
| | | public static String formatPhoneNum(String aPhoneNum) { |
| | | String first = aPhoneNum.substring(0, 3); |
| | | String end = aPhoneNum.substring(7, 11); |
| | | String phoneNumber = first + "****" + end; |
| | | return phoneNumber; |
| | | } |
| | | |
| | | // 妫?煡瀛楃涓叉槸鍚︿负绾暟瀛? |
| | | public static boolean isNumeric(String str) { |
| | | for (int i = str.length(); --i >= 0;) { |
| | | if (!Character.isDigit(str.charAt(i))) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | public static boolean isLetter(String s) { |
| | | for (int i = 0; i < s.length(); i++) { |
| | | if (!(s.charAt(i) >= 'A' && s.charAt(i) <= 'Z') |
| | | && !(s.charAt(i) >= 'a' && s.charAt(i) <= 'z')) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // 鍘婚櫎瀛楃涓蹭腑绌烘牸 |
| | | public static String clearSpaces(String aString) { |
| | | StringTokenizer aStringTok = new StringTokenizer(aString, " ", false); |
| | | String aResult = ""; |
| | | while (aStringTok.hasMoreElements()) { |
| | | aResult += aStringTok.nextElement(); |
| | | } |
| | | return aResult; |
| | | } |
| | | |
| | | /** |
| | | * is null or its length is 0 or it is made by space |
| | | * |
| | | * @param str |
| | | * @return if string is null or its size is 0 or it is made by space, return |
| | | * true, else return false. |
| | | */ |
| | | public static boolean isBlank(String str) { |
| | | return (str == null || str.trim().length() == 0); |
| | | } |
| | | |
| | | /** |
| | | * is null or its length is 0 |
| | | * |
| | | * @param str |
| | | * @return if string is null or its size is 0, return true, else return |
| | | * false. |
| | | */ |
| | | public static boolean isEmpty(String str) { |
| | | return (str == null || str.length() == 0); |
| | | } |
| | | |
| | | /** |
| | | * compare two string |
| | | * |
| | | * @param actual |
| | | * @param expected |
| | | * @return |
| | | * @see ObjectUtils#isEquals(Object, Object) |
| | | */ |
| | | // public static boolean isEquals(String actual, String expected) { |
| | | // return ObjectUtils.isEquals(actual, expected); |
| | | // } |
| | | |
| | | /** |
| | | * capitalize first letter |
| | | * |
| | | * <pre> |
| | | * capitalizeFirstLetter(null) = null; |
| | | * capitalizeFirstLetter("") = ""; |
| | | * capitalizeFirstLetter("2ab") = "2ab" |
| | | * capitalizeFirstLetter("a") = "A" |
| | | * capitalizeFirstLetter("ab") = "Ab" |
| | | * capitalizeFirstLetter("Abc") = "Abc" |
| | | * </pre> |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String capitalizeFirstLetter(String str) { |
| | | if (isEmpty(str)) { |
| | | return str; |
| | | } |
| | | char c = str.charAt(0); |
| | | return (!Character.isLetter(c) || Character.isUpperCase(c)) ? str |
| | | : new StringBuilder(str.length()) |
| | | .append(Character.toUpperCase(c)) |
| | | .append(str.substring(1)).toString(); |
| | | } |
| | | |
| | | |
| | | public static boolean isInt(String text) { |
| | | if (text == null || text.length() == 0) { |
| | | return false; |
| | | } |
| | | try { |
| | | Integer.parseInt(text); |
| | | return true; |
| | | } catch (Exception e) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public static final String[] imageEndWiths = new String[] { ".jpg", ".gif", |
| | | ".png", ".bmp" }; |
| | | |
| | | public static boolean isEmail(String email) { |
| | | String regex = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"; |
| | | Pattern p = Pattern.compile(regex); |
| | | Matcher m = p.matcher(email); |
| | | return m.find(); |
| | | } |
| | | |
| | | /** |
| | | * 是否是正确的电话号码 |
| | | * |
| | | * @param mobile |
| | | * @return |
| | | */ |
| | | public static boolean isMobile(String mobile) { |
| | | |
| | | String regex = "^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$"; |
| | | Pattern p = Pattern.compile(regex); |
| | | Matcher m = p.matcher(mobile); |
| | | |
| | | if (mobile == null || mobile.equals("") || mobile.length() != 11) { |
| | | |
| | | return false; |
| | | |
| | | } else { |
| | | return m.find(); |
| | | } |
| | | } |
| | | |
| | | public static boolean isVoice(String text) { |
| | | |
| | | return text.toLowerCase().endsWith(".amr"); |
| | | |
| | | } |
| | | |
| | | public static boolean isImage(String text) { |
| | | text = text.toLowerCase(); |
| | | for (int i = 0; i < imageEndWiths.length; i++) { |
| | | String endWidth = imageEndWiths[i]; |
| | | if (text.endsWith(endWidth)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public static String createNewFileName(String fileName) { |
| | | |
| | | int i = fileName.lastIndexOf("."); |
| | | |
| | | String end = fileName.substring(i); |
| | | |
| | | return System.currentTimeMillis() + end; |
| | | |
| | | } |
| | | |
| | | public static boolean isTrimEmpty(String text) { |
| | | return text == null || text.trim().length() == 0; |
| | | } |
| | | |
| | | public static boolean isNullOrEmpty(String text) { |
| | | return text == null || text.length() == 0 || text.equals("null"); |
| | | } |
| | | |
| | | public static String itrim(String beginTimeDis) { |
| | | if (beginTimeDis != null) { |
| | | int length = beginTimeDis.length(); |
| | | StringBuffer buffer = new StringBuffer(); |
| | | for (int i = 0; i < length; i++) { |
| | | char c = beginTimeDis.charAt(i); |
| | | if (c != ':') { |
| | | buffer.append(c); |
| | | } else { |
| | | buffer.append(":"); |
| | | } |
| | | } |
| | | return buffer.toString(); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | public static String getLocationDis(double distance) { |
| | | if (distance < 0) { |
| | | return "0m"; |
| | | } else if (distance < 100) { |
| | | int d = (int) distance; |
| | | return d + "m"; |
| | | } else { |
| | | String desc = ""; |
| | | |
| | | double f = distance / 1000d; |
| | | |
| | | DecimalFormat df = new DecimalFormat("#.###"); |
| | | |
| | | desc = df.format(f); |
| | | |
| | | return desc + "km"; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | public static int toInt(String nextText, int i) { |
| | | try { |
| | | int value = Integer.parseInt(nextText); |
| | | return value; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | | * 身份证验�? |
| | | * |
| | | * @param card |
| | | * @return |
| | | */ |
| | | public static boolean isIdCard(String card) { |
| | | Pattern p = Pattern.compile("^(\\d{14}|\\d{17})(\\d|[xX])$"); |
| | | Matcher matcher = p.matcher(card); |
| | | return matcher.matches(); |
| | | } |
| | | |
| | | public static boolean isCharecter(String str) { |
| | | String regEx = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#�?…�?&*()—�?+|{}【�?‘;:�?“�?。,、?]"; |
| | | Pattern p = Pattern.compile(regEx); |
| | | Matcher m = p.matcher(str); |
| | | return m.find(); |
| | | } |
| | | |
| | | private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', |
| | | '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; |
| | | |
| | | private static String toHexString(byte[] b) { |
| | | // String to byte |
| | | StringBuilder sb = new StringBuilder(b.length * 2); |
| | | for (int i = 0; i < b.length; i++) { |
| | | sb.append(HEX_DIGITS[(b[i] & 0xf0) >>> 4]); |
| | | sb.append(HEX_DIGITS[b[i] & 0x0f]); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /* |
| | | * MD5加密 |
| | | */ |
| | | public static String MD5(String s) { |
| | | try { |
| | | // Create MD5 Hash |
| | | MessageDigest digest = java.security.MessageDigest |
| | | .getInstance("MD5"); |
| | | digest.update(s.getBytes()); |
| | | byte[] messageDigest = digest.digest(); |
| | | |
| | | return toHexString(messageDigest); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return ""; |
| | | } |
| | | |
| | | public static String getSimpleString(String st) { |
| | | if (isNullOrEmpty(st)) { |
| | | return "暂无"; |
| | | } |
| | | return st; |
| | | } |
| | | |
| | | // 判断List是否为空 |
| | | |
| | | public static boolean listIsNullOrEmpty(List<String> list) { |
| | | return list == null || list.size() == 0; |
| | | } |
| | | |
| | | // 获取手机型号 |
| | | public static String PeopleModel() { |
| | | Build bd = new Build(); |
| | | String model = Build.MODEL; |
| | | return model; |
| | | } |
| | | |
| | | public static String PeopleDeviceId(Context context) { |
| | | TelephonyManager tm = (TelephonyManager) context |
| | | .getSystemService(Context.TELEPHONY_SERVICE); |
| | | String deviceid =""; |
| | | if (ContextCompat.checkSelfPermission(context, android.Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED |
| | | || ContextCompat.checkSelfPermission(context, android.Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) { |
| | | deviceid = tm.getDeviceId();// 获取deviceId |
| | | } |
| | | |
| | | return deviceid; |
| | | } |
| | | |
| | | public static void getdiffrentColor(TextView tv, int color, int start, |
| | | int end) { |
| | | SpannableStringBuilder style = new SpannableStringBuilder(tv.getText()); |
| | | ForegroundColorSpan redSpan = new ForegroundColorSpan(color); |
| | | style.setSpan(redSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | tv.setText(style); |
| | | } |
| | | |
| | | public static void getdiffrentColor(TextView tv, int color, int size, |
| | | int start, int end) { |
| | | SpannableStringBuilder style = new SpannableStringBuilder(tv.getText()); |
| | | ForegroundColorSpan redSpan = new ForegroundColorSpan(color); |
| | | style.setSpan(redSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | RelativeSizeSpan sizeSpan = new RelativeSizeSpan(size); |
| | | style.setSpan(sizeSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | tv.setText(style); |
| | | } |
| | | |
| | | public static String get2Number(int number) { |
| | | if (number >= 0 && number < 10) |
| | | return "0" + number; |
| | | else |
| | | return number + ""; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.update.appupdate.view; |
| | | |
| | | import android.app.Dialog; |
| | | import android.content.Context; |
| | | import android.content.DialogInterface; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup.LayoutParams; |
| | | import android.view.WindowManager; |
| | | import android.widget.TextView; |
| | | |
| | | import com.hanju.update.appupdate.R; |
| | | |
| | | public class CustomDialog extends Dialog { |
| | | |
| | | public CustomDialog(Context context) { |
| | | super(context); |
| | | } |
| | | |
| | | public CustomDialog(Context context, int theme) { |
| | | super(context, theme); |
| | | } |
| | | |
| | | public static class Builder { |
| | | private Context context; |
| | | private String title; |
| | | private String message; |
| | | private String version; |
| | | private String size; |
| | | private boolean no_wifi; |
| | | private String positiveButtonText; |
| | | private String negativeButtonText; |
| | | private View contentView; |
| | | private DialogInterface.OnClickListener positiveButtonClickListener; |
| | | private DialogInterface.OnClickListener negativeButtonClickListener; |
| | | |
| | | public Builder(Context context) { |
| | | this.context = context; |
| | | } |
| | | |
| | | public Builder setMessage(String message) { |
| | | this.message = message; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setVersion(String version) { |
| | | this.version = version; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setSize(String size) { |
| | | this.size = size; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setNoti_WIFI(boolean no_wifi) { |
| | | this.no_wifi = no_wifi; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * Set the Dialog message from resource |
| | | * |
| | | * @return |
| | | */ |
| | | public Builder setMessage(int message) { |
| | | this.message = (String) context.getText(message); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * Set the Dialog title from resource |
| | | * |
| | | * @param title |
| | | * @return |
| | | */ |
| | | public Builder setTitle(int title) { |
| | | this.title = (String) context.getText(title); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * Set the Dialog title from String |
| | | * |
| | | * @param title |
| | | * @return |
| | | */ |
| | | |
| | | public Builder setTitle(String title) { |
| | | this.title = title; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setContentView(View v) { |
| | | this.contentView = v; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * Set the positive button resource and it's listener |
| | | * |
| | | * @param positiveButtonText |
| | | * @return |
| | | */ |
| | | public Builder setPositiveButton(int positiveButtonText, |
| | | DialogInterface.OnClickListener listener) { |
| | | this.positiveButtonText = (String) context |
| | | .getText(positiveButtonText); |
| | | this.positiveButtonClickListener = listener; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setPositiveButton(String positiveButtonText, |
| | | DialogInterface.OnClickListener listener) { |
| | | this.positiveButtonText = positiveButtonText; |
| | | this.positiveButtonClickListener = listener; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setNegativeButton(int negativeButtonText, |
| | | DialogInterface.OnClickListener listener) { |
| | | this.negativeButtonText = (String) context |
| | | .getText(negativeButtonText); |
| | | this.negativeButtonClickListener = listener; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setNegativeButton(String negativeButtonText, |
| | | DialogInterface.OnClickListener listener) { |
| | | this.negativeButtonText = negativeButtonText; |
| | | this.negativeButtonClickListener = listener; |
| | | return this; |
| | | } |
| | | |
| | | public CustomDialog create() { |
| | | LayoutInflater inflater = (LayoutInflater) context |
| | | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
| | | // instantiate the dialog with the custom Theme |
| | | WindowManager wm = (WindowManager) context |
| | | .getSystemService(Context.WINDOW_SERVICE); |
| | | |
| | | int width = wm.getDefaultDisplay().getWidth(); |
| | | int height = wm.getDefaultDisplay().getHeight(); |
| | | |
| | | final CustomDialog dialog = new CustomDialog(context, |
| | | R.style.Dialog); |
| | | |
| | | View layout = inflater.inflate(R.layout.custom_dialog, null); |
| | | dialog.addContentView(layout, new LayoutParams( |
| | | LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); |
| | | // set the dialog title |
| | | ((TextView) layout.findViewById(R.id.tv_dialog_title)) |
| | | .setText(title); |
| | | // set the confirm button |
| | | if (positiveButtonText != null) { |
| | | ((TextView) layout.findViewById(R.id.tv_atonce_update)) |
| | | .setText(positiveButtonText); |
| | | if (positiveButtonClickListener != null) { |
| | | layout.findViewById(R.id.tv_atonce_update) |
| | | .setOnClickListener(new View.OnClickListener() { |
| | | public void onClick(View v) { |
| | | positiveButtonClickListener.onClick(dialog, |
| | | DialogInterface.BUTTON_POSITIVE); |
| | | } |
| | | }); |
| | | } |
| | | } else { |
| | | // if no confirm button just set the visibility to GONE |
| | | layout.findViewById(R.id.tv_atonce_update).setVisibility( |
| | | View.GONE); |
| | | } |
| | | // set the cancel button |
| | | if (negativeButtonText != null) { |
| | | ((TextView) layout.findViewById(R.id.tv_no_update)) |
| | | .setText(negativeButtonText); |
| | | if (negativeButtonClickListener != null) { |
| | | layout.findViewById(R.id.tv_no_update) |
| | | .setOnClickListener(new View.OnClickListener() { |
| | | public void onClick(View v) { |
| | | negativeButtonClickListener.onClick(dialog, |
| | | DialogInterface.BUTTON_NEGATIVE); |
| | | } |
| | | }); |
| | | } |
| | | } else { |
| | | // if no confirm button just set the visibility to GONE |
| | | layout.findViewById(R.id.tv_no_update).setVisibility(View.GONE); |
| | | } |
| | | // set the content message |
| | | if (message != null) { |
| | | ((TextView) layout.findViewById(R.id.tv_dialog_content)) |
| | | .setText(message); |
| | | } |
| | | if (version != null) { |
| | | ((TextView) layout.findViewById(R.id.tv_version)) |
| | | .setText("版本:" + version); |
| | | } |
| | | if (size != null) { |
| | | ((TextView) layout.findViewById(R.id.tv_size)) |
| | | .setText("大小:" + size); |
| | | } |
| | | if (!no_wifi) { |
| | | layout.findViewById(R.id.tv_dialog_noti_wifi) |
| | | .setVisibility(View.VISIBLE); |
| | | } else { |
| | | layout.findViewById(R.id.tv_dialog_noti_wifi) |
| | | .setVisibility(View.GONE); |
| | | } |
| | | dialog.setContentView(layout); |
| | | |
| | | android.view.WindowManager.LayoutParams params = dialog.getWindow() |
| | | .getAttributes(); |
| | | params.width = (width * 3) / 4; |
| | | params.height = android.view.WindowManager.LayoutParams.WRAP_CONTENT; |
| | | dialog.getWindow().setAttributes(params); |
| | | dialog.setCanceledOnTouchOutside(false); |
| | | return dialog; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | <application |
| | | android:allowBackup="true" |
| | | android:icon="@drawable/ic_launcher" |
| | | android:label="@string/app_name" |
| | | android:theme="@style/AppTheme" > |
| | | </application> |
| | |
| | | |
| | | /** |
| | | * Tools for managing files. Not for public consumption. |
| | | * |
| | | * @hide |
| | | */ |
| | | public class FileUtils |
| | | { |
| | | public class FileUtils { |
| | | public static final int S_IRWXU = 00700; |
| | | public static final int S_IRUSR = 00400; |
| | | public static final int S_IWUSR = 00200; |
| | |
| | | public static final int S_IROTH = 00004; |
| | | public static final int S_IWOTH = 00002; |
| | | public static final int S_IXOTH = 00001; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * File status information. This class maps directly to the POSIX stat structure. |
| | | * |
| | | * @hide |
| | | */ |
| | | public static final class FileStatus { |
| | |
| | | public long mtime; |
| | | public long ctime; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get the status for the given path. This is equivalent to the POSIX stat(2) system call. |
| | | * @param path The path of the file to be stat'd. |
| | | * Get the status for the given path. This is equivalent to the POSIX stat(2) system call. |
| | | * |
| | | * @param path The path of the file to be stat'd. |
| | | * @param status Optional argument to fill in. It will only fill in the status if the file |
| | | * exists. |
| | | * @return true if the file exists and false if it does not exist. If you do not have |
| | | * exists. |
| | | * @return true if the file exists and false if it does not exist. If you do not have |
| | | * permission to stat the file, then this method will return false. |
| | | */ |
| | | public static native boolean getFileStatus(String path, FileStatus status); |
| | | |
| | | /** Regular expression for safe filenames: no spaces or metacharacters */ |
| | | /** |
| | | * Regular expression for safe filenames: no spaces or metacharacters |
| | | */ |
| | | private static final Pattern SAFE_FILENAME_PATTERN = Pattern.compile("[\\w%+,./=_-]+"); |
| | | |
| | | public static native int setPermissions(String file, int mode, int uid, int gid); |
| | | |
| | | public static native int getPermissions(String file, int[] outPermissions); |
| | | |
| | | /** returns the FAT file system volume ID for the volume mounted |
| | | /** |
| | | * returns the FAT file system volume ID for the volume mounted |
| | | * at the given mount point, or -1 for failure |
| | | * |
| | | * @param mount point for FAT volume |
| | | * @return volume ID or -1 |
| | | */ |
| | |
| | | InputStream in = new FileInputStream(srcFile); |
| | | try { |
| | | result = copyToFile(in, destFile); |
| | | } finally { |
| | | } finally { |
| | | in.close(); |
| | | } |
| | | } catch (IOException e) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Copy data from a source stream to destFile. |
| | | * Return true if succeed, return false if failed. |
| | |
| | | |
| | | /** |
| | | * Check if a filename is "safe" (no metacharacters or spaces). |
| | | * @param file The file to check |
| | | * |
| | | * @param file The file to check |
| | | */ |
| | | public static boolean isFilenameSafe(File file) { |
| | | // Note, we check whether it matches what's known to be safe, |
| | |
| | | |
| | | /** |
| | | * Read a text file into a String, optionally limiting the length. |
| | | * @param file to read (will not seek, so things like /proc files are OK) |
| | | * @param max length (positive for head, negative of tail, 0 for no limit) |
| | | * |
| | | * @param file to read (will not seek, so things like /proc files are OK) |
| | | * @param max length (positive for head, negative of tail, 0 for no limit) |
| | | * @param ellipsis to add of the file was truncated (can be null) |
| | | * @return the contents of the file, possibly truncated |
| | | * @throws IOException if something goes wrong reading the file |
| | |
| | | byte[] last = null, data = null; |
| | | do { |
| | | if (last != null) rolled = true; |
| | | byte[] tmp = last; last = data; data = tmp; |
| | | byte[] tmp = last; |
| | | last = data; |
| | | data = tmp; |
| | | if (data == null) data = new byte[-max]; |
| | | len = input.read(data); |
| | | } while (len == data.length); |
| | |
| | | <application |
| | | android:name="com.hanju.video.app.HanJuApplication" |
| | | android:allowBackup="true" |
| | | android:icon="@drawable/ic_launcher" |
| | | android:icon="${app_icon}" |
| | | android:label="@string/app_name" |
| | | android:largeHeap="true" |
| | | android:theme="@style/AppTheme" |
| | | tools:replace="android:allowBackup"> |
| | | tools:replace="android:allowBackup,android:icon"> |
| | | |
| | | <activity |
| | | android:name="com.hanju.video.app.ui.SplashActivity" |
| | |
| | | android:label="@string/app_name" |
| | | android:windowSoftInputMode="adjustResize" /> |
| | | |
| | | <service android:name="com.ysh.wpc.appupdate.service.DownLoadFileService"></service> |
| | | <service android:name="com.hanju.video.app.service.DownLoadFileService" /> |
| | | |
| | | |
| | | <service |
| | | android:name="com.sohuvideo.player.statistic.LogService" |
| | | android:exported="false" |
| | | android:label="CoreService"></service> |
| | | <service android:name="com.hanju.update.appupdate.service.DownLoadFileService"></service> |
| | | <service android:name="com.hanju.video.app.services.DownLoadFileService" /> |
| | | |
| | | <meta-data |
| | | android:name="android.max_aspect" |
| | |
| | | |
| | | |
| | | <provider |
| | | android:name="com.hanju.video.app.db.WatchHistoryProvider" |
| | | android:name="com.hanju.video.app.database.WatchHistoryProvider" |
| | | android:authorities="com.hanju.video.provider.watchhistory" |
| | | android:exported="false" /> |
| | | <provider |
| | | android:name="com.hanju.video.app.db.DownloadProvider" |
| | | android:name="com.hanju.video.app.database.DownloadProvider" |
| | | android:authorities="com.hanju.video.provider.download" |
| | | android:exported="false" /> |
| | | <provider |
| | | android:name="com.hanju.video.app.db.MessageProvider" |
| | | android:name="com.hanju.video.app.database.MessageProvider" |
| | | android:authorities="com.hanju.video.provider.message" |
| | | android:exported="false" /> |
| | | <provider |
| | |
| | | </intent-filter> |
| | | </receiver> |
| | | |
| | | <!-- 【必须】 信鸽receiver广播接收 --> |
| | | <receiver |
| | | android:name="com.tencent.android.tpush.XGPushReceiver" |
| | | android:process=":xg_service_v2"> |
| | | <intent-filter android:priority="0x7fffffff"> |
| | | <!-- 【必须】 信鸽SDK的内部广播 --> |
| | | <action android:name="com.tencent.android.tpush.action.SDK" /> |
| | | <action android:name="com.tencent.android.tpush.action.INTERNAL_PUSH_MESSAGE" /> |
| | | <!-- 【必须】 系统广播:开屏和网络切换 --> |
| | | <action android:name="android.intent.action.USER_PRESENT" /> |
| | | <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> |
| | | |
| | | <!-- 【可选】 一些常用的系统广播,增强信鸽service的复活机会,请根据需要选择。当然,你也可以添加APP自定义的一些广播让启动service --> |
| | | <action android:name="android.bluetooth.adapter.action.STATE_CHANGED" /> |
| | | <action android:name="android.intent.action.ACTION_POWER_CONNECTED" /> |
| | | <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" /> |
| | | </intent-filter> |
| | | </receiver> |
| | | <receiver |
| | | android:name="com.hanju.video.app.HanJuMessageHandler" |
| | | android:exported="true"> |
| | | <intent-filter> |
| | | |
| | | <!-- 接收消息透传 --> |
| | | <action android:name="com.tencent.android.tpush.action.PUSH_MESSAGE" /> |
| | | <!-- 监听注册、反注册、设置/删除标签、通知被点击等处理结果 --> |
| | | <action android:name="com.tencent.android.tpush.action.FEEDBACK" /> |
| | | </intent-filter> |
| | | </receiver> |
| | | <!-- 【必须】 (2.30及以上版新增)展示通知的activity --> |
| | | <!-- 【注意】 如果被打开的activity是启动模式为SingleTop,SingleTask或SingleInstance,请根据通知的异常自查列表第8点处理--> |
| | | <activity |
| | | android:name="com.tencent.android.tpush.XGPushActivity" |
| | | android:exported="false"> |
| | | <intent-filter> |
| | | <!-- 若使用AndroidStudio,请设置android:name="android.intent.action"--> |
| | | <action android:name="android.intent.action" /> |
| | | </intent-filter> |
| | | </activity> |
| | | |
| | | <!-- 【必须】 信鸽service --> |
| | | <service |
| | | android:name="com.tencent.android.tpush.service.XGPushService" |
| | | android:exported="true" |
| | | android:persistent="true" |
| | | android:process=":xg_service_v2" /> |
| | | |
| | | <!-- 【必须】 通知service,此选项有助于提高抵达率 --> |
| | | <service |
| | | android:name="com.tencent.android.tpush.rpc.XGRemoteService" |
| | | android:exported="true"> |
| | | <intent-filter> |
| | | <action android:name="com.hanju.video.PUSH_ACTION" /> |
| | | </intent-filter> |
| | | </service> |
| | | |
| | | <!-- 【必须】 请将YOUR_ACCESS_ID修改为APP的AccessId,“21”开头的10位数字,中间没空格 --> |
| | | <meta-data |
New file |
| | |
| | | <script language="javascript"> |
| | | |
| | | function generateRandom() { |
| | | return Math.floor((1 + Math.random()) * 0x10000) |
| | | .toString(16) |
| | | .substring(1); |
| | | } |
| | | |
| | | |
| | | // This only works if `open` and `send` are called in a synchronous way |
| | | // That is, after calling `open`, there must be no other call to `open` or |
| | | // `send` from another place of the code until the matching `send` is called. |
| | | requestID = null; |
| | | XMLHttpRequest.prototype.reallyOpen = XMLHttpRequest.prototype.open; |
| | | XMLHttpRequest.prototype.open = function(method, url, async, user, password) { |
| | | requestID = generateRandom() |
| | | var signed_url = url + "AJAXINTERCEPT" + requestID; |
| | | this.reallyOpen(method, signed_url , async, user, password); |
| | | }; |
| | | XMLHttpRequest.prototype.reallySend = XMLHttpRequest.prototype.send; |
| | | XMLHttpRequest.prototype.send = function(body) { |
| | | interception.customAjax(requestID, body); |
| | | this.reallySend(body); |
| | | }; |
| | | </script> |
| | |
| | | |
| | | dependencies { |
| | | api project(':library-ViewPagerIndicator') |
| | | api files('libs/SohuPlayerExtend_4.1.0_0_201606121225_open_release.jar') |
| | | api 'androidx.appcompat:appcompat:1.0.0' |
| | | api files('libs/jg_filter_sdk_1.1.jar') |
| | | api files('libs/wup-1.0.0.E-SNAPSHOT.jar') |
| | | api files('libs/Xg_sdk_v2.46_20160602_1638.jar') |
| | | api files('libs/FunshionPlaySDK1.5.1.aar') |
| | | api project(':social_sdk_library_project') |
| | | api project(':GuangDianTongSDK') |
| | |
| | | implementation 'androidx.recyclerview:recyclerview:1.0.0' |
| | | implementation project(path: ':gallery') |
| | | //穿山甲广告 |
| | | compile(name: 'open_ad_sdk', ext: 'aar') |
| | | implementation(name: 'open_ad_sdk_3.9.0.2', ext: 'aar') |
| | | |
| | | implementation "org.jsoup:jsoup:1.11.2" |
| | | |
| | | //----------阿里百川开始------------ |
| | | implementation files('libs/avmpaar3-5.4.36.aar') |
| | |
| | | // implementation files('libs/permissions4m-2.1.2-processor.jar') |
| | | //微信SDK |
| | | api 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+' |
| | | //视频播放器 |
| | | //完整版引入 |
| | | implementation 'com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer:v8.1.5-jitpack' |
| | | } |
| | | android { |
| | | signingConfigs { |
| | |
| | | } |
| | | defaultConfig { |
| | | applicationId "com.hanju.video" |
| | | versionCode 95 |
| | | versionName "3.7.7" |
| | | versionCode 96 |
| | | versionName "2.0.2" |
| | | multiDexEnabled = true |
| | | minSdkVersion 19 |
| | | targetSdkVersion 27 |
| | | ndk { |
| | | abiFilters "armeabi-v7a", "x86", "armeabi" |
| | | } |
| | | //爱韩剧 |
| | | resValue "string", "app_name", "韩剧播放器" |
| | | manifestPlaceholders = [app_icon: "@drawable/ic_launcher"] |
| | | } |
| | | dexOptions { |
| | | javaMaxHeapSize = "4g" |
| | |
| | | |
| | | // buildTypes { |
| | | // release { |
| | | // //true -打开混淆 |
| | | // minifyEnabled true |
| | | // //true 打开资源压缩 |
| | | // shrinkResources false |
| | | // proguardFiles getDefaultProguardFile('proguard-android.txt') |
| | | // } |
| | | // debug { |
| | | // //true -打开混淆 |
| | | // minifyEnabled true |
| | | // //true 打开资源压缩 |
| | | // shrinkResources true |
| | | // proguardFiles getDefaultProguardFile('proguard-android.txt') |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | project.afterEvaluate { |
| | | project.android.applicationVariants.all { variant -> |
| | | variant.outputs.each { output -> |
| | | output.processResources.doFirst { pm -> |
| | | String manifestPath = output.processResources.manifestFile; |
| | | def manifestContent = file(manifestPath).getText() |
| | | //删除注释,防止注释里面的中文乱码导致更改后的内容系统无法正常解析 |
| | | manifestContent = manifestContent.replaceAll("<!--[\\s\\S]*?-->", "") |
| | | manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.CAMERA" />', '') |
| | | manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.BLUETOOTH" />', '') |
| | | |
| | | println "AndroidManifest-Content:" |
| | | println manifestContent |
| | | file(manifestPath).write(manifestContent) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | repositories { |
| | | flatDir { |
| | | dirs 'libs' |
New file |
| | |
| | | # To enable ProGuard in your project, edit project.properties |
| | | # to define the proguard.config property as described in that file. |
| | | # |
| | | # Add project specific ProGuard rules here. |
| | | # By default, the flags in this file are appended to flags specified |
| | | # in ${sdk.dir}/tools/proguard/proguard-android.txt |
| | | # You can edit the include path and order by changing the ProGuard |
| | | # include property in project.properties. |
| | | # |
| | | # For more details, see |
| | | # http://developer.android.com/guide/developing/tools/proguard.html |
| | | |
| | | # Add any project specific keep options here: |
| | | |
| | | # If your project uses WebView with JS, uncomment the following |
| | | # and specify the fully qualified class name to the JavaScript interface |
| | | # class: |
| | | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { |
| | | # public *; |
| | | #} |
| | | |
| | | |
| | | ############################################# |
| | | # |
| | | # 对于一些基本指令的添加 |
| | | # |
| | | ############################################# |
| | | # 代码混淆压缩比,在0~7之间,默认为5,一般不做修改 |
| | | -optimizationpasses 5 |
| | | |
| | | # 混合时不使用大小写混合,混合后的类名为小写 |
| | | -dontusemixedcaseclassnames |
| | | |
| | | # 指定不去忽略非公共库的类 |
| | | -dontskipnonpubliclibraryclasses |
| | | |
| | | # 这句话能够使我们的项目混淆后产生映射文件 |
| | | # 包含有类名->混淆后类名的映射关系 |
| | | -verbose |
| | | |
| | | # 指定不去忽略非公共库的类成员 |
| | | -dontskipnonpubliclibraryclassmembers |
| | | |
| | | # 不做预校验,preverify是proguard的四个步骤之一,Android不需要preverify,去掉这一步能够加快混淆速度。 |
| | | -dontpreverify |
| | | |
| | | # 保留Annotation不混淆 |
| | | -keepattributes *Annotation*,InnerClasses |
| | | |
| | | # 避免混淆泛型 |
| | | -keepattributes Signature |
| | | |
| | | # 抛出异常时保留代码行号 |
| | | -keepattributes SourceFile,LineNumberTable |
| | | |
| | | # 指定混淆是采用的算法,后面的参数是一个过滤器 |
| | | # 这个过滤器是谷歌推荐的算法,一般不做更改 |
| | | -optimizations !code/simplification/cast,!field/*,!class/merging/* |
| | | |
| | | |
| | | ############################################# |
| | | # |
| | | # Android开发中一些需要保留的公共部分 |
| | | # |
| | | ############################################# |
| | | |
| | | # 保留我们使用的四大组件,自定义的Application等等这些类不被混淆 |
| | | # 因为这些子类都有可能被外部调用 |
| | | -keep public class * extends android.app.Activity |
| | | -keep public class * extends com.hanju.video.app.ui.MyRetainViewFragment |
| | | -keep public class * extends com.hanju.lib.library.RetainViewFragment |
| | | -keep public class * extends androidx.fragment.app.Fragment |
| | | |
| | | -keep class com.hanju.video.app.ui.main.CategoryFragment |
| | | |
| | | -keep public class * extends android.app.Application |
| | | -keep public class * extends android.app.Service |
| | | -keep public class * extends android.content.BroadcastReceiver |
| | | -keep public class * extends android.content.ContentProvider |
| | | -keep public class * extends android.app.backup.BackupAgentHelper |
| | | -keep public class * extends android.preference.Preference |
| | | -keep public class * extends android.view.View |
| | | |
| | | # 保留support下的所有类及其内部类 |
| | | -keep class androidx.*.** |
| | | -keep interface androidx.*.** |
| | | |
| | | #v4包不混淆 |
| | | -keep class android.support.v4.app.** { *; } |
| | | -keep interface android.support.v4.app.** { *; } |
| | | |
| | | #Gson混淆配置 |
| | | -keep class sun.misc.Unsafe { *; } |
| | | -keep class com.idea.fifaalarmclock.entity.*** |
| | | -keep class com.google.gson.** { *; } |
| | | |
| | | # 保留R下面的资源 |
| | | -keep class **.R$* {*;} |
| | | |
| | | # 保留本地native方法不被混淆 |
| | | -keepclasseswithmembernames class * { |
| | | native <methods>; |
| | | } |
| | | |
| | | # 保留在Activity中的方法参数是view的方法, |
| | | # 这样以来我们在layout中写的onClick就不会被影响 |
| | | -keepclassmembers class * extends android.app.Activity{ |
| | | public void *(android.view.View); |
| | | } |
| | | |
| | | # 保留枚举类不被混淆 |
| | | -keepclassmembers enum * { |
| | | public static **[] values(); |
| | | public static ** valueOf(java.lang.String); |
| | | } |
| | | |
| | | # 保留我们自定义控件(继承自View)不被混淆 |
| | | -keep public class * extends android.view.View{ |
| | | *** get*(); |
| | | void set*(***); |
| | | public <init>(android.content.Context); |
| | | public <init>(android.content.Context, android.util.AttributeSet); |
| | | public <init>(android.content.Context, android.util.AttributeSet, int); |
| | | } |
| | | |
| | | # 保留Parcelable序列化类不被混淆 |
| | | -keep class * implements android.os.Parcelable { |
| | | public static final android.os.Parcelable$Creator *; |
| | | } |
| | | |
| | | # 保留Serializable序列化的类不被混淆 |
| | | -keepclassmembers class * implements java.io.Serializable { |
| | | static final long serialVersionUID; |
| | | private static final java.io.ObjectStreamField[] serialPersistentFields; |
| | | !static !transient <fields>; |
| | | !private <fields>; |
| | | !private <methods>; |
| | | private void writeObject(java.io.ObjectOutputStream); |
| | | private void readObject(java.io.ObjectInputStream); |
| | | java.lang.Object writeReplace(); |
| | | java.lang.Object readResolve(); |
| | | } |
| | | |
| | | # 对于带有回调函数的onXXEvent、**On*Listener的,不能被混淆 |
| | | -keepclassmembers class * { |
| | | void *(**On*Event); |
| | | void *(**On*Listener); |
| | | } |
| | | |
| | | # webView处理,项目中没有使用到webView忽略即可 |
| | | -keepclassmembers class * extends android.webkit.WebViewClient { |
| | | public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap); |
| | | public boolean *(android.webkit.WebView, java.lang.String); |
| | | } |
| | | |
| | | |
| | | -keepclassmembers class * extends android.webkit.WebViewClient { |
| | | public void *(android.webkit.WebView, java.lang.String); |
| | | } |
| | | |
| | | #AQuery |
| | | -dontwarn com.androidquery.** |
| | | -keep class com.androidquery.** { *;} |
| | | |
| | | |
| | | #广点通 |
| | | # 如果使用了tbs版本的sdk需要进行以下配置 |
| | | -keep class com.tencent.smtt.** { *; } |
| | | -dontwarn dalvik.** |
| | | -dontwarn com.tencent.smtt.** |
| | | |
| | | # 如果使用了微信OpenSDK,需要添加如下配置 |
| | | -keep class com.tencent.mm.opensdk.** { *; } |
| | | |
| | | -keep class com.tencent.wxop.** { *; } |
| | | |
| | | -keep class com.tencent.mm.sdk.** { *; } |
| | | |
| | | |
| | | #穿山甲 |
| | | -keep class com.bytedance.sdk.openadsdk.** { *; } |
| | | -keep class com.bytedance.frameworks.** { *; } |
| | | |
| | | -keep class ms.bd.c.Pgl.**{*;} |
| | | -keep class com.bytedance.mobsec.metasec.ml.**{*;} |
| | | |
| | | -keep class com.ss.android.**{*;} |
| | | |
| | | -keep class com.bytedance.embedapplog.** {*;} |
| | | -keep class com.bytedance.embed_dr.** {*;} |
| | | |
| | | -keep class com.bykv.vk.** {*;} |
| | | |
| | | #eventbus |
| | | -keep class de.greenrobot.event.**{*;} |
| | | -keep class de.greenrobot.event.util.**{*;} |
| | | |
| | | #umeng |
| | | -keep class com.umeng.** {*;} |
| | | |
| | | -keepclassmembers class * { |
| | | public <init> (org.json.JSONObject); |
| | | } |
| | | |
| | | #okhttp |
| | | -dontwarn okhttp3.** |
| | | -keep class okhttp3.**{*;} |
| | | -keep interface okhttp3.**{*;} |
| | | |
| | | #okio |
| | | -dontwarn okio.** |
| | | -keep class okio.**{*;} |
| | | -keep interface okio.**{*;} |
| | | |
| | | #腾讯X5浏览服务 |
| | | -dontwarn dalvik.** |
| | | -dontwarn com.tencent.smtt.** |
| | | |
| | | -keep class com.tencent.smtt.** { |
| | | *; |
| | | } |
| | | |
| | | -keep class com.tencent.tbs.** { |
| | | *; |
| | | } |
| | | |
| | |
| | | # project structure. |
| | | # |
| | | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): |
| | | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt |
| | | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-android.txt |
| | | |
| | | # Project target. |
| | | target=android-19 |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <item android:drawable="@drawable/shape_pic_dialog_bottom" android:state_pressed="false"></item> |
| | | <item android:drawable="@drawable/v1_shape_pic_dialog_bottom" android:state_pressed="false"></item> |
| | | <item android:drawable="@drawable/shape_pic_dialog_bottom_highlight" android:state_pressed="true"></item> |
| | | |
| | | </selector> |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_btn_recent_color" |
| | | android:background="@drawable/v1_selector_btn_recent_color" |
| | | android:text="@string/select_all" |
| | | android:textColor="@color/gray" /> |
| | | |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_btn_recent_color" |
| | | android:background="@drawable/v1_selector_btn_recent_color" |
| | | android:text="@string/delete" |
| | | android:textColor="@color/top_bar_color" /> |
| | | </LinearLayout> |
| | |
| | | android:layout_height="0dp" |
| | | android:layout_weight="1"> |
| | | |
| | | <com.lcjian.library.util.RefreshLayout |
| | | <com.hanju.lib.library.util.RefreshLayout |
| | | android:id="@+id/rl_follow_activity" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:background="@color/transparent" |
| | | android:divider="@null" |
| | | android:dividerHeight="5dp"></ListView> |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/ll_no_data" |
| | |
| | | |
| | | <include layout="@layout/navigation_top_bar" /> |
| | | |
| | | <com.lcjian.library.util.RefreshLayout |
| | | <com.hanju.lib.library.util.RefreshLayout |
| | | android:id="@+id/rl_review_goods" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:divider="@null"></ListView> |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | | </LinearLayout> |
| | | |
| | | <ImageView |
| | |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | <com.hanju.lib.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_margin="8dp" |
| | |
| | | android:scaleType="centerCrop" |
| | | android:src="@drawable/ic_launcher" /> |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | |
| | | android:background="#0B78E3" /> |
| | | |
| | | |
| | | <com.hanju.video.app.util.x5.X5WebView |
| | | <com.hanju.video.app.util.x5web.X5WebView |
| | | android:id="@+id/webview" |
| | | android:layout_width="fill_parent" |
| | | android:layout_height="fill_parent" /> |
| | |
| | | |
| | | <include layout="@layout/navigation_top_bar" /> |
| | | |
| | | <com.lcjian.library.util.RefreshLayout |
| | | <com.hanju.lib.library.util.RefreshLayout |
| | | android:id="@+id/rl_live_category" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content"> |
| | |
| | | android:id="@+id/lv_live_category" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content"></ListView> |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | | |
| | | </LinearLayout> |
| | |
| | | android:layout_weight="1" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | app:ratio="0.625"> |
| | |
| | | android:layout_alignParentRight="true" |
| | | android:layout_marginBottom="5dp" |
| | | android:src="@drawable/tsa_ad_logo" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | </LinearLayout> |
| | | |
| | | </LinearLayout> |
| | |
| | | android:background="#0B78E3" /> |
| | | |
| | | |
| | | <com.hanju.video.app.util.x5.X5WebView |
| | | <com.hanju.video.app.util.x5web.X5WebView |
| | | android:id="@+id/webview" |
| | | android:layout_width="fill_parent" |
| | | android:layout_height="fill_parent" /> |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1.33" > |
| | |
| | | android:layout_height="match_parent" |
| | | android:scaleType="centerCrop" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1.33" > |
| | |
| | | android:paddingLeft="8dp" |
| | | android:paddingRight="8dp" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title1" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1.33" > |
| | |
| | | android:paddingLeft="8dp" |
| | | android:paddingRight="8dp" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title2" |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <com.lcjian.library.util.RefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | <com.hanju.lib.library.util.RefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:id="@+id/rl_starView" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" > |
| | |
| | | android:verticalSpacing="1dp" > |
| | | </ListView> |
| | | |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | |
| | | |
| | | </TextView> |
| | | |
| | | <com.lcjian.library.util.RefreshLayout |
| | | <com.hanju.lib.library.util.RefreshLayout |
| | | android:layout_weight="1" |
| | | android:id="@+id/rl_unique_ptrlv" |
| | | android:layout_width="match_parent" |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:divider="@null"></ListView> |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | | |
| | | </LinearLayout> |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="48dp" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_btn_recent_color" |
| | | android:background="@drawable/v1_selector_btn_recent_color" |
| | | android:text="@string/select_all" |
| | | android:textColor="@color/gray" /> |
| | | |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="48dp" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_btn_recent_color" |
| | | android:background="@drawable/v1_selector_btn_recent_color" |
| | | android:text="@string/delete" |
| | | android:textColor="@color/top_bar_color" /> |
| | | </LinearLayout> |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <com.lcjian.library.util.RefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | <com.hanju.lib.library.util.RefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:id="@+id/rl_discover" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content"> |
| | |
| | | android:background="@color/register_gray" |
| | | android:divider="@null" |
| | | android:dividerHeight="8dp"></ListView> |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | |
| | | android:id="@+id/include_notice" |
| | | layout="@layout/notice" /> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | <com.hanju.lib.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:background="@color/white" |
| | |
| | | android:text="更多专题" /> |
| | | </FrameLayout> |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | |
| | | <LinearLayout |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | <com.lcjian.library.util.RefreshLayout |
| | | <com.hanju.lib.library.util.RefreshLayout |
| | | android:id="@+id/sr_follow" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | |
| | | android:background="@color/transparent" |
| | | android:divider="@null" |
| | | android:dividerHeight="5dp"></ListView> |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/ll_no_login" |
| | |
| | | android:layout_height="match_parent" |
| | | android:background="@color/theme"> |
| | | |
| | | <com.lcjian.library.util.RefreshLayout |
| | | <com.hanju.lib.library.util.RefreshLayout |
| | | android:id="@+id/rl_guess_like" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | |
| | | android:layout_height="match_parent" |
| | | android:divider="@null" |
| | | android:dividerHeight="8dp"></ListView> |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | | |
| | | </FrameLayout> |
| | |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.util.RefreshLayout |
| | | <com.hanju.lib.library.util.RefreshLayout |
| | | android:id="@+id/rl_live_girl" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:divider="@null"></ListView> |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | | |
| | | |
| | | </LinearLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | <com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer |
| | | android:id="@+id/videoPlayer" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"></com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer> |
| | | |
| | | |
| | | </FrameLayout> |
| | |
| | | android:layout_height="1px" |
| | | android:background="@color/register_gray" /> |
| | | |
| | | <com.lcjian.library.util.RefreshLayout |
| | | <com.hanju.lib.library.util.RefreshLayout |
| | | android:id="@+id/rl_recommend_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content"> |
| | |
| | | android:background="@color/white" |
| | | android:dividerHeight="1px" |
| | | android:listSelector="@android:color/transparent"></ListView> |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | | |
| | | |
| | | </LinearLayout> |
| | |
| | | android:orientation="horizontal"> |
| | | <!--穿山甲广告 --> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | |
| | | |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | </LinearLayout> |
| | |
| | | android:orientation="horizontal"> |
| | | <!--穿山甲广告 --> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | |
| | | |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | </LinearLayout> |
| | |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/rl_container" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | |
| | | |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | <com.hanju.lib.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:id="@+id/rl_banner" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | |
| | | </FrameLayout> |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:textColor="#DDDDDD" |
| | |
| | | android:orientation="vertical"> |
| | | |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.6857"> |
| | |
| | | </FrameLayout> |
| | | </androidx.cardview.widget.CardView> |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | |
| | | </LinearLayout> |
| | |
| | | <com.lcjian.library.widget.RatioLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | <com.hanju.lib.library.widget.RatioLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res/com.hanju.video" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | |
| | | </RelativeLayout> |
| | | </FrameLayout> |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | |
| | | android:layout_weight="1" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1"> |
| | |
| | | |
| | | |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/item_star_tv" |
| | |
| | | android:layout_weight="1" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1"> |
| | |
| | | |
| | | |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/item_star_tv1" |
| | |
| | | android:layout_weight="1" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1"> |
| | |
| | | |
| | | |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/item_star_tv2" |
| | |
| | | android:orientation="vertical"> |
| | | |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/rl_discover" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"></FrameLayout> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/item_unique_tv" |
| | |
| | | android:background="@color/register_gray" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.93"> |
| | |
| | | android:layout_marginLeft="8dp" /> |
| | | </LinearLayout> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | |
| | | android:layout_marginBottom="5dp"> |
| | | |
| | | |
| | | <com.lcjian.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | <com.hanju.lib.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | android:scaleType="centerCrop" /> |
| | | |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_gif_load" |
| | |
| | | android:layout_marginTop="5dp" |
| | | android:layout_weight="1"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | <com.hanju.lib.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | android:contentDescription="@string/app_name" |
| | | android:paddingRight="5dp" |
| | | android:scaleType="centerCrop" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | > |
| | | |
| | | <ImageView |
| | |
| | | android:layout_marginTop="5dp" |
| | | android:layout_weight="1"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | <com.hanju.lib.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | android:layout_gravity="center" |
| | | android:contentDescription="@string/app_name" |
| | | android:scaleType="centerCrop" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | > |
| | | |
| | | <ImageView |
| | |
| | | android:layout_marginTop="5dp" |
| | | android:layout_weight="1"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | <com.hanju.lib.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | android:paddingRight="5dp" |
| | | android:scaleType="centerCrop" /> |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_video_play1" |
| | |
| | | android:layout_marginTop="5dp" |
| | | android:layout_weight="1"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | <com.hanju.lib.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | android:contentDescription="@string/app_name" |
| | | android:paddingRight="5dp" |
| | | android:scaleType="centerCrop" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_video_play2" |
| | |
| | | android:layout_marginTop="5dp" |
| | | android:layout_weight="1"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | <com.hanju.lib.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | android:contentDescription="@string/app_name" |
| | | android:paddingRight="5dp" |
| | | android:scaleType="centerCrop" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_video_play3" |
| | |
| | | android:gravity="center" |
| | | android:text="猜你喜欢" /> |
| | | |
| | | <com.lcjian.library.widget.MyGridView |
| | | <com.hanju.lib.library.widget.MyGridView |
| | | android:id="@+id/gv_guess" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:columnWidth="3dp" |
| | | android:horizontalSpacing="10dp" |
| | | android:numColumns="2" |
| | | android:verticalSpacing="10dp"></com.lcjian.library.widget.MyGridView> |
| | | android:verticalSpacing="10dp"></com.hanju.lib.library.widget.MyGridView> |
| | | </LinearLayout> |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | <com.hanju.lib.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.93"> |
| | |
| | | </FrameLayout> |
| | | |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | <com.hanju.lib.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.93"> |
| | |
| | | android:paddingTop="3dp" /> |
| | | </FrameLayout> |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_goods_des" |
| | |
| | | android:background="@color/theme" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/rl_guess_like" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:text="评论数" /> |
| | | </LinearLayout> |
| | | </LinearLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | </LinearLayout> |
| | |
| | | android:layout_weight="1" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1.0"> |
| | |
| | | android:src="@drawable/tsa_ad_logo" /> |
| | | </FrameLayout> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="wrap_content" |
| | |
| | | android:layout_weight="1" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1.0"> |
| | |
| | | android:src="@drawable/ic_live_on_live" /> |
| | | |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="wrap_content" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | android:scaleType="centerCrop" /> |
| | | |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | |
| | | <FrameLayout |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | android:scaleType="centerCrop" /> |
| | | |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | |
| | | android:orientation="vertical" |
| | | android:paddingLeft="10dp"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1"> |
| | |
| | | android:src="@drawable/ic_live_on_live" /> |
| | | </FrameLayout> |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="wrap_content" |
| | |
| | | android:orientation="vertical"> |
| | | |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/rl_pic" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | |
| | | </androidx.cardview.widget.CardView> |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_name" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/rl_ratio" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:src="@drawable/tsa_ad_logo" |
| | | android:visibility="gone" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title" |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_btn_recent_color" |
| | | android:background="@drawable/v1_selector_btn_recent_color" |
| | | android:text="@string/delete" |
| | | android:textColor="@color/top_bar_color" |
| | | android:textSize="15sp" /> |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1"> |
| | |
| | | |
| | | |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/item_star_tv" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1"> |
| | |
| | | |
| | | |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/item_star_tv1" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1"> |
| | |
| | | android:layout_gravity="center" /> |
| | | |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/item_star_tv2" |
| | |
| | | android:textColor="@color/gray" /> |
| | | </LinearLayout> |
| | | |
| | | <com.lcjian.library.widget.MyListView |
| | | <com.hanju.lib.library.widget.MyListView |
| | | android:id="@+id/list_reply" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_marginBottom="5dp" |
| | | android:layout_marginLeft="60dp" |
| | | android:layout_marginRight="10dp" > |
| | | </com.lcjian.library.widget.MyListView> |
| | | </com.hanju.lib.library.widget.MyListView> |
| | | |
| | | </LinearLayout> |
| | |
| | | android:layout_height="match_parent" |
| | | android:gravity="center"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | app:ratio="0.5625"> |
| | |
| | | </FrameLayout> |
| | | </LinearLayout> |
| | | </com.qq.e.ads.nativ.widget.NativeAdContainer> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | </LinearLayout> |
| | |
| | | android:layout_height="wrap_content"> |
| | | |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="95" |
| | |
| | | |
| | | </FrameLayout> |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | |
| | | android:orientation="horizontal"> |
| | | |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="120" |
| | |
| | | android:layout_alignParentLeft="true" |
| | | android:scaleType="centerCrop" /> |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | |
| | | <LinearLayout |
| | |
| | | android:orientation="vertical" |
| | | android:visibility="visible" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | app:ratio="0.625" > |
| | |
| | | </FrameLayout> |
| | | </LinearLayout> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title" |
| | |
| | | android:orientation="vertical" |
| | | android:visibility="visible" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | app:ratio="0.625" > |
| | |
| | | </FrameLayout> |
| | | </LinearLayout> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title1" |
| | |
| | | android:background="@drawable/shape_movie_card" |
| | | android:orientation="vertical" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625" > |
| | |
| | | android:paddingLeft="8dp" |
| | | android:paddingRight="8dp" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title" |
| | |
| | | android:layout_weight="1" |
| | | android:orientation="vertical" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1.33" > |
| | |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1.33" > |
| | |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title1" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1.33" > |
| | |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title2" |
| | |
| | | android:layout_weight="1" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.606"> |
| | |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.606"> |
| | |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title1" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1.33" > |
| | |
| | | android:paddingLeft="8dp" |
| | | android:paddingRight="8dp" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | android:src="@drawable/tsa_ad_logo" |
| | | android:visibility="gone" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title1" |
| | |
| | | android:layout_marginRight="3dp" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.606"> |
| | |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title" |
| | |
| | | android:layout_weight="1" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title" |
| | |
| | | android:layout_weight="1" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title1" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_movie_title" |
| | |
| | | |
| | | <include layout="@layout/navigation_top_bar" /> |
| | | |
| | | <com.lcjian.library.util.RefreshLayout |
| | | <com.hanju.lib.library.util.RefreshLayout |
| | | android:id="@+id/rl_walfare" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | |
| | | android:layout_height="match_parent" |
| | | android:divider="@null" |
| | | android:dividerHeight="8dp"></ListView> |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | | |
| | | |
| | | <FrameLayout |
| | |
| | | android:layout_height="0dp" |
| | | android:layout_weight="1"> |
| | | |
| | | <com.lcjian.library.util.RefreshLayout |
| | | <com.hanju.lib.library.util.RefreshLayout |
| | | android:id="@+id/srl_favourite" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content"> |
| | |
| | | android:divider="@null" |
| | | android:dividerHeight="1px" /> |
| | | |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | | |
| | | |
| | | <FrameLayout |
| | |
| | | android:layout_weight="1" |
| | | android:button="@null" |
| | | android:textSize="0dp" |
| | | android:drawableTop="@drawable/selector_mine" |
| | | android:drawableTop="@drawable/v1_selector_mine" |
| | | android:gravity="center" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/selector_bottom_bar_text" /> |
| | |
| | | android:id="@+id/rb_watch_history" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:background="@drawable/selector_switch_left_bg" |
| | | android:background="@drawable/v1_selector_switch_left_bg" |
| | | android:button="@null" |
| | | android:gravity="center" |
| | | android:paddingLeft="24dp" |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_btn_recent_color" |
| | | android:background="@drawable/v1_selector_btn_recent_color" |
| | | android:text="@string/select_all" |
| | | android:textColor="@color/gray" /> |
| | | |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_btn_recent_color" |
| | | android:background="@drawable/v1_selector_btn_recent_color" |
| | | android:text="@string/delete" |
| | | android:textColor="@color/top_bar_color" /> |
| | | </LinearLayout> |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content"></LinearLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/rl_recommend_top" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content"></com.lzj.gallery.library.views.BannerViewPager> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <GridView |
| | | android:id="@+id/gv_special" |
| | |
| | | </RelativeLayout> |
| | | |
| | | |
| | | <com.lcjian.library.widget.MyListView |
| | | <com.hanju.lib.library.widget.MyListView |
| | | android:id="@+id/gv_video_container2" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:background="@color/register_gray" |
| | | android:divider="@null" |
| | | android:paddingLeft="2dp" |
| | | android:paddingRight="2dp"></com.lcjian.library.widget.MyListView> |
| | | android:paddingRight="2dp"></com.hanju.lib.library.widget.MyListView> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/ll_video_container" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical"></LinearLayout> |
| | | |
| | | <com.lcjian.library.widget.MyListView |
| | | <com.hanju.lib.library.widget.MyListView |
| | | android:id="@+id/gv_video_container3" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:background="@color/register_gray" |
| | | android:divider="@null" |
| | | android:paddingLeft="2dp" |
| | | android:paddingRight="2dp"></com.lcjian.library.widget.MyListView> |
| | | android:paddingRight="2dp"></com.hanju.lib.library.widget.MyListView> |
| | | </LinearLayout> |
| | | |
| | | </LinearLayout> |
| | |
| | | android:text="@string/hot_search" |
| | | android:textColor="#DDDDDD" /> |
| | | |
| | | <com.lcjian.library.widget.MyGridView |
| | | <com.hanju.lib.library.widget.MyGridView |
| | | android:id="@+id/gv_hot_search" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:paddingRight="8dp" |
| | | android:paddingBottom="8dp" |
| | | android:stretchMode="columnWidth" |
| | | android:verticalSpacing="8dp"></com.lcjian.library.widget.MyGridView> |
| | | android:verticalSpacing="8dp"></com.hanju.lib.library.widget.MyGridView> |
| | | </LinearLayout> |
| | | |
| | | |
| | |
| | | android:textColor="@color/gray" /> |
| | | </RelativeLayout> |
| | | |
| | | <com.lcjian.library.widget.MyGridView |
| | | <com.hanju.lib.library.widget.MyGridView |
| | | android:id="@+id/gv_history_search" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:paddingRight="8dp" |
| | | android:paddingBottom="8dp" |
| | | android:stretchMode="columnWidth" |
| | | android:verticalSpacing="8dp"></com.lcjian.library.widget.MyGridView> |
| | | android:verticalSpacing="8dp"></com.hanju.lib.library.widget.MyGridView> |
| | | </LinearLayout> |
| | | |
| | | |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/fl_share_to_sina" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:text="@string/sina_weibo" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/black" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/fl_share_qzone" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:text="@string/qq_kongjian" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/black" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/fl_share_to_circle" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:text="@string/friend_circle" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/black" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_share_item_bg" > |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | </TableRow> |
| | | |
| | | <TableRow |
| | |
| | | android:layout_height="wrap_content" |
| | | android:visibility="gone" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/fl_share_to_qq" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:text="@string/qq_friend" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/black" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/fl_share_to_wechat" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:text="@string/wechat_friend" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/black" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_share_item_bg" > |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_share_item_bg" > |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | </TableRow> |
| | | </TableLayout> |
| | | |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/fl_share_to_sina" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:text="@string/sina_weibo" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/black" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/fl_share_qzone" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:text="@string/qq_kongjian" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/black" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/fl_share_to_circle" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:text="@string/friend_circle" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/black" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_share_item_bg" > |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | </TableRow> |
| | | |
| | | <TableRow |
| | |
| | | android:layout_height="wrap_content" |
| | | android:visibility="gone" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/fl_share_to_qq" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:text="@string/qq_friend" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/black" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:id="@+id/fl_share_to_wechat" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:text="@string/wechat_friend" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/black" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_share_item_bg" > |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_share_item_bg" > |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | </TableRow> |
| | | |
| | | </TableLayout> |
| | |
| | | android:layout_weight="1" |
| | | android:orientation="vertical" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1.33" > |
| | |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/sp_movie_title" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1.33" > |
| | |
| | | android:layout_marginTop="5dp" |
| | | android:scaleType="centerCrop" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/sp_movie_title2" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="vertical" > |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="1.33" > |
| | |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" /> |
| | | </FrameLayout> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/sp_movie_title3" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.4375"> |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:scaleType="centerCrop" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | |
| | | android:background="@color/white" |
| | | android:orientation="horizontal"> |
| | | |
| | | <com.lcjian.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | <com.hanju.lib.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | |
| | | android:id="@+id/star_detail_portrait" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" /> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_below="@id/v_status_bar" |
| | | |
| | | android:background="@color/bg_download_so"> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fragment_video_parser" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:visibility="gone"></FrameLayout> |
| | | |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fragment_video_play_container" |
| | |
| | | |
| | | </FrameLayout> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_player" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | |
| | | </FrameLayout> |
| | | |
| | | <ProgressBar |
| | | android:id="@+id/pb_loading" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:visibility="gone"> |
| | | |
| | | </ProgressBar> |
| | | |
| | | |
| | | </FrameLayout> |
| | | |
| | | |
| | |
| | | |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/ll_bottom" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="48dp" |
| | | android:layout_alignParentBottom="true" |
| | |
| | | |
| | | |
| | | <ImageView |
| | | android:visibility="gone" |
| | | android:id="@+id/iv_share" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="20dp" |
| | | android:layout_marginLeft="35dp" |
| | | android:src="@drawable/ic_video_detail_share" /> |
| | | android:src="@drawable/ic_video_detail_share" |
| | | android:visibility="gone" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | |
| | | android:orientation="vertical"> |
| | | |
| | | |
| | | <com.lcjian.library.widget.MyViewPager |
| | | <com.hanju.lib.library.widget.MyViewPager |
| | | android:id="@+id/vp_episode" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content"></com.lcjian.library.widget.MyViewPager> |
| | | android:layout_height="wrap_content"></com.hanju.lib.library.widget.MyViewPager> |
| | | </LinearLayout> |
| | | </ScrollView> |
| | | </LinearLayout> |
| | |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical" > |
| | | |
| | | <com.lcjian.library.widget.MyGridView |
| | | <com.hanju.lib.library.widget.MyGridView |
| | | android:id="@+id/gv_episode2" |
| | | android:layout_width="200dp" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:padding="8dp" |
| | | android:stretchMode="columnWidth" |
| | | android:verticalSpacing="8dp" > |
| | | </com.lcjian.library.widget.MyGridView> |
| | | </com.hanju.lib.library.widget.MyGridView> |
| | | </LinearLayout> |
| | | |
| | | </ScrollView> |
| | |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.lcjian.library.util.RefreshLayout |
| | | <com.hanju.lib.library.util.RefreshLayout |
| | | android:id="@+id/rl_review" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:dividerHeight="1dp"></ListView> |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/tv_review_layout" |
| | |
| | | |
| | | <include layout="@layout/navigation_top_bar" /> |
| | | |
| | | <com.lcjian.library.util.RefreshLayout |
| | | <com.hanju.lib.library.util.RefreshLayout |
| | | android:id="@+id/rl_video" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | |
| | | android:dividerHeight="8dp"> |
| | | |
| | | </ListView> |
| | | </com.lcjian.library.util.RefreshLayout> |
| | | </com.hanju.lib.library.util.RefreshLayout> |
| | | |
| | | |
| | | <WebView |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <resources> |
| | | <color name="white">#FFFFFFFF</color> |
| | | <color name="white_discover">#bbFFFFFF</color> |
| | | <color name="white_special">#00FFFFFF</color> |
| | | <color name="red">#FFe9372d</color> |
| | | <color name="yellow">#FFf7db00</color> |
| | | <color name="black1">#ff161514</color> |
| | | <color name="qq_blue">#4CAFEA</color> |
| | | <color name="blue">#FFffffff</color> |
| | | <color name="blue2">#FF028df6</color> |
| | | <color name="top_bar_color">#FF000000</color> |
| | | <color name="bg_download_so">#FF987b63</color> |
| | | <color name="blue3">#FF067cf6</color> |
| | | <color name="blue1">#ff028cf7</color> |
| | | <color name="gray">#ff999999</color> |
| | | <color name="gray1">#ff252525</color> |
| | | <color name="gray2">#ffd0d0d0</color> |
| | | <color name="black">#ff333333</color> |
| | | <color name="light_gray">#ffcccccc</color> |
| | | <color name="bg">#ffeeeeee</color> |
| | | <color name="fill_color">#30EE0A</color> |
| | | <color name="green">#2ac600</color> |
| | | <color name="page_color">#32B1E6</color> |
| | | <color name="light_light_gray">#F2F2F2</color> |
| | | <color name="register_gray">#f3f2f0</color> |
| | | <color name="register_gray1">#ffe0e0e0</color> |
| | | <color name="backgroud_gray">#fafafa</color> |
| | | <color name="message_backgroud_gray">#f5f5f5</color> |
| | | <color name="category_unique_lv_item">#2880BF</color> |
| | | <color name="category_star_tv_font">#656565</color> |
| | | <color name="text_color_small">#ffff7300</color> |
| | | <color name="transparent">#00000000</color> |
| | | <color name="transparent_gray">#99666666</color> |
| | | <color name="main_color">#fff9644e</color> |
| | | <drawable name="blued">#ff009fe1</drawable> |
| | | <color name="news_title_color_gray">#333333</color> |
| | | <color name="gray6">#666666</color> |
| | | <color name="goods_divider_color">#fff1f1f1</color> |
| | | <color name="cutline">#EEEEEE</color> |
| | | <color name="search_bar_color">#ff221b19</color> |
| | | |
| | | |
| | | <color name="colorPrimary">#3F51B5</color> |
| | | <color name="colorPrimaryDark">#303F9F</color> |
| | | <color name="colorAccent">#FF4081</color> |
| | | |
| | | <color name="colorPrimary">#3F51B5</color> |
| | | <color name="gray">#ff999999</color> |
| | | <color name="cutline">#EEEEEE</color> |
| | | <color name="page_color">#32B1E6</color> |
| | | <color name="videoTitle">#DCDCDC</color> |
| | | <color name="videoTag">#c0c0c0</color> |
| | | <color name="category_star_tv_font">#656565</color> |
| | | <color name="light_gray">#ffcccccc</color> |
| | | <color name="bg">#ffeeeeee</color> |
| | | <color name="search_bar_color">#ff221b19</color> |
| | | <color name="blue1">#ff028cf7</color> |
| | | <color name="white_special">#00FFFFFF</color> |
| | | <color name="colorPrimaryDark">#303F9F</color> |
| | | <color name="white">#FFFFFFFF</color> |
| | | <color name="gray6">#666666</color> |
| | | <color name="register_gray1">#ffe0e0e0</color> |
| | | <color name="white_discover">#bbFFFFFF</color> |
| | | <color name="backgroud_gray">#fafafa</color> |
| | | <color name="yellow">#FFf7db00</color> |
| | | <color name="gray1">#ff252525</color> |
| | | <color name="category_unique_lv_item">#2880BF</color> |
| | | <color name="transparent">#00000000</color> |
| | | <color name="gray2">#ffd0d0d0</color> |
| | | |
| | | <color name="goods_divider_color">#fff1f1f1</color> |
| | | <drawable name="blued">#ff009fe1</drawable> |
| | | <color name="blue2">#FF028df6</color> |
| | | <color name="videoTag">#c0c0c0</color> |
| | | <color name="register_gray">#f3f2f0</color> |
| | | <color name="transparent_gray">#99666666</color> |
| | | <color name="text_color_small">#ffff7300</color> |
| | | <color name="message_backgroud_gray">#f5f5f5</color> |
| | | <color name="top_bar_color">#FF000000</color> |
| | | <color name="green">#2ac600</color> |
| | | <color name="light_light_gray">#F2F2F2</color> |
| | | <color name="news_title_color_gray">#333333</color> |
| | | <color name="theme">#3C3C3C</color> |
| | | <color name="blue">#FFffffff</color> |
| | | <color name="main_color">#fff9644e</color> |
| | | <color name="black">#ff333333</color> |
| | | <color name="red">#FFe9372d</color> |
| | | |
| | | <color name="blue3">#FF067cf6</color> |
| | | <color name="fill_color">#30EE0A</color> |
| | | <color name="qq_blue">#4CAFEA</color> |
| | | <color name="black1">#ff161514</color> |
| | | <color name="bg_download_so">#FF987b63</color> |
| | | </resources> |
| | |
| | | <resources> |
| | | <string name="app_name">韩剧播放器</string> |
| | | <string name="recommend">推荐</string> |
| | | <string name="category">分类</string> |
| | | <string name="discover">发现</string> |
| | | <string name="mine">我的</string> |
| | | <string name="statement">声明</string> |
| | | <string name="my_favourites">收藏</string> |
| | | <string name="download_url">下载链接</string> |
| | | <string name="my_score">我的成绩</string> |
| | | <string name="my_accumulate">我的积分</string> |
| | | <string name="share_to">分享软件</string> |
| | | <string name="to_review">去评价</string> |
| | | <string name="suggestion">帮助与反馈</string> |
| | | <string name="settings">设置</string> |
| | | <string name="review_tip">给个好评,将会看到福利哦</string> |
| | | <string name="suggestion_tip">提交你想看的影片或建议</string> |
| | | <string name="score_tip">一共观看了%1$d部影片</string> |
| | | <string name="accumulate_tip">%1$d分</string> |
| | | <string name="favourites_count">%1$d部影片</string> |
| | | <string name="wonderful_channel">精彩频道</string> |
| | | <string name="hot_star">热门频道</string> |
| | | <string name="watch_history">观看记录</string> |
| | | <string name="offline_cache">缓存</string> |
| | | <string name="system_alarm">系统公告</string> |
| | | <string name="faq">常见问题</string> |
| | | <string name="clear_cache">清空图片缓存</string> |
| | | <string name="check_update">检查更新</string> |
| | | <string name="about_us">关于我们</string> |
| | | <string name="disclaimer">免责声明</string> |
| | | <string name="post">提交</string> |
| | | <string name="accumulate">积分</string> |
| | | <string name="your_current_accumulate">你当前的积分:</string> |
| | | <string name="add_accumulate">%1$+d分</string> |
| | | <string name="minus_accumulate">%1$d分</string> |
| | | <string name="use">使用</string> |
| | | <string name="more">更多</string> |
| | | <string name="cancel">取消</string> |
| | | <string name="hot_search">热门搜索</string> |
| | | <string name="history_search">搜索记录</string> |
| | | <string name="clear_history_search">清空记录</string> |
| | | <string name="guess_like">猜你喜欢</string> |
| | | <string name="related_video">相关视频</string> |
| | | <string name="everybody_look">大家都在看</string> |
| | | <string name="all">全部</string> |
| | | <string name="movie">电影</string> |
| | | <string name="tvshow">电视剧</string> |
| | | <string name="search">搜索</string> |
| | | <string name="share_right_now">立即分享到</string> |
| | | <string name="qq_friend">QQ好友</string> |
| | | <string name="qq_kongjian">QQ空间</string> |
| | | <string name="wechat_friend">微信好友</string> |
| | | <string name="friend_circle">朋友圈</string> |
| | | <string name="sina_weibo">新浪微博</string> |
| | | <string name="add_to_favourite">收藏</string> |
| | | <string name="watch_history_time">观看至%1$s</string> |
| | | <string name="select_all">全选</string> |
| | | <string name="delete">删除</string> |
| | | <string name="remove_from_favourite">取消收藏</string> |
| | | <string name="only_wifi_download">非WiFi禁止下载</string> |
| | | <string name="no_review">暂无评论</string> |
| | | <string name="rating_score">评分:%1$.1f</string> |
| | | <string name="episode_more">更多下载剧集</string> |
| | | <string name="msg_no_network">当前网络不可用,请设置网络</string> |
| | | <string name="load_tip">别催嘛,人家正在拼命加载中···</string> |
| | | <string name="report">来源</string> |
| | | <string name="offline_cache_title">离线缓存</string> |
| | | <string name="mine_follow">我的追剧</string> |
| | | <string name="mine_message">我的消息</string> |
| | | <string name="msg_empty">暂无消息</string> |
| | | <string name="oauth">一键登录</string> |
| | | <string name="after_login">登录后享受更多服务</string> |
| | | <string name="review_edit">我也来说两句...</string> |
| | | <string name="review_deliver">发表</string> |
| | | <string name="discover_everybody_play">大家都在玩</string> |
| | | <string name="discover_game_more">更多好玩游戏></string> |
| | | <string name="definition_fluency">普清</string> |
| | | <string name="definition_high">高清</string> |
| | | <string name="definition_super">超清</string> |
| | | <string name="definition_original">原画</string> |
| | | <string name="btn_confirm">确定</string> |
| | | <string name="btn_cancel">取消</string> |
| | | <string name="skip_tail">跳过片尾</string> |
| | | <string name="auto_next">自动播放下一集</string> |
| | | <string name="skip_header">跳过片头</string> |
| | | <string name="forward">快进</string> |
| | | <string name="backwrard">快退</string> |
| | | <string name="alert_title_hint">提示</string> |
| | | <string name="alert_title_player_setting">播放器设置</string> |
| | | <string name="alert_player_error_network">播放器网络发生错误,是否重试?</string> |
| | | <string name="alert_player_error">播放器发生错误,是否重试?</string> |
| | | <string name="alert_player_error_unknown">播放过程出错,是否重试?</string> |
| | | <string name="alert_loading_error_iplimit">由于版权限制,该视频无法播放。</string> |
| | | <string name="alert_loading_error_mobile_limit">由于版权限制,该视频无法播放。</string> |
| | | <string name="alert_loading_error_network">网络发生错误,是否重试?</string> |
| | | <string name="alert_loading_error_fail">数据加载失败,是否重试?</string> |
| | | <string name="alert_loading_error_no_next">没有发现下一集,是否重试?</string> |
| | | <string name="alert_loading_error_no_previous">没有发现上一集,是否重试?</string> |
| | | <string name="alert_apikey_error">授权原因,无法继续加载视频。</string> |
| | | <string name="alert_apikey_missing">需要授权,请联系搜狐视频获取。</string> |
| | | <string name="alert_illigal_argument">参数原因,无法继续播放。</string> |
| | | <string name="btn_retry">重试</string> |
| | | <string name="activity_main_login">立即登录</string> |
| | | <string name="user_agreement">《用户使用协议》</string> |
| | | <string name="privacy_policy">《隐私政策》</string> |
| | | <string name="clear_cache">清空图片缓存</string> |
| | | <string name="post">提交</string> |
| | | <string name="more">更多</string> |
| | | <string name="rule_email">0123456789abcdefghijklmnopqrstuvwxyz@.</string> |
| | | <string name="rule_password">0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`¬!"£$%^*()~=#{}[];':,./?/*-_+<>@&</string> |
| | | <string name="my_favourites">收藏</string> |
| | | <string name="msg_no_network">当前网络不可用,请设置网络</string> |
| | | <string name="clear_history_search">清空记录</string> |
| | | |
| | | <string name="sina_weibo">新浪微博</string> |
| | | <!-- <string name="app_name">韩剧播放器</string>--> |
| | | <string name="user_agreement">《用户使用协议》</string> |
| | | <string name="help">帮助</string> |
| | | <string name="disclaimer">免责声明</string> |
| | | <string name="delete">删除</string> |
| | | <string name="watch_history_time">观看至%1$s</string> |
| | | <string name="no_review">暂无评论</string> |
| | | <string name="load_tip">别催嘛,人家正在拼命加载中···</string> |
| | | <string name="offline_cache_title">离线缓存</string> |
| | | <string name="hot_search">热门搜索</string> |
| | | <string name="qq_kongjian">QQ空间</string> |
| | | <string name="activity_main_login">立即登录</string> |
| | | <string name="about_us">关于我们</string> |
| | | <string name="review_edit">我也来说两句...</string> |
| | | <string name="select_all">全选</string> |
| | | <string name="share_right_now">立即分享到</string> |
| | | <string name="umeng_key">6125b4785358984f59b6f9a7</string> |
| | | <string name="friend_circle">朋友圈</string> |
| | | |
| | | <string name="watch_history">观看记录</string> |
| | | <string name="history_search">搜索记录</string> |
| | | <string name="wechat_friend">微信好友</string> |
| | | <string name="suggestion">帮助与反馈</string> |
| | | <string name="qq_friend">QQ好友</string> |
| | | <string name="rule_password">0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`¬!"£$%^*()~=#{}[];':,./?/*-_+<>@&</string> |
| | | <string name="only_wifi_download">非WiFi禁止下载</string> |
| | | <string name="settings">设置</string> |
| | | <string name="privacy_policy">《隐私政策》</string> |
| | | <string name="check_update">检查更新</string> |
| | | <string name="offline_cache">缓存</string> |
| | | <string name="mine_message">我的消息</string> |
| | | <string name="string_help_text">当前应用缺少必要权限。\n\n请点击\"设置\"-\"权限\"-打开所需权限。\n\n最后点击两次后退按钮,即可返回。</string> |
| | | <string name="msg_empty">暂无消息</string> |
| | | <string name="quit">退出</string> |
| | | <string name="umeng_key">5769f13267e58e2f31002183</string> |
| | | <string name="system_alarm">系统公告</string> |
| | | |
| | | </resources> |
| | |
| | | import androidx.multidex.MultiDex; |
| | | |
| | | import android.util.Log; |
| | | import android.widget.Toast; |
| | | |
| | | import com.hanju.video.app.util.ConfigUtil; |
| | | import com.hanju.video.app.util.common.AppConfigUtil; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.hanju.video.app.util.downutil.StringUtils; |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.hanju.video.app.util.downutils.StringUtils; |
| | | import com.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.nostra13.universalimageloader.core.ImageLoader; |
| | | import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; |
| | |
| | | import com.umeng.commonsdk.UMConfigure; |
| | | import com.umeng.socialize.PlatformConfig; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.ut.device.UTDevice; |
| | | import com.hanju.video.app.util.CrashHandler; |
| | | import com.hanju.video.app.util.common.CrashHandler; |
| | | import com.hanju.video.app.util.ad.TTAdManagerHolder; |
| | | |
| | | public class HanJuApplication extends Application { |
| | |
| | | ImageLoader.getInstance().init(buildDefaultILC(application)); |
| | | initX5(application); |
| | | initWX(application); |
| | | String gdtAppId = ConfigUtil.getGDTAppId(application); |
| | | String csjAppId = ConfigUtil.getCSJAppId(application); |
| | | String gdtAppId = AppConfigUtil.getGDTAppId(application); |
| | | String csjAppId = AppConfigUtil.getCSJAppId(application); |
| | | initAd(application, gdtAppId, csjAppId); |
| | | } |
| | | |
New file |
| | |
| | | package com.hanju.video.app.database; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | import android.content.ContentProvider; |
| | | import android.content.ContentUris; |
| | | import android.content.ContentValues; |
| | | import android.content.UriMatcher; |
| | | import android.database.Cursor; |
| | | import android.database.SQLException; |
| | | import android.database.sqlite.SQLiteDatabase; |
| | | import android.database.sqlite.SQLiteQueryBuilder; |
| | | import android.net.Uri; |
| | | import androidx.core.database.DatabaseUtilsCompat; |
| | | |
| | | public class DownloadProvider extends ContentProvider { |
| | | |
| | | // A projection map used to select columns from the database |
| | | private final HashMap<String, String> mNotesProjectionMap; |
| | | // Uri matcher to decode incoming URIs. |
| | | private final UriMatcher mUriMatcher; |
| | | |
| | | // The incoming URI matches the main table URI pattern |
| | | private static final int DOWNLOAD = 1; |
| | | // The incoming URI matches the main table row ID URI pattern |
| | | private static final int DOWNLOAD_ID = 2; |
| | | |
| | | // Handle to a new DatabaseHelper. |
| | | private HanJuSQLiteOpenHelper mOpenHelper; |
| | | |
| | | /** |
| | | * Global provider initialization. |
| | | */ |
| | | public DownloadProvider() { |
| | | // Create and initialize URI matcher. |
| | | mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); |
| | | mUriMatcher.addURI(DownloadTable.AUTHORITY, "downloads", DOWNLOAD); |
| | | mUriMatcher.addURI(DownloadTable.AUTHORITY, "downloads/#", DOWNLOAD_ID); |
| | | |
| | | // Create and initialize projection map for all columns. This is |
| | | // simply an identity mapping. |
| | | mNotesProjectionMap = new HashMap<String, String>(); |
| | | mNotesProjectionMap.put(DownloadTable._ID, DownloadTable._ID); |
| | | mNotesProjectionMap.put(DownloadTable.TASK_ID, DownloadTable.TASK_ID); |
| | | mNotesProjectionMap.put(DownloadTable.VIDEO_ID, DownloadTable.VIDEO_ID); |
| | | mNotesProjectionMap.put(DownloadTable.VIDEO_DETAIL_ID, DownloadTable.VIDEO_DETAIL_ID); |
| | | mNotesProjectionMap.put(DownloadTable.VIDEO_THIRD_TYPE, DownloadTable.VIDEO_THIRD_TYPE); |
| | | mNotesProjectionMap.put(DownloadTable.VIDEO_DETAIL, DownloadTable.VIDEO_DETAIL); |
| | | } |
| | | |
| | | /** |
| | | * Perform provider creation. |
| | | */ |
| | | @Override |
| | | public boolean onCreate() { |
| | | mOpenHelper = new HanJuSQLiteOpenHelper(getContext()); |
| | | // Assumes that any failures will be reported by a thrown exception. |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Return the MIME type for an known URI in the provider. |
| | | */ |
| | | @Override |
| | | public String getType(Uri uri) { |
| | | switch (mUriMatcher.match(uri)) { |
| | | case DOWNLOAD: |
| | | return DownloadTable.CONTENT_TYPE; |
| | | case DOWNLOAD_ID: |
| | | return DownloadTable.CONTENT_ITEM_TYPE; |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Handle incoming queries. |
| | | */ |
| | | @Override |
| | | public Cursor query(Uri uri, String[] projection, String selection, |
| | | String[] selectionArgs, String sortOrder) { |
| | | Cursor c; |
| | | SQLiteDatabase db = mOpenHelper.getReadableDatabase(); |
| | | switch (mUriMatcher.match(uri)) { |
| | | case DOWNLOAD: { |
| | | // Constructs a new query builder and sets its table name |
| | | SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); |
| | | qb.setTables(getTableName(uri)); |
| | | // If the incoming URI is for main table. |
| | | qb.setProjectionMap(mNotesProjectionMap); |
| | | c = qb.query(db, projection, selection, selectionArgs, |
| | | null /* no group */, null /* no filter */, sortOrder); |
| | | } |
| | | break; |
| | | case DOWNLOAD_ID: { |
| | | // Constructs a new query builder and sets its table name |
| | | SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); |
| | | qb.setTables(getTableName(uri)); |
| | | // The incoming URI is for a single row. |
| | | qb.setProjectionMap(mNotesProjectionMap); |
| | | qb.appendWhere(DownloadTable._ID + "=?"); |
| | | selectionArgs = DatabaseUtilsCompat.appendSelectionArgs(selectionArgs, |
| | | new String[] { uri.getLastPathSegment() }); |
| | | c = qb.query(db, projection, selection, selectionArgs, |
| | | null /* no group */, null /* no filter */, sortOrder); |
| | | } |
| | | break; |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | c.setNotificationUri(getContext().getContentResolver(), uri); |
| | | return c; |
| | | } |
| | | |
| | | /** |
| | | * Handler inserting new data. |
| | | */ |
| | | @Override |
| | | public Uri insert(Uri uri, ContentValues initialValues) { |
| | | if (mUriMatcher.match(uri) != DOWNLOAD) { |
| | | // Can only insert into to main URI. |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | |
| | | ContentValues values; |
| | | |
| | | if (initialValues != null) { |
| | | values = new ContentValues(initialValues); |
| | | } else { |
| | | values = new ContentValues(); |
| | | } |
| | | |
| | | SQLiteDatabase db = mOpenHelper.getWritableDatabase(); |
| | | long rowId = db.insert(DownloadTable.TABLE_NAME, null, values); |
| | | // If the insert succeeded, the row ID exists. |
| | | if (rowId > 0) { |
| | | Uri noteUri = ContentUris.withAppendedId(DownloadTable.CONTENT_URI, rowId); |
| | | getContext().getContentResolver().notifyChange(noteUri, null); |
| | | return noteUri; |
| | | } |
| | | |
| | | throw new SQLException("Failed to insert row into " + uri); |
| | | } |
| | | |
| | | /** |
| | | * Handle deleting data. |
| | | */ |
| | | @Override |
| | | public int delete(Uri uri, String where, String[] whereArgs) { |
| | | SQLiteDatabase db = mOpenHelper.getWritableDatabase(); |
| | | String finalWhere; |
| | | |
| | | int count; |
| | | |
| | | switch (mUriMatcher.match(uri)) { |
| | | case DOWNLOAD: |
| | | // If URI is main table, delete uses incoming where clause and args. |
| | | count = db.delete(DownloadTable.TABLE_NAME, where, whereArgs); |
| | | break; |
| | | |
| | | // If the incoming URI matches a single note ID, does the delete based on the |
| | | // incoming data, but modifies the where clause to restrict it to the |
| | | // particular note ID. |
| | | case DOWNLOAD_ID: |
| | | // If URI is for a particular row ID, delete is based on incoming |
| | | // data but modified to restrict to the given ID. |
| | | finalWhere = DatabaseUtilsCompat.concatenateWhere( |
| | | DownloadTable._ID + " = " + uri.getLastPathSegment(), where); |
| | | count = db.delete(DownloadTable.TABLE_NAME, finalWhere, whereArgs); |
| | | break; |
| | | |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | getContext().getContentResolver().notifyChange(uri, null); |
| | | |
| | | return count; |
| | | } |
| | | |
| | | /** |
| | | * Handle updating data. |
| | | */ |
| | | @Override |
| | | public int update(Uri uri, ContentValues values, String where, String[] whereArgs) { |
| | | SQLiteDatabase db = mOpenHelper.getWritableDatabase(); |
| | | int count; |
| | | String finalWhere; |
| | | |
| | | switch (mUriMatcher.match(uri)) { |
| | | case DOWNLOAD: |
| | | // If URI is main table, update uses incoming where clause and args. |
| | | count = db.update(DownloadTable.TABLE_NAME, values, where, whereArgs); |
| | | break; |
| | | |
| | | case DOWNLOAD_ID: |
| | | // If URI is for a particular row ID, update is based on incoming |
| | | // data but modified to restrict to the given ID. |
| | | finalWhere = DatabaseUtilsCompat.concatenateWhere( |
| | | DownloadTable._ID + " = " + uri.getLastPathSegment(), where); |
| | | count = db.update(DownloadTable.TABLE_NAME, values, finalWhere, whereArgs); |
| | | break; |
| | | |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | getContext().getContentResolver().notifyChange(uri, null); |
| | | |
| | | return count; |
| | | } |
| | | |
| | | private String getTableName(Uri uri) { |
| | | switch (mUriMatcher.match(uri)) { |
| | | case DOWNLOAD: |
| | | case DOWNLOAD_ID: |
| | | return DownloadTable.TABLE_NAME; |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.database; |
| | | |
| | | import android.database.sqlite.SQLiteDatabase; |
| | | import android.net.Uri; |
| | | import android.provider.BaseColumns; |
| | | |
| | | public class DownloadTable implements BaseColumns { |
| | | |
| | | public static final String AUTHORITY = "com.hanju.video.provider.download"; |
| | | |
| | | public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY |
| | | + "/" + "downloads"); |
| | | /** |
| | | * The MIME type of {@link #CONTENT_URI}. |
| | | */ |
| | | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.weikou.download"; |
| | | /** |
| | | * The MIME type of a {@link #CONTENT_URI} sub-directory of a single row. |
| | | */ |
| | | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.weikou.download"; |
| | | |
| | | public static final String TABLE_NAME = "DOWNLOAD"; |
| | | |
| | | public static final String TASK_ID = "_TASK_ID"; |
| | | |
| | | public static final String VIDEO_ID = "_VIDEO_ID"; |
| | | |
| | | public static final String VIDEO_DETAIL_ID = "_VIDEO_DETAIL_ID"; |
| | | |
| | | public static final String VIDEO_THIRD_TYPE = "_VIDEO_THIRD_TYPE"; |
| | | |
| | | public static final String VIDEO_DETAIL = "_VIDEO_DETAIL"; |
| | | |
| | | public static void createTables(SQLiteDatabase db) { |
| | | db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" |
| | | + DownloadTable._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," |
| | | + DownloadTable.TASK_ID + " INTEGER," + DownloadTable.VIDEO_ID |
| | | + " TEXT," + DownloadTable.VIDEO_DETAIL_ID + " TEXT," |
| | | + DownloadTable.VIDEO_THIRD_TYPE + " TEXT," |
| | | + DownloadTable.VIDEO_DETAIL + " TEXT)"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.database; |
| | | |
| | | import android.content.Context; |
| | | import android.database.Cursor; |
| | | import android.database.sqlite.SQLiteDatabase; |
| | | import android.database.sqlite.SQLiteOpenHelper; |
| | | import android.util.Log; |
| | | |
| | | public class HanJuSQLiteOpenHelper extends SQLiteOpenHelper { |
| | | |
| | | private static final String TAG = "HanJuSQLiteOpenHelper"; |
| | | |
| | | /** |
| | | * 数据库名称 |
| | | */ |
| | | private static final String DATABASE_NAME = "hanju.db"; |
| | | |
| | | /** |
| | | * 数据库版本 |
| | | */ |
| | | private static int DATABASE_VERSION = 3; |
| | | |
| | | public HanJuSQLiteOpenHelper(Context context) { |
| | | super(context, DATABASE_NAME, null, DATABASE_VERSION); |
| | | Log.i(TAG, "HanJuSQLiteOpenHelper"); |
| | | } |
| | | |
| | | @Override |
| | | public void onCreate(SQLiteDatabase db) { |
| | | Log.i(TAG, "onCreate"); |
| | | WatchHistoryTable.createTables(db); |
| | | DownloadTable.createTables(db); |
| | | MessageTable.createTables(db); |
| | | } |
| | | |
| | | //原来的数据库表重命名 |
| | | public static final String TEMP_SQL_CREATE_TABLE_SUBSCRIBE = "alter table " + WatchHistoryTable.TABLE_NAME + " rename to temp_" + WatchHistoryTable.TABLE_NAME; |
| | | public static final String TEMP_SQL_ADD_LINE = "ALTER TABLE " + WatchHistoryTable.TABLE_NAME + " ADD column " + WatchHistoryTable.VIDEO_RESOURCE_ID + " TEXT"; |
| | | |
| | | public static final String INSERT_SUBSCRIBE = "select insert into " + WatchHistoryTable.TABLE_NAME + " from temp_" + WatchHistoryTable.TABLE_NAME; |
| | | public static final String DROP_TEMP_SUBSCRIBE = "drop table if exists temp_" + WatchHistoryTable.TABLE_NAME; |
| | | public static final String DROP_TEMP_SUBSCRIBE1 = "drop table if exists " + WatchHistoryTable.TABLE_NAME; |
| | | |
| | | @Override |
| | | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { |
| | | Log.i("mResult", "onUpgrade"); |
| | | for (int i = oldVersion; i <= newVersion; i++) { |
| | | switch (i) { |
| | | case 2: { |
| | | Log.i(TAG, "onUpgrade创建新表" + newVersion); |
| | | MessageTable.createTables(db); |
| | | } |
| | | break; |
| | | case 3: { |
| | | Log.i("mResult", "onUpgrade" + newVersion); |
| | | // db.execSQL("alter table 'WATCH_HISTORY' add '_VIDEO_RESOURCE_ID' TEXT"); |
| | | // db.execSQL("alter table " + WatchHistoryTable.TABLE_NAME + " add column " + WatchHistoryTable.VIDEO_RESOURCE_ID + " TEXT"); |
| | | |
| | | //创建临时表 |
| | | // db.execSQL(TEMP_SQL_CREATE_TABLE_SUBSCRIBE); |
| | | // WatchHistoryTable.createTables(db); |
| | | // db.execSQL(TEMP_SQL_ADD_LINE); |
| | | // //执行OnCreate方法,这个方法中放的是表的初始化操作工作,比如创建新表之类的 |
| | | //// //将临时表中的数据放入表A |
| | | // Cursor cursor = db.rawQuery(INSERT_SUBSCRIBE, null); |
| | | // if (cursor.moveToFirst()) { |
| | | // do { |
| | | // db.execSQL(cursor.getString(cursor |
| | | // .getColumnIndex(WatchHistoryTable.VIDEO_RESOURCE_ID))); |
| | | // } while (cursor.moveToNext()); |
| | | // } |
| | | // cursor.close();//将临时表删除掉 |
| | | // db.execSQL(DROP_TEMP_SUBSCRIBE1); |
| | | // WatchHistoryTable.createTables(db); |
| | | db.execSQL("alter table " + WatchHistoryTable.TABLE_NAME + " add column " + WatchHistoryTable.VIDEO_RESOURCE + " TEXT"); |
| | | db.execSQL("alter table " + WatchHistoryTable.TABLE_NAME + " add column " + WatchHistoryTable.VIDEO_RESOURCE_ID + " TEXT"); |
| | | Cursor cursor = db.query(WatchHistoryTable.TABLE_NAME, null, |
| | | WatchHistoryTable.VIDEO_ID + " = ? ", |
| | | new String[]{"1090602"}, null, null, null); |
| | | Log.i("mResult", "表的列数有:" + cursor.getColumnCount()); |
| | | } |
| | | break; |
| | | case 4: { |
| | | |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.database; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | import android.content.ContentProvider; |
| | | import android.content.ContentUris; |
| | | import android.content.ContentValues; |
| | | import android.content.UriMatcher; |
| | | import android.database.Cursor; |
| | | import android.database.SQLException; |
| | | import android.database.sqlite.SQLiteDatabase; |
| | | import android.database.sqlite.SQLiteQueryBuilder; |
| | | import android.net.Uri; |
| | | import androidx.core.database.DatabaseUtilsCompat; |
| | | |
| | | public class MessageProvider extends ContentProvider { |
| | | |
| | | // A projection map used to select columns from the database |
| | | private final HashMap<String, String> mNotesProjectionMap; |
| | | // Uri matcher to decode incoming URIs. |
| | | private final UriMatcher mUriMatcher; |
| | | |
| | | // The incoming URI matches the main table URI pattern |
| | | private static final int MESSAGE = 1; |
| | | // The incoming URI matches the main table row ID URI pattern |
| | | private static final int MESSAGE_ID = 2; |
| | | |
| | | // Handle to a new DatabaseHelper. |
| | | private HanJuSQLiteOpenHelper mOpenHelper; |
| | | |
| | | /** |
| | | * Global provider initialization. |
| | | */ |
| | | public MessageProvider() { |
| | | // Create and initialize URI matcher. |
| | | mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); |
| | | mUriMatcher.addURI(MessageTable.AUTHORITY, "messages", MESSAGE); |
| | | mUriMatcher.addURI(MessageTable.AUTHORITY, "messages/#", MESSAGE_ID); |
| | | |
| | | // Create and initialize projection map for all columns. This is |
| | | // simply an identity mapping. |
| | | mNotesProjectionMap = new HashMap<String, String>(); |
| | | mNotesProjectionMap.put(MessageTable._ID, MessageTable._ID); |
| | | mNotesProjectionMap.put(MessageTable.MESSAGE_ID, MessageTable.MESSAGE_ID); |
| | | mNotesProjectionMap.put(MessageTable.MESSAGE_TITLE, MessageTable.MESSAGE_TITLE); |
| | | mNotesProjectionMap.put(MessageTable.MESSAGE_CONTENT, MessageTable.MESSAGE_CONTENT); |
| | | mNotesProjectionMap.put(MessageTable.MESSAGE_STATUS, MessageTable.MESSAGE_STATUS); |
| | | mNotesProjectionMap.put(MessageTable.UPDATE_TIME, MessageTable.UPDATE_TIME); |
| | | mNotesProjectionMap.put(MessageTable.CREATE_TIME, MessageTable.CREATE_TIME); |
| | | } |
| | | |
| | | /** |
| | | * Perform provider creation. |
| | | */ |
| | | @Override |
| | | public boolean onCreate() { |
| | | mOpenHelper = new HanJuSQLiteOpenHelper(getContext()); |
| | | // Assumes that any failures will be reported by a thrown exception. |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Return the MIME type for an known URI in the provider. |
| | | */ |
| | | @Override |
| | | public String getType(Uri uri) { |
| | | switch (mUriMatcher.match(uri)) { |
| | | case MESSAGE: |
| | | return MessageTable.CONTENT_TYPE; |
| | | case MESSAGE_ID: |
| | | return MessageTable.CONTENT_ITEM_TYPE; |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Handle incoming queries. |
| | | */ |
| | | @Override |
| | | public Cursor query(Uri uri, String[] projection, String selection, |
| | | String[] selectionArgs, String sortOrder) { |
| | | Cursor c; |
| | | SQLiteDatabase db = mOpenHelper.getReadableDatabase(); |
| | | switch (mUriMatcher.match(uri)) { |
| | | case MESSAGE: { |
| | | // Constructs a new query builder and sets its table name |
| | | SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); |
| | | qb.setTables(getTableName(uri)); |
| | | // If the incoming URI is for main table. |
| | | qb.setProjectionMap(mNotesProjectionMap); |
| | | c = qb.query(db, projection, selection, selectionArgs, |
| | | null /* no group */, null /* no filter */, sortOrder); |
| | | } |
| | | break; |
| | | case MESSAGE_ID: { |
| | | // Constructs a new query builder and sets its table name |
| | | SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); |
| | | qb.setTables(getTableName(uri)); |
| | | // The incoming URI is for a single row. |
| | | qb.setProjectionMap(mNotesProjectionMap); |
| | | qb.appendWhere(MessageTable._ID + "=?"); |
| | | selectionArgs = DatabaseUtilsCompat.appendSelectionArgs(selectionArgs, |
| | | new String[] { uri.getLastPathSegment() }); |
| | | c = qb.query(db, projection, selection, selectionArgs, |
| | | null /* no group */, null /* no filter */, sortOrder); |
| | | } |
| | | break; |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | c.setNotificationUri(getContext().getContentResolver(), uri); |
| | | return c; |
| | | } |
| | | |
| | | /** |
| | | * Handler inserting new data. |
| | | */ |
| | | @Override |
| | | public Uri insert(Uri uri, ContentValues initialValues) { |
| | | if (mUriMatcher.match(uri) != MESSAGE) { |
| | | // Can only insert into to main URI. |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | |
| | | ContentValues values; |
| | | |
| | | if (initialValues != null) { |
| | | values = new ContentValues(initialValues); |
| | | } else { |
| | | values = new ContentValues(); |
| | | } |
| | | |
| | | SQLiteDatabase db = mOpenHelper.getWritableDatabase(); |
| | | long rowId = db.insert(MessageTable.TABLE_NAME, null, values); |
| | | // If the insert succeeded, the row ID exists. |
| | | if (rowId > 0) { |
| | | Uri noteUri = ContentUris.withAppendedId(MessageTable.CONTENT_URI, rowId); |
| | | getContext().getContentResolver().notifyChange(noteUri, null); |
| | | return noteUri; |
| | | } |
| | | |
| | | throw new SQLException("Failed to insert row into " + uri); |
| | | } |
| | | |
| | | /** |
| | | * Handle deleting data. |
| | | */ |
| | | @Override |
| | | public int delete(Uri uri, String where, String[] whereArgs) { |
| | | SQLiteDatabase db = mOpenHelper.getWritableDatabase(); |
| | | String finalWhere; |
| | | |
| | | int count; |
| | | |
| | | switch (mUriMatcher.match(uri)) { |
| | | case MESSAGE: |
| | | // If URI is main table, delete uses incoming where clause and args. |
| | | count = db.delete(MessageTable.TABLE_NAME, where, whereArgs); |
| | | break; |
| | | |
| | | // If the incoming URI matches a single note ID, does the delete based on the |
| | | // incoming data, but modifies the where clause to restrict it to the |
| | | // particular note ID. |
| | | case MESSAGE_ID: |
| | | // If URI is for a particular row ID, delete is based on incoming |
| | | // data but modified to restrict to the given ID. |
| | | finalWhere = DatabaseUtilsCompat.concatenateWhere( |
| | | MessageTable._ID + " = " + uri.getLastPathSegment(), where); |
| | | count = db.delete(MessageTable.TABLE_NAME, finalWhere, whereArgs); |
| | | break; |
| | | |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | getContext().getContentResolver().notifyChange(uri, null); |
| | | |
| | | return count; |
| | | } |
| | | |
| | | /** |
| | | * Handle updating data. |
| | | */ |
| | | @Override |
| | | public int update(Uri uri, ContentValues values, String where, String[] whereArgs) { |
| | | SQLiteDatabase db = mOpenHelper.getWritableDatabase(); |
| | | int count; |
| | | String finalWhere; |
| | | |
| | | switch (mUriMatcher.match(uri)) { |
| | | case MESSAGE: |
| | | // If URI is main table, update uses incoming where clause and args. |
| | | count = db.update(MessageTable.TABLE_NAME, values, where, whereArgs); |
| | | break; |
| | | |
| | | case MESSAGE_ID: |
| | | // If URI is for a particular row ID, update is based on incoming |
| | | // data but modified to restrict to the given ID. |
| | | finalWhere = DatabaseUtilsCompat.concatenateWhere( |
| | | MessageTable._ID + " = " + uri.getLastPathSegment(), where); |
| | | count = db.update(MessageTable.TABLE_NAME, values, finalWhere, whereArgs); |
| | | break; |
| | | |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | getContext().getContentResolver().notifyChange(uri, null); |
| | | |
| | | return count; |
| | | } |
| | | |
| | | private String getTableName(Uri uri) { |
| | | switch (mUriMatcher.match(uri)) { |
| | | case MESSAGE: |
| | | case MESSAGE_ID: |
| | | return MessageTable.TABLE_NAME; |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.database; |
| | | |
| | | import android.database.sqlite.SQLiteDatabase; |
| | | import android.net.Uri; |
| | | import android.provider.BaseColumns; |
| | | |
| | | public class MessageTable implements BaseColumns { |
| | | |
| | | public static final String AUTHORITY = "com.hanju.video.provider.message"; |
| | | |
| | | public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + "messages"); |
| | | /** |
| | | * The MIME type of {@link #CONTENT_URI}. |
| | | */ |
| | | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.weikou.message"; |
| | | /** |
| | | * The MIME type of a {@link #CONTENT_URI} sub-directory of a single row. |
| | | */ |
| | | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.weikou.message"; |
| | | |
| | | public static final String TABLE_NAME = "MESSAGE"; |
| | | |
| | | public static final String MESSAGE_ID = "_MESSAGE_ID"; |
| | | |
| | | public static final String MESSAGE_TITLE = "_MESSAGE_TITLE"; |
| | | |
| | | public static final String MESSAGE_CONTENT = "_MESSAGE_CONTENT"; |
| | | |
| | | public static final String MESSAGE_STATUS = "_MESSAGE_STATUS"; |
| | | |
| | | public static final String UPDATE_TIME = "_UPDATE_TIME"; |
| | | |
| | | public static final String CREATE_TIME = "_CREATE_TIME"; |
| | | |
| | | public static void createTables(SQLiteDatabase db) { |
| | | db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" |
| | | + MessageTable._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," |
| | | + MessageTable.MESSAGE_ID + " TEXT," |
| | | + MessageTable.MESSAGE_TITLE + " TEXT," |
| | | + MessageTable.MESSAGE_CONTENT + " TEXT," |
| | | + MessageTable.MESSAGE_STATUS + " INTEGER," |
| | | + MessageTable.UPDATE_TIME + " INTEGER," |
| | | + MessageTable.CREATE_TIME + " INTEGER)"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.database; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | import android.content.ContentProvider; |
| | | import android.content.ContentUris; |
| | | import android.content.ContentValues; |
| | | import android.content.UriMatcher; |
| | | import android.database.Cursor; |
| | | import android.database.SQLException; |
| | | import android.database.sqlite.SQLiteDatabase; |
| | | import android.database.sqlite.SQLiteQueryBuilder; |
| | | import android.net.Uri; |
| | | import androidx.core.database.DatabaseUtilsCompat; |
| | | import android.util.Log; |
| | | |
| | | public class WatchHistoryProvider extends ContentProvider { |
| | | |
| | | // A projection map used to select columns from the database |
| | | private final HashMap<String, String> mNotesProjectionMap; |
| | | // Uri matcher to decode incoming URIs. |
| | | private final UriMatcher mUriMatcher; |
| | | |
| | | // The incoming URI matches the main table URI pattern |
| | | private static final int WATCH_HISTORY = 1; |
| | | // The incoming URI matches the main table row ID URI pattern |
| | | private static final int WATCH_HISTORY_ID = 2; |
| | | |
| | | // Handle to a new DatabaseHelper. |
| | | private HanJuSQLiteOpenHelper mOpenHelper; |
| | | |
| | | /** |
| | | * Global provider initialization. |
| | | */ |
| | | public WatchHistoryProvider() { |
| | | // Create and initialize URI matcher. |
| | | mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); |
| | | mUriMatcher.addURI(WatchHistoryTable.AUTHORITY, "watchhistories", WATCH_HISTORY); |
| | | mUriMatcher.addURI(WatchHistoryTable.AUTHORITY, "watchhistories/#", WATCH_HISTORY_ID); |
| | | |
| | | // Create and initialize projection map for all columns. This is |
| | | // simply an identity mapping. |
| | | mNotesProjectionMap = new HashMap<>(); |
| | | mNotesProjectionMap.put(WatchHistoryTable._ID, WatchHistoryTable._ID); |
| | | mNotesProjectionMap.put(WatchHistoryTable.VIDEO_ID, WatchHistoryTable.VIDEO_ID); |
| | | mNotesProjectionMap.put(WatchHistoryTable.VIDEO_DETAIL_ID, WatchHistoryTable.VIDEO_DETAIL_ID); |
| | | mNotesProjectionMap.put(WatchHistoryTable.VIDEO_THIRD_TYPE, WatchHistoryTable.VIDEO_THIRD_TYPE); |
| | | mNotesProjectionMap.put(WatchHistoryTable.VIDEO_DETAIL, WatchHistoryTable.VIDEO_DETAIL); |
| | | mNotesProjectionMap.put(WatchHistoryTable.WATCH_TIME, WatchHistoryTable.WATCH_TIME); |
| | | mNotesProjectionMap.put(WatchHistoryTable.UPDATE_TIME, WatchHistoryTable.UPDATE_TIME); |
| | | mNotesProjectionMap.put(WatchHistoryTable.CREATE_TIME, WatchHistoryTable.CREATE_TIME); |
| | | mNotesProjectionMap.put(WatchHistoryTable.VIDEO_RESOURCE, WatchHistoryTable.VIDEO_RESOURCE); |
| | | mNotesProjectionMap.put(WatchHistoryTable.VIDEO_RESOURCE_ID, WatchHistoryTable.VIDEO_RESOURCE_ID); |
| | | } |
| | | |
| | | /** |
| | | * Perform provider creation. |
| | | */ |
| | | @Override |
| | | public boolean onCreate() { |
| | | mOpenHelper = new HanJuSQLiteOpenHelper(getContext()); |
| | | // Assumes that any failures will be reported by a thrown exception. |
| | | Log.i("mResult", "HanJuSQLiteOpenHelper"); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Return the MIME type for an known URI in the provider. |
| | | */ |
| | | @Override |
| | | public String getType(Uri uri) { |
| | | switch (mUriMatcher.match(uri)) { |
| | | case WATCH_HISTORY: |
| | | return WatchHistoryTable.CONTENT_TYPE; |
| | | case WATCH_HISTORY_ID: |
| | | return WatchHistoryTable.CONTENT_ITEM_TYPE; |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Handle incoming queries. |
| | | */ |
| | | @Override |
| | | public Cursor query(Uri uri, String[] projection, String selection, |
| | | String[] selectionArgs, String sortOrder) { |
| | | Cursor c; |
| | | SQLiteDatabase db = mOpenHelper.getReadableDatabase(); |
| | | switch (mUriMatcher.match(uri)) { |
| | | case WATCH_HISTORY: { |
| | | // Constructs a new query builder and sets its table name |
| | | SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); |
| | | qb.setTables(getTableName(uri)); |
| | | // If the incoming URI is for main table. |
| | | qb.setProjectionMap(mNotesProjectionMap); |
| | | c = qb.query(db, projection, selection, selectionArgs, |
| | | null /* no group */, null /* no filter */, sortOrder); |
| | | } |
| | | break; |
| | | case WATCH_HISTORY_ID: { |
| | | // Constructs a new query builder and sets its table name |
| | | SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); |
| | | qb.setTables(getTableName(uri)); |
| | | // The incoming URI is for a single row. |
| | | qb.setProjectionMap(mNotesProjectionMap); |
| | | qb.appendWhere(WatchHistoryTable._ID + "=?"); |
| | | selectionArgs = DatabaseUtilsCompat.appendSelectionArgs(selectionArgs, |
| | | new String[] { uri.getLastPathSegment() }); |
| | | c = qb.query(db, projection, selection, selectionArgs, |
| | | null /* no group */, null /* no filter */, sortOrder); |
| | | } |
| | | break; |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | c.setNotificationUri(getContext().getContentResolver(), uri); |
| | | return c; |
| | | } |
| | | |
| | | /** |
| | | * Handler inserting new data. |
| | | */ |
| | | @Override |
| | | public Uri insert(Uri uri, ContentValues initialValues) { |
| | | if (mUriMatcher.match(uri) != WATCH_HISTORY) { |
| | | // Can only insert into to main URI. |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | |
| | | ContentValues values; |
| | | |
| | | if (initialValues != null) { |
| | | values = new ContentValues(initialValues); |
| | | } else { |
| | | values = new ContentValues(); |
| | | } |
| | | |
| | | SQLiteDatabase db = mOpenHelper.getWritableDatabase(); |
| | | long rowId = db.insert(WatchHistoryTable.TABLE_NAME, null, values); |
| | | // If the insert succeeded, the row ID exists. |
| | | if (rowId > 0) { |
| | | Uri noteUri = ContentUris.withAppendedId(WatchHistoryTable.CONTENT_URI, rowId); |
| | | getContext().getContentResolver().notifyChange(noteUri, null); |
| | | return noteUri; |
| | | } |
| | | |
| | | throw new SQLException("Failed to insert row into " + uri); |
| | | } |
| | | |
| | | /** |
| | | * Handle deleting data. |
| | | */ |
| | | @Override |
| | | public int delete(Uri uri, String where, String[] whereArgs) { |
| | | SQLiteDatabase db = mOpenHelper.getWritableDatabase(); |
| | | String finalWhere; |
| | | |
| | | int count; |
| | | |
| | | switch (mUriMatcher.match(uri)) { |
| | | case WATCH_HISTORY: |
| | | // If URI is main table, delete uses incoming where clause and args. |
| | | count = db.delete(WatchHistoryTable.TABLE_NAME, where, whereArgs); |
| | | break; |
| | | |
| | | // If the incoming URI matches a single note ID, does the delete based on the |
| | | // incoming data, but modifies the where clause to restrict it to the |
| | | // particular note ID. |
| | | case WATCH_HISTORY_ID: |
| | | // If URI is for a particular row ID, delete is based on incoming |
| | | // data but modified to restrict to the given ID. |
| | | finalWhere = DatabaseUtilsCompat.concatenateWhere( |
| | | WatchHistoryTable._ID + " = " + uri.getLastPathSegment(), where); |
| | | count = db.delete(WatchHistoryTable.TABLE_NAME, finalWhere, whereArgs); |
| | | break; |
| | | |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | getContext().getContentResolver().notifyChange(uri, null); |
| | | |
| | | return count; |
| | | } |
| | | |
| | | /** |
| | | * Handle updating data. |
| | | */ |
| | | @Override |
| | | public int update(Uri uri, ContentValues values, String where, String[] whereArgs) { |
| | | SQLiteDatabase db = mOpenHelper.getWritableDatabase(); |
| | | int count; |
| | | String finalWhere; |
| | | |
| | | switch (mUriMatcher.match(uri)) { |
| | | case WATCH_HISTORY: |
| | | // If URI is main table, update uses incoming where clause and args. |
| | | count = db.update(WatchHistoryTable.TABLE_NAME, values, where, whereArgs); |
| | | break; |
| | | |
| | | case WATCH_HISTORY_ID: |
| | | // If URI is for a particular row ID, update is based on incoming |
| | | // data but modified to restrict to the given ID. |
| | | finalWhere = DatabaseUtilsCompat.concatenateWhere( |
| | | WatchHistoryTable._ID + " = " + uri.getLastPathSegment(), where); |
| | | count = db.update(WatchHistoryTable.TABLE_NAME, values, finalWhere, whereArgs); |
| | | break; |
| | | |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | getContext().getContentResolver().notifyChange(uri, null); |
| | | |
| | | return count; |
| | | } |
| | | |
| | | private String getTableName(Uri uri) { |
| | | switch (mUriMatcher.match(uri)) { |
| | | case WATCH_HISTORY: |
| | | case WATCH_HISTORY_ID: |
| | | return WatchHistoryTable.TABLE_NAME; |
| | | default: |
| | | throw new IllegalArgumentException("Unknown URI " + uri); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.database; |
| | | |
| | | import android.database.sqlite.SQLiteDatabase; |
| | | import android.net.Uri; |
| | | import android.provider.BaseColumns; |
| | | |
| | | public class WatchHistoryTable implements BaseColumns { |
| | | |
| | | public static final String AUTHORITY = "com.hanju.video.provider.watchhistory"; |
| | | |
| | | public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + "watchhistories"); |
| | | /** |
| | | * The MIME type of {@link #CONTENT_URI}. |
| | | */ |
| | | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.weikou.watchhistory"; |
| | | /** |
| | | * The MIME type of a {@link #CONTENT_URI} sub-directory of a single row. |
| | | */ |
| | | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.weikou.watchhistory"; |
| | | |
| | | public static final String TABLE_NAME = "WATCH_HISTORY"; |
| | | |
| | | public static final String VIDEO_ID = "_VIDEO_ID"; |
| | | |
| | | public static final String VIDEO_DETAIL_ID = "_VIDEO_DETAIL_ID"; |
| | | |
| | | public static final String VIDEO_THIRD_TYPE = "_VIDEO_THIRD_TYPE"; |
| | | |
| | | public static final String VIDEO_DETAIL = "_VIDEO_DETAIL"; |
| | | |
| | | public static final String VIDEO_RESOURCE = "_VIDEO_RESOURCE"; |
| | | |
| | | public static final String VIDEO_RESOURCE_ID = "_VIDEO_RESOURCE_ID"; |
| | | |
| | | public static final String WATCH_TIME = "_WATCH_TIME"; |
| | | |
| | | public static final String UPDATE_TIME = "_UPDATE_TIME"; |
| | | |
| | | public static final String CREATE_TIME = "_CREATE_TIME"; |
| | | |
| | | public static void createTables(SQLiteDatabase db) { |
| | | db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" |
| | | + WatchHistoryTable._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," |
| | | + WatchHistoryTable.VIDEO_ID + " TEXT," |
| | | + WatchHistoryTable.VIDEO_DETAIL_ID + " TEXT," |
| | | + WatchHistoryTable.VIDEO_THIRD_TYPE + " TEXT," |
| | | + WatchHistoryTable.VIDEO_DETAIL + " TEXT," |
| | | + WatchHistoryTable.WATCH_TIME + " INTEGER," |
| | | + WatchHistoryTable.UPDATE_TIME + " INTEGER," |
| | | + WatchHistoryTable.CREATE_TIME + " INTEGER," |
| | | + WatchHistoryTable.VIDEO_RESOURCE + " TEXT," |
| | | + WatchHistoryTable.VIDEO_RESOURCE_ID + " TEXT)"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.ad; |
| | | |
| | | import android.os.Parcel; |
| | | import android.os.Parcelable; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.common.AdminInfo; |
| | | |
| | | |
| | | public class AdTag implements Parcelable { |
| | | @Expose |
| | | private String id; |
| | | @Expose |
| | | private String picture; |
| | | private AdminInfo admin; |
| | | private String beizhu; |
| | | @Expose |
| | | private String createtime; |
| | | |
| | | @Override |
| | | public void writeToParcel(Parcel dest, int flags) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public int describeContents() { |
| | | return 0; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | | |
| | | public void setPicture(String picture) { |
| | | this.picture = picture; |
| | | } |
| | | |
| | | public AdminInfo getAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(AdminInfo admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | public String getBeizhu() { |
| | | return beizhu; |
| | | } |
| | | |
| | | public void setBeizhu(String beizhu) { |
| | | this.beizhu = beizhu; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.ad; |
| | | |
| | | |
| | | import com.hanju.video.app.entity.common.AdminInfo; |
| | | |
| | | public class AdType { |
| | | private int progress;//下载SO库借用 |
| | | private String id; |
| | | private String name; |
| | | private String createtime; |
| | | private String beizhu; |
| | | private AdminInfo admin; |
| | | |
| | | public int getProgress() { |
| | | return progress; |
| | | } |
| | | |
| | | public void setProgress(int progress) { |
| | | this.progress = progress; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public String getBeizhu() { |
| | | return beizhu; |
| | | } |
| | | |
| | | public void setBeizhu(String beizhu) { |
| | | this.beizhu = beizhu; |
| | | } |
| | | |
| | | public AdminInfo getAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(AdminInfo admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.ad; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | |
| | | //通用广告类 |
| | | public class CommonAd { |
| | | @Expose |
| | | private String id; |
| | | @Expose |
| | | private String name; |
| | | @Expose |
| | | private int linkType; |
| | | @Expose |
| | | private String link; |
| | | @Expose |
| | | private String picture; |
| | | @Expose |
| | | private String pid; |
| | | @Expose |
| | | private String desc; |
| | | |
| | | private boolean show; |
| | | private String beizhu; |
| | | private String createtime; |
| | | |
| | | public String getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(String pid) { |
| | | this.pid = pid; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public void setDesc(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public int getLinkType() { |
| | | return linkType; |
| | | } |
| | | |
| | | public void setLinkType(int linkType) { |
| | | this.linkType = linkType; |
| | | } |
| | | |
| | | public String getLink() { |
| | | return link; |
| | | } |
| | | |
| | | public void setLink(String link) { |
| | | this.link = link; |
| | | } |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | | |
| | | public void setPicture(String picture) { |
| | | this.picture = picture; |
| | | } |
| | | |
| | | public boolean isShow() { |
| | | return show; |
| | | } |
| | | |
| | | public void setShow(boolean show) { |
| | | this.show = show; |
| | | } |
| | | |
| | | public String getBeizhu() { |
| | | return beizhu; |
| | | } |
| | | |
| | | public void setBeizhu(String beizhu) { |
| | | this.beizhu = beizhu; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.common; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | public class AccumulateRule implements Serializable { |
| | | |
| | | /** |
| | | * serialVersionUID |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String name; |
| | | |
| | | private int score; |
| | | |
| | | private String description; |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public int getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(int score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.common; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class AdminInfo implements Serializable { |
| | | |
| | | /** |
| | | * serialVersionUID |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | private String id; |
| | | private String name; |
| | | private String createtime; |
| | | private String account; |
| | | private String pwd; |
| | | private String superadmin; |
| | | |
| | | public String getAccount() { |
| | | return account; |
| | | } |
| | | |
| | | public void setAccount(String account) { |
| | | this.account = account; |
| | | } |
| | | |
| | | public String getPwd() { |
| | | return pwd; |
| | | } |
| | | |
| | | public void setPwd(String pwd) { |
| | | this.pwd = pwd; |
| | | } |
| | | |
| | | public String getSuperadmin() { |
| | | return superadmin; |
| | | } |
| | | |
| | | public void setSuperadmin(String superadmin) { |
| | | this.superadmin = superadmin; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.common; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2017/3/7. |
| | | */ |
| | | |
| | | public class JumpDetail implements Serializable { |
| | | @Expose |
| | | private String activity; |
| | | @Expose |
| | | private String id; |
| | | @Expose |
| | | private String name; |
| | | @Expose |
| | | private String type; |
| | | @Expose |
| | | private boolean needLogin; |
| | | @Expose |
| | | private String controller; |
| | | |
| | | public String getActivity() { |
| | | return activity; |
| | | } |
| | | |
| | | public void setActivity(String activity) { |
| | | this.activity = activity; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getController() { |
| | | return controller; |
| | | } |
| | | |
| | | public void setController(String controller) { |
| | | this.controller = controller; |
| | | } |
| | | |
| | | public boolean isNeedLogin() { |
| | | return needLogin; |
| | | } |
| | | |
| | | public void setNeedLogin(boolean needLogin) { |
| | | this.needLogin = needLogin; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.common; |
| | | |
| | | public class SDCardEntity { |
| | | private String path; |
| | | private long totalSize; |
| | | private long availableSize; |
| | | |
| | | public String getPath() { |
| | | return path; |
| | | } |
| | | |
| | | public void setPath(String path) { |
| | | this.path = path; |
| | | } |
| | | |
| | | public long getTotalSize() { |
| | | return totalSize; |
| | | } |
| | | |
| | | public void setTotalSize(long totalSize) { |
| | | this.totalSize = totalSize; |
| | | } |
| | | |
| | | public long getAvailableSize() { |
| | | return availableSize; |
| | | } |
| | | |
| | | public void setAvailableSize(long availableSize) { |
| | | this.availableSize = availableSize; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.common; |
| | | |
| | | import com.hanju.video.app.entity.common.AdminInfo; |
| | | |
| | | /** |
| | | * ϵͳ��Ϣ�� |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class SystemInfo { |
| | | private String id; |
| | | private String name; |
| | | private String createtime; |
| | | private AdminInfo admin; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public AdminInfo getAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(AdminInfo admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.goods; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.user.UserInfo; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2017/1/10. |
| | | * 评论信息--评论列表 |
| | | */ |
| | | public class GoodsComments { |
| | | @Expose |
| | | private String Id;//商品本地ID |
| | | @Expose |
| | | private String Content;//评论内容 |
| | | @Expose |
| | | private String Createtime;//评论时间 |
| | | @Expose |
| | | private UserInfo User; |
| | | |
| | | public UserInfo getUser() { |
| | | return User; |
| | | } |
| | | |
| | | public void setUser(UserInfo user) { |
| | | User = user; |
| | | } |
| | | |
| | | public String getId() { |
| | | return Id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.Id = id; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return Content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | Content = content; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return Createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | Createtime = createtime; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.goods; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.user.UserInfo; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2017/1/10. |
| | | * 商品介绍--商品列表 |
| | | */ |
| | | |
| | | public class GoodsInfo implements Serializable { |
| | | @Expose |
| | | private UserInfo loginUser;//用户信息 |
| | | @Expose |
| | | private Ware Item;//商品信息 |
| | | @Expose |
| | | private String Collectcount;//收藏数 |
| | | @Expose |
| | | private String Commentcount;//评论数 |
| | | @Expose |
| | | private String Title;//首条评论 |
| | | @Expose |
| | | private String Collect;//收藏 |
| | | @Expose |
| | | private String Id;//收藏 |
| | | |
| | | public String getId() { |
| | | return Id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | Id = id; |
| | | } |
| | | |
| | | public String getCollect() { |
| | | return Collect; |
| | | } |
| | | |
| | | public void setCollect(String collect) { |
| | | Collect = collect; |
| | | } |
| | | |
| | | public void setLoginUser(UserInfo loginUser) { |
| | | this.loginUser = loginUser; |
| | | } |
| | | |
| | | public UserInfo getLoginUser() { |
| | | return loginUser; |
| | | } |
| | | |
| | | public Ware getItem() { |
| | | return Item; |
| | | } |
| | | |
| | | public void setItem(Ware item) { |
| | | this.Item = item; |
| | | } |
| | | |
| | | public String getCollectcount() { |
| | | return Collectcount; |
| | | } |
| | | |
| | | public void setCollectcount(String collectcount) { |
| | | Collectcount = collectcount; |
| | | } |
| | | |
| | | public String getCommentcount() { |
| | | return Commentcount; |
| | | } |
| | | |
| | | public void setCommentcount(String commentcount) { |
| | | Commentcount = commentcount; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return Title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | Title = title; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.goods; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2017/1/10. |
| | | * 商品信息--单个商品 |
| | | */ |
| | | |
| | | public class Ware implements Serializable { |
| | | @Expose |
| | | private String Id;//本地商品ID |
| | | @Expose |
| | | private String Num_iid;//淘宝商品ID |
| | | @Expose |
| | | private String Title;//商品名称 |
| | | @Expose |
| | | private String Pict_url;//商品图片 |
| | | private String SmallImages;//商品小图 |
| | | private String Reserve;//原价 |
| | | @Expose |
| | | private String Zk_final_price;//折扣价 |
| | | @Expose |
| | | private String Item_url;//商品链接 |
| | | @Expose |
| | | private String Click_url;//商品链接 |
| | | |
| | | public String getClick_url() { |
| | | return Click_url; |
| | | } |
| | | |
| | | public void setClick_url(String click_url) { |
| | | Click_url = click_url; |
| | | } |
| | | |
| | | public String getId() { |
| | | return Id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | Id = id; |
| | | } |
| | | |
| | | public String getNum_iid() { |
| | | return Num_iid; |
| | | } |
| | | |
| | | public void setNum_iid(String num_iid) { |
| | | Num_iid = num_iid; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return Title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | Title = title; |
| | | } |
| | | |
| | | public String getPict_url() { |
| | | return Pict_url; |
| | | } |
| | | |
| | | public void setPict_url(String pict_url) { |
| | | Pict_url = pict_url; |
| | | } |
| | | |
| | | public String getSmallImages() { |
| | | return SmallImages; |
| | | } |
| | | |
| | | public void setSmallImages(String smallImages) { |
| | | SmallImages = smallImages; |
| | | } |
| | | |
| | | public String getReserve() { |
| | | return Reserve; |
| | | } |
| | | |
| | | public void setReserve(String reserve) { |
| | | Reserve = reserve; |
| | | } |
| | | |
| | | public String getZk_final_price() { |
| | | return Zk_final_price; |
| | | } |
| | | |
| | | public void setZk_final_price(String zk_final_price) { |
| | | Zk_final_price = zk_final_price; |
| | | } |
| | | |
| | | public String getItem_url() { |
| | | return Item_url; |
| | | } |
| | | |
| | | public void setItem_url(String item_url) { |
| | | Item_url = item_url; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.recommend; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.ad.CommonAd; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoType; |
| | | |
| | | //大区推荐视频 |
| | | public class CategoryRecommendVideo { |
| | | private String id; |
| | | @Expose |
| | | private String picture; |
| | | @Expose |
| | | private String desc; |
| | | @Expose |
| | | private VideoInfo videoInfo; |
| | | @Expose |
| | | private int jpos; |
| | | private String createtime; |
| | | private VideoType videoType; |
| | | private int orderby; |
| | | private String beizhu; |
| | | @Expose |
| | | private CommonAd ad; |
| | | |
| | | public CommonAd getAd() { |
| | | return ad; |
| | | } |
| | | |
| | | public void setAd(CommonAd ad) { |
| | | this.ad = ad; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | | |
| | | public void setPicture(String picture) { |
| | | this.picture = picture; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public void setDesc(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public VideoInfo getVideoInfo() { |
| | | return videoInfo; |
| | | } |
| | | |
| | | public void setVideoInfo(VideoInfo videoInfo) { |
| | | this.videoInfo = videoInfo; |
| | | } |
| | | |
| | | public int getJpos() { |
| | | return jpos; |
| | | } |
| | | |
| | | public void setJpos(int jpos) { |
| | | this.jpos = jpos; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public VideoType getVideoType() { |
| | | return videoType; |
| | | } |
| | | |
| | | public void setVideoType(VideoType videoType) { |
| | | this.videoType = videoType; |
| | | } |
| | | |
| | | public int getOrderby() { |
| | | return orderby; |
| | | } |
| | | |
| | | public void setOrderby(int orderby) { |
| | | this.orderby = orderby; |
| | | } |
| | | |
| | | public String getBeizhu() { |
| | | return beizhu; |
| | | } |
| | | |
| | | public void setBeizhu(String beizhu) { |
| | | this.beizhu = beizhu; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.recommend; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.ad.AdTag; |
| | | import com.hanju.video.app.entity.common.AdminInfo; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * ��ҳ��� |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class HomeAd implements Serializable { |
| | | |
| | | public HomeAd(){ |
| | | |
| | | } |
| | | |
| | | @Expose |
| | | private String id; |
| | | @Expose |
| | | private AdTag tag; |
| | | private AdminInfo admin; |
| | | @Expose |
| | | private String picture; |
| | | //@Expose |
| | | private String createtime; |
| | | @Expose |
| | | private VideoInfo video; |
| | | private String starttime; |
| | | private String endtime; |
| | | @Expose |
| | | private String title; |
| | | private String beizhu; |
| | | @Expose |
| | | private int linkType; |
| | | @Expose |
| | | private String clazz; |
| | | @Expose |
| | | private String params; |
| | | |
| | | public int getLinkType() { |
| | | return linkType; |
| | | } |
| | | |
| | | public void setLinkType(int linkType) { |
| | | this.linkType = linkType; |
| | | } |
| | | |
| | | |
| | | |
| | | public String getClazz() { |
| | | return clazz; |
| | | } |
| | | |
| | | public void setClazz(String clazz) { |
| | | this.clazz = clazz; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public AdTag getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(AdTag tag) { |
| | | this.tag = tag; |
| | | } |
| | | |
| | | public AdminInfo getAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(AdminInfo admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | | |
| | | public void setPicture(String picture) { |
| | | this.picture = picture; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public VideoInfo getVideo() { |
| | | return video; |
| | | } |
| | | |
| | | public void setVideo(VideoInfo video) { |
| | | this.video = video; |
| | | } |
| | | |
| | | public String getStarttime() { |
| | | return starttime; |
| | | } |
| | | |
| | | public void setStarttime(String starttime) { |
| | | this.starttime = starttime; |
| | | } |
| | | |
| | | public String getEndtime() { |
| | | return endtime; |
| | | } |
| | | |
| | | public void setEndtime(String endtime) { |
| | | this.endtime = endtime; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public String getBeizhu() { |
| | | return beizhu; |
| | | } |
| | | |
| | | public void setBeizhu(String beizhu) { |
| | | this.beizhu = beizhu; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.recommend; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | |
| | | public class HomeSpecial implements Serializable { |
| | | public HomeSpecial() { |
| | | } |
| | | |
| | | private String icon; |
| | | private String name; |
| | | private String id; |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.recommend; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.common.AdminInfo; |
| | | import com.hanju.video.app.ui.category.bean.HotStar; |
| | | |
| | | |
| | | public class HomeType implements Serializable { |
| | | |
| | | public HomeType(){ |
| | | |
| | | } |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | @Expose |
| | | private String id; |
| | | @Expose |
| | | private String name; |
| | | @Expose |
| | | private String createtime; |
| | | private String beizhu; |
| | | private String orderby; |
| | | private AdminInfo admin; |
| | | @Expose |
| | | private int columns; |
| | | @Expose |
| | | private String activity; |
| | | @Expose |
| | | private String params; |
| | | @Expose |
| | | private String hasMore; |
| | | @Expose |
| | | private List<HomeVideo> homeVideoList; |
| | | @Expose |
| | | private List<HomeTypeItem> itemTypeList; |
| | | @Expose |
| | | private String icon; |
| | | |
| | | private List<VideoInfo> videoInfoList; |
| | | |
| | | public List<VideoInfo> getVideoInfoList() { |
| | | return videoInfoList; |
| | | } |
| | | |
| | | public void setVideoInfoList(List<VideoInfo> videoInfoList) { |
| | | this.videoInfoList = videoInfoList; |
| | | } |
| | | |
| | | private List<HotStar> hotStars; |
| | | |
| | | public List<HotStar> getHotStars() { |
| | | return hotStars; |
| | | } |
| | | |
| | | public void setHotStars(List<HotStar> hotStars) { |
| | | this.hotStars = hotStars; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public List<HomeTypeItem> getItemTypeList() { |
| | | return itemTypeList; |
| | | } |
| | | |
| | | public void setItemTypeList(List<HomeTypeItem> itemTypeList) { |
| | | this.itemTypeList = itemTypeList; |
| | | } |
| | | |
| | | public String getActivity() { |
| | | return activity; |
| | | } |
| | | |
| | | public void setActivity(String activity) { |
| | | this.activity = activity; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | public String getHasMore() { |
| | | return hasMore; |
| | | } |
| | | |
| | | public void setHasMore(String hasMore) { |
| | | this.hasMore = hasMore; |
| | | } |
| | | |
| | | public List<HomeVideo> getHomeVideoList() { |
| | | return homeVideoList; |
| | | } |
| | | |
| | | public void setHomeVideoList(List<HomeVideo> homeVideoList) { |
| | | this.homeVideoList = homeVideoList; |
| | | } |
| | | |
| | | public int getColumns() { |
| | | return columns; |
| | | } |
| | | |
| | | public void setColumns(int columns) { |
| | | this.columns = columns; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public String getBeizhu() { |
| | | return beizhu; |
| | | } |
| | | |
| | | public void setBeizhu(String beizhu) { |
| | | this.beizhu = beizhu; |
| | | } |
| | | |
| | | public String getOrderby() { |
| | | return orderby; |
| | | } |
| | | |
| | | public void setOrderby(String orderby) { |
| | | this.orderby = orderby; |
| | | } |
| | | |
| | | public AdminInfo getAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(AdminInfo admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.hanju.video.app.entity.recommend; |
| | | |
| | | import com.hanju.video.app.entity.HomeVideo; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | |
| | | /** |
New file |
| | |
| | | package com.hanju.video.app.entity.recommend; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | |
| | | public class HomeTypeItem { |
| | | public HomeTypeItem() { |
| | | |
| | | } |
| | | |
| | | private String id; |
| | | private HomeType parent; |
| | | @Expose |
| | | private HomeType item; |
| | | private String createtime; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public HomeType getParent() { |
| | | return parent; |
| | | } |
| | | |
| | | public void setParent(HomeType parent) { |
| | | this.parent = parent; |
| | | } |
| | | |
| | | public HomeType getItem() { |
| | | return item; |
| | | } |
| | | |
| | | public void setItem(HomeType item) { |
| | | this.item = item; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.recommend; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | |
| | | public class HomeVideo implements Serializable { |
| | | |
| | | public HomeVideo(){ |
| | | |
| | | } |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | @Expose |
| | | private String id; |
| | | private HomeType type; |
| | | @Expose |
| | | private VideoInfo video; |
| | | @Expose |
| | | private String tag;//简介 |
| | | @Expose |
| | | private String picture; |
| | | |
| | | // private IMvNativeAd ad;// 广告 |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(String tag) { |
| | | this.tag = tag; |
| | | } |
| | | |
| | | public HomeType getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(HomeType type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public VideoInfo getVideo() { |
| | | return video; |
| | | } |
| | | |
| | | public void setVideo(VideoInfo video) { |
| | | this.video = video; |
| | | } |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | | |
| | | public void setPicture(String picture) { |
| | | this.picture = picture; |
| | | } |
| | | |
| | | // public IMvNativeAd getAd() { |
| | | // return ad; |
| | | // } |
| | | // |
| | | // public void setAd(IMvNativeAd ad) { |
| | | // this.ad = ad; |
| | | // } |
| | | } |
| | |
| | | package com.hanju.video.app.entity.recommend; |
| | | |
| | | import com.hanju.video.app.entity.HomeAd; |
| | | import com.hanju.video.app.entity.HomeType; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | |
| | | import java.util.List; |
New file |
| | |
| | | package com.hanju.video.app.entity.recommend; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.ad.CommonAd; |
| | | |
| | | public class Special { |
| | | @Expose |
| | | private String id; |
| | | @Expose |
| | | private String name; |
| | | @Expose |
| | | private String picture; |
| | | @Expose |
| | | private String introduction; |
| | | private String createtime; |
| | | private int orderby; |
| | | private boolean show; |
| | | private boolean showonmain;// 是否在首页显示 |
| | | @Expose |
| | | private CommonAd commonAd;// 常规广告 |
| | | |
| | | public CommonAd getCommonAd() { |
| | | return commonAd; |
| | | } |
| | | |
| | | public void setCommonAd(CommonAd commonAd) { |
| | | this.commonAd = commonAd; |
| | | } |
| | | |
| | | public boolean isShowonmain() { |
| | | return showonmain; |
| | | } |
| | | |
| | | public void setShowonmain(boolean showonmain) { |
| | | this.showonmain = showonmain; |
| | | } |
| | | |
| | | public boolean isShow() { |
| | | return show; |
| | | } |
| | | |
| | | public void setShow(boolean show) { |
| | | this.show = show; |
| | | } |
| | | |
| | | public Special() { |
| | | } |
| | | |
| | | public Special(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | | |
| | | public void setPicture(String picture) { |
| | | this.picture = picture; |
| | | } |
| | | |
| | | public String getIntroduction() { |
| | | return introduction; |
| | | } |
| | | |
| | | public void setIntroduction(String introduction) { |
| | | this.introduction = introduction; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public int getOrderby() { |
| | | return orderby; |
| | | } |
| | | |
| | | public void setOrderby(int orderby) { |
| | | this.orderby = orderby; |
| | | } |
| | | } |
| | |
| | | import android.widget.FrameLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import com.lcjian.library.widget.RatioLayout; |
| | | import com.hanju.lib.library.widget.RatioLayout; |
| | | import com.hanju.video.app.R; |
| | | |
| | | public class RecommendVideoAdHolder extends RecyclerView.ViewHolder { |
New file |
| | |
| | | package com.hanju.video.app.entity.user; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | |
| | | |
| | | public class Attention { |
| | | @Expose |
| | | private long id; |
| | | @Expose |
| | | private VideoInfo videoInfo; |
| | | @Expose |
| | | private boolean isAttention = false; |
| | | private String createtime; |
| | | private boolean show; |
| | | |
| | | public boolean isAttention() { |
| | | return isAttention; |
| | | } |
| | | |
| | | public void setAttention(boolean attention) { |
| | | isAttention = attention; |
| | | } |
| | | |
| | | public long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public VideoInfo getVideoInfo() { |
| | | return videoInfo; |
| | | } |
| | | |
| | | public void setVideoInfo(VideoInfo videoInfo) { |
| | | this.videoInfo = videoInfo; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public boolean isShow() { |
| | | return show; |
| | | } |
| | | |
| | | public void setShow(boolean show) { |
| | | this.show = show; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.user; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | |
| | | /** |
| | | * ���� |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class Comment { |
| | | @Expose |
| | | private String id; |
| | | @Expose |
| | | private VideoInfo video; |
| | | @Expose |
| | | private String createtime; |
| | | @Expose |
| | | private UserInfo user; |
| | | @Expose |
| | | private String content; |
| | | private String thirdType;// 0--自己 1-百度 |
| | | private boolean show;// 是否显示 |
| | | |
| | | public VideoInfo getVideo() { |
| | | return video; |
| | | } |
| | | |
| | | public void setVideo(VideoInfo video) { |
| | | this.video = video; |
| | | } |
| | | |
| | | @Expose |
| | | private List<CommentReply> replyList;// 回复列表 |
| | | |
| | | public List<CommentReply> getReplyList() { |
| | | return replyList; |
| | | } |
| | | |
| | | public void setReplyList(List<CommentReply> replyList) { |
| | | this.replyList = replyList; |
| | | } |
| | | |
| | | public Comment() { |
| | | |
| | | } |
| | | |
| | | public Comment(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public boolean isShow() { |
| | | return show; |
| | | } |
| | | |
| | | public void setShow(boolean show) { |
| | | this.show = show; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public UserInfo getUser() { |
| | | return user; |
| | | } |
| | | |
| | | public void setUser(UserInfo user) { |
| | | this.user = user; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public String getThirdType() { |
| | | return thirdType; |
| | | } |
| | | |
| | | public void setThirdType(String thirdType) { |
| | | this.thirdType = thirdType; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.user; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | |
| | | public class CommentReply { |
| | | |
| | | @Expose |
| | | private String id; |
| | | @Expose |
| | | private Comment comment; |
| | | @Expose |
| | | private UserInfo user; |
| | | @Expose |
| | | private String content; |
| | | @Expose |
| | | private String createtime; |
| | | @Expose |
| | | private boolean read; |
| | | @Expose |
| | | private CommentReply parent; |
| | | |
| | | public CommentReply() { |
| | | |
| | | } |
| | | |
| | | public CommentReply(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Comment getComment() { |
| | | return comment; |
| | | } |
| | | |
| | | public void setComment(Comment comment) { |
| | | this.comment = comment; |
| | | } |
| | | |
| | | public UserInfo getUser() { |
| | | return user; |
| | | } |
| | | |
| | | public void setUser(UserInfo user) { |
| | | this.user = user; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public boolean isRead() { |
| | | return read; |
| | | } |
| | | |
| | | public void setRead(boolean read) { |
| | | this.read = read; |
| | | } |
| | | |
| | | public CommentReply getParent() { |
| | | return parent; |
| | | } |
| | | |
| | | public void setParent(CommentReply parent) { |
| | | this.parent = parent; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.user; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2016/8/15. |
| | | * 关注相关实体 |
| | | */ |
| | | public class Follow implements Serializable { |
| | | private String movieName; |
| | | private String moviePicture; |
| | | private String updateInfo; |
| | | private boolean isAttention; |
| | | |
| | | public boolean isAttention() { |
| | | return isAttention; |
| | | } |
| | | |
| | | public void setAttention(boolean attention) { |
| | | isAttention = attention; |
| | | } |
| | | |
| | | public String getMovieName() { |
| | | return movieName; |
| | | } |
| | | |
| | | public void setMovieName(String movieName) { |
| | | this.movieName = movieName; |
| | | } |
| | | |
| | | public String getMoviePicture() { |
| | | return moviePicture; |
| | | } |
| | | |
| | | public void setMoviePicture(String moviePicture) { |
| | | this.moviePicture = moviePicture; |
| | | } |
| | | |
| | | public String getUpdateInfo() { |
| | | return updateInfo; |
| | | } |
| | | |
| | | public void setUpdateInfo(String updateInfo) { |
| | | this.updateInfo = updateInfo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.user; |
| | | |
| | | /** |
| | | * 传递eventbus信息 |
| | | * |
| | | * @author weikou2015 |
| | | * |
| | | */ |
| | | public class NewComment { |
| | | |
| | | boolean isChecked = false; |
| | | |
| | | public NewComment(boolean isChecked) { |
| | | this.isChecked = isChecked; |
| | | } |
| | | |
| | | public boolean getState() { |
| | | return isChecked; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.user; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.common.SystemInfo; |
| | | |
| | | /** |
| | | * �û���Ϣ |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class UserInfo { |
| | | private String id; |
| | | private String score; |
| | | private String device; |
| | | private String createtime; |
| | | @Expose |
| | | private String Portrait;// 用户头像 |
| | | @Expose |
| | | private String Nickname;// 用户昵称 |
| | | |
| | | public String getPortrait() { |
| | | return Portrait; |
| | | } |
| | | |
| | | public void setPortrait(String portrait) { |
| | | Portrait = portrait; |
| | | } |
| | | |
| | | public String getNickname() { |
| | | return Nickname; |
| | | } |
| | | |
| | | public void setNickname(String nickname) { |
| | | Nickname = nickname; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(String score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | public String getDevice() { |
| | | return device; |
| | | } |
| | | |
| | | public void setDevice(String device) { |
| | | this.device = device; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public SystemInfo getSystem() { |
| | | return system; |
| | | } |
| | | |
| | | public void setSystem(SystemInfo system) { |
| | | this.system = system; |
| | | } |
| | | |
| | | private SystemInfo system; |
| | | } |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.VideoType; |
| | | |
| | | public class HomeNav extends VideoType { |
| | | |
New file |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | |
| | | /** |
| | | * 么么直播实体类 |
| | | * |
| | | * @author weikou2015 |
| | | */ |
| | | public class MemeLiveInfo { |
| | | |
| | | @Expose |
| | | private String live_time;// 直播时间 |
| | | @Expose |
| | | private String star_name;// 主播昵称 |
| | | @Expose |
| | | private String level;// 主播等级 |
| | | @Expose |
| | | private String image_url;// 主播头像 |
| | | @Expose |
| | | private String star_id;// 主播ID |
| | | @Expose |
| | | private String audience_num;// 直播间观众数 |
| | | @Expose |
| | | private String online;// 主播是否在线 |
| | | @Expose |
| | | private String content_url;// 直播间web地址 |
| | | |
| | | |
| | | public String getLive_time() { |
| | | return live_time; |
| | | } |
| | | |
| | | public void setLive_time(String live_time) { |
| | | this.live_time = live_time; |
| | | } |
| | | |
| | | public String getStar_name() { |
| | | return star_name; |
| | | } |
| | | |
| | | public void setStar_name(String star_name) { |
| | | this.star_name = star_name; |
| | | } |
| | | |
| | | public String getLevel() { |
| | | return level; |
| | | } |
| | | |
| | | public void setLevel(String level) { |
| | | this.level = level; |
| | | } |
| | | |
| | | public String getImage_url() { |
| | | return image_url; |
| | | } |
| | | |
| | | public void setImage_url(String image_url) { |
| | | this.image_url = image_url; |
| | | } |
| | | |
| | | public String getStar_id() { |
| | | return star_id; |
| | | } |
| | | |
| | | public void setStar_id(String star_id) { |
| | | this.star_id = star_id; |
| | | } |
| | | |
| | | public String getAudience_num() { |
| | | return audience_num; |
| | | } |
| | | |
| | | public void setAudience_num(String audience_num) { |
| | | this.audience_num = audience_num; |
| | | } |
| | | |
| | | public String getOnline() { |
| | | return online; |
| | | } |
| | | |
| | | public void setOnline(String online) { |
| | | this.online = online; |
| | | } |
| | | |
| | | public String getContent_url() { |
| | | return content_url; |
| | | } |
| | | |
| | | public void setContent_url(String content_url) { |
| | | this.content_url = content_url; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | public class Play { |
| | | private PlayUrl playUrl; |
| | | |
| | | public PlayUrl getPlayUrl() { |
| | | return playUrl; |
| | | } |
| | | |
| | | public void setPlayUrl(PlayUrl playUrl) { |
| | | this.playUrl = playUrl; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | |
| | | public class PlayUrl implements Serializable { |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | @Expose |
| | | private VideoResource resource; |
| | | @Expose |
| | | private String url; |
| | | @Expose |
| | | private int playType;// 0、不可播 1、站外-html 2、站内-播放器 |
| | | @Expose |
| | | private String params; |
| | | |
| | | public VideoResource getResource() { |
| | | return resource; |
| | | } |
| | | |
| | | public void setResource(VideoResource resource) { |
| | | this.resource = resource; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public int getPlayType() { |
| | | return playType; |
| | | } |
| | | |
| | | public void setPlayType(int playType) { |
| | | this.playType = playType; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | public class Playlocation implements Serializable { |
| | | |
| | | int position; |
| | | |
| | | public int getPosition() { |
| | | return position; |
| | | } |
| | | |
| | | public void setPosition(int position) { |
| | | this.position = position; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2016/9/9. |
| | | */ |
| | | public class PushEpisode implements Serializable { |
| | | |
| | | int episodeNum; |
| | | |
| | | public int getEpisodeNum() { |
| | | return episodeNum; |
| | | } |
| | | |
| | | public void setEpisodeNum(int episodeNum) { |
| | | this.episodeNum = episodeNum; |
| | | } |
| | | } |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | |
| | | public class VideoContent { |
New file |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.common.AdminInfo; |
| | | import com.hanju.video.app.entity.video.PlayUrl; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | |
| | | |
| | | public class VideoDetailInfo implements Serializable { |
| | | |
| | | /** |
| | | * serialVersionUID |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | @Expose |
| | | private String id; |
| | | private VideoInfo video; |
| | | @Expose |
| | | private String name; |
| | | private AdminInfo admin; |
| | | private String beizhu; |
| | | @Expose |
| | | private String createtime; |
| | | @Expose |
| | | private List<PlayUrl> urls; |
| | | @Expose |
| | | private String introduction; |
| | | @Expose |
| | | private String type; |
| | | @Expose |
| | | private String eId; |
| | | @Expose |
| | | private String picture; |
| | | private String comment; |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | | |
| | | public void setPicture(String picture) { |
| | | this.picture = picture; |
| | | } |
| | | |
| | | public String geteId() { |
| | | return eId; |
| | | } |
| | | |
| | | public void seteId(String eId) { |
| | | this.eId = eId; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public static long getSerialversionuid() { |
| | | return serialVersionUID; |
| | | } |
| | | |
| | | public String getIntroduction() { |
| | | return introduction; |
| | | } |
| | | |
| | | public void setIntroduction(String introduction) { |
| | | this.introduction = introduction; |
| | | } |
| | | |
| | | public String getComment() { |
| | | return comment; |
| | | } |
| | | |
| | | public void setComment(String comment) { |
| | | this.comment = comment; |
| | | } |
| | | |
| | | public List<PlayUrl> getUrls() { |
| | | return urls; |
| | | } |
| | | |
| | | public void setUrls(List<PlayUrl> urls) { |
| | | this.urls = urls; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public VideoInfo getVideo() { |
| | | return video; |
| | | } |
| | | |
| | | public void setVideo(VideoInfo video) { |
| | | this.video = video; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public AdminInfo getAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(AdminInfo admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | public String getBeizhu() { |
| | | return beizhu; |
| | | } |
| | | |
| | | public void setBeizhu(String beizhu) { |
| | | this.beizhu = beizhu; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public String getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(String tag) { |
| | | this.tag = tag; |
| | | } |
| | | |
| | | private String tag; |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.common.AdminInfo; |
| | | import com.hanju.video.app.entity.user.Follow; |
| | | import com.qq.e.ads.nativ.NativeADDataRef; |
| | | import com.qq.e.ads.nativ.NativeExpressADView; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | |
| | | public class VideoInfo implements Serializable { |
| | | |
| | | /** |
| | | * serialVersionUID |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Expose |
| | | private String id; |
| | | @Expose |
| | | private String picture; |
| | | @Expose |
| | | private String vpicture; |
| | | @Expose |
| | | private String hpicture; |
| | | @Expose |
| | | private String name; |
| | | @Expose |
| | | private String introduction; |
| | | @Expose |
| | | private String duration; |
| | | @Expose |
| | | private String mainActor; |
| | | @Expose |
| | | private String year; |
| | | @Expose |
| | | private String thirdType; |
| | | @Expose |
| | | private VideoType videoType; |
| | | @Expose |
| | | private String share; |
| | | private AdminInfo admin; |
| | | private String beizhu; |
| | | @Expose |
| | | private String qulity; |
| | | @Expose |
| | | private String createtime; |
| | | @Expose |
| | | private String score; |
| | | @Expose |
| | | private String watchCount; |
| | | @Expose |
| | | private String tag; |
| | | @Expose |
| | | private String area; |
| | | @Expose |
| | | private String commentCount;// 评论数目 |
| | | @Expose |
| | | private List<VideoDetailInfo> videoDetailList; |
| | | @Expose |
| | | private boolean canSave;// true-可以 false-不行 |
| | | |
| | | private NativeADDataRef adInfo;// 原生广告信息 |
| | | private NativeExpressADView adView;// 原生广告信息 |
| | | @Expose |
| | | private List<VideoResource> resourceList; |
| | | @Expose |
| | | private int showType;// 1、单列 2、多列 |
| | | @Expose |
| | | private String playPicture; |
| | | @Expose |
| | | private String updatetime; |
| | | @Expose |
| | | private String evalueate; |
| | | @Expose |
| | | private int contentType;//是否为正片 1-正片 |
| | | |
| | | public int getContentType() { |
| | | return contentType; |
| | | } |
| | | |
| | | public void setContentType(int contentType) { |
| | | this.contentType = contentType; |
| | | } |
| | | |
| | | public String getVpicture() { |
| | | return vpicture; |
| | | } |
| | | |
| | | public void setVpicture(String vpicture) { |
| | | this.vpicture = vpicture; |
| | | } |
| | | |
| | | public String getHpicture() { |
| | | return hpicture; |
| | | } |
| | | |
| | | public void setHpicture(String hpicture) { |
| | | this.hpicture = hpicture; |
| | | } |
| | | |
| | | private Follow attention; |
| | | |
| | | public static long getSerialVersionUID() { |
| | | return serialVersionUID; |
| | | } |
| | | |
| | | public String getEvalueate() { |
| | | return evalueate; |
| | | } |
| | | |
| | | public void setEvalueate(String evalueate) { |
| | | this.evalueate = evalueate; |
| | | } |
| | | |
| | | public String getArea() { |
| | | return area; |
| | | } |
| | | |
| | | public void setArea(String area) { |
| | | this.area = area; |
| | | } |
| | | |
| | | public Follow getAttention() { |
| | | return attention; |
| | | } |
| | | |
| | | public void setAttention(Follow attention) { |
| | | this.attention = attention; |
| | | } |
| | | |
| | | public String getUpdatetime() { |
| | | return updatetime; |
| | | } |
| | | |
| | | public void setUpdatetime(String updatetime) { |
| | | this.updatetime = updatetime; |
| | | } |
| | | |
| | | public String getPlayPicture() { |
| | | return playPicture; |
| | | } |
| | | |
| | | public void setPlayPicture(String playPicture) { |
| | | this.playPicture = playPicture; |
| | | } |
| | | |
| | | public int getShowType() { |
| | | return showType; |
| | | } |
| | | |
| | | public void setShowType(int showType) { |
| | | this.showType = showType; |
| | | } |
| | | |
| | | public String getCommentCount() { |
| | | return commentCount; |
| | | } |
| | | |
| | | public void setCommentCount(String commentCount) { |
| | | this.commentCount = commentCount; |
| | | } |
| | | |
| | | public NativeADDataRef getAdInfo() { |
| | | return adInfo; |
| | | } |
| | | |
| | | public void setAdInfo(NativeADDataRef adInfo) { |
| | | this.adInfo = adInfo; |
| | | } |
| | | |
| | | public static long getSerialversionuid() { |
| | | return serialVersionUID; |
| | | } |
| | | |
| | | public boolean isCanSave() { |
| | | return canSave; |
| | | } |
| | | |
| | | public void setCanSave(boolean canSave) { |
| | | this.canSave = canSave; |
| | | } |
| | | |
| | | private String extraData;// 需要再次请求网络的播放url |
| | | |
| | | public String getExtraData() { |
| | | return extraData; |
| | | } |
| | | |
| | | public void setExtraData(String extraData) { |
| | | this.extraData = extraData; |
| | | } |
| | | |
| | | public String getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(String tag) { |
| | | this.tag = tag; |
| | | } |
| | | |
| | | public String getShare() { |
| | | return share; |
| | | } |
| | | |
| | | public void setShare(String share) { |
| | | this.share = share; |
| | | } |
| | | |
| | | public String getMainActor() { |
| | | return mainActor; |
| | | } |
| | | |
| | | public void setMainActor(String mainActor) { |
| | | this.mainActor = mainActor; |
| | | } |
| | | |
| | | public String getThirdType() { |
| | | return thirdType; |
| | | } |
| | | |
| | | public void setThirdType(String thirdType) { |
| | | this.thirdType = thirdType; |
| | | } |
| | | |
| | | public VideoType getVideoType() { |
| | | return videoType; |
| | | } |
| | | |
| | | public void setVideoType(VideoType videoType) { |
| | | this.videoType = videoType; |
| | | } |
| | | |
| | | public String getWatchCount() { |
| | | return watchCount; |
| | | } |
| | | |
| | | public void setWatchCount(String watchCount) { |
| | | this.watchCount = watchCount; |
| | | } |
| | | |
| | | public List<VideoDetailInfo> getVideoDetailList() { |
| | | return videoDetailList; |
| | | } |
| | | |
| | | public void setVideoDetailList(List<VideoDetailInfo> videoDetalList) { |
| | | this.videoDetailList = videoDetalList; |
| | | } |
| | | |
| | | public String getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(String score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | | |
| | | public void setPicture(String picture) { |
| | | this.picture = picture; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getIntroduction() { |
| | | return introduction; |
| | | } |
| | | |
| | | public void setIntroduction(String introduction) { |
| | | this.introduction = introduction; |
| | | } |
| | | |
| | | public String getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(String duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public String getMainactor() { |
| | | return mainActor; |
| | | } |
| | | |
| | | public void setMainactor(String mainactor) { |
| | | this.mainActor = mainactor; |
| | | } |
| | | |
| | | public String getYear() { |
| | | return year; |
| | | } |
| | | |
| | | public void setYear(String year) { |
| | | this.year = year; |
| | | } |
| | | |
| | | public AdminInfo getAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(AdminInfo admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | public String getBeizhu() { |
| | | return beizhu; |
| | | } |
| | | |
| | | public void setBeizhu(String beizhu) { |
| | | this.beizhu = beizhu; |
| | | } |
| | | |
| | | public String getQulity() { |
| | | return qulity; |
| | | } |
| | | |
| | | public void setQulity(String qulity) { |
| | | this.qulity = qulity; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public List<VideoResource> getResourceList() { |
| | | return resourceList; |
| | | } |
| | | |
| | | public void setResourceList(List<VideoResource> resourceList) { |
| | | this.resourceList = resourceList; |
| | | } |
| | | |
| | | public NativeExpressADView getAdView() { |
| | | return adView; |
| | | } |
| | | |
| | | public void setAdView(NativeExpressADView adView) { |
| | | this.adView = adView; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.common.AdminInfo; |
| | | |
| | | |
| | | public class VideoResource implements Serializable { |
| | | |
| | | /** |
| | | * serialVersionUID |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | @Expose |
| | | private String id; |
| | | @Expose |
| | | private String name; |
| | | @Expose |
| | | private String createtime; |
| | | private AdminInfo admin; |
| | | private String beizhu; |
| | | @Expose |
| | | private String picture; |
| | | @Expose |
| | | private boolean checked; |
| | | |
| | | public boolean isChecked() { |
| | | return checked; |
| | | } |
| | | |
| | | public void setChecked(boolean checked) { |
| | | this.checked = checked; |
| | | } |
| | | |
| | | public static long getSerialversionuid() { |
| | | return serialVersionUID; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public AdminInfo getAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(AdminInfo admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | public String getBeizhu() { |
| | | return beizhu; |
| | | } |
| | | |
| | | public void setBeizhu(String beizhu) { |
| | | this.beizhu = beizhu; |
| | | } |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | | |
| | | public void setPicture(String picture) { |
| | | this.picture = picture; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.common.AdminInfo; |
| | | |
| | | |
| | | public class VideoType implements Serializable { |
| | | |
| | | /** |
| | | * serialVersionUID |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Expose |
| | | private String id; |
| | | @Expose |
| | | private String name; |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | @Expose |
| | | private String icon; |
| | | private AdminInfo admin; |
| | | |
| | | public String getCategoryType() { |
| | | return categoryType; |
| | | } |
| | | |
| | | public void setCategoryType(String categoryType) { |
| | | this.categoryType = categoryType; |
| | | } |
| | | |
| | | @Expose |
| | | private String categoryType; |
| | | private String beizhu; |
| | | @Expose |
| | | private String createtime; |
| | | @Expose |
| | | private VideoType parent; |
| | | |
| | | @Expose |
| | | private String main;//1-主分类 0-热门 |
| | | |
| | | public String getMain() { |
| | | return main; |
| | | } |
| | | |
| | | public void setMain(String main) { |
| | | this.main = main; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public AdminInfo getAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(AdminInfo admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | public String getBeizhu() { |
| | | return beizhu; |
| | | } |
| | | |
| | | public void setBeizhu(String beizhu) { |
| | | this.beizhu = beizhu; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public VideoType getParent() { |
| | | return parent; |
| | | } |
| | | |
| | | public void setParent(VideoType parent) { |
| | | this.parent = parent; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.common.AdminInfo; |
| | | |
| | | /** |
| | | * ��Ƶ��url���� |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class VideoUrl implements Serializable { |
| | | |
| | | /** |
| | | * serialVersionUID |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | @Expose |
| | | private String id; |
| | | private VideoDetailInfo videoDetail; |
| | | @Expose |
| | | private VideoResource resource; |
| | | @Expose |
| | | private String url; |
| | | @Expose |
| | | private String createtime; |
| | | @Expose |
| | | private String invalid;// 0-有效 1-无效 |
| | | |
| | | private boolean selected = false;// 是否被选中 |
| | | |
| | | public boolean isSelected() { |
| | | return selected; |
| | | } |
| | | |
| | | public void setSelected(boolean selected) { |
| | | this.selected = selected; |
| | | } |
| | | |
| | | public String getInvalid() { |
| | | return invalid; |
| | | } |
| | | |
| | | public void setInvalid(String invalid) { |
| | | this.invalid = invalid; |
| | | } |
| | | |
| | | private AdminInfo admin; |
| | | private String beizhu; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public VideoDetailInfo getVideoDetail() { |
| | | return videoDetail; |
| | | } |
| | | |
| | | public void setVideoDetail(VideoDetailInfo videoDetail) { |
| | | this.videoDetail = videoDetail; |
| | | } |
| | | |
| | | public VideoResource getResource() { |
| | | return resource; |
| | | } |
| | | |
| | | public void setResource(VideoResource resource) { |
| | | this.resource = resource; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public String getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(String createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public AdminInfo getAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(AdminInfo admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | public String getBeizhu() { |
| | | return beizhu; |
| | | } |
| | | |
| | | public void setBeizhu(String beizhu) { |
| | | this.beizhu = beizhu; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.qq.e.ads.nativ.NativeADDataRef; |
| | | |
| | | public class ZhiBoContent { |
| | | @Expose |
| | | private String id;// 编号 |
| | | @Expose |
| | | private String name;// 名称 |
| | | @Expose |
| | | private int rank;// 等级 |
| | | @Expose |
| | | private String headPic;// 头像 |
| | | @Expose |
| | | private int liveNum;// 在线人数 |
| | | @Expose |
| | | private String roomPic;// 封面 |
| | | @Expose |
| | | private String h5Url;// 网页链接 |
| | | @Expose |
| | | private String state;// 网页链接 |
| | | @Expose |
| | | private int type;// 渠道 |
| | | @Expose |
| | | private String roomId;// 房间ID |
| | | |
| | | private NativeADDataRef adInfo;// 聚效原生广告信息 |
| | | |
| | | private int watchCount; |
| | | |
| | | public NativeADDataRef getAdInfo() { |
| | | return adInfo; |
| | | } |
| | | |
| | | public void setAdInfo(NativeADDataRef adInfo) { |
| | | this.adInfo = adInfo; |
| | | } |
| | | |
| | | public String getHeadPic() { |
| | | return headPic; |
| | | } |
| | | |
| | | public void setHeadPic(String headPic) { |
| | | this.headPic = headPic; |
| | | } |
| | | |
| | | public String getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(String state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public int getWatchCount() { |
| | | return watchCount; |
| | | } |
| | | |
| | | public void setWatchCount(int watchCount) { |
| | | this.watchCount = watchCount; |
| | | } |
| | | |
| | | public int getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(int type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getRoomId() { |
| | | return roomId; |
| | | } |
| | | |
| | | public void setRoomId(String roomId) { |
| | | this.roomId = roomId; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public int getRank() { |
| | | return rank; |
| | | } |
| | | |
| | | public void setRank(int rank) { |
| | | this.rank = rank; |
| | | } |
| | | |
| | | public int getLiveNum() { |
| | | return liveNum; |
| | | } |
| | | |
| | | public void setLiveNum(int liveNum) { |
| | | this.liveNum = liveNum; |
| | | } |
| | | |
| | | public String getRoomPic() { |
| | | return roomPic; |
| | | } |
| | | |
| | | public void setRoomPic(String roomPic) { |
| | | this.roomPic = roomPic; |
| | | } |
| | | |
| | | public String getH5Url() { |
| | | return h5Url; |
| | | } |
| | | |
| | | public void setH5Url(String h5Url) { |
| | | this.h5Url = h5Url; |
| | | } |
| | | } |
| | |
| | | import android.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import com.lcjian.library.widget.RatioLayout; |
| | | import com.hanju.lib.library.widget.RatioLayout; |
| | | import com.hanju.video.app.R; |
| | | |
| | | public class VideoHolder extends RecyclerView.ViewHolder { |
New file |
| | |
| | | package com.hanju.video.app.receivers; |
| | | |
| | | import android.content.ActivityNotFoundException; |
| | | import android.content.BroadcastReceiver; |
| | | import android.content.ComponentName; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.os.Build; |
| | | import android.os.Handler; |
| | | |
| | | import com.hanju.video.app.HanJuApplication; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.ui.recommend.RecommendAdapter; |
| | | |
| | | public class APPInstallReceiver extends BroadcastReceiver { |
| | | |
| | | private Context mContext; |
| | | |
| | | @Override |
| | | public void onReceive(Context context, Intent intent) { |
| | | if (intent.getAction().equals("android.intent.action.PACKAGE_ADDED")) { |
| | | final String packageName = intent.getDataString().substring(8); |
| | | mContext = context; |
| | | int time = 0; |
| | | if (Build.VERSION.SDK_INT >= 21) { |
| | | time = 2000; |
| | | } |
| | | |
| | | handler.postDelayed(new Runnable() { |
| | | |
| | | @Override |
| | | public void run() { |
| | | if (packageName != null |
| | | && packageName |
| | | .equalsIgnoreCase(RecommendAdapter.MM_PACKAGE_NAME) |
| | | && !StringUtils |
| | | .isBlank(HanJuApplication.MMNumber)) { |
| | | |
| | | if (packageName |
| | | .equalsIgnoreCase(RecommendAdapter.MM_PACKAGE_NAME)) { |
| | | Intent intent = new Intent(); |
| | | intent.setComponent(new ComponentName( |
| | | RecommendAdapter.MM_PACKAGE_NAME, |
| | | RecommendAdapter.MM_CLASS_NAME)); |
| | | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | intent.setAction("com.memezhibo.android.exportedAction");// 么么直播action名 |
| | | intent.putExtra("room_id", Long |
| | | .parseLong(HanJuApplication.MMNumber)); |
| | | |
| | | try { |
| | | mContext.startActivity(intent); |
| | | } catch (ActivityNotFoundException e) { |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | }, time); |
| | | } |
| | | } |
| | | |
| | | Handler handler = new Handler() { |
| | | public void handleMessage(android.os.Message msg) { |
| | | |
| | | } |
| | | }; |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.services; |
| | | |
| | | import android.app.Notification; |
| | | import android.app.NotificationManager; |
| | | import android.app.Service; |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.os.IBinder; |
| | | import android.os.Message; |
| | | import android.widget.RemoteViews; |
| | | import android.widget.Toast; |
| | | |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.ad.AdTag; |
| | | import com.hanju.video.app.util.downutils.DownLoadApks; |
| | | import com.hanju.video.app.util.downutils.DownLoadApks.IProgress; |
| | | |
| | | import java.io.File; |
| | | |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | | public class DownLoadFileService extends Service { |
| | | private NotificationManager manager; |
| | | private Notification notif; |
| | | public static int j = -1; |
| | | private String downloadUrl = "";// apk下载路径 |
| | | private String apkType; |
| | | |
| | | @Override |
| | | public IBinder onBind(Intent intent) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public int onStartCommand(Intent intent, int flags, int startId) { |
| | | if (intent == null) { |
| | | return 0; |
| | | } |
| | | Bundle bundle = intent.getExtras(); |
| | | downloadUrl = bundle.getString("downloadurl", ""); |
| | | if (downloadUrl.contains("memezhibo")) { |
| | | apkType = "com.memezhibo.android"; |
| | | } else { |
| | | apkType = ""; |
| | | } |
| | | new DownLoadApks(this, new IProgress() { |
| | | |
| | | @Override |
| | | public void getProgress(int p) { |
| | | // TODO Auto-generated method |
| | | // stub |
| | | if (p == 100) { |
| | | handler.sendEmptyMessage(1); |
| | | } else { |
| | | if (manager == null || notif == null) { |
| | | Toast.makeText(DownLoadFileService.this, |
| | | "插件开始下载······", Toast.LENGTH_SHORT).show(); |
| | | manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); |
| | | notif = new Notification(); |
| | | notif.icon = R.drawable.ic_launcher; |
| | | notif.tickerText = "插件下载"; |
| | | // 通知栏显示所用到的布局文件 |
| | | notif.contentView = new RemoteViews(getPackageName(), |
| | | R.layout.notify_item); |
| | | } |
| | | Message msg = handler.obtainMessage(); |
| | | if (j != p) { |
| | | msg.what = 0; |
| | | msg.arg1 = p; |
| | | handler.sendMessage(msg); |
| | | } |
| | | j = p; |
| | | } |
| | | } |
| | | }, apkType).execute(downloadUrl); |
| | | return super.onStartCommand(intent, flags, startId); |
| | | } |
| | | |
| | | @Override |
| | | public void onCreate() { |
| | | super.onCreate(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 下载进度推送 |
| | | */ |
| | | private Handler handler = new Handler() { |
| | | @Override |
| | | public void handleMessage(Message msg) { |
| | | // TODO Auto-generated method stub |
| | | super.handleMessage(msg); |
| | | switch (msg.what) { |
| | | case 0: |
| | | notif.contentView.setTextViewText(R.id.content_view_per, |
| | | msg.arg1 + "%"); |
| | | manager.notify(0, notif); |
| | | break; |
| | | case 1: |
| | | notif.contentView |
| | | .setTextViewText(R.id.content_view_per, "下载完成"); |
| | | manager.notify(0, notif); |
| | | j = 100; |
| | | File a = getExternalFilesDir("pptv"); |
| | | if (a.listFiles().length == 2) { |
| | | AdTag tag=new AdTag(); |
| | | EventBus.getDefault().post(tag); |
| | | } |
| | | manager.cancelAll(); |
| | | stopSelf(); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | }; |
| | | |
| | | @Override |
| | | public void onStart(Intent intent, int startId) { |
| | | // TODO Auto-generated method stub |
| | | super.onStart(intent, startId); |
| | | } |
| | | |
| | | @Override |
| | | public void onDestroy() { |
| | | // TODO Auto-generated method stub |
| | | super.onDestroy(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.ui; |
| | | |
| | | import java.util.*; |
| | | import java.io.*; |
| | | |
| | | public class JarClassFindUtil { |
| | | public static int count = 0; |
| | | |
| | | static public void main(String[] args) { |
| | | /* |
| | | 11 |
| | | * if (args.length < 2) { showHowToUsage(); return; } |
| | | 12 |
| | | */ |
| | | String className = "StringUtil"; // 要查询的class,要带包名的类名 |
| | | String libPath = "E:\\work\\workspace\\jngl_mysql\\WebRoot\\WEB-INF\\lib\\"; // 所要查找的JAR包的目录 |
| | | |
| | | String absoluteclassname = className.replace('.', '/') + ".class"; |
| | | System.out.println("Find class [" + className + "] in Path [" + libPath + "] Results:"); |
| | | FindClassInLocalSystem(libPath, absoluteclassname); |
| | | if (JarClassFindUtil.count == 0) { |
| | | System.out.println("Error:Can't Find Such Jar File!"); |
| | | } |
| | | System.out.println("Find Process Ended! Total Results:" + JarClassFindUtil.count); |
| | | } |
| | | |
| | | private static void FindClassInLocalSystem(String path, String classname) { |
| | | if (path.charAt(path.length() - 1) != '\\') { |
| | | path += '\\'; |
| | | } |
| | | File file = new File(path); |
| | | if (!file.exists()) { |
| | | System.out.println("Error: Path not Existed! Please Check it out!"); |
| | | return; |
| | | } |
| | | String[] filelist = file.list(); |
| | | for (int i = 0; i < filelist.length; i++) { |
| | | File temp = new File(path + filelist[i]); |
| | | if ((temp.isDirectory() && !temp.isHidden() && temp.exists())) { |
| | | FindClassInLocalSystem(path + filelist[i], classname); |
| | | } else { |
| | | if (filelist[i].endsWith("jar")) { |
| | | try { |
| | | java.util.jar.JarFile jarfile = new java.util.jar.JarFile(path + filelist[i]); |
| | | for (Enumeration e = jarfile.entries(); e.hasMoreElements(); ) { |
| | | String name = e.nextElement().toString(); |
| | | if (name.equals(classname) || name.indexOf(classname) > -1) { |
| | | System.out.println("No." + ++JarClassFindUtil.count); |
| | | System.out.println("Jar Package:" + path + filelist[i]); |
| | | System.out.println(name); |
| | | } |
| | | } |
| | | } catch (Exception eee) { |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void showHowToUsage() { |
| | | System.out.println("Usage: Java -cp. JarClassFindUtil <source path> <source class name>"); |
| | | System.out.println("Usage: Java -classpath. JarClassFindUtil <source path> <source class name>"); |
| | | System.out.println(); |
| | | System.out.println("<source path>:\t\tPath to Find eg:D:\\Jbuilder"); |
| | | System.out.println("<source class name>:\tClass to Find eg:java.applet.Applet"); |
| | | } |
| | | } |
| | |
| | | package com.hanju.video.app.ui; |
| | | |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | |
| | | public abstract class MyRetainViewFragment extends RetainViewFragment { |
| | |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.google.gson.Gson; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HanJuApplication; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.ad.AdPositionEnum; |
| | | import com.hanju.video.app.entity.ad.AdTypeVO; |
| | | import com.hanju.video.app.ui.dialog.UserProtocolDialog; |
| | | import com.hanju.video.app.ui.main.MainActivity; |
| | | import com.hanju.video.app.util.ConfigUtil; |
| | | import com.hanju.video.app.util.GlideRoundTransform; |
| | | import com.hanju.video.app.util.common.AppConfigUtil; |
| | | import com.hanju.video.app.util.ui.GlideRoundTransform; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.PermissionsChecker; |
| | | import com.hanju.video.app.util.SDCardUtil; |
| | | import com.hanju.video.app.util.ui.SDCardUtil; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.ad.CSJConstant; |
| | | import com.hanju.video.app.util.ad.GDTConstant; |
| | | import com.hanju.video.app.util.ad.CSJADConstant; |
| | | import com.hanju.video.app.util.ad.GDTADConstant; |
| | | import com.hanju.video.app.util.ad.SplashAdUtil; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | |
| | | import org.apache.http.Header; |
| | |
| | | HanJuConstant.GDT_SEARCH_RESULT_MIN_NATIVE = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | HanJuConstant.GDT_PLAYER_DETAIL = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | HanJuConstant.GDT_CATEGORY_BANNER = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTConstant.PID_HOME_RECOMMEND_BIG_IMG = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTConstant.PID_2_VIDEO_DETAIL_PLAY_EXPRESS1 = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTConstant.PID_2_VIDEO_DETAIL_PLAY_EXPRESS2 = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN3 = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN2 = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTConstant.PID_HOME_RECOMMEND_BIG_IMG = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTADConstant.PID_HOME_RECOMMEND_BIG_IMG = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTADConstant.PID_2_VIDEO_DETAIL_PLAY_EXPRESS1 = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTADConstant.PID_2_VIDEO_DETAIL_PLAY_EXPRESS2 = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTADConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN3 = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTADConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN2 = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTADConstant.PID_HOME_RECOMMEND_BIG_IMG = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | |
| | | CSJConstant.RECOMMEND_BIG_IMG_AD = CSJConstant.INVALID_AD; |
| | | CSJADConstant.RECOMMEND_BIG_IMG_AD = CSJADConstant.INVALID_AD; |
| | | } |
| | | |
| | | //获取广告 |
| | | String adType = data.optString("adType"); |
| | | if (!com.hanju.video.app.util.downutil.StringUtils.isNullOrEmpty(adType)) { |
| | | if (!com.hanju.video.app.util.downutils.StringUtils.isNullOrEmpty(adType)) { |
| | | AdTypeVO ad = new Gson().fromJson(adType, AdTypeVO.class); |
| | | if (ad != null) |
| | | HanJuConstant.AD_TYPE = ad; |
| | |
| | | boolean showPermission = sharedPreferences.getBoolean("show", true); |
| | | |
| | | if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PERMISSION_GRANTED && showPermission) { |
| | | ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_PHONE_STATE}, REQUEST_CODE); |
| | | ActivityCompat.requestPermissions(this, PERMISSIONS, REQUEST_CODE); |
| | | } else { |
| | | getUid(); |
| | | vg_ad.postDelayed(new Runnable() { |
| | |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | JSONObject data = jsonObject.getJSONObject("Data"); |
| | | JSONObject ad = data.optJSONObject("adNew"); |
| | | ConfigUtil.savePlayerJumpOutProtocolPrefix(getApplicationContext(), data.optString("jumpAppProtocolPrefix")); |
| | | AppConfigUtil.savePlayerJumpOutProtocolPrefix(getApplicationContext(), data.optString("jumpAppProtocolPrefix")); |
| | | //保存广告的应用ID |
| | | String gdtAppId = ad.optString("gdtAppId"); |
| | | String csjAppId = ad.optString("csjAppId"); |
| | | ConfigUtil.saveADAPPId(getApplicationContext(), gdtAppId, csjAppId); |
| | | ConfigUtil.saveConcatUsLink(getApplicationContext(), data.optString("contactUsLink")); |
| | | ConfigUtil.saveUnRegisterLink(getApplicationContext(), data.optString("unRegisterLink")); |
| | | |
| | | AppConfigUtil.saveADAPPId(getApplicationContext(), gdtAppId, csjAppId); |
| | | AppConfigUtil.saveConcatUsLink(getApplicationContext(), data.optString("contactUsLink")); |
| | | AppConfigUtil.saveUnRegisterLink(getApplicationContext(), data.optString("unRegisterLink")); |
| | | AdUtil.saveAdConfig(getApplicationContext(), ad); |
| | | } |
| | | } |
| | |
| | | for (int i = 0; i < permissions.length; i++) { |
| | | if (grantResults[i] == PERMISSION_GRANTED) {//选择了“始终允许” |
| | | myRequetPermission(); |
| | | } else if (grantResults[i] == PERMISSION_DENIED) { |
| | | myRequetPermission(); |
| | | //记住permission |
| | | SharedPreferences sharedPreferences = getSharedPreferences("permission", Context.MODE_PRIVATE); |
| | | SharedPreferences.Editor editor = sharedPreferences.edit(); |
| | | editor.putBoolean("show", false); |
| | | editor.commit(); |
| | | } else { |
| | | if (grantResults[i] == PERMISSION_DENIED) { |
| | | //记住permission |
| | | SharedPreferences sharedPreferences = getSharedPreferences("permission", Context.MODE_PRIVATE); |
| | | SharedPreferences.Editor editor = sharedPreferences.edit(); |
| | | editor.putBoolean("show", false); |
| | | editor.commit(); |
| | | } |
| | | myRequetPermission(); |
| | | } |
| | | } |
| | |
| | | @Override |
| | | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| | | super.onActivityResult(requestCode, resultCode, data); |
| | | if (requestCode == REQUEST_CODE) { |
| | | myRequetPermission();//由于不知道是否选择了允许所以需要再次判断 |
| | | } |
| | | // if (requestCode == REQUEST_CODE) { |
| | | // myRequetPermission();//由于不知道是否选择了允许所以需要再次判断 |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | import android.webkit.WebViewClient; |
| | | import android.widget.Toast; |
| | | |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.hanju.video.app.util.downutil.DownFiles; |
| | | import com.hanju.video.app.util.downutil.DownFiles.IProgress; |
| | | import com.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.hanju.video.app.util.downutils.DownFiles; |
| | | import com.hanju.video.app.util.downutils.DownFiles.IProgress; |
| | | import com.hanju.video.app.R; |
| | | |
| | | /** |
| | | * 网页加载页面 |
| | | * |
| | | * @author Administrator |
| | | */ |
| | | |
| | | public class VBrowserActivity extends Activity implements OnClickListener { |
| | | |
| | | // private TextView tv_top_bar_left; |
| | |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.ad.GDTConstant; |
| | | import com.hanju.video.app.util.ad.GDTADConstant; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | |
| | | if (mAdData != null) |
| | | mAdData.destroy(); |
| | | pb_progress.setVisibility(View.VISIBLE); |
| | | String pid = GDTConstant.PID_VIDEO_DETAIL_PLAYER; |
| | | String pid = GDTADConstant.PID_VIDEO_DETAIL_PLAYER; |
| | | if (AdUtil.getAdType(getContext(), AdPositionEnum.videoPlayPre) != AdUtil.AD_TYPE.gdt) |
| | | pid = HanJuConstant.GDT_DOWNLOAD_HINT_ID; |
| | | |
| | |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.loopj.android.http.JsonHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.CategoryRecommendVideo; |
| | | import com.hanju.video.app.entity.CommonAd; |
| | | import com.hanju.video.app.service.DownLoadFileService; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.recommend.CategoryRecommendVideo; |
| | | import com.hanju.video.app.entity.ad.CommonAd; |
| | | import com.hanju.video.app.services.DownLoadFileService; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.ui.mine.BrowserActivity; |
| | | import com.hanju.video.app.R; |
| | |
| | | import android.view.ViewGroup; |
| | | import android.widget.RelativeLayout; |
| | | |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.viewpagerindicator.CirclePageIndicator; |
| | | import com.hanju.video.app.entity.CategoryRecommendVideo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.VideoType; |
| | | import com.hanju.video.app.entity.recommend.CategoryRecommendVideo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoType; |
| | | import com.hanju.video.app.ui.video.VideoColumn2Adapter; |
| | | import com.hanju.video.app.R; |
| | | |
| | |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | | import android.content.pm.ActivityInfo; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | |
| | | import androidx.fragment.app.Fragment; |
| | |
| | | |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | import android.widget.TextView; |
| | | |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.entity.HomeSpecial; |
| | | import com.hanju.video.app.entity.recommend.HomeSpecial; |
| | | import com.viewpagerindicator.MTabPageIndicator; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.VideoType; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.video.VideoType; |
| | | import com.hanju.video.app.ui.common.VideosFragment; |
| | | import com.hanju.video.app.ui.mine.BrowserActivity; |
| | | import com.hanju.video.app.ui.mine.WatchHistoryActivity; |
| | | import com.hanju.video.app.ui.recommend.SearchActivity; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public class MVideosActivity extends FragmentActivity implements |
| | |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.hanju.video.app.R; |
| | | import com.nostra13.universalimageloader.core.DisplayImageOptions; |
| | | import com.nostra13.universalimageloader.core.ImageLoader; |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | | import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer; |
| | | import com.hanju.video.app.ui.category.bean.HotStar; |
| | | import com.hanju.video.app.util.GlideCircleTransform; |
| | | import com.hanju.video.app.util.ui.GlideCircleTransform; |
| | | |
| | | /** |
| | | * 分类明星中GridView的适配器 |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoContent; |
| | | import com.hanju.video.app.ui.video.VideoCloumn1Adapter; |
| | | import com.hanju.video.app.util.DimenUtils; |
| | | import com.hanju.video.app.util.common.DimenUtils; |
| | | import com.hanju.video.app.util.ui.DividerItemDecoration; |
| | | import com.hanju.video.app.R; |
| | | |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoContent; |
| | | import com.hanju.video.app.ui.video.VideoCloumn1Adapter; |
| | | import com.hanju.video.app.util.DimenUtils; |
| | | import com.hanju.video.app.util.GlideCircleTransform; |
| | | import com.hanju.video.app.util.common.DimenUtils; |
| | | import com.hanju.video.app.util.ui.GlideCircleTransform; |
| | | import com.hanju.video.app.util.ui.DividerItemDecoration; |
| | | import com.hanju.video.app.R; |
| | | |
| | |
| | | package com.hanju.video.app.ui.category.bean; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.AdminInfo; |
| | | import com.hanju.video.app.entity.common.AdminInfo; |
| | | |
| | | /** |
| | | * 热门明星实体类 |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.lcjian.library.util.RefreshLayout; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.ui.category.NewStarAdapter; |
| | | import com.hanju.video.app.ui.category.bean.HotStar; |
| | | import com.hanju.video.app.R; |
| | |
| | | package com.hanju.video.app.ui.common; |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | |
| | | import android.view.View; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.ListView; |
| | | import android.widget.ProgressBar; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.util.RefreshLayout; |
| | | import com.lcjian.library.util.SingleToast; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.Attention; |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.user.Attention; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.login.LoginActivity; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | |
| | |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.video.app.entity.Attention; |
| | | import com.hanju.video.app.entity.Follow; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.entity.user.Attention; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.util.GlideCircleTransform; |
| | | import com.hanju.video.app.util.TimeUtil; |
| | | import com.hanju.video.app.R; |
| | | |
| | | import org.apache.http.Header; |
| | |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.RequestManager; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.video.app.entity.ZhiBoContent; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.R; |
| | | import com.nostra13.universalimageloader.core.DisplayImageOptions; |
| | | import com.nostra13.universalimageloader.core.ImageLoader; |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | | import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | |
| | | public class GridVideoAdapter extends BaseAdapter { |
| | | |
| | |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.RequestManager; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.R; |
| | | import com.nostra13.universalimageloader.core.DisplayImageOptions; |
| | | import com.nostra13.universalimageloader.core.ImageLoader; |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | | import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.ui.mine.MyFavouriteActivity; |
| | | import com.hanju.video.app.ui.recent.DownloadAdapter2.IGetDeleteCallback; |
| | | |
| | | public class ListVideoAdapter extends BaseAdapter { |
| | | |
| | |
| | | import android.webkit.WebSettings; |
| | | import android.webkit.WebView; |
| | | import android.webkit.WebViewClient; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.util.downutil.DownFiles; |
| | | import com.hanju.video.app.util.downutil.DownFiles.IProgress; |
| | | import com.hanju.video.app.util.downutils.DownFiles; |
| | | import com.hanju.video.app.util.downutils.DownFiles.IProgress; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | |
| | | public class LiveBrowserActivity extends BaseActivity implements OnClickListener { |
| | |
| | | import com.nostra13.universalimageloader.core.ImageLoader; |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | | import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.ZhiBoContent; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.video.ZhiBoContent; |
| | | import com.hanju.video.app.ui.mine.BrowserActivity; |
| | | import com.hanju.video.app.util.AdPromptDialog; |
| | | import com.hanju.video.app.util.ad.AdPromptDialog; |
| | | import com.hanju.video.app.R; |
| | | |
| | | import org.apache.http.Header; |
| | |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | | import android.content.pm.ActivityInfo; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.widget.AdapterView; |
| | | import android.widget.AdapterView.OnItemClickListener; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ListView; |
| | | import android.widget.ProgressBar; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.util.RefreshLayout; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.R; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | | import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer; |
| | | import com.hanju.video.app.HanJuApplication; |
| | | import com.hanju.video.app.entity.MemeLiveInfo; |
| | | import com.hanju.video.app.service.DownLoadFileService; |
| | | import com.hanju.video.app.util.downutil.ApkUtil; |
| | | import com.hanju.video.app.entity.video.MemeLiveInfo; |
| | | import com.hanju.video.app.services.DownLoadFileService; |
| | | import com.hanju.video.app.util.downutils.ApkUtil; |
| | | import com.hanju.video.app.R; |
| | | |
| | | import java.util.List; |
| | |
| | | package com.hanju.video.app.ui.common; |
| | | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | import android.graphics.Color; |
| | | import android.net.wifi.hotspot2.pps.HomeSp; |
| | | import android.os.Bundle; |
| | | |
| | | import androidx.fragment.app.Fragment; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.entity.HomeSpecial; |
| | | import com.hanju.video.app.entity.recommend.HomeSpecial; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.VideoType; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoType; |
| | | import com.hanju.video.app.ui.video.VideoColumn2Adapter; |
| | | import com.hanju.video.app.util.DimenUtils; |
| | | import com.hanju.video.app.util.common.DimenUtils; |
| | | import com.hanju.video.app.util.ui.DividerItemDecoration; |
| | | import com.hanju.video.app.R; |
| | | |
| | |
| | | |
| | | import android.app.ActivityManager; |
| | | import android.content.ComponentName; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.webkit.WebView; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | import android.widget.ListView; |
| | | import android.widget.ProgressBar; |
| | | import android.widget.TextView; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.util.RefreshLayout; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.MemeLiveInfo; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.video.MemeLiveInfo; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | |
| | | import android.app.Activity; |
| | | import android.app.Dialog; |
| | | import android.content.Context; |
| | | import android.content.DialogInterface; |
| | | import android.graphics.Color; |
| | | import android.graphics.drawable.GradientDrawable; |
| | | import android.view.Gravity; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.widget.EditText; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.util.DimenUtils; |
| | | import com.lcjian.library.util.SystemCommon; |
| | | import com.ysh.wpc.appupdate.util.StringUtils; |
| | | |
| | | import static android.widget.LinearLayout.VERTICAL; |
| | | import com.hanju.video.app.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.SystemCommon; |
| | | |
| | | /** |
| | | * 用户协议弹框 |
| | |
| | | import android.app.Dialog; |
| | | import android.content.Context; |
| | | import android.content.DialogInterface; |
| | | import android.graphics.Color; |
| | | import android.text.method.LinkMovementMethod; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.widget.EditText; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import com.lcjian.library.util.SystemCommon; |
| | | import com.hanju.lib.library.util.SystemCommon; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.util.ui.TextViewUtil; |
| | | import com.ysh.wpc.appupdate.util.StringUtils; |
| | | import com.hanju.update.appupdate.util.StringUtils; |
| | | |
| | | /** |
| | | * 用户协议弹框 |
| | |
| | | import android.widget.FrameLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import com.lcjian.library.util.SystemCommon; |
| | | import com.hanju.lib.library.util.SystemCommon; |
| | | import com.hanju.video.app.util.ui.TextViewUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.ysh.wpc.appupdate.util.StringUtils; |
| | | import com.hanju.update.appupdate.util.StringUtils; |
| | | |
| | | /** |
| | | * 用户协议弹框 |
| | |
| | | import android.widget.TextView; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.lcjian.library.widget.IsPad; |
| | | import com.hanju.lib.library.widget.IsPad; |
| | | import com.loopj.android.http.JsonHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.CommonAd; |
| | | import com.hanju.video.app.entity.Special; |
| | | import com.hanju.video.app.service.DownLoadFileService; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.ad.CommonAd; |
| | | import com.hanju.video.app.entity.recommend.Special; |
| | | import com.hanju.video.app.services.DownLoadFileService; |
| | | import com.hanju.video.app.ui.category.SpecificDetailActivity; |
| | | import com.hanju.video.app.ui.mine.BrowserActivity; |
| | | import com.hanju.video.app.R; |
| | |
| | | package com.hanju.video.app.ui.discover; |
| | | |
| | | import android.content.Intent; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | import android.widget.EditText; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.lcjian.library.util.SingleToast; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.login.RegisterActivity; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | |
| | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | import android.content.pm.ActivityInfo; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | import android.view.View; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.ListView; |
| | | import android.widget.ProgressBar; |
| | | import android.widget.TextView; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.util.RefreshLayout; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.ZhiBoContent; |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.video.ZhiBoContent; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.common.LiveGirlAdapter; |
| | | import com.hanju.video.app.R; |
| | |
| | | import android.widget.EditText; |
| | | import android.widget.TextView; |
| | | |
| | | import com.lcjian.library.util.SingleToast; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.util.IsEmail; |
| | | import com.hanju.video.app.util.EmailUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.util.ui.LoginUiUtil; |
| | | |
| | |
| | | SingleToast.showToast(ForgetPwdActivity.this, "请先输入邮箱号"); |
| | | return; |
| | | } else { |
| | | Matcher m = IsEmail.isEmailAddress().matcher(email); |
| | | Matcher m = EmailUtil.isEmailAddress().matcher(email); |
| | | if (m.matches()) { |
| | | getVerficationCode(email); |
| | | } else { |
| | |
| | | SingleToast.showToast(ForgetPwdActivity.this, "请先输入邮箱号"); |
| | | return; |
| | | } else { |
| | | Matcher m = IsEmail.isEmailAddress().matcher(str); |
| | | Matcher m = EmailUtil.isEmailAddress().matcher(str); |
| | | if (!m.matches()) { |
| | | SingleToast.showToast(ForgetPwdActivity.this, "输入的邮箱账号有误,请查证!"); |
| | | return; |
| | |
| | | import android.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.lcjian.library.util.SingleToast; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.mine.BrowserActivity; |
| | | import com.hanju.video.app.util.XGPush; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.hanju.video.app.util.ui.LoginUiUtil; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONException; |
| | |
| | | |
| | | SingleToast.showToast(LoginActivity.this, |
| | | "登录成功"); |
| | | XGPush.registerPush(LoginActivity.this); |
| | | finish(); |
| | | } |
| | | |
| | |
| | | import android.content.pm.PackageManager; |
| | | import android.graphics.Bitmap; |
| | | import android.graphics.BitmapFactory; |
| | | import android.graphics.drawable.BitmapDrawable; |
| | | import android.net.Uri; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.provider.MediaStore; |
| | | import android.util.Base64; |
| | | import android.util.Log; |
| | | import android.view.Gravity; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.DatePicker; |
| | | import android.widget.EditText; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.PopupWindow; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.androidquery.AQuery; |
| | | import com.bumptech.glide.Glide; |
| | | import com.hanju.video.app.ui.mine.BrowserActivity; |
| | | import com.hanju.video.app.util.PhotoCrop; |
| | | import com.lcjian.library.util.Environment; |
| | | import com.lcjian.library.util.SingleToast; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.util.common.PhotoCrop; |
| | | import com.hanju.lib.library.util.Environment; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.dialog.InputTextDialog; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.GlideCircleTransform; |
| | | import com.hanju.video.app.util.SelectPicUtil; |
| | | import com.hanju.video.app.util.ui.GlideCircleTransform; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | import com.hanju.video.app.util.ui.TopBarUtil; |
| | |
| | | |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.lcjian.library.util.SingleToast; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.mine.BrowserActivity; |
| | | import com.hanju.video.app.util.IsEmail; |
| | | import com.hanju.video.app.util.EmailUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.util.ui.LoginUiUtil; |
| | | |
| | |
| | | break; |
| | | } |
| | | |
| | | Matcher m = IsEmail.isEmailAddress().matcher(email); |
| | | Matcher m = EmailUtil.isEmailAddress().matcher(email); |
| | | if (m.matches()) { |
| | | tv_obtain_verfication_code.setEnabled(false); |
| | | getVerficationCode(email); |
| | |
| | | break; |
| | | } |
| | | |
| | | Matcher mc = IsEmail.isEmailAddress().matcher(email1); |
| | | Matcher mc = EmailUtil.isEmailAddress().matcher(email1); |
| | | if (!mc.matches()) { |
| | | SingleToast.showToast(RegisterActivity.this, "输入的邮箱账号有误,请查证!"); |
| | | break; |
| | |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | | import android.content.pm.PackageInfo; |
| | | import android.content.pm.PackageManager.NameNotFoundException; |
| | | import android.graphics.Canvas; |
| | | import android.graphics.Rect; |
| | | import android.os.Bundle; |
| | | import android.provider.Settings; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.entity.HomeSpecial; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.lcjian.library.content.ConnectivityChangeHelper; |
| | | import com.lcjian.library.content.ConnectivityChangeHelper.OnConnectivityChangeListener; |
| | | import com.lcjian.library.util.cache.DiskLruCache; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StorageUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.video.app.entity.recommend.HomeSpecial; |
| | | import com.hanju.lib.library.content.ConnectivityChangeHelper; |
| | | import com.hanju.lib.library.content.ConnectivityChangeHelper.OnConnectivityChangeListener; |
| | | import com.hanju.lib.library.util.cache.DiskLruCache; |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.common.StorageUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.qq.e.ads.banner.ADSize; |
| | | import com.qq.e.ads.banner.AbstractBannerADListener; |
| | | import com.qq.e.ads.banner.BannerView; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.VideoType; |
| | | import com.hanju.video.app.ui.MyRetainViewFragment; |
| | | import com.hanju.video.app.ui.category.MVideosActivity; |
| | | import com.hanju.video.app.ui.common.VideosLiveActivity; |
| | | import com.hanju.video.app.ui.mine.BrowserActivity; |
| | | import com.hanju.video.app.ui.recommend.SearchActivity; |
| | | |
| | | import org.apache.http.Header; |
| | |
| | | package com.hanju.video.app.ui.main; |
| | | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | import android.os.Bundle; |
| | | |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.recommend.DiscoverVideosAdapter; |
| | | import com.hanju.video.app.util.ConfigUtil; |
| | | import com.hanju.video.app.util.downutil.StringUtils; |
| | | import com.lcjian.library.util.RefreshLayout; |
| | | import com.lcjian.library.util.SingleToast; |
| | | import com.hanju.video.app.util.common.AppConfigUtil; |
| | | import com.hanju.video.app.util.downutils.StringUtils; |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.qq.e.ads.cfg.VideoOption; |
| | | import com.qq.e.ads.nativ.ADSize; |
| | | import com.qq.e.ads.nativ.NativeExpressAD; |
| | | import com.qq.e.ads.nativ.NativeExpressADView; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.ui.MyRetainViewFragment; |
| | | import com.hanju.video.app.ui.category.bean.UniqueBean; |
| | | import com.hanju.video.app.ui.recommend.DiscoverAdapter; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.R; |
| | | |
| | |
| | | |
| | | // 1.加载广告,先设置加载上下文环境和条件 |
| | | private void refreshAd() { |
| | | String appId = ConfigUtil.getGDTAppId(getContext()); |
| | | String appId = AppConfigUtil.getGDTAppId(getContext()); |
| | | if (StringUtils.isNullOrEmpty(appId)) { |
| | | return; |
| | | } |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.util.ConfigUtil; |
| | | import com.hanju.video.app.util.common.AppConfigUtil; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.downutil.StringUtils; |
| | | import com.lcjian.library.util.RefreshLayout; |
| | | import com.lcjian.library.util.SingleToast; |
| | | import com.hanju.video.app.util.downutils.StringUtils; |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.qq.e.ads.cfg.VideoOption; |
| | | import com.qq.e.ads.nativ.ADSize; |
| | | import com.qq.e.ads.nativ.NativeExpressAD; |
| | | import com.qq.e.ads.nativ.NativeExpressADView; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.MyRetainViewFragment; |
| | | import com.hanju.video.app.ui.recommend.GuessLikeAdapter; |
| | | import com.hanju.video.app.R; |
| | |
| | | |
| | | // 1.加载广告,先设置加载上下文环境和条件 |
| | | private void refreshAd() { |
| | | String appId = ConfigUtil.getGDTAppId(getContext()); |
| | | String appId = AppConfigUtil.getGDTAppId(getContext()); |
| | | if (StringUtils.isNullOrEmpty(appId)) { |
| | | return; |
| | | } |
| | |
| | | package com.hanju.video.app.ui.main; |
| | | |
| | | import android.content.Context; |
| | | import android.content.DialogInterface; |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | | import android.content.pm.PackageInfo; |
| | | import android.content.pm.PackageManager; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.os.Bundle; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.fragment.app.Fragment; |
| | | import androidx.fragment.app.FragmentManager; |
| | |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.request.target.SimpleTarget; |
| | | import com.bumptech.glide.request.transition.Transition; |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.entity.video.HomeNav; |
| | | import com.hanju.video.app.ui.mine.DownloadActivity; |
| | | import com.lcjian.library.util.cache.DiskLruCache; |
| | | import com.lcjian.library.util.common.StorageUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.cache.DiskLruCache; |
| | | import com.hanju.lib.library.util.common.StorageUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.viewpagerindicator.MainTabPageIndicator; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.NewComment; |
| | | import com.hanju.video.app.entity.VideoType; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.user.NewComment; |
| | | import com.hanju.video.app.entity.video.VideoType; |
| | | import com.hanju.video.app.ui.MyRetainViewFragment; |
| | | import com.hanju.video.app.ui.dialog.UserProtocolDialog; |
| | | import com.hanju.video.app.ui.login.LoginActivity; |
| | | import com.hanju.video.app.ui.login.PersonInfoActivity; |
| | | import com.hanju.video.app.ui.mine.BrowserActivity; |
| | |
| | | import com.hanju.video.app.ui.mine.WatchHistoryActivity; |
| | | import com.hanju.video.app.ui.recommend.RecommendFragment; |
| | | import com.hanju.video.app.ui.recommend.SearchActivity; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.hanju.video.app.R; |
| | | |
| | | import org.apache.http.Header; |
| | |
| | | import android.content.DialogInterface; |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | | import android.content.SharedPreferences.Editor; |
| | | import android.content.pm.ActivityInfo; |
| | | import android.database.Cursor; |
| | | import android.net.wifi.WifiInfo; |
| | | import android.net.wifi.WifiManager; |
| | | import android.os.Bundle; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.widget.RadioButton; |
| | | import android.widget.RadioGroup; |
| | | |
| | | import com.lcjian.library.util.FragmentSwitchHelper; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.FragmentSwitchHelper; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.db.MessageTable; |
| | | import com.hanju.video.app.entity.NewComment; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.mine.BrowserActivity; |
| | | import com.hanju.video.app.ui.mine.SystemMessageActivity; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.ExitDialog; |
| | | import com.hanju.video.app.util.LoginFirstDialog; |
| | | import com.hanju.video.app.util.ad.FullVideoAdManager; |
| | | import com.hanju.video.app.util.ad.manager.SearchResultAdManager; |
| | | import com.hanju.video.app.util.ui.ExitDialog; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | import com.ysh.wpc.appupdate.AppUpdate; |
| | | import com.hanju.update.appupdate.AppUpdate; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | | |
| | | import androidx.loader.app.LoaderManager; |
| | | import androidx.loader.content.CursorLoader; |
| | | import androidx.loader.content.Loader; |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | | public class MainActivity extends BaseActivity implements View.OnClickListener { |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.db.HanJuSQLiteOpenHelper; |
| | | import com.hanju.video.app.db.WatchHistoryTable; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.database.HanJuSQLiteOpenHelper; |
| | | import com.hanju.video.app.database.WatchHistoryTable; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.mine.AboutUsActivity; |
| | | import com.hanju.video.app.ui.mine.WatchHistoryMineAdapter; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.lcjian.library.content.ConnectivityChangeHelper; |
| | | import com.lcjian.library.content.ConnectivityChangeHelper.OnConnectivityChangeListener; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.content.ConnectivityChangeHelper; |
| | | import com.hanju.lib.library.content.ConnectivityChangeHelper.OnConnectivityChangeListener; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.umeng.socialize.UMShareListener; |
| | | import com.umeng.socialize.bean.SHARE_MEDIA; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.NewComment; |
| | | import com.hanju.video.app.entity.user.NewComment; |
| | | import com.hanju.video.app.ui.MyRetainViewFragment; |
| | | import com.hanju.video.app.ui.common.FollowActivity; |
| | | import com.hanju.video.app.ui.login.LoginActivity; |
| | |
| | | import com.hanju.video.app.ui.mine.SystemMessageActivity; |
| | | import com.hanju.video.app.ui.mine.WatchHistoryActivity; |
| | | import com.hanju.video.app.ui.recommend.SearchActivity; |
| | | import com.hanju.video.app.util.GlideCircleTransform; |
| | | import com.hanju.video.app.util.ui.GlideCircleTransform; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.lang.reflect.Array; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import androidx.loader.content.CursorLoader; |
| | | import androidx.loader.content.Loader; |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | |
| | | import android.graphics.Bitmap; |
| | | import android.graphics.Color; |
| | | import android.graphics.Rect; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.util.Log; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.Play; |
| | | import com.hanju.video.app.entity.PlayUrl; |
| | | import com.hanju.video.app.entity.Playlocation; |
| | | import com.hanju.video.app.entity.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.VideoResource; |
| | | import com.hanju.video.app.entity.video.Play; |
| | | import com.hanju.video.app.entity.video.PlayUrl; |
| | | import com.hanju.video.app.entity.video.Playlocation; |
| | | import com.hanju.video.app.entity.video.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoResource; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.ui.login.LoginActivity; |
| | | import com.hanju.video.app.ui.video.EpisodeNewAdapter; |
| | | import com.hanju.video.app.ui.video.IVideoClickListener; |
| | | import com.hanju.video.app.ui.video.VideoColumn2Adapter; |
| | | import com.hanju.video.app.util.VideoUtil; |
| | | import com.hanju.video.app.util.video.VideoUtil; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.ad.ExpressAdManager; |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.lcjian.library.util.SingleToast; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.nostra13.universalimageloader.core.DisplayImageOptions; |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | | |
| | |
| | | import androidx.fragment.app.FragmentManager; |
| | | import androidx.fragment.app.FragmentPagerAdapter; |
| | | |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | |
| | | public class EpisodePagerAdapter extends FragmentPagerAdapter { |
| | | |
| | |
| | | import android.widget.FrameLayout; |
| | | import android.widget.Toast; |
| | | |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.tencent.smtt.export.external.interfaces.SslError; |
| | | import com.tencent.smtt.export.external.interfaces.SslErrorHandler; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.entity.AccumulateRule; |
| | | import com.hanju.video.app.entity.PlayUrl; |
| | | import com.hanju.video.app.entity.common.AccumulateRule; |
| | | import com.hanju.video.app.entity.video.PlayUrl; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity.ChangeVideoEvent; |
| | | import com.hanju.video.app.util.downutil.DownFiles; |
| | | import com.hanju.video.app.util.downutil.DownFiles.IProgress; |
| | | import com.hanju.video.app.util.x5.X5WebView; |
| | | import com.hanju.video.app.util.downutils.DownFiles; |
| | | import com.hanju.video.app.util.downutils.DownFiles.IProgress; |
| | | import com.hanju.video.app.util.x5web.X5WebView; |
| | | import com.hanju.video.app.R; |
| | | |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | | /** |
| | | * 网页加载页面 |
| | | * |
| | | * @author Administrator |
| | | */ |
| | | |
| | | public class IQYVideoFragment extends RetainViewFragment implements |
| | | OnClickListener { |
| | | private X5WebView webview; |
| | |
| | | import android.view.View.OnClickListener; |
| | | import android.view.ViewGroup; |
| | | import android.view.WindowManager; |
| | | import android.widget.AdapterView; |
| | | import android.widget.BaseAdapter; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.androidquery.AQuery; |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.bumptech.glide.request.target.SimpleTarget; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.ui.video.VideoPlayerFragment; |
| | | import com.hanju.video.app.ui.video.parser.VideoPlayUrlParseFragment; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.db.WatchHistoryTable; |
| | | import com.hanju.video.app.entity.AccumulateRule; |
| | | import com.hanju.video.app.entity.Follow; |
| | | import com.hanju.video.app.entity.Play; |
| | | import com.hanju.video.app.entity.PlayUrl; |
| | | import com.hanju.video.app.entity.Playlocation; |
| | | import com.hanju.video.app.entity.PushEpisode; |
| | | import com.hanju.video.app.entity.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.VideoResource; |
| | | import com.hanju.video.app.database.WatchHistoryTable; |
| | | import com.hanju.video.app.entity.common.AccumulateRule; |
| | | import com.hanju.video.app.entity.user.Follow; |
| | | import com.hanju.video.app.entity.video.Play; |
| | | import com.hanju.video.app.entity.video.PlayUrl; |
| | | import com.hanju.video.app.entity.video.Playlocation; |
| | | import com.hanju.video.app.entity.video.PushEpisode; |
| | | import com.hanju.video.app.entity.video.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoResource; |
| | | import com.hanju.video.app.entity.ad.AdPositionEnum; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.ad.VideoDetailVideoAdFragment; |
| | | import com.hanju.video.app.ui.common.ShareActivity; |
| | |
| | | import com.hanju.video.app.ui.video.VideoPlayerActivity; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.hanju.video.app.util.VideoUtil; |
| | | import com.hanju.video.app.util.video.VideoUtil; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.ad.FullVideoAdManager; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | import com.lcjian.library.util.SingleToast; |
| | | import com.lcjian.library.util.SystemCommon; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.hanju.lib.library.util.SystemCommon; |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.umeng.socialize.ShareAction; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.umeng.socialize.UMShareListener; |
| | |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | | |
| | | /** |
| | | * 视频详情 |
| | | * |
| | | * @author Administrator |
| | | */ |
| | | // |
| | | public class VideoDetailActivity extends BaseActivity implements |
| | | OnClickListener { |
| | |
| | | |
| | | private TextView tv_video_resource; |
| | | |
| | | private VideoPlayUrlParseFragment videoPlayUrlParseFragment; |
| | | |
| | | private AQuery mAquery; |
| | | |
| | | private VideoPlayerFragment mVideoPlayerFragment; |
| | | |
| | | @Override |
| | | protected void onSaveInstanceState(Bundle outState) { |
| | | outState.putString("flash exit", "VideoDetailActivity"); |
| | |
| | | tv_video_resource.setOnClickListener(this); |
| | | findViewById(R.id.iv_offline_cache).setOnClickListener(this); |
| | | findViewById(R.id.iv_share).setOnClickListener(this); |
| | | //初始化视频解析 |
| | | videoPlayUrlParseFragment = new VideoPlayUrlParseFragment(); |
| | | getSupportFragmentManager().beginTransaction().replace(R.id.fragment_video_parser, videoPlayUrlParseFragment).commitAllowingStateLoss(); |
| | | } |
| | | |
| | | @Override |
| | | public void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.video_detail_activity); |
| | | |
| | | mAquery = new AQuery(this); |
| | | StatusBarUtil.init(this); |
| | | |
| | | /** |
| | |
| | | resourceId = bundle.getString("ResourceId"); |
| | | detailid = bundle.getString("DetailId"); |
| | | } |
| | | if (!StringUtils.isNumeric(videoInfo.getId())) { |
| | | iv_favourite.setVisibility(View.GONE); |
| | | } else { |
| | | iv_favourite.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | |
| | | if ("1".equals(videoInfo.getShare())) { |
| | | SharedPreferences preferences = getSharedPreferences("user", |
| | |
| | | |
| | | |
| | | private void loadFullVideoAd() { |
| | | //加载广告 |
| | | if (HanJuConstant.AD_TYPE.isVideoDetailSplashAd()) { |
| | | if (FullVideoAdManager.getInstance().isCacahed()) { |
| | | FullVideoAdManager.getInstance().showAd(this); |
| | | AdUtil.AD_TYPE adType = AdUtil.getAdType(getApplicationContext(), AdPositionEnum.videoDetailFullVideo); |
| | | if (adType != null) { |
| | | String pid = AdUtil.getAdPid(getApplicationContext(), AdPositionEnum.videoDetailFullVideo); |
| | | try { |
| | | FullVideoAdManager.getInstance().loadAd(getApplicationContext(), pid, new FullVideoAdManager.IFullVideoAdListener() { |
| | | @Override |
| | | public void onSuccess() { |
| | | FullVideoAdManager.getInstance().showAd(VideoDetailActivity.this); |
| | | } |
| | | }); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | SingleToast.showToast(VideoDetailActivity.this, "初始化播放路径中,请稍候点击播放!"); |
| | | return; |
| | | } |
| | | |
| | | mAquery.id(R.id.pb_loading).visibility(View.VISIBLE); |
| | | |
| | | //开始解析视频 |
| | | String tempUrl = "https://www.hmtv.me/vplay/MTEzMS0xLTA=.html"; |
| | | // String tempUrl = "https://www.hmtv.me/vplay/MTEwMC0zLTE=.html"; |
| | | |
| | | List<VideoPlayUrlParseFragment.ParseParams> parseParams = new ArrayList<>(); |
| | | String js = "function parseResult(url, data) {console.log(data); try {var result =JSON.parse( data);if (result.code == 200) {return result.url.replace('/\"/g', '');}} catch (e) {if (url.indexOf('.m3u8') > -1) { return url;}}return null;};"; |
| | | |
| | | // String js = "function parseResult(url) {return url;}"; |
| | | |
| | | |
| | | parseParams.add(new VideoPlayUrlParseFragment.ParseParams("^(https://){1}.*(\\.m3u8)$", js, false)); |
| | | |
| | | parseParams.add(new VideoPlayUrlParseFragment.ParseParams("^(https://chaoren\\.sc2yun\\.com/superman\\.php)", js, true)); |
| | | |
| | | |
| | | videoPlayUrlParseFragment.startParse(tempUrl, parseParams, new VideoPlayUrlParseFragment.IVideoParseListener() { |
| | | @Override |
| | | public void onSuccess(String result) { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | mAquery.id(R.id.pb_loading).visibility(View.GONE); |
| | | if (mVideoPlayerFragment == null) { |
| | | mVideoPlayerFragment = VideoPlayerFragment.newInstance("测试标题", tempUrl, result); |
| | | getSupportFragmentManager().beginTransaction().replace(R.id.fl_player, mVideoPlayerFragment).commitAllowingStateLoss(); |
| | | } else |
| | | mVideoPlayerFragment.setVideoInfo("测试标题", tempUrl, result); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onFail(String msg) { |
| | | |
| | | } |
| | | }); |
| | | |
| | | |
| | | if (1 > 0) |
| | | return; |
| | | |
| | | |
| | | if (playUrl.getPlayType() != 1) {//测试 |
| | | setViewOrientation(); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void onBackPressed() { |
| | | // if (mLandscape |
| | | // || this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { |
| | | // super.onBackPressed(); |
| | | // } else { |
| | | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| | | // } |
| | | |
| | | if (mVideoPlayerFragment != null) { |
| | | mVideoPlayerFragment.onBackPressed(); |
| | | } |
| | | |
| | | if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { |
| | | super.onBackPressed(); |
| | | } else { |
| | | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | android.view.ViewGroup.LayoutParams layoutParams = findViewById( |
| | | R.id.fragment_video_play_container).getLayoutParams(); |
| | | R.id.fragment_video_play_container1).getLayoutParams(); |
| | | layoutParams.height = android.view.ViewGroup.LayoutParams.MATCH_PARENT; |
| | | findViewById(R.id.fragment_video_play_container).requestLayout(); |
| | | layoutParams.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT; |
| | | |
| | | // android.view.ViewGroup.LayoutParams layoutParams1 = findViewById( |
| | | // R.id.fl_player).getLayoutParams(); |
| | | // layoutParams1.height = android.view.ViewGroup.LayoutParams.MATCH_PARENT; |
| | | |
| | | findViewById(R.id.fragment_video_play_container1).requestLayout(); |
| | | |
| | | findViewById(R.id.ll_bottom).setVisibility(View.GONE); |
| | | |
| | | } else { |
| | | // Show the status bar显示状态栏 |
| | | WindowManager.LayoutParams attrs = getWindow().getAttributes(); |
| | |
| | | |
| | | } |
| | | |
| | | FrameLayout layout = findViewById(R.id.fragment_video_play_container); |
| | | FrameLayout layout = findViewById(R.id.fragment_video_play_container1); |
| | | if (layout == null) |
| | | return; |
| | | android.view.ViewGroup.LayoutParams layoutParams = layout |
| | | .getLayoutParams(); |
| | | layoutParams.height = (int) (DimenUtils.getScreenWidth(this) * 0.5625f); |
| | | |
| | | // layout = findViewById(R.id.fl_player); |
| | | // if (layout == null) |
| | | // return; |
| | | // layoutParams = layout |
| | | // .getLayoutParams(); |
| | | // layoutParams.height = (int) (DimenUtils.getScreenWidth(this) * 0.5625f); |
| | | |
| | | |
| | | layout.requestLayout(); |
| | | |
| | | findViewById(R.id.ll_bottom).setVisibility(View.VISIBLE); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public void onEventMainThread(VideoInfo info) { |
| | | videoInfo = info; |
| | | if (iv_favourite != null) { |
| | | if (!StringUtils.isNumeric(videoInfo.getId())) { |
| | | iv_favourite.setVisibility(View.GONE); |
| | | } else { |
| | | iv_favourite.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void getVideoDetail(final Context context, String videoId, |
| | |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | if (HanJuConstant.AD_TYPE.isVideoDetailSplashAd()) |
| | | try { |
| | | FullVideoAdManager.getInstance().loadAd(getApplicationContext(), null); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | tv_video_resource.setText("来源:" + selectedUrl.getName()); |
| | | } |
| | | popupWindow = new PopupWindow( |
| | | com.hanju.video.app.util.DimenUtils.dip2px(getApplicationContext(), 93), |
| | | com.hanju.video.app.util.common.DimenUtils.dip2px(getApplicationContext(), 93), |
| | | android.view.WindowManager.LayoutParams.WRAP_CONTENT); |
| | | popupWindow.setOutsideTouchable(true);// 点击外部可点击 |
| | | popupWindow.setBackgroundDrawable(new ColorDrawable(0));// 设置背景 |
| | |
| | | import com.nostra13.universalimageloader.core.DisplayImageOptions; |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.entity.PushEpisode; |
| | | import com.hanju.video.app.entity.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.VideoResource; |
| | | import com.hanju.video.app.entity.video.PushEpisode; |
| | | import com.hanju.video.app.entity.video.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoResource; |
| | | import com.hanju.video.app.R; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | | /** |
| | | * 视频详情 |
| | | * |
| | | * @author Administrator |
| | | */ |
| | | |
| | | public class VideoDetailFragment extends Fragment { |
| | | |
| | | private VideoInfo mVideoInfo; |
| | |
| | | import android.graphics.Canvas; |
| | | import android.graphics.Rect; |
| | | import android.os.Bundle; |
| | | import android.text.Html; |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.view.animation.Animation; |
| | | import android.view.animation.RotateAnimation; |
| | | import android.view.animation.Transformation; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.ScrollView; |
| | | import android.widget.TextView; |
| | | |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.PushEpisode; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.VideoResource; |
| | | import com.hanju.video.app.entity.video.PushEpisode; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoResource; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.util.VideoUtil; |
| | | import com.hanju.video.app.util.video.VideoUtil; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.ad.ExpressAdManager; |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | |
| | | import java.util.List; |
| | |
| | | package com.hanju.video.app.ui.media; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | |
| | | import android.widget.PopupWindow; |
| | | import android.widget.Toast; |
| | | |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.ui.login.LoginActivity; |
| | | |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | | public class VideoReviewPopupWindow extends PopupWindow { |
| | | private LayoutInflater mInflater; |
| | |
| | | package com.hanju.video.app.ui.mine; |
| | | |
| | | import android.Manifest; |
| | | import android.app.Notification; |
| | | import android.app.NotificationChannel; |
| | | import android.app.NotificationManager; |
| | | import android.content.Intent; |
| | | import android.content.pm.PackageManager; |
| | | import android.graphics.BitmapFactory; |
| | | import android.graphics.Color; |
| | | import android.graphics.PixelFormat; |
| | |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | | |
| | | import androidx.annotation.Nullable; |
| | | import androidx.core.app.ActivityCompat; |
| | | import androidx.core.app.NotificationCompat; |
| | | import androidx.core.content.ContextCompat; |
| | | |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.view.ViewGroup; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | import android.widget.ProgressBar; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.hanju.video.app.util.downutil.StringUtils; |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.hanju.video.app.util.common.FileUtils; |
| | | import com.hanju.video.app.util.downutils.StringUtils; |
| | | import com.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.tencent.smtt.export.external.interfaces.SslError; |
| | | import com.tencent.smtt.export.external.interfaces.SslErrorHandler; |
| | | import com.tencent.smtt.export.external.interfaces.WebResourceRequest; |
| | | import com.tencent.smtt.sdk.DownloadListener; |
| | | import com.tencent.smtt.sdk.ValueCallback; |
| | | import com.tencent.smtt.sdk.WebChromeClient; |
| | | import com.tencent.smtt.sdk.WebSettings; |
| | | import com.tencent.smtt.sdk.WebView; |
| | |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.util.browser.BWJavaInterface; |
| | | import com.hanju.video.app.util.downutil.DownFiles; |
| | | import com.hanju.video.app.util.downutil.DownFiles.IProgress; |
| | | import com.hanju.video.app.util.browser.HanJuJavaInterface; |
| | | import com.hanju.video.app.util.downutils.DownFiles; |
| | | import com.hanju.video.app.util.downutils.DownFiles.IProgress; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | import com.hanju.video.app.util.x5.X5WebView; |
| | | import com.hanju.video.app.util.x5web.X5WebView; |
| | | |
| | | import java.io.File; |
| | | |
| | | public class BrowserActivity extends BaseActivity implements OnClickListener { |
| | | private final static int FILECHOOSER_RESULTCODE = 10002; |
| | | |
| | | private static final String TAG = BrowserActivity.class.getSimpleName(); |
| | | private TextView tv_top_bar_left; |
| | | private TextView tv_top_bar_left2; |
| | | private TextView tv_top_bar_middle; |
| | | private X5WebView webview; |
| | | ProgressBar progressBar; |
| | | private ValueCallback mUploadMessage; |
| | | |
| | | |
| | | private void initX5WebView() { |
| | |
| | | webview.setWebViewClient(new WebViewClient() { |
| | | @Override |
| | | public boolean shouldOverrideUrlLoading(WebView view, String url) { |
| | | Log.i(TAG, "url:" + url); |
| | | if (url != null && url.startsWith("weixin://")) { |
| | | Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); |
| | | startActivity(intent); |
| | |
| | | |
| | | @Override |
| | | public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) { |
| | | String url = webResourceRequest.getUrl().toString(); |
| | | Log.i(TAG, "url:" + url); |
| | | return super.shouldOverrideUrlLoading(webView, webResourceRequest); |
| | | } |
| | | |
| | |
| | | } |
| | | super.onProgressChanged(webView, i); |
| | | } |
| | | |
| | | @Override |
| | | public void openFileChooser(ValueCallback<Uri> valueCallback, String acceptType, String capture) { |
| | | if (mUploadMessage != null) { |
| | | mUploadMessage.onReceiveValue(null); |
| | | } |
| | | if (lacksPermissions(Manifest.permission.READ_EXTERNAL_STORAGE)) { //存储权限未开启 |
| | | valueCallback.onReceiveValue(null); |
| | | ActivityCompat.requestPermissions(BrowserActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 10023); |
| | | return; |
| | | } |
| | | mUploadMessage = valueCallback; |
| | | Intent i = new Intent(Intent.ACTION_GET_CONTENT); |
| | | i.addCategory(Intent.CATEGORY_OPENABLE); |
| | | String type = TextUtils.isEmpty(acceptType) ? "*/*" : acceptType; |
| | | i.setType(type); |
| | | startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); |
| | | super.openFileChooser(valueCallback, acceptType, capture); |
| | | } |
| | | |
| | | // 判断权限集合 是否授权 false授权 true未授权 |
| | | public boolean lacksPermissions(String... permissions) { |
| | | for (String permission : permissions) { |
| | | if (lacksPermission(permission)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | // 判断是否缺少权限 |
| | | private boolean lacksPermission(String permission) { |
| | | //权限未授权 |
| | | return ContextCompat.checkSelfPermission(getApplicationContext(), permission) == PackageManager.PERMISSION_DENIED; |
| | | } |
| | | |
| | | @Override |
| | | public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, FileChooserParams fileChooserParams) { |
| | | if (mUploadMessage != null) { |
| | | mUploadMessage.onReceiveValue(null); |
| | | } |
| | | if (lacksPermissions(Manifest.permission.READ_EXTERNAL_STORAGE)) { //存储权限未开启 |
| | | valueCallback.onReceiveValue(null); |
| | | ActivityCompat.requestPermissions(BrowserActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 10023); |
| | | return true; |
| | | } |
| | | |
| | | |
| | | mUploadMessage = valueCallback; |
| | | Intent i = new Intent(Intent.ACTION_GET_CONTENT); |
| | | i.addCategory(Intent.CATEGORY_OPENABLE); |
| | | if (fileChooserParams != null && fileChooserParams.getAcceptTypes() != null |
| | | && fileChooserParams.getAcceptTypes().length > 0) { |
| | | i.setType(fileChooserParams.getAcceptTypes()[0]); |
| | | } else { |
| | | i.setType("*/*"); |
| | | } |
| | | startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); |
| | | return true; |
| | | } |
| | | }); |
| | | WebSettings webSetting = webview.getSettings(); |
| | | webSetting.setJavaScriptEnabled(true); |
| | | webSetting.setTextZoom(100); |
| | | webSetting.setDomStorageEnabled(true); |
| | | webview.addJavascriptInterface(new BWJavaInterface(this, webview), "yestv"); |
| | | webview.addJavascriptInterface(new HanJuJavaInterface(this, webview), "yestv"); |
| | | } |
| | | |
| | | @Override |
| | | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { |
| | | super.onActivityResult(requestCode, resultCode, data); |
| | | if (requestCode == FILECHOOSER_RESULTCODE) { |
| | | if (null == mUploadMessage) return; |
| | | Uri result = data == null || resultCode != RESULT_OK ? null : data.getData(); |
| | | if (result == null) { |
| | | mUploadMessage.onReceiveValue(null); |
| | | mUploadMessage = null; |
| | | return; |
| | | } |
| | | String path = FileUtils.getFilePathByUri(this, result); |
| | | if (TextUtils.isEmpty(path)) { |
| | | mUploadMessage.onReceiveValue(null); |
| | | mUploadMessage = null; |
| | | return; |
| | | } |
| | | Uri uri = Uri.fromFile(new File(path)); |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
| | | mUploadMessage.onReceiveValue(new Uri[]{uri}); |
| | | } else { |
| | | mUploadMessage.onReceiveValue(uri); |
| | | } |
| | | mUploadMessage = null; |
| | | } |
| | | } |
| | | |
| | | private String wholeTitle; |
| | |
| | | if (!StringUtils.isNullOrEmpty(wholeTitle)) { |
| | | tv_top_bar_middle.setText(wholeTitle); |
| | | } |
| | | // webview.loadUrl("http://192.168.3.122:8848/BuWanWeb/unregister/index.html"); |
| | | webview.loadUrl("https://www.hmtv.me/vplay/MjY3LTEtMQ==.html"); |
| | | } |
| | | // 文件下载监听 |
| | | |
| | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | webview.reload(); |
| | | // webview.reload(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import android.view.View.OnClickListener; |
| | | import android.widget.Button; |
| | | import android.widget.EditText; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.lcjian.library.DeviceUuidFactory; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.lib.library.DeviceUuidFactory; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | |
| | | package com.hanju.video.app.ui.mine; |
| | | |
| | | import android.content.Intent; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.provider.Settings; |
| | | |
| | |
| | | import androidx.fragment.app.FragmentActivity; |
| | | |
| | | import android.view.View; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | import android.view.View.OnClickListener; |
| | | import android.widget.Button; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | | import android.widget.ToggleButton; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | |
| | | import com.lcjian.library.util.FragmentSwitchHelper; |
| | | import com.hanju.lib.library.util.FragmentSwitchHelper; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.ui.recent.DownloadAdapter2; |
| | | import com.hanju.video.app.ui.recent.OfflineCacheFragment2; |
| | | import com.hanju.video.app.ui.recent.WatchHistoryFragment; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | |
| | | public class DownloadActivity extends FragmentActivity implements |
| | | DownloadAdapter2.IGetDeleteCallback, OnClickListener { |
| | |
| | | import android.webkit.WebView; |
| | | import android.webkit.WebViewClient; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.ProgressBar; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.util.downutil.DownFiles; |
| | | import com.hanju.video.app.util.downutil.DownFiles.IProgress; |
| | | import com.hanju.video.app.util.downutils.DownFiles; |
| | | import com.hanju.video.app.util.downutils.DownFiles.IProgress; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | import com.hanju.video.app.widget.CustomWebView; |
| | | import com.hanju.video.app.ui.widget.CustomWebView; |
| | | |
| | | public class FXBrowserActivity extends BaseActivity implements OnClickListener { |
| | | |
| | |
| | | import android.view.ViewGroup; |
| | | import android.widget.TextView; |
| | | |
| | | import com.lcjian.library.util.common.DateUtils; |
| | | import com.hanju.lib.library.util.common.DateUtils; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.db.MessageTable; |
| | | import com.hanju.video.app.widget.BadgeView; |
| | | import com.hanju.video.app.database.MessageTable; |
| | | import com.hanju.video.app.ui.widget.BadgeView; |
| | | |
| | | public class MessageAdapter extends CursorAdapter { |
| | | |
| | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.widget.Button; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.FrameLayout.LayoutParams; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.ListView; |
| | | import android.widget.ProgressBar; |
| | |
| | | import android.widget.RadioGroup; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | import android.widget.ToggleButton; |
| | | |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.util.RefreshLayout; |
| | | import com.lcjian.library.util.SingleToast; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.GoodsInfo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.goods.GoodsInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.common.ListVideoAdapter; |
| | | import com.hanju.video.app.ui.login.LoginActivity; |
| | |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.nostra13.universalimageloader.core.ImageLoader; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.umeng.socialize.UMAuthListener; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.umeng.socialize.bean.SHARE_MEDIA; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.SDCardEntity; |
| | | import com.hanju.video.app.entity.common.SDCardEntity; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.login.PersonInfoActivity; |
| | | import com.hanju.video.app.ui.main.MineFragment; |
| | | import com.hanju.video.app.util.SDCardUtil; |
| | | import com.hanju.video.app.util.XGPush; |
| | | import com.hanju.video.app.util.ui.SDCardUtil; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | import com.hanju.video.app.widget.BadgeView; |
| | | import com.ysh.wpc.appupdate.AppUpdate; |
| | | import com.hanju.video.app.ui.widget.BadgeView; |
| | | import com.hanju.update.appupdate.AppUpdate; |
| | | |
| | | import java.util.Map; |
| | | |
| | |
| | | edit.putBoolean("PushType", false); |
| | | edit.commit(); |
| | | MineFragment.isLogin = false;// 改为未登录状态 |
| | | XGPush.unRegisterPush(SettingsActivity.this); |
| | | finish(); |
| | | } |
| | | }); |
| | |
| | | import android.app.ProgressDialog; |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | import android.view.View; |
| | |
| | | import android.widget.EditText; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | |
| | | |
| | | import android.content.ContentValues; |
| | | import android.database.Cursor; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import androidx.loader.app.LoaderManager; |
| | | import androidx.loader.content.CursorLoader; |
| | |
| | | import android.view.ViewGroup; |
| | | import android.widget.AdapterView; |
| | | import android.widget.AdapterView.OnItemClickListener; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | import android.widget.ListView; |
| | | import android.widget.TextView; |
| | | |
| | | import com.lcjian.library.util.common.DateUtils; |
| | | import com.hanju.lib.library.util.common.DateUtils; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.db.MessageTable; |
| | | import com.hanju.video.app.database.MessageTable; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | |
| | |
| | | package com.hanju.video.app.ui.mine; |
| | | |
| | | import android.content.Intent; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.provider.Settings; |
| | | |
| | |
| | | import androidx.fragment.app.FragmentActivity; |
| | | |
| | | import android.view.View; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | import android.view.View.OnClickListener; |
| | | import android.widget.Button; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | | import android.widget.ToggleButton; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | |
| | | import com.lcjian.library.util.FragmentSwitchHelper; |
| | | import com.hanju.lib.library.util.FragmentSwitchHelper; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.ui.recent.DownloadAdapter2; |
| | | import com.hanju.video.app.ui.recent.OfflineCacheFragment2; |
| | | import com.hanju.video.app.ui.recent.WatchHistoryFragment; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | |
| | | public class WatchHistoryActivity extends FragmentActivity implements |
| | | DownloadAdapter2.IGetDeleteCallback, OnClickListener { |
| | |
| | | package com.hanju.video.app.ui.mine; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.graphics.Canvas; |
| | | import android.graphics.Rect; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | |
| | | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.entity.recommend.holder.RecommendVideoAdHolder; |
| | | import com.hanju.video.app.entity.video.VideoContent; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.holder.FooterViewHolder; |
| | | import com.hanju.video.app.entity.video.holder.HeaderViewHolder; |
| | | import com.hanju.video.app.entity.video.holder.VideoHolder; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.ui.video.IVideoClickListener; |
| | | import com.hanju.video.app.util.VideoUtil; |
| | | import com.hanju.video.app.util.ad.ExpressAdManager; |
| | | import com.hanju.video.app.util.ad.GDTConstant; |
| | | import com.hanju.video.app.util.ad.GDTNativeADUnifiedManager; |
| | | import com.lcjian.library.util.ScreenUtils; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.lcjian.library.widget.RatioLayout; |
| | | import com.qq.e.ads.nativ.NativeUnifiedADData; |
| | | import com.qq.e.ads.nativ.widget.NativeAdContainer; |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.widget.RatioLayout; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade; |
| | |
| | | |
| | | import android.database.Cursor; |
| | | import android.net.Uri; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.os.Environment; |
| | | import androidx.fragment.app.Fragment; |
| | |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | import android.widget.ToggleButton; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | |
| | | import com.mozillaonline.providers.DownloadManager; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.db.DownloadTable; |
| | | import com.hanju.video.app.database.DownloadTable; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.recent.DownLoadAdapter.IGetDeleteCallback; |
| | | import com.hanju.video.app.ui.recent.DownLoadAdapter.IGetSelectStatus; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.util.common.ConnectionUtils; |
| | | import com.hanju.lib.library.util.common.ConnectionUtils; |
| | | import com.mozillaonline.providers.DownloadManager; |
| | | import com.mozillaonline.providers.downloads.Downloads; |
| | | import com.nostra13.universalimageloader.core.DisplayImageOptions; |
| | |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | | import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.db.DownloadTable; |
| | | import com.hanju.video.app.entity.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.database.DownloadTable; |
| | | import com.hanju.video.app.entity.video.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.util.DownloadUtils; |
| | | import com.hanju.video.app.util.downutils.DownloadUtils; |
| | | |
| | | public class DownLoadAdapter extends CursorAdapter { |
| | | public interface IGetDeleteCallback { |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.util.common.ConnectionUtils; |
| | | import com.hanju.lib.library.util.common.ConnectionUtils; |
| | | import com.mozillaonline.providers.DownloadManager; |
| | | import com.hanju.video.app.R; |
| | | import com.nostra13.universalimageloader.core.DisplayImageOptions; |
| | | import com.nostra13.universalimageloader.core.ImageLoader; |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | | import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer; |
| | | import com.hanju.video.app.db.DownloadTable; |
| | | import com.hanju.video.app.entity.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.database.DownloadTable; |
| | | import com.hanju.video.app.entity.video.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.util.DownloadUtils; |
| | | import com.hanju.video.app.util.downutils.DownloadUtils; |
| | | |
| | | public class DownloadAdapter2 extends BaseAdapter { |
| | | |
| | |
| | | import android.widget.Toast; |
| | | |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.db.DownloadTable; |
| | | import com.hanju.video.app.entity.SDCardEntity; |
| | | import com.hanju.video.app.database.DownloadTable; |
| | | import com.hanju.video.app.entity.common.SDCardEntity; |
| | | import com.hanju.video.app.ui.recent.DownloadAdapter2.IGetDeleteCallback; |
| | | import com.hanju.video.app.ui.recent.DownloadAdapter2.IGetSelectStatus; |
| | | import com.hanju.video.app.util.SDCardUtil; |
| | | import com.hanju.video.app.util.ui.SDCardUtil; |
| | | import com.mozillaonline.providers.DownloadManager; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.mozillaonline.providers.DownloadManager; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.db.DownloadTable; |
| | | import com.hanju.video.app.db.WatchHistoryTable; |
| | | import com.hanju.video.app.entity.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.database.DownloadTable; |
| | | import com.hanju.video.app.database.WatchHistoryTable; |
| | | import com.hanju.video.app.entity.video.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.db.WatchHistoryTable; |
| | | import com.hanju.video.app.database.WatchHistoryTable; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.CategoryRecommendVideo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.VideoType; |
| | | import com.hanju.video.app.entity.recommend.CategoryRecommendVideo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoType; |
| | | import com.hanju.video.app.ui.category.CategoryRecommendAdapter; |
| | | import com.hanju.video.app.util.DimenUtils; |
| | | import com.hanju.video.app.util.common.DimenUtils; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.RequestManager; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.lcjian.library.widget.RatioLayout; |
| | | import com.hanju.lib.library.widget.RatioLayout; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.RequestManager; |
| | | import com.lcjian.library.widget.RatioLayout; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.lib.library.widget.RatioLayout; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.R; |
| | | |
| | |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.HomeSpecial; |
| | | import com.hanju.video.app.entity.recommend.HomeSpecial; |
| | | import com.hanju.video.app.ui.category.MVideosActivity; |
| | | import com.hanju.video.app.util.GlideCircleTransform; |
| | | import com.hanju.video.app.util.ui.GlideCircleTransform; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.lcjian.library.util.MarketUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.lcjian.library.widget.MyListView; |
| | | import com.hanju.lib.library.util.MarketUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.widget.MyListView; |
| | | import com.hanju.video.app.HanJuApplication; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.HomeType; |
| | | import com.hanju.video.app.entity.HomeVideo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.VideoType; |
| | | import com.hanju.video.app.service.DownLoadFileService; |
| | | import com.hanju.video.app.entity.recommend.HomeType; |
| | | import com.hanju.video.app.entity.recommend.HomeVideo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoType; |
| | | import com.hanju.video.app.services.DownLoadFileService; |
| | | import com.hanju.video.app.ui.category.StarDetailActivity; |
| | | import com.hanju.video.app.ui.category.bean.HotStar; |
| | | import com.hanju.video.app.ui.common.VideosLiveActivity; |
| | | import com.hanju.video.app.ui.discover.StarsActivity; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.util.AppMarket; |
| | | import com.hanju.video.app.util.GlideCircleTransform; |
| | | import com.hanju.video.app.util.downutil.ApkUtil; |
| | | import com.hanju.video.app.util.common.AppMarket; |
| | | import com.hanju.video.app.util.ui.GlideCircleTransform; |
| | | import com.hanju.video.app.util.downutils.ApkUtil; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.fragment.app.Fragment; |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.entity.HomeSpecial; |
| | | import com.hanju.video.app.entity.recommend.HomeSpecial; |
| | | import com.hanju.video.app.entity.video.HomeNav; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.lcjian.library.content.ConnectivityChangeHelper; |
| | | import com.lcjian.library.content.ConnectivityChangeHelper.OnConnectivityChangeListener; |
| | | import com.lcjian.library.util.SystemCommon; |
| | | import com.lcjian.library.util.cache.DiskLruCache; |
| | | import com.lcjian.library.util.common.StorageUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.lcjian.library.widget.RatioLayout; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.hanju.lib.library.content.ConnectivityChangeHelper; |
| | | import com.hanju.lib.library.content.ConnectivityChangeHelper.OnConnectivityChangeListener; |
| | | import com.hanju.lib.library.util.SystemCommon; |
| | | import com.hanju.lib.library.util.cache.DiskLruCache; |
| | | import com.hanju.lib.library.util.common.StorageUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.widget.RatioLayout; |
| | | import com.lzj.gallery.library.views.BannerViewPager; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.HomeAd; |
| | | import com.hanju.video.app.entity.HomeType; |
| | | import com.hanju.video.app.entity.HomeTypeItem; |
| | | import com.hanju.video.app.entity.HomeVideo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.VideoType; |
| | | import com.hanju.video.app.entity.recommend.HomeAd; |
| | | import com.hanju.video.app.entity.recommend.HomeType; |
| | | import com.hanju.video.app.entity.recommend.HomeTypeItem; |
| | | import com.hanju.video.app.entity.recommend.HomeVideo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoType; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.ui.category.bean.HotStar; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.ui.mine.BrowserActivity; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.CustomShareDialog; |
| | | import com.hanju.video.app.util.DimenUtils; |
| | | import com.hanju.video.app.util.common.DimenUtils; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.ad.ExpressAdManager; |
| | | import com.hanju.video.app.util.ui.DividerItemDecoration; |
| | | import com.hanju.video.app.util.ui.GlideUtil; |
| | | import com.ysh.wpc.appupdate.GoReview; |
| | | import com.ysh.wpc.appupdate.service.DownLoadFileService; |
| | | import com.hanju.update.appupdate.GoReview; |
| | | import com.hanju.update.appupdate.service.DownLoadFileService; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONArray; |
| | |
| | | super.getItemOffsets(outRect, view, parent, state); |
| | | int index = parent.getChildAdapterPosition(view); |
| | | int total = parent.getAdapter().getItemCount(); |
| | | int minWidth = com.lcjian.library.util.common.DimenUtils.dipToPixels(10, view.getContext()); |
| | | int minWidth = com.hanju.lib.library.util.common.DimenUtils.dipToPixels(10, view.getContext()); |
| | | outRect.bottom = 2 * minWidth; |
| | | } |
| | | }; |
| | |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Intent; |
| | | |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.view.ViewGroup; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.RelativeLayout; |
| | | import android.widget.TextView; |
| | |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.hanju.video.app.entity.video.holder.FooterViewHolder; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.HomeType; |
| | | import com.hanju.video.app.entity.HomeVideo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.VideoType; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.entity.recommend.HomeType; |
| | | import com.hanju.video.app.entity.recommend.HomeTypeContent; |
| | | import com.hanju.video.app.entity.recommend.HomeVideo; |
| | | import com.hanju.video.app.entity.recommend.RecommendContent; |
| | | import com.hanju.video.app.entity.recommend.holder.RecommendVideoAdHolder; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoType; |
| | | import com.hanju.video.app.entity.video.holder.FooterViewHolder; |
| | | import com.hanju.video.app.entity.video.holder.HeaderViewHolder; |
| | | import com.hanju.video.app.entity.video.holder.VideoHolder; |
| | | import com.hanju.video.app.ui.common.VideosLiveActivity; |
| | |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.ui.video.VideoAlbumAdapter; |
| | | import com.hanju.video.app.ui.video.VideoColumn2Adapter; |
| | | import com.hanju.video.app.util.VideoUtil; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.ad.ExpressAdManager; |
| | | import com.hanju.video.app.util.video.VideoUtil; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.TreeSet; |
| | | |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | public class RecommendNewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { |
| | | |
| | |
| | | adapter.initRecyclerViewDisplayWidthRow1(holder.rv_content); |
| | | holder.rv_content.setAdapter(adapter); |
| | | holder.view.setVisibility(View.VISIBLE); |
| | | }else{ |
| | | } else { |
| | | holder.view.setVisibility(View.GONE); |
| | | } |
| | | } else { |
| | |
| | | ad.getCsj().setDislikeCallback(mContext, new TTAdDislike.DislikeInteractionCallback() { |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s) { |
| | | public void onShow() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s, boolean b) { |
| | | contentList.remove(content); |
| | | notifyDataSetChanged(); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRefuse() { |
| | | |
| | | } |
| | | }); |
| | | ad.getCsj().render(); |
| | | holder.fl_container.addView(ad.getCsj().getExpressAdView()); |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.util.ConfigUtil; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.video.app.util.common.AppConfigUtil; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.qq.e.ads.cfg.VideoOption; |
| | | import com.qq.e.ads.nativ.ADSize; |
| | | import com.qq.e.ads.nativ.NativeExpressAD; |
| | | import com.qq.e.ads.nativ.NativeExpressADView; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.video.SuggestKeysAdapter; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | |
| | | |
| | | // 1.加载广告,先设置加载上下文环境和条件 |
| | | private void initAdvertisement() { |
| | | String appId = ConfigUtil.getGDTAppId(getApplicationContext()); |
| | | if (com.hanju.video.app.util.downutil.StringUtils.isNullOrEmpty(appId)) { |
| | | String appId = AppConfigUtil.getGDTAppId(getApplicationContext()); |
| | | if (com.hanju.video.app.util.downutils.StringUtils.isNullOrEmpty(appId)) { |
| | | return; |
| | | } |
| | | |
| | |
| | | import android.content.SharedPreferences; |
| | | import android.graphics.Color; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | |
| | | import android.widget.AdapterView.OnItemClickListener; |
| | | import android.widget.AutoCompleteTextView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | import android.widget.ProgressBar; |
| | | import android.widget.TextView; |
| | | |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.util.common.SoftKeyboardUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.common.SoftKeyboardUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.HttpApiUtil; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.VideoType; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoType; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.entity.video.VideoContent; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.video.SearchResultAdapter; |
| | | import com.hanju.video.app.ui.video.SuggestKeysAdapter; |
| | | import com.hanju.video.app.util.DimenUtils; |
| | | import com.hanju.video.app.util.common.DimenUtils; |
| | | import com.hanju.video.app.util.ad.ExpressAdManager; |
| | | import com.hanju.video.app.util.ad.manager.SearchResultAdManager; |
| | | import com.hanju.video.app.util.ui.DividerItemDecoration; |
| | |
| | | import android.view.ViewGroup; |
| | | import android.widget.TextView; |
| | | |
| | | import com.hanju.video.app.entity.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.util.DimenUtils; |
| | | import com.hanju.video.app.entity.video.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.util.common.DimenUtils; |
| | | import com.hanju.video.app.R; |
| | | |
| | | public class EpisodeNewAdapter extends RecyclerView.Adapter { |
| | |
| | | package com.hanju.video.app.ui.video; |
| | | |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | |
| | | public interface IVideoClickListener { |
| | | |
| | |
| | | import android.widget.TextView; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.video.app.entity.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.entity.video.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.entity.video.VideoContent; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.entity.video.VideoContent; |
| | | import com.hanju.video.app.entity.video.holder.VideoHolder; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.util.ad.ExpressAdManager; |
| | | import com.lcjian.library.widget.RatioLayout; |
| | | import com.hanju.lib.library.widget.RatioLayout; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.List; |
| | | |
| | | import androidx.annotation.NonNull; |
| | |
| | | import android.widget.FrameLayout; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.entity.video.VideoContent; |
| | | import com.hanju.video.app.entity.video.holder.VideoHolder; |
| | |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.qq.e.ads.nativ.NativeUnifiedADData; |
| | | import com.qq.e.ads.nativ.widget.NativeAdContainer; |
| | | import com.hanju.video.app.entity.VideoInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.entity.recommend.holder.RecommendVideoAdHolder; |
| | | import com.hanju.video.app.entity.video.VideoContent; |
| | |
| | | import com.hanju.video.app.entity.video.holder.HeaderViewHolder; |
| | | import com.hanju.video.app.entity.video.holder.VideoHolder; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.util.VideoUtil; |
| | | import com.hanju.video.app.util.video.VideoUtil; |
| | | import com.hanju.video.app.util.ad.ExpressAdManager; |
| | | import com.hanju.video.app.util.ad.GDTConstant; |
| | | import com.hanju.video.app.util.ad.GDTADConstant; |
| | | import com.hanju.video.app.util.ad.GDTNativeADUnifiedManager; |
| | | import com.hanju.video.app.R; |
| | | |
| | |
| | | if (contentList == null || contentList.size() == 0) |
| | | return; |
| | | |
| | | GDTNativeADUnifiedManager.loadAD(columns == 3 ? GDTConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN3 : GDTConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN2, 1, mContext, new GDTNativeADUnifiedManager.IAdLoadListener() { |
| | | GDTNativeADUnifiedManager.loadAD(columns == 3 ? GDTADConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN3 : GDTADConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN2, 1, mContext, new GDTNativeADUnifiedManager.IAdLoadListener() { |
| | | @Override |
| | | public void onSuccess(List<NativeUnifiedADData> adList) { |
| | | if (adList != null && adList.size() > 0) |
| | |
| | | import android.view.View.OnClickListener; |
| | | import android.view.ViewGroup; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | import android.widget.ProgressBar; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.hanju.video.app.ui.dialog.BrowserMoreDialog; |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.lcjian.library.util.common.ClipboardUtil; |
| | | import com.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.hanju.lib.library.util.common.ClipboardUtil; |
| | | import com.tencent.smtt.export.external.interfaces.SslError; |
| | | import com.tencent.smtt.export.external.interfaces.SslErrorHandler; |
| | | import com.tencent.smtt.export.external.interfaces.WebResourceRequest; |
| | |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.util.browser.BWJavaInterface; |
| | | import com.hanju.video.app.util.downutil.DownFiles; |
| | | import com.hanju.video.app.util.downutil.DownFiles.IProgress; |
| | | import com.hanju.video.app.util.browser.HanJuJavaInterface; |
| | | import com.hanju.video.app.util.downutils.DownFiles; |
| | | import com.hanju.video.app.util.downutils.DownFiles.IProgress; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | import com.hanju.video.app.util.x5.X5WebView; |
| | | import com.hanju.video.app.util.x5web.X5WebView; |
| | | import com.hanju.video.app.R; |
| | | |
| | | public class VideoPlayerActivity extends BaseActivity implements OnClickListener { |
| | |
| | | WebSettings webSetting = webview.getSettings(); |
| | | webSetting.setJavaScriptEnabled(true); |
| | | webSetting.setTextZoom(100); |
| | | webview.addJavascriptInterface(new BWJavaInterface(this, webview), "yestv"); |
| | | webview.addJavascriptInterface(new HanJuJavaInterface(this, webview), "yestv"); |
| | | } |
| | | |
| | | @Override |
New file |
| | |
| | | package com.hanju.video.app.ui.video; |
| | | |
| | | import android.content.pm.ActivityInfo; |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | import android.widget.ListView; |
| | | import android.widget.ProgressBar; |
| | | |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.MyRetainViewFragment; |
| | | import com.hanju.video.app.ui.category.bean.UniqueBean; |
| | | import com.hanju.video.app.ui.recommend.DiscoverVideosAdapter; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.common.AppConfigUtil; |
| | | import com.hanju.video.app.util.downutils.StringUtils; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.qq.e.ads.cfg.VideoOption; |
| | | import com.qq.e.ads.nativ.ADSize; |
| | | import com.qq.e.ads.nativ.NativeExpressAD; |
| | | import com.qq.e.ads.nativ.NativeExpressADView; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.shuyu.gsyvideoplayer.GSYVideoManager; |
| | | import com.shuyu.gsyvideoplayer.model.VideoOptionModel; |
| | | import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | import tv.danmaku.ijk.media.player.IjkMediaPlayer; |
| | | |
| | | /** |
| | | * 专题碎片 |
| | | */ |
| | | public class VideoPlayerFragment extends RetainViewFragment { |
| | | |
| | | private String playUrl; |
| | | private String url; |
| | | private String title; |
| | | |
| | | private StandardGSYVideoPlayer videoPlayer; |
| | | |
| | | public static VideoPlayerFragment newInstance(String title, String url, String playUrl) { |
| | | VideoPlayerFragment fragment = new VideoPlayerFragment(); |
| | | Bundle bundle = new Bundle(); |
| | | bundle.putString("url", url); |
| | | bundle.putString("title", title); |
| | | bundle.putString("playUrl", playUrl); |
| | | fragment.setArguments(bundle); |
| | | return fragment; |
| | | } |
| | | |
| | | public void setVideoInfo(String title, String url, String playUrl) { |
| | | this.title = title; |
| | | this.url = url; |
| | | this.playUrl = playUrl; |
| | | videoPlayer.setUp(playUrl, true, title); |
| | | videoPlayer.getTitleTextView().setVisibility(View.VISIBLE); |
| | | videoPlayer.startPlayLogic(); |
| | | } |
| | | |
| | | @Override |
| | | public int getContentResource() { |
| | | return R.layout.fragment_player; |
| | | } |
| | | |
| | | |
| | | private void initPlayer() { |
| | | /**此中内容:优化加载速度,降低延迟*/ |
| | | VideoOptionModel videoOptionModel = new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "rtsp_transport", "tcp"); |
| | | List<VideoOptionModel> list = new ArrayList<>(); |
| | | list.add(videoOptionModel); |
| | | videoOptionModel = new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "rtsp_flags", "prefer_tcp"); |
| | | list.add(videoOptionModel); |
| | | videoOptionModel = new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "allowed_media_types", "video"); //根据媒体类型来配置 |
| | | list.add(videoOptionModel); |
| | | videoOptionModel = new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "timeout", 20000); |
| | | list.add(videoOptionModel); |
| | | videoOptionModel = new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "buffer_size", 1316); |
| | | list.add(videoOptionModel); |
| | | videoOptionModel = new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "infbuf", 1); // 无限读 |
| | | list.add(videoOptionModel); |
| | | videoOptionModel = new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "analyzemaxduration", 100); |
| | | list.add(videoOptionModel); |
| | | videoOptionModel = new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "probesize", 10240); |
| | | list.add(videoOptionModel); |
| | | videoOptionModel = new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "flush_packets", 1); |
| | | list.add(videoOptionModel); |
| | | // 关闭播放器缓冲,这个必须关闭,否则会出现播放一段时间后,一直卡主,控制台打印 FFP_MSG_BUFFERING_START |
| | | videoOptionModel = new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "packet-buffering", 0); |
| | | list.add(videoOptionModel); |
| | | // GSYVideoManager.instance().setOptionModelList(list); |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | videoPlayer = contentView.findViewById(R.id.videoPlayer); |
| | | url = getArguments().getString("url", ""); |
| | | playUrl = getArguments().getString("playUrl", ""); |
| | | title = getArguments().getString("title", ""); |
| | | initPlayer(); |
| | | //设置返回按键功能 |
| | | videoPlayer.getBackButton().setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | getActivity().onBackPressed(); |
| | | } |
| | | }); |
| | | videoPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (getActivity().getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { |
| | | getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); |
| | | } else { |
| | | getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| | | } |
| | | } |
| | | }); |
| | | videoPlayer.setUp(playUrl, true, title); |
| | | videoPlayer.getTitleTextView().setVisibility(View.VISIBLE); |
| | | videoPlayer.startPlayLogic(); |
| | | } |
| | | |
| | | |
| | | public void onBackPressed() { |
| | | //先返回正常状态 |
| | | if (getActivity().getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { |
| | | videoPlayer.getFullscreenButton().performClick(); |
| | | return; |
| | | } |
| | | //释放所有 |
| | | videoPlayer.setVideoAllCallBack(null); |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | videoPlayer.onVideoResume(); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | videoPlayer.onVideoPause(); |
| | | } |
| | | |
| | | @Override |
| | | public void onDestroy() { |
| | | super.onDestroy(); |
| | | GSYVideoManager.releaseAllVideos(); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.ui.video.parser; |
| | | |
| | | import android.content.Context; |
| | | import android.webkit.JavascriptInterface; |
| | | |
| | | import org.jsoup.Jsoup; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | public class AjaxInterceptJavascriptInterface { |
| | | |
| | | private static String interceptHeader = null; |
| | | private WriteHandlingWebViewClient mWebViewClient = null; |
| | | |
| | | public AjaxInterceptJavascriptInterface(WriteHandlingWebViewClient webViewClient) { |
| | | mWebViewClient = webViewClient; |
| | | } |
| | | |
| | | public static String enableIntercept(Context context, byte[] data) throws IOException { |
| | | if (interceptHeader == null) { |
| | | interceptHeader = new String( |
| | | Utils.consumeInputStream(context.getAssets().open("interceptheader.html")) |
| | | ); |
| | | } |
| | | |
| | | org.jsoup.nodes.Document doc = Jsoup.parse(new String(data)); |
| | | doc.outputSettings().prettyPrint(true); |
| | | |
| | | // Prefix every script to capture submits |
| | | // Make sure our interception is the first element in the |
| | | // header |
| | | org.jsoup.select.Elements element = doc.getElementsByTag("head"); |
| | | if (element.size() > 0) { |
| | | element.get(0).prepend(interceptHeader); |
| | | } |
| | | |
| | | String pageContents = doc.toString(); |
| | | return pageContents; |
| | | } |
| | | |
| | | /** |
| | | * js调用该方法,将post参数给客户端 |
| | | * |
| | | * @param ID key值 |
| | | * @param body 参数 |
| | | */ |
| | | @JavascriptInterface |
| | | public void customAjax(final String ID, final String body) { |
| | | mWebViewClient.addAjaxRequest(ID, body); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.ui.video.parser; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | |
| | | public class Utils { |
| | | static byte[] consumeInputStream(InputStream inputStream) throws IOException { |
| | | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
| | | byte[] buffer = new byte[1024]; |
| | | for (int count; (count = inputStream.read(buffer)) != -1; ) { |
| | | byteArrayOutputStream.write(buffer, 0, count); |
| | | } |
| | | return byteArrayOutputStream.toByteArray(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.ui.video.parser; |
| | | |
| | | import android.os.Bundle; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.webkit.ConsoleMessage; |
| | | import android.webkit.JavascriptInterface; |
| | | import android.webkit.ValueCallback; |
| | | import android.webkit.WebChromeClient; |
| | | import android.webkit.WebSettings; |
| | | import android.webkit.WebView; |
| | | |
| | | import com.hanju.video.app.util.downutils.StringUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.fragment.app.Fragment; |
| | | |
| | | /** |
| | | * 视频播放路径解析 |
| | | */ |
| | | public class VideoPlayUrlParseFragment extends Fragment { |
| | | private String TAG = "VideoPlayUrlParseFragment"; |
| | | private WebView webView; |
| | | private String url; |
| | | |
| | | private WriteHandlingWebViewClient mWriteHandlingWebViewClient; |
| | | |
| | | private void initView() { |
| | | WebSettings settings = webView.getSettings(); |
| | | settings.setJavaScriptEnabled(true); |
| | | mWriteHandlingWebViewClient = new WriteHandlingWebViewClient(webView); |
| | | webView.setWebViewClient(mWriteHandlingWebViewClient); |
| | | webView.setWebChromeClient(new WebChromeClient() { |
| | | @Override |
| | | public boolean onConsoleMessage(ConsoleMessage consoleMessage) { |
| | | Log.i(TAG, consoleMessage.lineNumber() + ":" + consoleMessage.message()); |
| | | return super.onConsoleMessage(consoleMessage); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onCreate(@Nullable Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | } |
| | | |
| | | @Nullable |
| | | @Override |
| | | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | | webView = new WebView(getContext()); |
| | | initView(); |
| | | |
| | | return webView; |
| | | } |
| | | |
| | | |
| | | public void startParse(String url, List<ParseParams> parseParamsList, final IVideoParseListener videoParseListener) { |
| | | this.url = url; |
| | | webView.loadUrl(url); |
| | | |
| | | mWriteHandlingWebViewClient.init(parseParamsList, new WriteHandlingWebViewClient.OnResponseListener() { |
| | | |
| | | @Override |
| | | public void onResult(WriteHandlingWebResourceRequest request, ParseParams parseParam, String result) { |
| | | webView.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | webView.loadUrl("javascript:" + parseParam.getParseJS()); |
| | | |
| | | // webView.loadUrl("javascript:help.log(document.getElementsByTagName('html')[0].innerHTML)"); |
| | | |
| | | // webView.loadUrl("javascript:"+String.format("parseResult(\"%s\")", result)); |
| | | |
| | | String requestUrl = request.getUrl().toString(); |
| | | webView.evaluateJavascript(String.format("parseResult(\"%s\",\"%s\")", requestUrl, parseParam.needResult ? result.replace("\"","\\"+"\"") : ""), new ValueCallback<String>() { |
| | | |
| | | @Override |
| | | public void onReceiveValue(String value) { |
| | | if (StringUtils.isNullOrEmpty(value)) |
| | | return; |
| | | Log.i(TAG, "解析结果:" + value); |
| | | if (videoParseListener != null) { |
| | | videoParseListener.onSuccess(value.replace("\"", "")); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | } |
| | | |
| | | @Override |
| | | public void onDestroy() { |
| | | super.onDestroy(); |
| | | webView.destroy(); |
| | | } |
| | | |
| | | public interface IVideoParseListener { |
| | | public void onSuccess(String result); |
| | | |
| | | public void onFail(String msg); |
| | | } |
| | | |
| | | public static class ParseParams { |
| | | |
| | | private String interceptRegex; |
| | | private String parseJS; |
| | | private boolean needResult; |
| | | |
| | | public boolean isNeedResult() { |
| | | return needResult; |
| | | } |
| | | |
| | | public void setNeedResult(boolean needResult) { |
| | | this.needResult = needResult; |
| | | } |
| | | |
| | | public ParseParams(String interceptRegex, String parseJS, boolean needResult) { |
| | | this.interceptRegex = interceptRegex; |
| | | this.parseJS = parseJS; |
| | | this.needResult = needResult; |
| | | } |
| | | |
| | | public String getInterceptRegex() { |
| | | return interceptRegex; |
| | | } |
| | | |
| | | public void setInterceptRegex(String interceptRegex) { |
| | | this.interceptRegex = interceptRegex; |
| | | } |
| | | |
| | | public String getParseJS() { |
| | | return parseJS; |
| | | } |
| | | |
| | | public void setParseJS(String parseJS) { |
| | | this.parseJS = parseJS; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.ui.video.parser; |
| | | |
| | | import android.net.Uri; |
| | | import android.webkit.WebResourceRequest; |
| | | |
| | | import java.util.Map; |
| | | |
| | | public class WriteHandlingWebResourceRequest implements WebResourceRequest { |
| | | final private Uri uri; |
| | | final private WebResourceRequest originalWebResourceRequest; |
| | | final private String requestBody; |
| | | |
| | | WriteHandlingWebResourceRequest(WebResourceRequest originalWebResourceRequest, String requestBody, Uri uri) { |
| | | this.originalWebResourceRequest = originalWebResourceRequest; |
| | | this.requestBody = requestBody; |
| | | if (uri != null) { |
| | | this.uri = uri; |
| | | } else { |
| | | this.uri = originalWebResourceRequest.getUrl(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Uri getUrl() { |
| | | return this.uri; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isForMainFrame() { |
| | | return originalWebResourceRequest.isForMainFrame(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isRedirect() { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasGesture() { |
| | | return originalWebResourceRequest.hasGesture(); |
| | | } |
| | | |
| | | @Override |
| | | public String getMethod() { |
| | | return originalWebResourceRequest.getMethod(); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, String> getRequestHeaders() { |
| | | return originalWebResourceRequest.getRequestHeaders(); |
| | | } |
| | | |
| | | public String getAjaxData() { |
| | | return requestBody; |
| | | } |
| | | |
| | | public boolean hasAjaxData() { |
| | | return requestBody != null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.ui.video.parser; |
| | | |
| | | |
| | | import android.content.Context; |
| | | import android.net.Uri; |
| | | import android.util.Log; |
| | | import android.webkit.WebResourceRequest; |
| | | import android.webkit.WebResourceResponse; |
| | | import android.webkit.WebView; |
| | | import android.webkit.WebViewClient; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.InputStream; |
| | | import java.net.URL; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import androidx.annotation.Nullable; |
| | | import okhttp3.MediaType; |
| | | import okhttp3.OkHttpClient; |
| | | import okhttp3.Request; |
| | | import okhttp3.RequestBody; |
| | | import okhttp3.Response; |
| | | |
| | | public class WriteHandlingWebViewClient extends WebViewClient { |
| | | |
| | | private final String MARKER = "AJAXINTERCEPT"; |
| | | |
| | | /** |
| | | * 请求参数Map集 |
| | | */ |
| | | private Map<String, String> ajaxRequestContents = new HashMap<>(); |
| | | private List<VideoPlayUrlParseFragment.ParseParams> parseParamsList = null; |
| | | private OnResponseListener responseListener; |
| | | |
| | | public void init(List<VideoPlayUrlParseFragment.ParseParams> parseParamsList, OnResponseListener responseListener) { |
| | | ajaxRequestContents.clear(); |
| | | this.parseParamsList = parseParamsList; |
| | | this.responseListener = responseListener; |
| | | } |
| | | |
| | | @Override |
| | | public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { |
| | | return super.shouldOverrideUrlLoading(view, request); |
| | | } |
| | | |
| | | @Nullable |
| | | @Override |
| | | public WebResourceResponse shouldInterceptRequest(WebView view, String url) { |
| | | return super.shouldInterceptRequest(view, url); |
| | | } |
| | | |
| | | public WriteHandlingWebViewClient(WebView webView) { |
| | | AjaxInterceptJavascriptInterface ajaxInterface = new AjaxInterceptJavascriptInterface(this); |
| | | webView.addJavascriptInterface(ajaxInterface, "interception"); |
| | | } |
| | | |
| | | /* |
| | | ** This here is the "fixed" shouldInterceptRequest method that you should override. |
| | | ** It receives a WriteHandlingWebResourceRequest instead of a WebResourceRequest. |
| | | */ |
| | | public WebResourceResponse shouldInterceptRequest(final WebView view, WriteHandlingWebResourceRequest request) { |
| | | OkHttpClient client = new OkHttpClient(); |
| | | try { |
| | | String url = request.getUrl().toString(); |
| | | // if (!Pattern.matches(regex, url)) { |
| | | // return super.shouldInterceptRequest(view, request); |
| | | // } |
| | | |
| | | Request.Builder builder = new Request.Builder().url(new URL(request.getUrl().toString())); |
| | | Map<String, String> headers = request.getRequestHeaders(); |
| | | if (headers != null) |
| | | for (Iterator<String> its = headers.keySet().iterator(); its.hasNext(); ) { |
| | | String key = its.next(); |
| | | builder.addHeader(key, headers.get(key)); |
| | | } |
| | | |
| | | |
| | | if ("POST".equals(request.getMethod())) { |
| | | builder.post(RequestBody.create(MediaType.parse("text"), request.getAjaxData())); |
| | | } |
| | | |
| | | Response response = client.newCall(builder.build()).execute(); |
| | | // Read input |
| | | String charset = "UTF-8"; //conn.getContentEncoding() != null ? conn.getContentEncoding() : Charset.defaultCharset().displayName(); |
| | | String mime = response.header("content-type"); |
| | | byte[] bytes = response.body().bytes(); |
| | | for (VideoPlayUrlParseFragment.ParseParams parseParams : parseParamsList) { |
| | | if (Pattern.matches(parseParams.getInterceptRegex(), url)) |
| | | responseListener.onResult(request, parseParams, new String(bytes)); |
| | | } |
| | | // Convert the contents and return |
| | | InputStream isContents = new ByteArrayInputStream(bytes); |
| | | response.close(); |
| | | return new WebResourceResponse(mime, charset, isContents); |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 拦截了webview中的所有请求 |
| | | * |
| | | * @param view |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @Override |
| | | public final WebResourceResponse shouldInterceptRequest(final WebView view, WebResourceRequest request) { |
| | | String requestBody = null; |
| | | Uri uri = request.getUrl(); |
| | | |
| | | // 判断是否为Ajax请求(只要链接中包含AJAXINTERCEPT即是) |
| | | if (isAjaxRequest(request)) { |
| | | // 获取post请求参数 |
| | | requestBody = getRequestBody(request); |
| | | // 获取原链接 |
| | | uri = getOriginalRequestUri(request, MARKER); |
| | | } |
| | | |
| | | // 重新构造请求,并获取response |
| | | WebResourceResponse webResourceResponse = shouldInterceptRequest(view, new WriteHandlingWebResourceRequest(request, requestBody, uri)); |
| | | if (webResourceResponse == null) { |
| | | return webResourceResponse; |
| | | } else { |
| | | return injectIntercept(webResourceResponse, view.getContext()); |
| | | } |
| | | } |
| | | |
| | | void addAjaxRequest(String id, String body) { |
| | | ajaxRequestContents.put(id, body); |
| | | } |
| | | |
| | | /** |
| | | * 获取post请求参数 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | private String getRequestBody(WebResourceRequest request) { |
| | | String requestID = getAjaxRequestID(request); |
| | | return getAjaxRequestBodyByID(requestID); |
| | | } |
| | | |
| | | /** |
| | | * 判断是否为Ajax请求 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | private boolean isAjaxRequest(WebResourceRequest request) { |
| | | return request.getUrl().toString().contains(MARKER); |
| | | } |
| | | |
| | | private String[] getUrlSegments(WebResourceRequest request, String divider) { |
| | | String urlString = request.getUrl().toString(); |
| | | return urlString.split(divider); |
| | | } |
| | | |
| | | /** |
| | | * 获取请求的id |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | private String getAjaxRequestID(WebResourceRequest request) { |
| | | return getUrlSegments(request, MARKER)[1]; |
| | | } |
| | | |
| | | /** |
| | | * 获取原链接 |
| | | * |
| | | * @param request |
| | | * @param marker |
| | | * @return |
| | | */ |
| | | private Uri getOriginalRequestUri(WebResourceRequest request, String marker) { |
| | | String urlString = getUrlSegments(request, marker)[0]; |
| | | return Uri.parse(urlString); |
| | | } |
| | | |
| | | /** |
| | | * 通过请求id获取请求参数 |
| | | * |
| | | * @param requestID |
| | | * @return |
| | | */ |
| | | private String getAjaxRequestBodyByID(String requestID) { |
| | | String body = ajaxRequestContents.get(requestID); |
| | | ajaxRequestContents.remove(requestID); |
| | | return body; |
| | | } |
| | | |
| | | /** |
| | | * 如果请求是网页,则html注入 |
| | | * |
| | | * @param response |
| | | * @param context |
| | | * @return |
| | | */ |
| | | private WebResourceResponse injectIntercept(WebResourceResponse response, Context context) { |
| | | String encoding = response.getEncoding(); |
| | | String mime = response.getMimeType(); |
| | | |
| | | // WebResourceResponse的mime必须为"text/html",不能是"text/html; charset=utf-8" |
| | | if (mime.contains("text/html")) { |
| | | mime = "text/html"; |
| | | } |
| | | |
| | | InputStream responseData = response.getData(); |
| | | InputStream injectedResponseData = injectInterceptToStream( |
| | | context, |
| | | responseData, |
| | | mime, |
| | | encoding |
| | | ); |
| | | return new WebResourceResponse(mime, encoding, injectedResponseData); |
| | | } |
| | | |
| | | /** |
| | | * 如果请求是网页,则html注入 |
| | | * |
| | | * @param context |
| | | * @param is |
| | | * @param mime |
| | | * @param charset |
| | | * @return |
| | | */ |
| | | private InputStream injectInterceptToStream(Context context, InputStream is, String mime, String charset) { |
| | | try { |
| | | byte[] pageContents = Utils.consumeInputStream(is); |
| | | if (mime.contains("text/html")) { |
| | | pageContents = AjaxInterceptJavascriptInterface |
| | | .enableIntercept(context, pageContents) |
| | | .getBytes(charset); |
| | | } |
| | | |
| | | return new ByteArrayInputStream(pageContents); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | public interface OnResponseListener { |
| | | public void onResult(WriteHandlingWebResourceRequest request, VideoPlayUrlParseFragment.ParseParams parseParams, String result); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.ui.widget; |
| | | |
| | | import android.content.Context; |
| | | import android.content.res.Resources; |
| | | import android.graphics.Color; |
| | | import android.graphics.Typeface; |
| | | import android.graphics.drawable.ShapeDrawable; |
| | | import android.graphics.drawable.shapes.RoundRectShape; |
| | | import android.util.AttributeSet; |
| | | import android.util.TypedValue; |
| | | import android.view.Gravity; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.view.ViewGroup.LayoutParams; |
| | | import android.view.ViewParent; |
| | | import android.view.animation.AccelerateInterpolator; |
| | | import android.view.animation.AlphaAnimation; |
| | | import android.view.animation.Animation; |
| | | import android.view.animation.DecelerateInterpolator; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.TabWidget; |
| | | import android.widget.TextView; |
| | | |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | |
| | | /** |
| | | * A simple text label view that can be applied as a "badge" to any given {@link android.view.View}. |
| | | * This class is intended to be instantiated at runtime rather than included in XML layouts. |
| | | * |
| | | * @author Jeff Gilfelt |
| | | */ |
| | | public class BadgeView extends TextView { |
| | | |
| | | public static final int POSITION_TOP_LEFT = 1; |
| | | public static final int POSITION_TOP_RIGHT = 2; |
| | | public static final int POSITION_BOTTOM_LEFT = 3; |
| | | public static final int POSITION_BOTTOM_RIGHT = 4; |
| | | public static final int POSITION_CENTER = 5; |
| | | |
| | | private static final int DEFAULT_MARGIN_DIP = 5; |
| | | private static final int DEFAULT_LR_PADDING_DIP = 5; |
| | | private static final int DEFAULT_CORNER_RADIUS_DIP = 8; |
| | | private static final int DEFAULT_POSITION = POSITION_TOP_RIGHT; |
| | | private static final int DEFAULT_BADGE_COLOR = Color.parseColor("#CCFF0000"); //Color.RED; |
| | | private static final int DEFAULT_TEXT_COLOR = Color.WHITE; |
| | | |
| | | private static Animation fadeIn; |
| | | private static Animation fadeOut; |
| | | |
| | | private Context context; |
| | | private View target; |
| | | |
| | | private int badgePosition; |
| | | private int badgeMarginH; |
| | | private int badgeMarginV; |
| | | private int badgeColor; |
| | | |
| | | private boolean isShown; |
| | | |
| | | private ShapeDrawable badgeBg; |
| | | |
| | | private int targetTabIndex; |
| | | |
| | | public BadgeView(Context context) { |
| | | this(context, (AttributeSet) null, android.R.attr.textViewStyle); |
| | | } |
| | | |
| | | public BadgeView(Context context, AttributeSet attrs) { |
| | | this(context, attrs, android.R.attr.textViewStyle); |
| | | } |
| | | |
| | | /** |
| | | * Constructor - |
| | | * |
| | | * create a new BadgeView instance attached to a target {@link android.view.View}. |
| | | * |
| | | * @param context context for this view. |
| | | * @param target the View to attach the badge to. |
| | | */ |
| | | public BadgeView(Context context, View target) { |
| | | this(context, null, android.R.attr.textViewStyle, target, 0); |
| | | } |
| | | |
| | | /** |
| | | * Constructor - |
| | | * |
| | | * create a new BadgeView instance attached to a target {@link android.widget.TabWidget} |
| | | * tab at a given index. |
| | | * |
| | | * @param context context for this view. |
| | | * @param target the TabWidget to attach the badge to. |
| | | * @param index the position of the tab within the target. |
| | | */ |
| | | public BadgeView(Context context, TabWidget target, int index) { |
| | | this(context, null, android.R.attr.textViewStyle, target, index); |
| | | } |
| | | |
| | | public BadgeView(Context context, AttributeSet attrs, int defStyle) { |
| | | this(context, attrs, defStyle, null, 0); |
| | | } |
| | | |
| | | public BadgeView(Context context, AttributeSet attrs, int defStyle, View target, int tabIndex) { |
| | | super(context, attrs, defStyle); |
| | | init(context, target, tabIndex); |
| | | } |
| | | |
| | | private void init(Context context, View target, int tabIndex) { |
| | | |
| | | this.context = context; |
| | | this.target = target; |
| | | this.targetTabIndex = tabIndex; |
| | | |
| | | // apply defaults |
| | | badgePosition = DEFAULT_POSITION; |
| | | badgeMarginH = dipToPixels(DEFAULT_MARGIN_DIP); |
| | | badgeMarginV = badgeMarginH; |
| | | badgeColor = DEFAULT_BADGE_COLOR; |
| | | |
| | | setTypeface(Typeface.DEFAULT_BOLD); |
| | | int paddingPixels = dipToPixels(DEFAULT_LR_PADDING_DIP); |
| | | setPadding(paddingPixels, 0, paddingPixels, 0); |
| | | setTextColor(DEFAULT_TEXT_COLOR); |
| | | |
| | | fadeIn = new AlphaAnimation(0, 1); |
| | | fadeIn.setInterpolator(new DecelerateInterpolator()); |
| | | fadeIn.setDuration(200); |
| | | |
| | | fadeOut = new AlphaAnimation(1, 0); |
| | | fadeOut.setInterpolator(new AccelerateInterpolator()); |
| | | fadeOut.setDuration(200); |
| | | |
| | | isShown = false; |
| | | |
| | | if (this.target != null) { |
| | | applyTo(this.target); |
| | | } else { |
| | | show(); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void applyTo(View target) { |
| | | |
| | | LayoutParams lp = target.getLayoutParams(); |
| | | ViewParent parent = target.getParent(); |
| | | FrameLayout container = new FrameLayout(context); |
| | | |
| | | if (target instanceof TabWidget) { |
| | | |
| | | // set target to the relevant tab child container |
| | | target = ((TabWidget) target).getChildTabViewAt(targetTabIndex); |
| | | this.target = target; |
| | | |
| | | ((ViewGroup) target).addView(container, |
| | | new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); |
| | | |
| | | this.setVisibility(View.GONE); |
| | | container.addView(this); |
| | | |
| | | } else { |
| | | |
| | | // TODO verify that parent is indeed a ViewGroup |
| | | ViewGroup group = (ViewGroup) parent; |
| | | int index = group.indexOfChild(target); |
| | | |
| | | group.removeView(target); |
| | | group.addView(container, index, lp); |
| | | |
| | | container.addView(target); |
| | | |
| | | this.setVisibility(View.GONE); |
| | | container.addView(this); |
| | | |
| | | group.invalidate(); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Make the badge visible in the UI. |
| | | * |
| | | */ |
| | | public void show() { |
| | | show(false, null); |
| | | } |
| | | |
| | | /** |
| | | * Make the badge visible in the UI. |
| | | * |
| | | * @param animate flag to apply the default fade-in animation. |
| | | */ |
| | | public void show(boolean animate) { |
| | | show(animate, fadeIn); |
| | | } |
| | | |
| | | /** |
| | | * Make the badge visible in the UI. |
| | | * |
| | | * @param anim Animation to apply to the view when made visible. |
| | | */ |
| | | public void show(Animation anim) { |
| | | show(true, anim); |
| | | } |
| | | |
| | | /** |
| | | * Make the badge non-visible in the UI. |
| | | * |
| | | */ |
| | | public void hide() { |
| | | hide(false, null); |
| | | } |
| | | |
| | | /** |
| | | * Make the badge non-visible in the UI. |
| | | * |
| | | * @param animate flag to apply the default fade-out animation. |
| | | */ |
| | | public void hide(boolean animate) { |
| | | hide(animate, fadeOut); |
| | | } |
| | | |
| | | /** |
| | | * Make the badge non-visible in the UI. |
| | | * |
| | | * @param anim Animation to apply to the view when made non-visible. |
| | | */ |
| | | public void hide(Animation anim) { |
| | | hide(true, anim); |
| | | } |
| | | |
| | | /** |
| | | * Toggle the badge visibility in the UI. |
| | | * |
| | | */ |
| | | public void toggle() { |
| | | toggle(false, null, null); |
| | | } |
| | | |
| | | /** |
| | | * Toggle the badge visibility in the UI. |
| | | * |
| | | * @param animate flag to apply the default fade-in/out animation. |
| | | */ |
| | | public void toggle(boolean animate) { |
| | | toggle(animate, fadeIn, fadeOut); |
| | | } |
| | | |
| | | /** |
| | | * Toggle the badge visibility in the UI. |
| | | * |
| | | * @param animIn Animation to apply to the view when made visible. |
| | | * @param animOut Animation to apply to the view when made non-visible. |
| | | */ |
| | | public void toggle(Animation animIn, Animation animOut) { |
| | | toggle(true, animIn, animOut); |
| | | } |
| | | |
| | | private void show(boolean animate, Animation anim) { |
| | | if (getBackground() == null) { |
| | | if (badgeBg == null) { |
| | | badgeBg = getDefaultBackground(); |
| | | } |
| | | setBackgroundDrawable(badgeBg); |
| | | } |
| | | applyLayoutParams(); |
| | | |
| | | if (animate) { |
| | | this.startAnimation(anim); |
| | | } |
| | | this.setVisibility(View.VISIBLE); |
| | | isShown = true; |
| | | } |
| | | |
| | | private void hide(boolean animate, Animation anim) { |
| | | this.setVisibility(View.GONE); |
| | | if (animate) { |
| | | this.startAnimation(anim); |
| | | } |
| | | isShown = false; |
| | | } |
| | | |
| | | private void toggle(boolean animate, Animation animIn, Animation animOut) { |
| | | if (isShown) { |
| | | hide(animate && (animOut != null), animOut); |
| | | } else { |
| | | show(animate && (animIn != null), animIn); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Increment the numeric badge label. If the current badge label cannot be converted to |
| | | * an integer value, its label will be set to "0". |
| | | * |
| | | * @param offset the increment offset. |
| | | */ |
| | | public int increment(int offset) { |
| | | CharSequence txt = getText(); |
| | | int i; |
| | | if (txt != null) { |
| | | try { |
| | | i = Integer.parseInt(txt.toString()); |
| | | } catch (NumberFormatException e) { |
| | | i = 0; |
| | | } |
| | | } else { |
| | | i = 0; |
| | | } |
| | | i = i + offset; |
| | | setText(String.valueOf(i)); |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | | * Decrement the numeric badge label. If the current badge label cannot be converted to |
| | | * an integer value, its label will be set to "0". |
| | | * |
| | | * @param offset the decrement offset. |
| | | */ |
| | | public int decrement(int offset) { |
| | | return increment(-offset); |
| | | } |
| | | |
| | | private ShapeDrawable getDefaultBackground() { |
| | | |
| | | int r = dipToPixels(DEFAULT_CORNER_RADIUS_DIP); |
| | | float[] outerR = new float[] {r, r, r, r, r, r, r, r}; |
| | | |
| | | RoundRectShape rr = new RoundRectShape(outerR, null, null); |
| | | ShapeDrawable drawable = new ShapeDrawable(rr); |
| | | drawable.getPaint().setColor(badgeColor); |
| | | |
| | | return drawable; |
| | | |
| | | } |
| | | |
| | | private void applyLayoutParams() { |
| | | |
| | | FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(DimenUtils.dipToPixels(12, getContext()), DimenUtils.dipToPixels(12, getContext())); |
| | | |
| | | switch (badgePosition) { |
| | | case POSITION_TOP_LEFT: |
| | | lp.gravity = Gravity.LEFT | Gravity.TOP; |
| | | lp.setMargins(badgeMarginH, badgeMarginV, 0, 0); |
| | | break; |
| | | case POSITION_TOP_RIGHT: |
| | | lp.gravity = Gravity.RIGHT | Gravity.TOP; |
| | | lp.setMargins(0, badgeMarginV, badgeMarginH, 0); |
| | | break; |
| | | case POSITION_BOTTOM_LEFT: |
| | | lp.gravity = Gravity.LEFT | Gravity.BOTTOM; |
| | | lp.setMargins(badgeMarginH, 0, 0, badgeMarginV); |
| | | break; |
| | | case POSITION_BOTTOM_RIGHT: |
| | | lp.gravity = Gravity.RIGHT | Gravity.BOTTOM; |
| | | lp.setMargins(0, 0, badgeMarginH, badgeMarginV); |
| | | break; |
| | | case POSITION_CENTER: |
| | | lp.gravity = Gravity.CENTER; |
| | | lp.setMargins(0, 0, 0, 0); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | setLayoutParams(lp); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Returns the target View this badge has been attached to. |
| | | * |
| | | */ |
| | | public View getTarget() { |
| | | return target; |
| | | } |
| | | |
| | | /** |
| | | * Is this badge currently visible in the UI? |
| | | * |
| | | */ |
| | | @Override |
| | | public boolean isShown() { |
| | | return isShown; |
| | | } |
| | | |
| | | /** |
| | | * Returns the positioning of this badge. |
| | | * |
| | | * one of POSITION_TOP_LEFT, POSITION_TOP_RIGHT, POSITION_BOTTOM_LEFT, POSITION_BOTTOM_RIGHT, POSTION_CENTER. |
| | | * |
| | | */ |
| | | public int getBadgePosition() { |
| | | return badgePosition; |
| | | } |
| | | |
| | | /** |
| | | * Set the positioning of this badge. |
| | | * |
| | | * @param layoutPosition one of POSITION_TOP_LEFT, POSITION_TOP_RIGHT, POSITION_BOTTOM_LEFT, POSITION_BOTTOM_RIGHT, POSTION_CENTER. |
| | | * |
| | | */ |
| | | public void setBadgePosition(int layoutPosition) { |
| | | this.badgePosition = layoutPosition; |
| | | } |
| | | |
| | | /** |
| | | * Returns the horizontal margin from the target View that is applied to this badge. |
| | | * |
| | | */ |
| | | public int getHorizontalBadgeMargin() { |
| | | return badgeMarginH; |
| | | } |
| | | |
| | | /** |
| | | * Returns the vertical margin from the target View that is applied to this badge. |
| | | * |
| | | */ |
| | | public int getVerticalBadgeMargin() { |
| | | return badgeMarginV; |
| | | } |
| | | |
| | | /** |
| | | * Set the horizontal/vertical margin from the target View that is applied to this badge. |
| | | * |
| | | * @param badgeMargin the margin in pixels. |
| | | */ |
| | | public void setBadgeMargin(int badgeMargin) { |
| | | this.badgeMarginH = badgeMargin; |
| | | this.badgeMarginV = badgeMargin; |
| | | } |
| | | |
| | | /** |
| | | * Set the horizontal/vertical margin from the target View that is applied to this badge. |
| | | * |
| | | * @param horizontal margin in pixels. |
| | | * @param vertical margin in pixels. |
| | | */ |
| | | public void setBadgeMargin(int horizontal, int vertical) { |
| | | this.badgeMarginH = horizontal; |
| | | this.badgeMarginV = vertical; |
| | | } |
| | | |
| | | /** |
| | | * Returns the color value of the badge background. |
| | | * |
| | | */ |
| | | public int getBadgeBackgroundColor() { |
| | | return badgeColor; |
| | | } |
| | | |
| | | /** |
| | | * Set the color value of the badge background. |
| | | * |
| | | * @param badgeColor the badge background color. |
| | | */ |
| | | public void setBadgeBackgroundColor(int badgeColor) { |
| | | this.badgeColor = badgeColor; |
| | | badgeBg = getDefaultBackground(); |
| | | } |
| | | |
| | | private int dipToPixels(int dip) { |
| | | Resources r = getResources(); |
| | | float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, r.getDisplayMetrics()); |
| | | return (int) px; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.ui.widget; |
| | | |
| | | import android.content.ClipData; |
| | | import android.content.ClipboardManager; |
| | | import android.content.Context; |
| | | import android.os.Build; |
| | | import android.view.ActionMode; |
| | | import android.view.ContextMenu; |
| | | import android.view.GestureDetector; |
| | | import android.view.Menu; |
| | | import android.view.MenuInflater; |
| | | import android.view.MenuItem; |
| | | import android.view.MotionEvent; |
| | | import android.view.View; |
| | | import android.view.ViewParent; |
| | | import android.webkit.JavascriptInterface; |
| | | import android.webkit.WebView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.hanju.video.app.R; |
| | | |
| | | |
| | | /** |
| | | * A convenient extension of WebView. |
| | | */ |
| | | public class CustomWebView extends WebView { |
| | | |
| | | private Context context; |
| | | |
| | | // override all other constructor to avoid crash |
| | | public CustomWebView(Context context) { |
| | | super(context); |
| | | this.context = context; |
| | | |
| | | this.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { |
| | | @Override |
| | | public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { |
| | | //menuInfo. |
| | | //ToastUtil.showMessage("info:"); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | private void enterTextSelection() { |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) |
| | | return; |
| | | |
| | | } |
| | | |
| | | |
| | | public class WebAppInterface { |
| | | Context mContext; |
| | | |
| | | WebAppInterface(Context c) { |
| | | mContext = c; |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void getText(String text) { |
| | | // put selected text into clipdata |
| | | ClipboardManager clipboard = (ClipboardManager) |
| | | mContext.getSystemService(Context.CLIPBOARD_SERVICE); |
| | | ClipData clip = ClipData.newPlainText("simple text", text); |
| | | clipboard.setPrimaryClip(clip); |
| | | // gives the toast for selected text |
| | | Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | } |
| | | |
| | | // setting custom action bar |
| | | private ActionMode mActionMode; |
| | | private ActionMode.Callback mSelectActionModeCallback; |
| | | private GestureDetector mDetector; |
| | | |
| | | // this will over ride the default action bar on long press |
| | | @Override |
| | | public ActionMode startActionMode(ActionMode.Callback callback) { |
| | | ViewParent parent = getParent(); |
| | | if (parent == null) { |
| | | return null; |
| | | } |
| | | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { |
| | | String name = callback.getClass().toString(); |
| | | if (name.contains("SelectActionModeCallback")) { |
| | | mSelectActionModeCallback = callback; |
| | | mDetector = new GestureDetector(context, |
| | | new CustomGestureListener()); |
| | | } |
| | | } |
| | | CustomActionModeCallback mActionModeCallback = new CustomActionModeCallback(); |
| | | return parent.startActionModeForChild(this, mActionModeCallback); |
| | | } |
| | | |
| | | private class CustomActionModeCallback implements ActionMode.Callback { |
| | | |
| | | @Override |
| | | public boolean onCreateActionMode(ActionMode mode, Menu menu) { |
| | | mActionMode = mode; |
| | | MenuInflater inflater = mode.getMenuInflater(); |
| | | inflater.inflate(R.menu.menu_main, menu); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean onPrepareActionMode(ActionMode mode, Menu menu) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean onActionItemClicked(ActionMode mode, MenuItem item) { |
| | | mode.finish(); |
| | | return false; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onDestroyActionMode(ActionMode mode) { |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
| | | clearFocus(); |
| | | } else { |
| | | if (mSelectActionModeCallback != null) { |
| | | mSelectActionModeCallback.onDestroyActionMode(mode); |
| | | } |
| | | mActionMode = null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void getSelectedData() { |
| | | |
| | | String js = "(function getSelectedText() {" + |
| | | "var txt;" + |
| | | "if (window.getSelection) {" + |
| | | "txt = window.getSelection().toString();" + |
| | | "} else if (window.document.getSelection) {" + |
| | | "txt = window.document.getSelection().toString();" + |
| | | "} else if (window.document.selection) {" + |
| | | "txt = window.document.selection.createRange().text;" + |
| | | "}" + |
| | | "JSInterface.getText(txt);" + |
| | | "})()"; |
| | | // calling the js function |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
| | | evaluateJavascript("javascript:" + js, null); |
| | | } else { |
| | | loadUrl("javascript:" + js); |
| | | } |
| | | } |
| | | |
| | | private class CustomGestureListener extends GestureDetector.SimpleOnGestureListener { |
| | | @Override |
| | | public boolean onSingleTapUp(MotionEvent e) { |
| | | if (mActionMode != null) { |
| | | mActionMode.finish(); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean onTouchEvent(MotionEvent event) { |
| | | // Send the event to our gesture detector |
| | | // If it is implemented, there will be a return value |
| | | if (mDetector != null) |
| | | mDetector.onTouchEvent(event); |
| | | // If the detected gesture is unimplemented, send it to the superclass |
| | | return super.onTouchEvent(event); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
New file |
| | |
| | | package com.hanju.video.app.ui.widget; |
| | | |
| | | import android.content.Context; |
| | | import android.database.DataSetObserver; |
| | | import androidx.viewpager.widget.PagerAdapter; |
| | | import androidx.viewpager.widget.ViewPager; |
| | | import android.util.AttributeSet; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | |
| | | public class CycleViewPager extends ViewPager { |
| | | private InnerPagerAdapter mAdapter; |
| | | |
| | | public CycleViewPager(Context context) { |
| | | super(context); |
| | | setOnPageChangeListener(null); |
| | | } |
| | | |
| | | public CycleViewPager(Context context, AttributeSet attrs) { |
| | | super(context, attrs); |
| | | setOnPageChangeListener(null); |
| | | } |
| | | |
| | | @Override |
| | | public void setAdapter(PagerAdapter arg0) { |
| | | mAdapter = new InnerPagerAdapter(arg0); |
| | | super.setAdapter(mAdapter); |
| | | setCurrentItem(1); |
| | | } |
| | | |
| | | @Override |
| | | public void setOnPageChangeListener(OnPageChangeListener listener) { |
| | | super.setOnPageChangeListener(new InnerOnPageChangeListener(listener)); |
| | | } |
| | | |
| | | private class InnerOnPageChangeListener implements OnPageChangeListener { |
| | | |
| | | private OnPageChangeListener listener; |
| | | private int position; |
| | | |
| | | public InnerOnPageChangeListener(OnPageChangeListener listener) { |
| | | this.listener = listener; |
| | | } |
| | | |
| | | @Override |
| | | public void onPageScrollStateChanged(int arg0) { |
| | | if (null != listener) { |
| | | listener.onPageScrollStateChanged(arg0); |
| | | } |
| | | if (arg0 == ViewPager.SCROLL_STATE_IDLE) { |
| | | if (position == mAdapter.getCount() - 1) { |
| | | setCurrentItem(1, false); |
| | | } else if (position == 0) { |
| | | setCurrentItem(mAdapter.getCount() - 2, false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onPageScrolled(int arg0, float arg1, int arg2) { |
| | | if (null != listener) { |
| | | listener.onPageScrolled(arg0, arg1, arg2); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onPageSelected(int arg0) { |
| | | position = arg0; |
| | | if (null != listener) { |
| | | listener.onPageSelected(arg0); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private class InnerPagerAdapter extends PagerAdapter { |
| | | |
| | | private PagerAdapter adapter; |
| | | |
| | | public InnerPagerAdapter(PagerAdapter adapter) { |
| | | this.adapter = adapter; |
| | | adapter.registerDataSetObserver(new DataSetObserver() { |
| | | @Override |
| | | public void onChanged() { |
| | | notifyDataSetChanged(); |
| | | } |
| | | |
| | | @Override |
| | | public void onInvalidated() { |
| | | notifyDataSetChanged(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public int getCount() { |
| | | return adapter.getCount() + 2; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isViewFromObject(View arg0, Object arg1) { |
| | | return adapter.isViewFromObject(arg0, arg1); |
| | | } |
| | | |
| | | @Override |
| | | public Object instantiateItem(ViewGroup container, int position) { |
| | | if (position == 0) { |
| | | position = adapter.getCount() - 1; |
| | | } else if (position == adapter.getCount() + 1) { |
| | | position = 0; |
| | | } else { |
| | | position -= 1; |
| | | } |
| | | return adapter.instantiateItem(container, position); |
| | | } |
| | | |
| | | @Override |
| | | public void destroyItem(ViewGroup container, int position, Object object) { |
| | | adapter.destroyItem(container, position, object); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.ui.widget; |
| | | |
| | | import android.annotation.SuppressLint; |
| | | import android.content.Context; |
| | | import android.content.res.TypedArray; |
| | | import android.graphics.Canvas; |
| | | import android.graphics.Movie; |
| | | import android.os.Build; |
| | | import android.util.AttributeSet; |
| | | import android.view.View; |
| | | |
| | | import com.hanju.video.app.R; |
| | | |
| | | /** |
| | | * This is a View class that wraps Android {@link Movie} object and displays it. |
| | | * You can set GIF as a Movie object or as a resource id from XML or by calling |
| | | * {@link #setMovie(Movie)} or {@link #setMovieResource(int)}. |
| | | * <p> |
| | | * You can pause and resume GIF animation by calling {@link #setPaused(boolean)}. |
| | | * <p> |
| | | * The animation is drawn in the center inside of the measured view bounds. |
| | | * |
| | | * @author Sergey Bakhtiarov |
| | | */ |
| | | |
| | | public class GifMovieView extends View { |
| | | |
| | | private static final int DEFAULT_MOVIEW_DURATION = 1000; |
| | | |
| | | private int mMovieResourceId; |
| | | private Movie mMovie; |
| | | |
| | | private long mMovieStart; |
| | | private int mCurrentAnimationTime = 0; |
| | | |
| | | /** |
| | | * Position for drawing animation frames in the center of the view. |
| | | */ |
| | | private float mLeft; |
| | | private float mTop; |
| | | |
| | | /** |
| | | * Scaling factor to fit the animation within view bounds. |
| | | */ |
| | | private float mScale; |
| | | |
| | | /** |
| | | * Scaled movie frames width and height. |
| | | */ |
| | | private int mMeasuredMovieWidth; |
| | | private int mMeasuredMovieHeight; |
| | | |
| | | private volatile boolean mPaused = false; |
| | | private boolean mVisible = true; |
| | | |
| | | public GifMovieView(Context context) { |
| | | this(context, null); |
| | | } |
| | | |
| | | public GifMovieView(Context context, AttributeSet attrs) { |
| | | this(context, attrs, R.styleable.CustomTheme_gifMoviewViewStyle); |
| | | } |
| | | |
| | | public GifMovieView(Context context, AttributeSet attrs, int defStyle) { |
| | | super(context, attrs, defStyle); |
| | | |
| | | setViewAttributes(context, attrs, defStyle); |
| | | } |
| | | |
| | | @SuppressLint("NewApi") |
| | | private void setViewAttributes(Context context, AttributeSet attrs, int defStyle) { |
| | | |
| | | /** |
| | | * Starting from HONEYCOMB have to turn off HW acceleration to draw |
| | | * Movie on Canvas. |
| | | */ |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { |
| | | setLayerType(View.LAYER_TYPE_SOFTWARE, null); |
| | | } |
| | | |
| | | final TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.GifMoviewView, defStyle, |
| | | R.style.Widget_GifMoviewView); |
| | | |
| | | mMovieResourceId = array.getResourceId(R.styleable.GifMoviewView_gif, -1); |
| | | mPaused = array.getBoolean(R.styleable.GifMoviewView_paused, false); |
| | | |
| | | array.recycle(); |
| | | |
| | | if (mMovieResourceId != -1) { |
| | | mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId)); |
| | | } |
| | | } |
| | | |
| | | public void setMovieResource(int movieResId) { |
| | | this.mMovieResourceId = movieResId; |
| | | mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId)); |
| | | requestLayout(); |
| | | } |
| | | |
| | | public void setMovie(Movie movie) { |
| | | this.mMovie = movie; |
| | | requestLayout(); |
| | | } |
| | | |
| | | public Movie getMovie() { |
| | | return mMovie; |
| | | } |
| | | |
| | | public void setMovieTime(int time) { |
| | | mCurrentAnimationTime = time; |
| | | invalidate(); |
| | | } |
| | | |
| | | public void setPaused(boolean paused) { |
| | | this.mPaused = paused; |
| | | |
| | | /** |
| | | * Calculate new movie start time, so that it resumes from the same |
| | | * frame. |
| | | */ |
| | | if (!paused) { |
| | | mMovieStart = android.os.SystemClock.uptimeMillis() - mCurrentAnimationTime; |
| | | } |
| | | |
| | | invalidate(); |
| | | } |
| | | |
| | | public boolean isPaused() { |
| | | return this.mPaused; |
| | | } |
| | | |
| | | @Override |
| | | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
| | | |
| | | if (mMovie != null) { |
| | | int movieWidth = mMovie.width(); |
| | | int movieHeight = mMovie.height(); |
| | | |
| | | /* |
| | | * Calculate horizontal scaling |
| | | */ |
| | | float scaleH = 1f; |
| | | int measureModeWidth = MeasureSpec.getMode(widthMeasureSpec); |
| | | |
| | | if (measureModeWidth != MeasureSpec.UNSPECIFIED) { |
| | | int maximumWidth = MeasureSpec.getSize(widthMeasureSpec); |
| | | // if (movieWidth > maximumWidth) { |
| | | scaleH = (float) movieWidth / (float) maximumWidth; |
| | | // } |
| | | } |
| | | |
| | | /* |
| | | * calculate vertical scaling |
| | | */ |
| | | float scaleW = 1f; |
| | | int measureModeHeight = MeasureSpec.getMode(heightMeasureSpec); |
| | | |
| | | if (measureModeHeight != MeasureSpec.UNSPECIFIED) { |
| | | int maximumHeight = MeasureSpec.getSize(heightMeasureSpec); |
| | | // if (movieHeight > maximumHeight) { |
| | | scaleW = (float) movieHeight / (float) maximumHeight; |
| | | // } |
| | | } |
| | | |
| | | /* |
| | | * calculate overall scale |
| | | */ |
| | | mScale = 1f / Math.max(scaleH, scaleW); |
| | | |
| | | mMeasuredMovieWidth = (int) (movieWidth * mScale); |
| | | mMeasuredMovieHeight = (int) (movieHeight * mScale); |
| | | |
| | | setMeasuredDimension(mMeasuredMovieWidth, mMeasuredMovieHeight); |
| | | |
| | | } else { |
| | | /* |
| | | * No movie set, just set minimum available size. |
| | | */ |
| | | setMeasuredDimension(getSuggestedMinimumWidth(), getSuggestedMinimumHeight()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void onLayout(boolean changed, int l, int t, int r, int b) { |
| | | super.onLayout(changed, l, t, r, b); |
| | | |
| | | /* |
| | | * Calculate left / top for drawing in center |
| | | */ |
| | | mLeft = (getWidth() - mMeasuredMovieWidth) / 2f; |
| | | mTop = (getHeight() - mMeasuredMovieHeight) / 2f; |
| | | |
| | | mVisible = getVisibility() == View.VISIBLE; |
| | | } |
| | | |
| | | @Override |
| | | protected void onDraw(Canvas canvas) { |
| | | if (mMovie != null) { |
| | | if (!mPaused) { |
| | | updateAnimationTime(); |
| | | drawMovieFrame(canvas); |
| | | invalidateView(); |
| | | } else { |
| | | drawMovieFrame(canvas); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Invalidates view only if it is visible. |
| | | * <br> |
| | | * {@link #postInvalidateOnAnimation()} is used for Jelly Bean and higher. |
| | | * |
| | | */ |
| | | @SuppressLint("NewApi") |
| | | private void invalidateView() { |
| | | if(mVisible) { |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { |
| | | postInvalidateOnAnimation(); |
| | | } else { |
| | | invalidate(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Calculate current animation time |
| | | */ |
| | | private void updateAnimationTime() { |
| | | long now = android.os.SystemClock.uptimeMillis(); |
| | | |
| | | if (mMovieStart == 0) { |
| | | mMovieStart = now; |
| | | } |
| | | |
| | | int dur = mMovie.duration(); |
| | | |
| | | if (dur == 0) { |
| | | dur = DEFAULT_MOVIEW_DURATION; |
| | | } |
| | | |
| | | mCurrentAnimationTime = (int) ((now - mMovieStart) % dur); |
| | | } |
| | | |
| | | /** |
| | | * Draw current GIF frame |
| | | */ |
| | | private void drawMovieFrame(Canvas canvas) { |
| | | |
| | | mMovie.setTime(mCurrentAnimationTime); |
| | | |
| | | canvas.save(); |
| | | canvas.scale(mScale, mScale); |
| | | mMovie.draw(canvas, mLeft / mScale, mTop / mScale); |
| | | canvas.restore(); |
| | | } |
| | | |
| | | @SuppressLint("NewApi") |
| | | @Override |
| | | public void onScreenStateChanged(int screenState) { |
| | | super.onScreenStateChanged(screenState); |
| | | mVisible = screenState == SCREEN_STATE_ON; |
| | | invalidateView(); |
| | | } |
| | | |
| | | @SuppressLint("NewApi") |
| | | @Override |
| | | protected void onVisibilityChanged(View changedView, int visibility) { |
| | | super.onVisibilityChanged(changedView, visibility); |
| | | mVisible = visibility == View.VISIBLE; |
| | | invalidateView(); |
| | | } |
| | | |
| | | @Override |
| | | protected void onWindowVisibilityChanged(int visibility) { |
| | | super.onWindowVisibilityChanged(visibility); |
| | | mVisible = visibility == View.VISIBLE; |
| | | invalidateView(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.ui.widget; |
| | | |
| | | import android.content.Context; |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | import android.util.AttributeSet; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2016/10/24. |
| | | */ |
| | | |
| | | public class MyRefreshLayout extends SwipeRefreshLayout { |
| | | |
| | | |
| | | /** |
| | | * 按下时的y坐标 |
| | | */ |
| | | private float mYDown; |
| | | private float mXDown; |
| | | /** |
| | | * 抬起时的y坐标, 与mYDown一起用于滑动到底部时判断是上拉还是下拉 |
| | | */ |
| | | private float mLastY; |
| | | private float mLastX; |
| | | private boolean mIsVpDragger; |
| | | |
| | | /** |
| | | * @param context |
| | | */ |
| | | public MyRefreshLayout(Context context) { |
| | | this(context, null); |
| | | } |
| | | |
| | | public MyRefreshLayout(Context context, AttributeSet attrs) { |
| | | super(context, attrs); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | protected void onLayout(boolean changed, int left, int top, int right, int bottom) { |
| | | super.onLayout(changed, left, top |
| | | , right, bottom); |
| | | } |
| | | } |
| | |
| | | import com.alibaba.baichuan.trade.biz.context.AlibcTradeResult; |
| | | import com.alibaba.baichuan.trade.biz.core.taoke.AlibcTaokeParams; |
| | | import com.hanju.video.app.ui.mine.BrowserActivity; |
| | | import com.hanju.video.app.util.downutil.ApkUtil; |
| | | import com.hanju.video.app.util.downutils.ApkUtil; |
| | | |
| | | /** |
| | | * 百川交易工具 |
New file |
| | |
| | | package com.hanju.video.app.util; |
| | | |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2016/10/27. |
| | | */ |
| | | |
| | | public class EmailUtil { |
| | | public static Pattern isEmailAddress() { |
| | | Pattern p = Pattern.compile("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\\.([a-zA-Z0-9_-])+)+$"); |
| | | return p; |
| | | } |
| | | } |
| | |
| | | //是否有开屏广告 |
| | | public final static boolean AD_SETTING_KAIPIN = true; |
| | | |
| | | public static final String USER_AGREEMENT = "http://bwapp.flqapp.com:8089/BuWan/api_control_ios.jsp"; |
| | | public static final String PRIVACY_POLICY = "http://bwapp.flqapp.com:8089/BuWan/user_protocol.jsp"; |
| | | public static final String USER_AGREEMENT = "http://h5.hanju.yeshitv.com/hanju/user_protocol.html"; |
| | | public static final String PRIVACY_POLICY = "http://h5.hanju.yeshitv.com/hanju/privacy.html"; |
| | | |
| | | public static final String HOST = "http://bwapp.flqapp.com:8089";//正式上线版本 |
| | | // public static final String HOST = "http://192.168.3.122:8080";//正式上线版本 |
| | |
| | | import com.alibaba.baichuan.trade.biz.context.AlibcTradeResult; |
| | | import com.alibaba.baichuan.trade.biz.core.taoke.AlibcTaokeParams; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.hanju.video.app.entity.JumpDetail; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.entity.common.JumpDetail; |
| | | |
| | | import org.json.JSONException; |
| | | |
| | |
| | | |
| | | import com.hanju.video.app.R; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2017/2/21. |
| | | */ |
| | | |
| | | public class PermissionsActivity extends Activity { |
| | | public static final int PERMISSIONS_GRANTED = 0; // 权限授权 |
| | | public static final int PERMISSIONS_DENIED = 1; // 权限拒绝 |
| | |
| | | package com.hanju.video.app.util; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2017/2/21. |
| | | */ |
| | | |
| | | import android.content.Context; |
| | | import android.content.pm.PackageManager; |
| | | |
| | | import androidx.core.content.ContextCompat; |
| | | |
| | | /** |
| | | * 检查权限的工具类 |
| | | * <p/> |
| | | * Created by wangchenlong on 16/1/26. |
| | | */ |
| | | |
| | | public class PermissionsChecker { |
| | | private final Context mContext; |
| | | |
| | |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.hanju.video.app.util.downutil.StringUtils; |
| | | import com.hanju.video.app.util.downutils.StringUtils; |
| | | |
| | | import static android.content.Context.MODE_PRIVATE; |
| | | |
New file |
| | |
| | | package com.hanju.video.app.util.ad; |
| | | |
| | | import android.app.Dialog; |
| | | import android.content.Context; |
| | | import android.content.DialogInterface; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.widget.FrameLayout; |
| | | |
| | | import com.hanju.lib.library.util.SystemCommon; |
| | | import com.hanju.video.app.R; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2017/2/28. |
| | | */ |
| | | |
| | | public class AdPromptDialog extends Dialog { |
| | | public AdPromptDialog(Context context) { |
| | | super(context); |
| | | this.setCancelable(false); |
| | | } |
| | | |
| | | public AdPromptDialog(Context context, int theme) { |
| | | super(context, theme); |
| | | this.setCancelable(false); |
| | | } |
| | | |
| | | public static class Builder { |
| | | private Context context; |
| | | private String positiveButtonText; |
| | | private String negativeButtonText; |
| | | private OnClickListener positiveButtonClickListener; |
| | | private OnClickListener negativeButtonClickListener; |
| | | |
| | | public Builder(Context context) { |
| | | this.context = context; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set the positive button resource and it's listener |
| | | * |
| | | * @param positiveButtonText |
| | | * @return |
| | | */ |
| | | public Builder setPositiveButton(int positiveButtonText, |
| | | OnClickListener listener) { |
| | | this.positiveButtonText = (String) context |
| | | .getText(positiveButtonText); |
| | | this.positiveButtonClickListener = listener; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setPositiveButton(String positiveButtonText, |
| | | OnClickListener listener) { |
| | | this.positiveButtonText = positiveButtonText; |
| | | this.positiveButtonClickListener = listener; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setNegativeButton(int negativeButtonText, |
| | | OnClickListener listener) { |
| | | this.negativeButtonText = (String) context |
| | | .getText(negativeButtonText); |
| | | this.negativeButtonClickListener = listener; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setNegativeButton(String negativeButtonText, |
| | | OnClickListener listener) { |
| | | this.negativeButtonText = negativeButtonText; |
| | | this.negativeButtonClickListener = listener; |
| | | return this; |
| | | } |
| | | |
| | | public AdPromptDialog create() { |
| | | LayoutInflater inflater = (LayoutInflater) context |
| | | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
| | | // instantiate the dialog with the custom Theme |
| | | final AdPromptDialog dialog = new AdPromptDialog(context, R.style.Dialog); |
| | | View layout = inflater.inflate(R.layout.item_ad_prompt, null); |
| | | dialog.addContentView(layout, new FrameLayout.LayoutParams( |
| | | FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT)); |
| | | // set the confirm button |
| | | if (positiveButtonClickListener != null) { |
| | | layout.findViewById(R.id.tv_login) |
| | | .setOnClickListener(new View.OnClickListener() { |
| | | public void onClick(View v) { |
| | | positiveButtonClickListener.onClick(dialog, |
| | | DialogInterface.BUTTON_POSITIVE); |
| | | } |
| | | }); |
| | | } |
| | | if (negativeButtonClickListener != null) { |
| | | layout.findViewById(R.id.tv_cancle) |
| | | .setOnClickListener(new View.OnClickListener() { |
| | | public void onClick(View v) { |
| | | negativeButtonClickListener.onClick(dialog, |
| | | DialogInterface.BUTTON_NEGATIVE); |
| | | } |
| | | }); |
| | | } |
| | | dialog.setContentView(layout); |
| | | |
| | | android.view.WindowManager.LayoutParams params = dialog.getWindow() |
| | | .getAttributes(); |
| | | params.width = (int) ((SystemCommon.getScreenWidth(context) * 3) / 4); |
| | | params.height = android.view.WindowManager.LayoutParams.WRAP_CONTENT; |
| | | dialog.getWindow().setAttributes(params); |
| | | dialog.setCanceledOnTouchOutside(false); |
| | | return dialog; |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.hanju.video.app.entity.ad.AdPositionEnum; |
| | | import com.hanju.video.app.entity.ad.AdTypeVO; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.downutil.StringUtils; |
| | | import com.hanju.video.app.util.downutils.StringUtils; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
New file |
| | |
| | | package com.hanju.video.app.util.ad; |
| | | |
| | | public class CSJADConstant { |
| | | |
| | | //首页大广告 |
| | | public static String RECOMMEND_BIG_IMG_AD = "945375047"; |
| | | |
| | | //VIVO开屏 |
| | | public static String SPLASH_AD_VIVO = "887378583"; |
| | | |
| | | //开屏广告 |
| | | public static String SPLASH_AD = "887360667"; |
| | | |
| | | //软件退出广告 |
| | | public static String APP_EXIT="945469133"; |
| | | |
| | | public static String INVALID_AD = "111111111"; |
| | | |
| | | } |
| | |
| | | import com.bytedance.sdk.openadsdk.TTAdManager; |
| | | import com.bytedance.sdk.openadsdk.TTAdNative; |
| | | import com.bytedance.sdk.openadsdk.TTNativeExpressAd; |
| | | import com.hanju.video.app.entity.ad.AdPositionEnum; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.common.DimenUtils; |
| | | import com.qq.e.ads.cfg.VideoOption; |
| | | import com.qq.e.ads.nativ.ADSize; |
| | | import com.qq.e.ads.nativ.NativeExpressAD; |
| | |
| | | import com.qq.e.ads.nativ.express2.NativeExpressADData2; |
| | | import com.qq.e.ads.nativ.express2.VideoOption2; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.util.DimenUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | int height = (int) (width * 0.8); |
| | | String pid = null; |
| | | if (sourceType == AdUtil.AD_TYPE.csj) { |
| | | pid = CSJConstant.RECOMMEND_BIG_IMG_AD; |
| | | pid = CSJADConstant.RECOMMEND_BIG_IMG_AD; |
| | | height = (int) (width * 0.56); |
| | | } else if (sourceType == AdUtil.AD_TYPE.gdt) { |
| | | pid = HanJuConstant.GDT_RECOMMAND_NATIVE; |
| | | } else if (sourceType == AdUtil.AD_TYPE.gdt2) { |
| | | pid = GDTConstant.PID_HOME_RECOMMEND_BIG_IMG; |
| | | pid = GDTADConstant.PID_HOME_RECOMMEND_BIG_IMG; |
| | | } |
| | | //获取屏幕的宽 |
| | | |
| | |
| | | if (sourceType == AdUtil.AD_TYPE.csj) { |
| | | pid = "945375047"; |
| | | } else if (sourceType == AdUtil.AD_TYPE.gdt2) { |
| | | pid = GDTConstant.PID_2_VIDEO_DETAIL_PLAY_EXPRESS1; |
| | | pid = GDTADConstant.PID_2_VIDEO_DETAIL_PLAY_EXPRESS1; |
| | | } |
| | | //获取屏幕的宽 |
| | | int deviceWidth = DimenUtils.getScreenWidth(mContext); |
| | |
| | | if (sourceType == AdUtil.AD_TYPE.csj) { |
| | | pid = "945375047"; |
| | | } else if (sourceType == AdUtil.AD_TYPE.gdt2) { |
| | | pid = GDTConstant.PID_2_VIDEO_DETAIL_PLAY_EXPRESS2; |
| | | pid = GDTADConstant.PID_2_VIDEO_DETAIL_PLAY_EXPRESS2; |
| | | } |
| | | if (mContext == null) |
| | | return; |
| | |
| | | pid = "945406595"; |
| | | } else if (sourceType == AdUtil.AD_TYPE.gdt2) { |
| | | if (columns == 3) |
| | | pid = GDTConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN3; |
| | | pid = GDTADConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN3; |
| | | else if (columns == 2) |
| | | pid = GDTConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN2; |
| | | pid = GDTADConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN2; |
| | | } |
| | | //获取屏幕的宽 |
| | | int deviceWidth = DimenUtils.getScreenWidth(mContext); |
| | |
| | | //加载大图 |
| | | String pid = null; |
| | | if (sourceType == AdUtil.AD_TYPE.csj) { |
| | | pid = CSJConstant.APP_EXIT; |
| | | pid = AdUtil.getAdPid(mContext, AdPositionEnum.exitApp); |
| | | } else if (sourceType == AdUtil.AD_TYPE.gdt) { |
| | | pid = HanJuConstant.GDT_EXIT_DIALOG; |
| | | pid = AdUtil.getAdPid(mContext, AdPositionEnum.exitApp); |
| | | } |
| | | //获取屏幕的宽 |
| | | int deviceWidth = DimenUtils.getScreenWidth(mContext); |
| | |
| | | |
| | | ad.getCsj().setDislikeCallback(activity, new TTAdDislike.DislikeInteractionCallback() { |
| | | |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s) { |
| | | public void onShow() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s, boolean b) { |
| | | if (adEventListener != null) { |
| | | adEventListener.closeAd(ad); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRefuse() { |
| | | |
| | | } |
| | | }); |
| | | ad.getCsj().render(); |
| | | if (ad.getCsj().getExpressAdView().getParent() != null) { |
| | |
| | | ad.getCsj().setDislikeCallback(activity, new TTAdDislike.DislikeInteractionCallback() { |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s) { |
| | | public void onShow() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s, boolean b) { |
| | | if (adEventListener != null) { |
| | | adEventListener.closeAd(ad); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRefuse() { |
| | | |
| | | } |
| | | }); |
| | | ad.getCsj().render(); |
| | | } |
| | |
| | | ad.getCsj().setDislikeCallback(activity, new TTAdDislike.DislikeInteractionCallback() { |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s) { |
| | | public void onShow() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s, boolean b) { |
| | | if (adEventListener != null) { |
| | | adEventListener.closeAd(ad); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRefuse() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.widget.Toast; |
| | | |
| | | import com.bytedance.sdk.openadsdk.AdSlot; |
| | | import com.bytedance.sdk.openadsdk.TTAdConstant; |
| | | import com.bytedance.sdk.openadsdk.TTAdManager; |
| | | import com.bytedance.sdk.openadsdk.TTAdNative; |
| | | import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd; |
| | | import com.hanju.video.app.util.DimenUtils; |
| | | import com.hanju.video.app.util.common.DimenUtils; |
| | | |
| | | public class FullVideoAdManager { |
| | | |
| | |
| | | return fullVideoAdManager; |
| | | } |
| | | |
| | | public void loadAd(final Context context, final IFullVideoAdListener adListener) { |
| | | public void loadAd(final Context context, String pid, final IFullVideoAdListener adListener) { |
| | | int w = DimenUtils.getScreenWidth(context); |
| | | int h = DimenUtils.getScreenHeight(context); |
| | | AdSlot adSlot = new AdSlot.Builder() |
| | | .setCodeId("945393854") |
| | | .setCodeId(pid) |
| | | .setSupportDeepLink(true) |
| | | .setExpressViewAcceptedSize(w,h) |
| | | .setExpressViewAcceptedSize(w, h) |
| | | .setOrientation(TTAdConstant.VERTICAL) |
| | | .build(); |
| | | TTAdManager ttAdManager = TTAdManagerHolder.get(); |
| | |
| | | @Override |
| | | public void onFullScreenVideoCached() { |
| | | } |
| | | |
| | | @Override |
| | | public void onFullScreenVideoCached(TTFullScreenVideoAd ttFullScreenVideoAd) { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | return mttFullVideoAd != null; |
| | | } |
| | | |
| | | interface IFullVideoAdListener { |
| | | public interface IFullVideoAdListener { |
| | | void onSuccess(); |
| | | } |
| | | |
New file |
| | |
| | | package com.hanju.video.app.util.ad; |
| | | |
| | | //广告常量 |
| | | public class GDTADConstant { |
| | | |
| | | public static String PID_HOME_RECOMMEND_BIG_IMG="2011627548122579"; |
| | | |
| | | public static String PID_VIDEO_DETAIL_PLAYER="5061928359494942"; |
| | | //视频播放器下方广告位 |
| | | public static String PID_2_VIDEO_DETAIL_PLAY_EXPRESS1 = "9031528552257617"; |
| | | //相关视频下方广告位 |
| | | public static String PID_2_VIDEO_DETAIL_PLAY_EXPRESS2 = "7091428572856609"; |
| | | //视频列表 |
| | | public static String PID_2_VIDEO_LIST_SMALL_AD_COLUMN3 = "4061924585347177"; |
| | | |
| | | public static String PID_2_VIDEO_LIST_SMALL_AD_COLUMN2 = "7001426565143389"; |
| | | |
| | | } |
| | |
| | | import com.bytedance.sdk.openadsdk.TTAdManager; |
| | | import com.bytedance.sdk.openadsdk.TTAdNative; |
| | | import com.bytedance.sdk.openadsdk.TTSplashAd; |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.qq.e.ads.splash.SplashAD; |
| | | import com.qq.e.ads.splash.SplashADListener; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.DimenUtils; |
| | | import com.hanju.video.app.util.common.DimenUtils; |
| | | |
| | | public class SplashAdUtil { |
| | | |
| | |
| | | if (height == 0) |
| | | height = 1080; |
| | | String channel = ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL"); |
| | | String code = CSJConstant.SPLASH_AD; |
| | | String code = CSJADConstant.SPLASH_AD; |
| | | if ("vivo".equalsIgnoreCase(channel)) { |
| | | code = CSJConstant.SPLASH_AD_VIVO; |
| | | code = CSJADConstant.SPLASH_AD_VIVO; |
| | | } |
| | | |
| | | AdSlot adSlot = new AdSlot.Builder() |
New file |
| | |
| | | package com.hanju.video.app.util.browser; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Intent; |
| | | import android.webkit.JavascriptInterface; |
| | | import android.widget.Toast; |
| | | |
| | | import com.alibaba.baichuan.android.trade.model.AlibcShowParams; |
| | | import com.alibaba.baichuan.android.trade.model.OpenType; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.google.gson.Gson; |
| | | import com.hanju.lib.library.util.common.ClipboardUtil; |
| | | import com.hanju.lib.library.util.common.PackageUtils2; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.security.MD5Utils; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.ut.device.UTDevice; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.util.JumpActivityUtil; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | |
| | | import static android.content.Context.MODE_PRIVATE; |
| | | |
| | | public class BaseHanJuJavaInterface { |
| | | |
| | | Activity mContext; |
| | | |
| | | public BaseHanJuJavaInterface(Activity activity) { |
| | | mContext = activity; |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public String getUid() { |
| | | return mContext.getSharedPreferences("user", MODE_PRIVATE).getString("LoginUid", ""); |
| | | } |
| | | |
| | | |
| | | @JavascriptInterface |
| | | public String getVersion() { |
| | | return PackageUtils2.getVersionCode(mContext) + ""; |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void toast(String str) { |
| | | Toast.makeText(mContext, str, Toast.LENGTH_LONG).show(); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public String getSign(String str) { |
| | | return MD5Utils.getMD532(str + "@?,223Hbb88lll"); |
| | | } |
| | | |
| | | |
| | | @JavascriptInterface |
| | | public void jumpBaiChuan(String tbClientInfo, String url, String auctionId) { |
| | | AlibcShowParams alibcShowParams = new AlibcShowParams(); |
| | | alibcShowParams.setOpenType(OpenType.Auto); |
| | | JumpActivityUtil.jumpBaiChuan(mContext, tbClientInfo, url, auctionId, alibcShowParams); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void copyText(String atr) { |
| | | ClipboardUtil.copy(mContext, atr); |
| | | } |
| | | |
| | | |
| | | @JavascriptInterface |
| | | public void jumpPage(String pageClassName, String paramJson) { |
| | | Intent intent = null; |
| | | JSONObject param = null; |
| | | try { |
| | | if (StringUtils.isEmpty(paramJson)) { |
| | | param = null; |
| | | } else { |
| | | param = new JSONObject(paramJson); |
| | | } |
| | | if (StringUtils.isEmpty(pageClassName)) { |
| | | return; |
| | | } else { |
| | | intent = new Intent(mContext, Class.forName(JumpActivityUtil.filterActivityName(pageClassName))); |
| | | } |
| | | } catch (JSONException e) { |
| | | param = null; |
| | | e.printStackTrace(); |
| | | } catch (ClassNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (null != param) { |
| | | @SuppressWarnings("unchecked") |
| | | Iterator<String> its = param.keys(); |
| | | while (its.hasNext()) { |
| | | String key = its.next(); |
| | | String value = param.optString(key); |
| | | intent.putExtra(key, value); |
| | | } |
| | | } |
| | | mContext.startActivity(intent); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public String getRequestBaseParams(String json) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | int version = PackageUtils2.getVersionCode(mContext); |
| | | if (!StringUtils.isEmpty(json)) { |
| | | JSONObject jsonObject = null; |
| | | try { |
| | | jsonObject = new JSONObject(json); |
| | | Iterator<String> iterator = jsonObject.keys(); |
| | | while (iterator.hasNext()) { |
| | | String key = iterator.next(); |
| | | params.put(key, jsonObject.optString(key)); |
| | | } |
| | | } catch (JSONException e) { |
| | | |
| | | } |
| | | } |
| | | |
| | | params.put("Package", mContext.getPackageName()); |
| | | params.put("Version", version + ""); |
| | | params.put("Device", UTDevice.getUtdid(mContext)); |
| | | params.put("Time",System.currentTimeMillis()+""); |
| | | LinkedHashMap<String, String> map = HttpApiUtil.validateParams(params, mContext); |
| | | |
| | | Gson gson = new Gson(); |
| | | String str = gson.toJson(map); |
| | | return str; |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void umEventCount(String eventId, String paramsJSON) { |
| | | Map map = JSON.parseObject(paramsJSON); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void umEventCompute(String eventId, String paramsJSON, int du) { |
| | | Map map = JSON.parseObject(paramsJSON); |
| | | MobclickAgent.onEventValue(mContext, eventId, map, du); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 清空粘贴板 |
| | | */ |
| | | @JavascriptInterface |
| | | public void clearClipboard() { |
| | | ClipboardUtil.emptyClipboard(mContext); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.browser; |
| | | |
| | | import android.Manifest; |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.pm.PackageManager; |
| | | import android.graphics.Bitmap; |
| | | import android.graphics.BitmapFactory; |
| | | import android.media.MediaScannerConnection; |
| | | import android.net.Uri; |
| | | import android.provider.MediaStore; |
| | | import android.webkit.JavascriptInterface; |
| | | import android.widget.ImageView; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.hanju.video.app.util.AlibcTradeUtil; |
| | | import com.hanju.video.app.util.JumpActivityUtil; |
| | | import com.hanju.video.app.util.x5web.X5WebView; |
| | | import com.hanju.lib.library.util.Environment; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.security.MD5Utils; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.util.Iterator; |
| | | |
| | | import androidx.core.app.ActivityCompat; |
| | | import androidx.core.content.ContextCompat; |
| | | |
| | | public class HanJuJavaInterface extends BaseHanJuJavaInterface { |
| | | |
| | | Activity mContext; |
| | | TextView tv_top_bar_middle, tv_top_bar_left2, tv_top_bar_right; |
| | | ImageView iv_right; |
| | | X5WebView webview; |
| | | private boolean boo = false; |
| | | |
| | | public HanJuJavaInterface(Activity activity, X5WebView webview) { |
| | | super(activity); |
| | | mContext = activity; |
| | | this.webview = webview; |
| | | boo = true; |
| | | } |
| | | |
| | | public HanJuJavaInterface(Activity activity, TextView tv_top_bar_middle |
| | | , TextView tv_top_bar_left2, TextView tv_top_bar_right |
| | | , ImageView iv_right, X5WebView webview) { |
| | | super(activity); |
| | | mContext = activity; |
| | | this.tv_top_bar_middle = tv_top_bar_middle; |
| | | this.tv_top_bar_left2 = tv_top_bar_left2; |
| | | this.tv_top_bar_right = tv_top_bar_right; |
| | | this.iv_right = iv_right; |
| | | this.webview = webview; |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void setTitle(final String title) { |
| | | // tv_top_bar_middle.setText(title); |
| | | if (!boo) |
| | | tv_top_bar_middle.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (null != title && !StringUtils.isEmpty(title.trim())) |
| | | tv_top_bar_middle.setText(title); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | @JavascriptInterface |
| | | public void jumpPageWithFinishCurrentPage(String pageClassName, String paramJson) { |
| | | Intent intent = null; |
| | | JSONObject param = null; |
| | | try { |
| | | if (StringUtils.isEmpty(paramJson)) { |
| | | param = null; |
| | | } else { |
| | | param = new JSONObject(paramJson); |
| | | } |
| | | if (StringUtils.isEmpty(pageClassName)) { |
| | | return; |
| | | } else { |
| | | intent = new Intent(mContext, Class.forName(JumpActivityUtil.filterActivityName(pageClassName))); |
| | | } |
| | | } catch (JSONException e) { |
| | | param = null; |
| | | e.printStackTrace(); |
| | | } catch (ClassNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (null != param) { |
| | | @SuppressWarnings("unchecked") |
| | | Iterator<String> its = param.keys(); |
| | | while (its.hasNext()) { |
| | | String key = its.next(); |
| | | String value = param.optString(key); |
| | | intent.putExtra(key, value); |
| | | } |
| | | } |
| | | mContext.startActivity(intent); |
| | | if (!boo) |
| | | mContext.finish(); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void finishPage() { |
| | | if (!boo) |
| | | iv_right.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | mContext.finish(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 淘宝授权 |
| | | * |
| | | * @param url |
| | | */ |
| | | @JavascriptInterface |
| | | public void tbAuth(String url) { |
| | | if (StringUtils.isEmpty(url)) |
| | | return; |
| | | AlibcTradeUtil.openAuthLink(mContext, url); |
| | | } |
| | | |
| | | // 判断权限集合 是否授权 false授权 true未授权 |
| | | public boolean lacksPermissions(String... permissions) { |
| | | for (String permission : permissions) { |
| | | if (lacksPermission(permission)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | // 判断是否缺少权限 |
| | | private boolean lacksPermission(String permission) { |
| | | //权限未授权 |
| | | return ContextCompat.checkSelfPermission(mContext, permission) == PackageManager.PERMISSION_DENIED; |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void savePicture(String url) { |
| | | if (lacksPermissions(Manifest.permission.READ_EXTERNAL_STORAGE, |
| | | Manifest.permission.WRITE_EXTERNAL_STORAGE)) { //存储权限未开启 |
| | | ActivityCompat.requestPermissions(mContext, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, 10023); |
| | | } else {//存储权限已开 |
| | | String md5 = MD5Utils.getMD532(url); |
| | | String path = Environment.getExternalStorageDirectory() |
| | | + "/hanju"; |
| | | File file = new File(path + "/" + md5 + ".jpg"); |
| | | if (!file.exists()) { |
| | | try { |
| | | File resultFile = saveImageFromPathToSdCard(mContext, url, path, md5 + ".jpg"); |
| | | if (resultFile != null) { |
| | | mContext.runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | MediaStore.Images.Media.insertImage(mContext.getContentResolver(), BitmapFactory.decodeFile(resultFile.getAbsolutePath()), resultFile.getName(), null); |
| | | Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); |
| | | Uri uri = Uri.fromFile(file); |
| | | intent.setData(uri); |
| | | mContext.sendBroadcast(intent); |
| | | Toast.makeText(mContext, "保存到相册成功", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | } |
| | | } catch (Exception e) { |
| | | Toast.makeText(mContext, "图片保存失败", Toast.LENGTH_LONG).show(); |
| | | if (file.exists()) |
| | | file.delete(); |
| | | } |
| | | |
| | | } else { |
| | | Toast.makeText(mContext, "图片已经保存!", Toast.LENGTH_LONG).show(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //创建本地保存路径 |
| | | public static File createImageFilePath(String path, String imageFileName) throws IOException { |
| | | File storageDir = new File(path); |
| | | if (!storageDir.exists()) { |
| | | storageDir.mkdir(); |
| | | } |
| | | File image = new File(storageDir, imageFileName); |
| | | return image; |
| | | } |
| | | |
| | | //保存网络图片保存到本地 |
| | | public static final File saveImageFromPathToSdCard(Context context, String image, |
| | | String path, String imageFileName) { |
| | | boolean success = false; |
| | | File file = null; |
| | | try { |
| | | file = createImageFilePath(path, imageFileName); |
| | | Bitmap bitmap = null; |
| | | URL url = new URL(image); |
| | | HttpURLConnection conn = null; |
| | | conn = (HttpURLConnection) url.openConnection(); |
| | | InputStream is = null; |
| | | is = conn.getInputStream(); |
| | | bitmap = BitmapFactory.decodeStream(is); |
| | | FileOutputStream outStream; |
| | | |
| | | outStream = new FileOutputStream(file); |
| | | bitmap.compress(Bitmap.CompressFormat.PNG, 100, outStream); |
| | | outStream.flush(); |
| | | outStream.close(); |
| | | success = true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | if (success) { |
| | | MediaScannerConnection.scanFile(context, new String[]{file.getPath()}, null, null); |
| | | return file; |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.common; |
| | | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | |
| | | public class AppConfigUtil { |
| | | |
| | | |
| | | /** |
| | | * 保存广告APPID |
| | | * |
| | | * @param context |
| | | * @param gdtAppId |
| | | * @param csjAppId |
| | | */ |
| | | public static void saveADAPPId(Context context, String gdtAppId, String csjAppId) { |
| | | saveConfig("gdtAppId", gdtAppId, context); |
| | | saveConfig("csjAppId", csjAppId, context); |
| | | } |
| | | |
| | | public static String getGDTAppId(Context context) { |
| | | return getConfig("gdtAppId", context); |
| | | } |
| | | |
| | | public static String getCSJAppId(Context context) { |
| | | return getConfig("csjAppId", context); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存播放器外跳协议 |
| | | * |
| | | * @param context |
| | | * @param content |
| | | */ |
| | | public static void savePlayerJumpOutProtocolPrefix(Context context, String content) { |
| | | saveConfig("jumpAppProtocolPrefix", content, context); |
| | | } |
| | | |
| | | public static Set<String> getPlayerJumpOutProtocolPrefix(Context context) { |
| | | try { |
| | | String config = getConfig("jumpAppProtocolPrefix", context); |
| | | if (!StringUtils.isEmpty(config)) { |
| | | Type type = new TypeToken<Set<String>>() { |
| | | }.getType(); |
| | | return new Gson().fromJson(config, type); |
| | | } |
| | | } catch (Exception e) { |
| | | e.getMessage(); |
| | | } |
| | | return new HashSet<>(); |
| | | } |
| | | |
| | | /** |
| | | * 保存联系我们链接 |
| | | * |
| | | * @param context |
| | | * @param link |
| | | */ |
| | | public static void saveConcatUsLink(Context context, String link) { |
| | | saveConfig("contactUs", link, context); |
| | | } |
| | | |
| | | public static String getConcatUsLink(Context context) { |
| | | return getConfig("contactUs", context); |
| | | } |
| | | |
| | | /** |
| | | * 保存注销链接 |
| | | * |
| | | * @param context |
| | | * @param link |
| | | */ |
| | | public static void saveUnRegisterLink(Context context, String link) { |
| | | saveConfig("unRegister", link, context); |
| | | } |
| | | |
| | | public static String getUnRegisterLink(Context context) { |
| | | return getConfig("unRegister", context); |
| | | } |
| | | |
| | | |
| | | private static void saveConfig(String key, String value, Context context) { |
| | | SharedPreferences.Editor editor = context.getSharedPreferences("config", Context.MODE_PRIVATE).edit(); |
| | | editor.putString(key, value); |
| | | editor.commit(); |
| | | } |
| | | |
| | | |
| | | private static String getConfig(String key, Context context) { |
| | | if (context == null) |
| | | return null; |
| | | SharedPreferences share = context.getSharedPreferences("config", Context.MODE_PRIVATE); |
| | | return share.getString(key, ""); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.common; |
| | | |
| | | import android.content.Context; |
| | | import android.content.DialogInterface; |
| | | import android.content.pm.ApplicationInfo; |
| | | import android.os.Build; |
| | | |
| | | import com.hanju.video.app.util.ui.GoReviewDialog; |
| | | import com.hanju.lib.library.util.MarketUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2017/9/14. |
| | | */ |
| | | |
| | | public class AppMarket { |
| | | |
| | | public static void mateAppMarket(final Context context) { |
| | | final List<ApplicationInfo> list = MarketUtils.filterInstalledPkgs(context, context.getPackageName()); |
| | | GoReviewDialog dialog = new GoReviewDialog.Builder(context).setPositiveButton("去好评", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | if (Build.BRAND.equalsIgnoreCase("XiaoMi")) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (list.get(i).packageName.equalsIgnoreCase("com.xiaomi.market")) { |
| | | MarketUtils.launchAppDetail(context, context.getPackageName(), list.get(i).packageName); |
| | | break; |
| | | } else if ((!list.get(i).packageName |
| | | .equalsIgnoreCase("com.xiaomi.market")) |
| | | && (i == list.size() - 1)) { |
| | | MarketUtils.launchAppDetail( |
| | | context, |
| | | context.getPackageName(), |
| | | list.get(0).packageName); |
| | | } |
| | | } |
| | | } else if (Build.BRAND.equalsIgnoreCase("MeiZu")) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (list.get(i).packageName.equalsIgnoreCase("com.meizu.mstore")) { |
| | | MarketUtils.launchAppDetail(context, context.getPackageName(), list.get(i).packageName); |
| | | break; |
| | | } else if ((!list.get(i).packageName |
| | | .equalsIgnoreCase("com.meizu.mstore")) |
| | | && (i == list.size() - 1)) { |
| | | MarketUtils.launchAppDetail( |
| | | context, |
| | | context.getPackageName(), |
| | | list.get(0).packageName); |
| | | } |
| | | } |
| | | } else if (Build.BRAND.equalsIgnoreCase("CoolPad")) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (list.get(i).packageName.equalsIgnoreCase("com.yulong.android.coolmart")) { |
| | | MarketUtils.launchAppDetail(context, context.getPackageName(), list.get(i).packageName); |
| | | break; |
| | | } else if ((!list.get(i).packageName |
| | | .equalsIgnoreCase("com.yulong.android.coolmart")) |
| | | && (i == list.size() - 1)) { |
| | | MarketUtils.launchAppDetail( |
| | | context, |
| | | context.getPackageName(), |
| | | list.get(0).packageName); |
| | | } |
| | | } |
| | | } else if (Build.BRAND.equalsIgnoreCase("OPPO")) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (list.get(i).packageName.equalsIgnoreCase("com.oppo.market")) { |
| | | MarketUtils.launchAppDetail(context, context.getPackageName(), list.get(i).packageName); |
| | | break; |
| | | } else if ((!list.get(i).packageName |
| | | .equalsIgnoreCase("com.oppo.market")) |
| | | && (i == list.size() - 1)) { |
| | | MarketUtils.launchAppDetail( |
| | | context, |
| | | context.getPackageName(), |
| | | list.get(0).packageName); |
| | | } |
| | | } |
| | | } else if (Build.BRAND.equalsIgnoreCase("vivo")) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (list.get(i).packageName.equalsIgnoreCase("com.bbk.appstore")) { |
| | | MarketUtils.launchAppDetail(context, context.getPackageName(), list.get(i).packageName); |
| | | break; |
| | | } else if ((!list.get(i).packageName |
| | | .equalsIgnoreCase("com.bbk.appstore")) |
| | | && (i == list.size() - 1)) { |
| | | MarketUtils.launchAppDetail( |
| | | context, |
| | | context.getPackageName(), |
| | | list.get(0).packageName); |
| | | } |
| | | } |
| | | } else if (Build.BRAND.equalsIgnoreCase("HuaWei")) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (list.get(i).packageName.equalsIgnoreCase("com.huawei.appmarket")) { |
| | | MarketUtils.launchAppDetail(context, context.getPackageName(), list.get(i).packageName); |
| | | break; |
| | | } else if ((!list.get(i).packageName |
| | | .equalsIgnoreCase("com.huawei.appmarket")) |
| | | && (i == list.size() - 1)) { |
| | | MarketUtils.launchAppDetail( |
| | | context, |
| | | context.getPackageName(), |
| | | list.get(0).packageName); |
| | | } |
| | | } |
| | | } else { |
| | | MarketUtils.launchAppDetail(context, context.getPackageName(), list.get(0).packageName); |
| | | } |
| | | dialog.dismiss(); |
| | | } |
| | | }).setNegativeButton("下次再说", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | dialog.dismiss(); |
| | | } |
| | | }).create(); |
| | | dialog.show(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.common; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.PrintWriter; |
| | | import java.io.StringWriter; |
| | | import java.io.Writer; |
| | | import java.lang.Thread.UncaughtExceptionHandler; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import android.content.Context; |
| | | import android.content.pm.PackageInfo; |
| | | import android.content.pm.PackageManager; |
| | | import android.content.pm.PackageManager.NameNotFoundException; |
| | | import android.os.Build; |
| | | import android.os.Looper; |
| | | import android.util.Log; |
| | | import android.widget.Toast; |
| | | |
| | | import com.hanju.video.app.entity.common.SDCardEntity; |
| | | import com.hanju.video.app.util.ui.SDCardUtil; |
| | | |
| | | public class CrashHandler implements UncaughtExceptionHandler { |
| | | |
| | | public static final String TAG = "CrashHandler"; |
| | | |
| | | // 系统默认的UncaughtException处理类 |
| | | private Thread.UncaughtExceptionHandler mDefaultHandler; |
| | | // CrashHandler实例 |
| | | private static CrashHandler INSTANCE = new CrashHandler(); |
| | | // 程序的Context对象 |
| | | private Context mContext; |
| | | // 用来存储设备信息和异常信息 |
| | | private Map<String, String> infos = new HashMap<String, String>(); |
| | | |
| | | // 用于格式化日期,作为日志文件名的一部分 |
| | | private java.text.DateFormat formatter = new SimpleDateFormat( |
| | | "yyyy-MM-dd-HH-mm-ss"); |
| | | |
| | | /** 保证只有一个CrashHandler实例 */ |
| | | private CrashHandler() { |
| | | } |
| | | |
| | | /** 获取CrashHandler实例 ,单例模式 */ |
| | | public static CrashHandler getInstance() { |
| | | return INSTANCE; |
| | | } |
| | | |
| | | /** |
| | | * 初始化 |
| | | * |
| | | * @param context |
| | | */ |
| | | public void init(Context context) { |
| | | mContext = context; |
| | | // 获取系统默认的UncaughtException处理器 |
| | | mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler(); |
| | | // 设置该CrashHandler为程序的默认处理器 |
| | | Thread.setDefaultUncaughtExceptionHandler(this); |
| | | } |
| | | |
| | | /** |
| | | * 当UncaughtException发生时会转入该函数来处理 |
| | | */ |
| | | @Override |
| | | public void uncaughtException(Thread thread, Throwable ex) { |
| | | if (!handleException(ex) && mDefaultHandler != null) { |
| | | // 如果用户没有处理则让系统默认的异常处理器来处理 |
| | | mDefaultHandler.uncaughtException(thread, ex); |
| | | } else { |
| | | try { |
| | | Thread.sleep(3000); |
| | | } catch (InterruptedException e) { |
| | | Log.e(TAG, "error : ", e); |
| | | } |
| | | // 退出程序 |
| | | android.os.Process.killProcess(android.os.Process.myPid()); |
| | | System.exit(1); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 自定义错误处理,收集错误信息 发送错误报告等操作均在此完成. |
| | | * |
| | | * @param ex |
| | | * @return true:如果处理了该异常信息;否则返回false. |
| | | */ |
| | | private boolean handleException(Throwable ex) { |
| | | if (ex == null) { |
| | | return false; |
| | | } |
| | | // 使用Toast来显示异常信息 |
| | | new Thread() { |
| | | @Override |
| | | public void run() { |
| | | Looper.prepare(); |
| | | Toast.makeText(mContext, "很抱歉,程序出现异常,即将退出.", Toast.LENGTH_LONG) |
| | | .show(); |
| | | Looper.loop(); |
| | | } |
| | | }.start(); |
| | | // 收集设备参数信息 |
| | | collectDeviceInfo(mContext); |
| | | // 保存日志文件 |
| | | saveCrashInfo2File(ex); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 收集设备参数信息 |
| | | * |
| | | * @param ctx |
| | | */ |
| | | public void collectDeviceInfo(Context ctx) { |
| | | try { |
| | | PackageManager pm = ctx.getPackageManager(); |
| | | PackageInfo pi = pm.getPackageInfo(ctx.getPackageName(), |
| | | PackageManager.GET_ACTIVITIES); |
| | | if (pi != null) { |
| | | String versionName = pi.versionName == null ? "null" |
| | | : pi.versionName; |
| | | String versionCode = pi.versionCode + ""; |
| | | infos.put("versionName", versionName); |
| | | infos.put("versionCode", versionCode); |
| | | } |
| | | } catch (NameNotFoundException e) { |
| | | Log.e(TAG, "an error occured when collect package info", e); |
| | | } |
| | | java.lang.reflect.Field[] fields = Build.class.getDeclaredFields(); |
| | | for (java.lang.reflect.Field field : fields) { |
| | | try { |
| | | field.setAccessible(true); |
| | | infos.put(field.getName(), field.get(null).toString()); |
| | | Log.d(TAG, field.getName() + " : " + field.get(null)); |
| | | } catch (Exception e) { |
| | | Log.e(TAG, "an error occured when collect crash info", e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存错误信息到文件中 |
| | | * |
| | | * @param ex |
| | | * @return 返回文件名称,便于将文件传送到服务器 |
| | | */ |
| | | private String saveCrashInfo2File(Throwable ex) { |
| | | |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (Map.Entry<String, String> entry : infos.entrySet()) { |
| | | String key = entry.getKey(); |
| | | String value = entry.getValue(); |
| | | sb.append(key + "=" + value + "\n"); |
| | | } |
| | | |
| | | Writer writer = new StringWriter(); |
| | | PrintWriter printWriter = new PrintWriter(writer); |
| | | ex.printStackTrace(printWriter); |
| | | Throwable cause = ex.getCause(); |
| | | while (cause != null) { |
| | | cause.printStackTrace(printWriter); |
| | | cause = cause.getCause(); |
| | | } |
| | | printWriter.close(); |
| | | String result = writer.toString(); |
| | | sb.append(result); |
| | | Log.e(TAG, "日志保存路径" + getCrashPath(mContext)); |
| | | |
| | | try { |
| | | long timestamp = System.currentTimeMillis(); |
| | | String time = formatter.format(new Date()); |
| | | String fileName = "crash-" + time + "-" + timestamp + ".log"; |
| | | String path = getCrashPath(mContext) + File.separator; |
| | | File dir = new File(path); |
| | | if (!dir.exists()) { |
| | | dir.mkdirs(); |
| | | } |
| | | |
| | | boolean isS = true; |
| | | if (!new File(path + fileName).exists()) |
| | | isS = new File(path + fileName).createNewFile(); |
| | | if (isS) { |
| | | FileOutputStream fos = new FileOutputStream(path + fileName); |
| | | fos.write(sb.toString().getBytes()); |
| | | fos.close(); |
| | | } |
| | | return fileName; |
| | | } catch (Exception e) { |
| | | Log.e(TAG, "an error occured while writing file...", e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private String getCrashPath(Context context) { |
| | | SDCardEntity entity = SDCardUtil.getDownLoadEntity(context); |
| | | String path = ""; |
| | | if (entity.getPath().endsWith("/")) |
| | | path = entity.getPath() + context.getPackageName(); |
| | | else |
| | | path = entity.getPath() + File.separator + context.getPackageName(); |
| | | if (!new File(path).exists()) |
| | | new File(path).mkdirs(); |
| | | return path; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.common; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.content.res.Resources; |
| | | import android.util.DisplayMetrics; |
| | | import android.util.TypedValue; |
| | | import android.view.Display; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | |
| | | public class DimenUtils { |
| | | |
| | | public static int dipToPixels(int dip, Context context) { |
| | | Resources r = context.getResources(); |
| | | float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, |
| | | r.getDisplayMetrics()); |
| | | return (int) px; |
| | | } |
| | | |
| | | public static int pxToDip(int px, Context context) { |
| | | Resources r = context.getResources(); |
| | | // float dip = TypedValue.complexToDimensionPixelSize(data, metrics) |
| | | // TypedValue.complexToDimensionPixelOffset(data, metrics) |
| | | return 0; |
| | | } |
| | | |
| | | public static int spToPixels(int sp, Context context) { |
| | | Resources r = context.getResources(); |
| | | float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, |
| | | r.getDisplayMetrics()); |
| | | return (int) px; |
| | | } |
| | | |
| | | public static int getScreenWidth(Context context) { |
| | | DisplayMetrics dm = context.getResources().getDisplayMetrics(); |
| | | return dm.widthPixels; |
| | | } |
| | | |
| | | public static int getScreenHeight(Context context) { |
| | | DisplayMetrics dm = context.getResources().getDisplayMetrics(); |
| | | return dm.heightPixels; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据手机的分辨率从 dp 的单位 转成为 px(像素) |
| | | */ |
| | | public static int dip2px(Context context, float dpValue) { |
| | | final float scale = context.getResources().getDisplayMetrics().density; |
| | | return (int) (dpValue * scale + 0.5f); |
| | | } |
| | | |
| | | /** |
| | | * 根据手机的分辨率从 px(像素) 的单位 转成为 dp |
| | | */ |
| | | public static int px2dip(Context context, float pxValue) { |
| | | final float scale = context.getResources().getDisplayMetrics().density; |
| | | return (int) (pxValue / scale + 0.5f); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.common; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | |
| | | import android.content.ContentResolver; |
| | | import android.content.ContentUris; |
| | | import android.content.Context; |
| | | import android.database.Cursor; |
| | | import android.graphics.Bitmap; |
| | | import android.net.Uri; |
| | | import android.os.Build; |
| | | import android.os.Environment; |
| | | import android.os.StatFs; |
| | | import android.provider.DocumentsContract; |
| | | import android.provider.MediaStore; |
| | | |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.util.downutils.Contents; |
| | | |
| | | public class FileUtils { |
| | | // 获取sd卡路径 |
| | | public static String getSDCardPath() { |
| | | if (Environment.getExternalStorageState().equals( |
| | | Environment.MEDIA_MOUNTED)) { |
| | | File file = new File(Environment.getExternalStorageDirectory() |
| | | .getPath()); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } else |
| | | return null; |
| | | } |
| | | |
| | | // 获取根目录 |
| | | public static String getRootPath() { |
| | | |
| | | if (StringUtils.isEmpty(getSDCardPath())) { |
| | | return null; |
| | | } else { |
| | | File file = new File(getSDCardPath() + File.separator |
| | | + Contents.ROOT); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } |
| | | } |
| | | |
| | | // 获取消息缓存文件夹 |
| | | public static String getChatInfoPath() { |
| | | if (StringUtils.isEmpty(getRootPath())) { |
| | | return null; |
| | | } else { |
| | | File file = new File(getRootPath() + File.separator |
| | | + Contents.CHATINFO); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 获取图片消息缓存文件夹 |
| | | public static String getChatImgPath() { |
| | | if (StringUtils.isEmpty(getChatInfoPath())) { |
| | | return null; |
| | | } else { |
| | | File file = new File(getChatInfoPath() + File.separator |
| | | + Contents.CHATIMG); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 获取缩略图片缓存文件夹 |
| | | public static String getChatThumbImgPath() { |
| | | if (StringUtils.isEmpty(getChatInfoPath())) { |
| | | return null; |
| | | } else { |
| | | File file = new File(getChatInfoPath() + File.separator |
| | | + Contents.THUMBIMAGE); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | |
| | | } |
| | | } |
| | | |
| | | // 获取图音频消息缓存文件夹 |
| | | public static String getChatVoicePath() { |
| | | if (StringUtils.isEmpty(getChatInfoPath())) { |
| | | return null; |
| | | } else { |
| | | File file = new File(getChatInfoPath() + File.separator |
| | | + Contents.CHATVOICE); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 获取缓存目录 |
| | | public static String getCachePath() { |
| | | if (StringUtils.isEmpty(getRootPath())) { |
| | | return null; |
| | | } else { |
| | | File file = new File(getChatInfoPath() + File.separator |
| | | + Contents.CACHE); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 写文本文�?在Android系统中,文件保存�?/data/data/PACKAGE_NAME/files 目录�? |
| | | * |
| | | * @param context |
| | | */ |
| | | public static void write(Context context, String fileName, String content) { |
| | | if (content == null) |
| | | content = ""; |
| | | |
| | | try { |
| | | FileOutputStream fos = context.openFileOutput(fileName, |
| | | Context.MODE_PRIVATE); |
| | | fos.write(content.getBytes()); |
| | | |
| | | fos.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 读取文本文件 |
| | | * |
| | | * @param context |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static String read(Context context, String fileName) { |
| | | try { |
| | | FileInputStream in = context.openFileInput(fileName); |
| | | return readInStream(in); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | private static String readInStream(FileInputStream inStream) { |
| | | try { |
| | | ByteArrayOutputStream outStream = new ByteArrayOutputStream(); |
| | | byte[] buffer = new byte[512]; |
| | | int length = -1; |
| | | while ((length = inStream.read(buffer)) != -1) { |
| | | outStream.write(buffer, 0, length); |
| | | } |
| | | |
| | | outStream.close(); |
| | | inStream.close(); |
| | | return outStream.toString(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static File createFile(String folderPath, String fileName) { |
| | | File destDir = new File(folderPath); |
| | | if (!destDir.exists()) { |
| | | destDir.mkdirs(); |
| | | } |
| | | return new File(folderPath, fileName + fileName); |
| | | } |
| | | |
| | | public static void copyFile(InputStream in, File file) { |
| | | |
| | | if (!file.exists()) { |
| | | try { |
| | | file.createNewFile(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | if (file.exists()) { |
| | | try { |
| | | FileOutputStream os = new FileOutputStream(file); |
| | | |
| | | byte[] b = new byte[1024]; |
| | | |
| | | int len = -1; |
| | | |
| | | while ((len = in.read(b)) != -1) { |
| | | os.write(b, 0, len); |
| | | } |
| | | |
| | | in.close(); |
| | | os.close(); |
| | | |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 向手机写图片 |
| | | * |
| | | * @param buffer |
| | | * @param folder |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static boolean writeFile(byte[] buffer, String folder, |
| | | String fileName) { |
| | | boolean writeSucc = false; |
| | | |
| | | boolean sdCardExist = Environment.getExternalStorageState().equals( |
| | | Environment.MEDIA_MOUNTED); |
| | | |
| | | String folderPath = ""; |
| | | if (sdCardExist) { |
| | | folderPath = Environment.getExternalStorageDirectory() |
| | | + File.separator + folder + File.separator; |
| | | } else { |
| | | writeSucc = false; |
| | | } |
| | | |
| | | File fileDir = new File(folderPath); |
| | | if (!fileDir.exists()) { |
| | | fileDir.mkdirs(); |
| | | } |
| | | |
| | | File file = new File(folderPath + fileName); |
| | | FileOutputStream out = null; |
| | | try { |
| | | out = new FileOutputStream(file); |
| | | out.write(buffer); |
| | | writeSucc = true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | out.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | return writeSucc; |
| | | } |
| | | |
| | | /** |
| | | * 根据文件绝对路径获取文件名 |
| | | * |
| | | * @param filePath |
| | | * @return |
| | | */ |
| | | public static String getFileName(String filePath) { |
| | | if (StringUtils.isEmpty(filePath)) |
| | | return ""; |
| | | return filePath.substring(filePath.lastIndexOf(File.separator) + 1); |
| | | } |
| | | |
| | | /** |
| | | * 根据文件的绝对路径获取文件名但不包含扩展名 |
| | | * |
| | | * @param filePath |
| | | * @return |
| | | */ |
| | | public static String getFileNameNoFormat(String filePath) { |
| | | if (StringUtils.isEmpty(filePath)) { |
| | | return ""; |
| | | } |
| | | int point = filePath.lastIndexOf('.'); |
| | | return filePath.substring(filePath.lastIndexOf(File.separator) + 1, |
| | | point); |
| | | } |
| | | |
| | | /** |
| | | * 获取文件扩展名 |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static String getFileFormat(String fileName) { |
| | | if (StringUtils.isEmpty(fileName)) |
| | | return ""; |
| | | |
| | | int point = fileName.lastIndexOf('.'); |
| | | return fileName.substring(point + 1); |
| | | } |
| | | |
| | | /** |
| | | * 获取文件大小 |
| | | * |
| | | * @param filePath |
| | | * @return |
| | | */ |
| | | public static long getFileSize(String filePath) { |
| | | long size = 0; |
| | | |
| | | File file = new File(filePath); |
| | | if (file != null && file.exists()) { |
| | | size = file.length(); |
| | | } |
| | | return size; |
| | | } |
| | | |
| | | /** |
| | | * 获取文件大小 |
| | | * |
| | | * @param size 字节 |
| | | * @return |
| | | */ |
| | | public static String getFileSize(long size) { |
| | | if (size <= 0) |
| | | return "0"; |
| | | java.text.DecimalFormat df = new java.text.DecimalFormat("##.##"); |
| | | float temp = (float) size / 1024; |
| | | if (temp >= 1024) { |
| | | return df.format(temp / 1024) + "M"; |
| | | } else { |
| | | return df.format(temp) + "K"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换文件大小 |
| | | * |
| | | * @param fileS |
| | | * @return B/KB/MB/GB |
| | | */ |
| | | public static String formatFileSize(long fileS) { |
| | | java.text.DecimalFormat df = new java.text.DecimalFormat("#.00"); |
| | | String fileSizeString = ""; |
| | | if (fileS < 1024) { |
| | | fileSizeString = df.format((double) fileS) + "B"; |
| | | } else if (fileS < 1048576) { |
| | | fileSizeString = df.format((double) fileS / 1024) + "KB"; |
| | | } else if (fileS < 1073741824) { |
| | | fileSizeString = df.format((double) fileS / 1048576) + "MB"; |
| | | } else { |
| | | fileSizeString = df.format((double) fileS / 1073741824) + "G"; |
| | | } |
| | | return fileSizeString; |
| | | } |
| | | |
| | | /** |
| | | * 获取目录文件大小 |
| | | * |
| | | * @param dir |
| | | * @return |
| | | */ |
| | | public static long getDirSize(File dir) { |
| | | if (dir == null) { |
| | | return 0; |
| | | } |
| | | if (!dir.isDirectory()) { |
| | | return 0; |
| | | } |
| | | long dirSize = 0; |
| | | File[] files = dir.listFiles(); |
| | | for (File file : files) { |
| | | if (file.isFile()) { |
| | | dirSize += file.length(); |
| | | } else if (file.isDirectory()) { |
| | | dirSize += file.length(); |
| | | dirSize += getDirSize(file); // 递归调用继续统计 |
| | | } |
| | | } |
| | | return dirSize; |
| | | } |
| | | |
| | | /** |
| | | * 获取目录文件个数 |
| | | * |
| | | * @return |
| | | */ |
| | | public long getFileList(File dir) { |
| | | long count = 0; |
| | | File[] files = dir.listFiles(); |
| | | count = files.length; |
| | | for (File file : files) { |
| | | if (file.isDirectory()) { |
| | | count = count + getFileList(file);// 递归 |
| | | count--; |
| | | } |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | public static byte[] toBytes(InputStream in) throws IOException { |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | int ch; |
| | | while ((ch = in.read()) != -1) { |
| | | out.write(ch); |
| | | } |
| | | byte[] buffer = out.toByteArray(); |
| | | out.close(); |
| | | return buffer; |
| | | } |
| | | |
| | | /** |
| | | * �?��文件是否存在 |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public static boolean checkFileExists(String name) { |
| | | boolean status; |
| | | if (!name.equals("")) { |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | File newPath = new File(path.toString() + name); |
| | | status = newPath.exists(); |
| | | } else { |
| | | status = false; |
| | | } |
| | | return status; |
| | | } |
| | | |
| | | public static boolean existFile(String path) { |
| | | |
| | | File file = new File(path); |
| | | |
| | | return file.isFile() && file.exists(); |
| | | } |
| | | |
| | | /** |
| | | * 计算SD卡的剩余空间 |
| | | * |
| | | * @return 返回-1,说明没有安装sd�? |
| | | */ |
| | | public static long getFreeDiskSpace() { |
| | | String status = Environment.getExternalStorageState(); |
| | | long freeSpace = 0; |
| | | if (status.equals(Environment.MEDIA_MOUNTED)) { |
| | | try { |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | StatFs stat = new StatFs(path.getPath()); |
| | | long blockSize = stat.getBlockSize(); |
| | | long availableBlocks = stat.getAvailableBlocks(); |
| | | freeSpace = availableBlocks * blockSize / 1024; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | return -1; |
| | | } |
| | | return (freeSpace); |
| | | } |
| | | |
| | | /** |
| | | * 新建目录 |
| | | * |
| | | * @param directoryName |
| | | * @return |
| | | */ |
| | | public static boolean createDirectory(String directoryName) { |
| | | boolean status; |
| | | if (!directoryName.equals("")) { |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | File newPath = new File(path.toString() + directoryName); |
| | | status = newPath.mkdir(); |
| | | status = true; |
| | | } else |
| | | status = false; |
| | | return status; |
| | | } |
| | | |
| | | /** |
| | | * �?��是否安装SD�? |
| | | * |
| | | * @return |
| | | */ |
| | | public static boolean checkSaveLocationExists() { |
| | | String sDCardStatus = Environment.getExternalStorageState(); |
| | | boolean status; |
| | | status = sDCardStatus.equals(Environment.MEDIA_MOUNTED); |
| | | return status; |
| | | } |
| | | |
| | | /** |
| | | * 删除目录(包括:目录里的所有文�? |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static boolean deleteDirectory(String fileName) { |
| | | boolean status; |
| | | SecurityManager checker = new SecurityManager(); |
| | | |
| | | if (!fileName.equals("")) { |
| | | |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | File newPath = new File(path.toString() + fileName); |
| | | checker.checkDelete(newPath.toString()); |
| | | if (newPath.isDirectory()) { |
| | | String[] listfile = newPath.list(); |
| | | // delete all files within the specified directory and then |
| | | // delete the directory |
| | | try { |
| | | for (int i = 0; i < listfile.length; i++) { |
| | | File deletedFile = new File(newPath.toString() + "/" |
| | | + listfile[i]); |
| | | deletedFile.delete(); |
| | | } |
| | | newPath.delete(); |
| | | |
| | | status = true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | status = false; |
| | | } |
| | | |
| | | } else |
| | | status = false; |
| | | } else |
| | | status = false; |
| | | return status; |
| | | } |
| | | |
| | | /** |
| | | * 删除文件 |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static boolean deleteFile(String fileName) { |
| | | boolean status; |
| | | SecurityManager checker = new SecurityManager(); |
| | | |
| | | if (!fileName.equals("")) { |
| | | |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | File newPath = new File(path.toString() + fileName); |
| | | checker.checkDelete(newPath.toString()); |
| | | if (newPath.isFile()) { |
| | | try { |
| | | |
| | | newPath.delete(); |
| | | status = true; |
| | | } catch (SecurityException se) { |
| | | se.printStackTrace(); |
| | | status = false; |
| | | } |
| | | } else |
| | | status = false; |
| | | } else |
| | | status = false; |
| | | return status; |
| | | } |
| | | |
| | | public static final String getTempFilePath(Context context) { |
| | | |
| | | return context.getCacheDir() + File.separator + "temp"; |
| | | |
| | | } |
| | | |
| | | public static String getSDPath() { |
| | | File sdDir = null; |
| | | boolean sdCardExist = Environment.getExternalStorageState().equals( |
| | | Environment.MEDIA_MOUNTED); // 判断sd卡是否存�? |
| | | if (sdCardExist) { |
| | | sdDir = Environment.getExternalStorageDirectory();// 获取跟目�? |
| | | } |
| | | return sdDir.getPath(); |
| | | } |
| | | |
| | | // 将图片保存到指定的路径 |
| | | public static String savePic(String filePath, String name, Bitmap bitmap) { |
| | | File file = new File(filePath); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | |
| | | File f = new File(filePath + File.separator + name); |
| | | try { |
| | | f.createNewFile(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FileOutputStream fOut = null; |
| | | try { |
| | | fOut = new FileOutputStream(f); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); |
| | | try { |
| | | fOut.flush(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | fOut.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return f.getPath(); |
| | | } |
| | | |
| | | // 将图片保存到指定的路径 |
| | | public static String savePic(String filePath, Bitmap bitmap) { |
| | | File f = new File(filePath); |
| | | try { |
| | | f.createNewFile(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FileOutputStream fOut = null; |
| | | try { |
| | | fOut = new FileOutputStream(f); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); |
| | | try { |
| | | fOut.flush(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | fOut.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return f.getPath(); |
| | | } |
| | | |
| | | |
| | | public static String getFilePathByUri(Context context, Uri uri) { |
| | | String path = null; |
| | | // 以 file:// 开头的 |
| | | if (ContentResolver.SCHEME_FILE.equals(uri.getScheme())) { |
| | | path = uri.getPath(); |
| | | return path; |
| | | } |
| | | // 以 content:// 开头的,比如 content://media/extenral/images/media/17766 |
| | | if (ContentResolver.SCHEME_CONTENT.equals(uri.getScheme()) && Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { |
| | | Cursor cursor = context.getContentResolver().query(uri, new String[]{MediaStore.Images.Media.DATA}, null, null, null); |
| | | if (cursor != null) { |
| | | if (cursor.moveToFirst()) { |
| | | int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); |
| | | if (columnIndex > -1) { |
| | | path = cursor.getString(columnIndex); |
| | | } |
| | | } |
| | | cursor.close(); |
| | | } |
| | | return path; |
| | | } |
| | | // 4.4及之后的 是以 content:// 开头的,比如 content://com.android.providers.media.documents/document/image%3A235700 |
| | | if (ContentResolver.SCHEME_CONTENT.equals(uri.getScheme()) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
| | | if (DocumentsContract.isDocumentUri(context, uri)) { |
| | | if (isExternalStorageDocument(uri)) { |
| | | // ExternalStorageProvider |
| | | final String docId = DocumentsContract.getDocumentId(uri); |
| | | final String[] split = docId.split(":"); |
| | | final String type = split[0]; |
| | | if ("primary".equalsIgnoreCase(type)) { |
| | | path = Environment.getExternalStorageDirectory() + "/" + split[1]; |
| | | return path; |
| | | } |
| | | } else if (isDownloadsDocument(uri)) { |
| | | // DownloadsProvider |
| | | final String id = DocumentsContract.getDocumentId(uri); |
| | | final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), |
| | | Long.valueOf(id)); |
| | | path = getDataColumn(context, contentUri, null, null); |
| | | return path; |
| | | } else if (isMediaDocument(uri)) { |
| | | // MediaProvider |
| | | final String docId = DocumentsContract.getDocumentId(uri); |
| | | final String[] split = docId.split(":"); |
| | | final String type = split[0]; |
| | | Uri contentUri = null; |
| | | if ("image".equals(type)) { |
| | | contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; |
| | | } else if ("video".equals(type)) { |
| | | contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; |
| | | } else if ("audio".equals(type)) { |
| | | contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; |
| | | } |
| | | final String selection = "_id=?"; |
| | | final String[] selectionArgs = new String[]{split[1]}; |
| | | path = getDataColumn(context, contentUri, selection, selectionArgs); |
| | | return path; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { |
| | | Cursor cursor = null; |
| | | final String column = "_data"; |
| | | final String[] projection = {column}; |
| | | try { |
| | | cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); |
| | | if (cursor != null && cursor.moveToFirst()) { |
| | | final int column_index = cursor.getColumnIndexOrThrow(column); |
| | | return cursor.getString(column_index); |
| | | } |
| | | } finally { |
| | | if (cursor != null) |
| | | cursor.close(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private static boolean isExternalStorageDocument(Uri uri) { |
| | | return "com.android.externalstorage.documents".equals(uri.getAuthority()); |
| | | } |
| | | |
| | | private static boolean isDownloadsDocument(Uri uri) { |
| | | return "com.android.providers.downloads.documents".equals(uri.getAuthority()); |
| | | } |
| | | |
| | | private static boolean isMediaDocument(Uri uri) { |
| | | return "com.android.providers.media.documents".equals(uri.getAuthority()); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.common; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.graphics.Bitmap; |
| | | import android.graphics.BitmapFactory; |
| | | import android.net.Uri; |
| | | import android.os.Build; |
| | | import android.os.Environment; |
| | | import android.provider.MediaStore; |
| | | import android.util.Log; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | |
| | | public class PhotoCrop { |
| | | |
| | | /** |
| | | * 获取相册图片 |
| | | * |
| | | * @param uri |
| | | */ |
| | | public Uri startPhotoZoom(Uri uri, Context mContext) { |
| | | Uri uriClipUri = null; |
| | | //com.android.camera.action.CROP,这个action是调用系统自带的图片裁切功能 |
| | | Intent intent = new Intent("com.android.camera.action.CROP"); |
| | | intent.setDataAndType(uri, "image/*");//裁剪的图片uri和图片类型 |
| | | intent.putExtra("crop", "true");//设置允许裁剪,如果不设置,就会跳过裁剪的过程,还可以设置putExtra("crop", "circle") |
| | | if (Build.MANUFACTURER.equals("HUAWEI")) { //华为特殊处理 不然会显示圆 |
| | | intent.putExtra("aspectX", 9998); |
| | | intent.putExtra("aspectY", 9999); |
| | | } else { |
| | | intent.putExtra("aspectX", 1);//裁剪框的 X 方向的比例,需要为整数 |
| | | intent.putExtra("aspectY", 1);//裁剪框的 Y 方向的比例,需要为整数 |
| | | } |
| | | intent.putExtra("outputX", 600);//返回数据的时候的X像素大小。 |
| | | intent.putExtra("outputY", 600);//返回数据的时候的Y像素大小。 |
| | | //裁剪时是否保留图片的比例,这里的比例是1:1 |
| | | intent.putExtra("scale", true); |
| | | //是否是圆形裁剪区域true,设置了也不一定有效 |
| | | intent.putExtra("circleCrop", false); |
| | | //uritempFile为Uri类变量,实例化uritempFile |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
| | | //如果是7.0的相册 |
| | | //设置裁剪的图片地址Uri |
| | | uriClipUri = Uri.parse("file://" + "/" + android.os.Environment.getExternalStorageDirectory().getPath() + "/FLQImg/" + "clip.jpg"); |
| | | } else { |
| | | uriClipUri = Uri.parse("file://" + "/" + android.os.Environment.getExternalStorageDirectory().getPath() + "/FLQImg/" + "clip.jpg"); |
| | | } |
| | | Log.e("uriClipUri=====", "" + uriClipUri); |
| | | //Android 对Intent中所包含数据的大小是有限制的,一般不能超过 1M,否则会使用缩略图 ,所以我们要指定输出裁剪的图片路径 |
| | | intent.putExtra(MediaStore.EXTRA_OUTPUT, uriClipUri); |
| | | intent.putExtra("return-data", false);//是否将数据保留在Bitmap中返回 |
| | | intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());//输出格式,一般设为Bitmap格式及图片类型 |
| | | intent.putExtra("noFaceDetection", false);//人脸识别功能 |
| | | ((Activity) mContext).startActivityForResult(intent, 1002);//裁剪完成的标识 |
| | | return uriClipUri; |
| | | } |
| | | |
| | | /** |
| | | * 图片压缩的方法(只是内存减少,避免oom,图片本身在disk盘体积不变) |
| | | * 显示的Bitmap占用的内存少一点,还是需要去设置加载的像素长度和宽度(变成缩略图) |
| | | * |
| | | * @param mFile |
| | | * @param crop 是否剪裁圆形图片 true 是 false 否 |
| | | * @return |
| | | */ |
| | | public boolean compressPhto(File mFile, boolean crop) { |
| | | // BitmapFactory这个类就提供了多个解析方法(decodeResource、decodeStream、decodeFile等)用于创建Bitmap。 |
| | | // 比如如果图片来源于网络,就可以使用decodeStream方法; |
| | | // 如果是sd卡里面的图片,就可以选择decodeFile方法; |
| | | // 如果是资源文件里面的图片,就可以使用decodeResource方法等 |
| | | BitmapFactory.Options options = new BitmapFactory.Options(); |
| | | options.inJustDecodeBounds = true; // 获取当前图片的边界大小 |
| | | //BitmapFactory.decodeResource(getResources(), R.drawable.bg, options); |
| | | BitmapFactory.decodeFile(mFile.getAbsolutePath(), options); |
| | | int outHeight = options.outHeight; //获取图片本身的高像素 |
| | | int outWidth = options.outWidth;//获取图片本身的宽的像素 |
| | | String outMimeType = options.outMimeType; |
| | | options.inJustDecodeBounds = false; |
| | | //inSampleSize的作用就是可以把图片的长短缩小inSampleSize倍,所占内存缩小inSampleSize的平方 |
| | | //对于inSampleSize值的大小有要求,最好是整数且2的倍数 |
| | | options.inSampleSize = caculateSampleSize(options, 500, 500); |
| | | //etPath()得到的是构造file的时候的路径。getAbsolutePath()得到的是全路径 |
| | | String path = mFile.getPath(); |
| | | String absPath = mFile.getAbsolutePath(); |
| | | Bitmap bitmap = BitmapFactory.decodeFile(absPath, options); |
| | | try { |
| | | return saveBitmap(bitmap, "avatar.png", crop);//保存成功 |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | // ivUserPhoto.setImageBitmap(bitmap); |
| | | // //尺寸压缩结果 |
| | | // ivSize.setImageBitmap(bitmap); |
| | | } |
| | | |
| | | |
| | | public Bitmap compressPhto(File mFile) { |
| | | // BitmapFactory这个类就提供了多个解析方法(decodeResource、decodeStream、decodeFile等)用于创建Bitmap。 |
| | | // 比如如果图片来源于网络,就可以使用decodeStream方法; |
| | | // 如果是sd卡里面的图片,就可以选择decodeFile方法; |
| | | // 如果是资源文件里面的图片,就可以使用decodeResource方法等 |
| | | BitmapFactory.Options options = new BitmapFactory.Options(); |
| | | options.inJustDecodeBounds = true; // 获取当前图片的边界大小 |
| | | //BitmapFactory.decodeResource(getResources(), R.drawable.bg, options); |
| | | BitmapFactory.decodeFile(mFile.getAbsolutePath(), options); |
| | | int outHeight = options.outHeight; //获取图片本身的高像素 |
| | | int outWidth = options.outWidth;//获取图片本身的宽的像素 |
| | | String outMimeType = options.outMimeType; |
| | | options.inJustDecodeBounds = false; |
| | | //inSampleSize的作用就是可以把图片的长短缩小inSampleSize倍,所占内存缩小inSampleSize的平方 |
| | | //对于inSampleSize值的大小有要求,最好是整数且2的倍数 |
| | | options.inSampleSize = caculateSampleSize(options, 500, 500); |
| | | //etPath()得到的是构造file的时候的路径。getAbsolutePath()得到的是全路径 |
| | | String path = mFile.getPath(); |
| | | String absPath = mFile.getAbsolutePath(); |
| | | Bitmap bitmap = BitmapFactory.decodeFile(absPath, options); |
| | | return bitmap; |
| | | } |
| | | |
| | | /** |
| | | * 计算出所需要压缩的大小 |
| | | * |
| | | * @param options |
| | | * @param reqWidth 希望的图片宽大小 |
| | | * @param reqHeight 希望的图片高大小 |
| | | * @return |
| | | */ |
| | | private int caculateSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { |
| | | int sampleSize = 1; |
| | | int picWidth = options.outWidth; |
| | | int picHeight = options.outHeight; |
| | | if (picWidth > reqWidth || picHeight > reqHeight) { |
| | | int halfPicWidth = picWidth / 2; |
| | | int halfPicHeight = picHeight / 2; |
| | | while (halfPicWidth / sampleSize > reqWidth || halfPicHeight / sampleSize > reqHeight) { |
| | | sampleSize *= 2; |
| | | } |
| | | } |
| | | return sampleSize; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存文件, |
| | | * |
| | | * @param bitmap |
| | | * @param bitName 文件名 |
| | | * @param crop |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | private boolean saveBitmap(Bitmap bitmap, String bitName, boolean crop) throws IOException { |
| | | boolean save = false; |
| | | File storageDir = new File(Environment.getExternalStorageDirectory().getPath() + "/FLQImg/"); |
| | | if (!storageDir.exists()) {//没有文件夹则创建 |
| | | storageDir.mkdir(); |
| | | } |
| | | String fileName; |
| | | File file; |
| | | fileName = Environment.getExternalStorageDirectory().getPath() + "/FLQImg/" + bitName; |
| | | file = new File(fileName); |
| | | if (bitmap != null) { |
| | | if (file.exists()) { |
| | | file.delete(); |
| | | } |
| | | FileOutputStream out; |
| | | |
| | | out = new FileOutputStream(file); |
| | | // 格式为 JPEG,照相机拍出的图片为JPEG格式的,PNG格式的不能显示在相册中 |
| | | if (bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out)) { |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | save = true;//保存成功 |
| | | } |
| | | return save; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.downutils; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | | import java.net.URLDecoder; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import android.content.ComponentName; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.pm.PackageManager; |
| | | import android.content.pm.PackageManager.NameNotFoundException; |
| | | |
| | | import com.loopj.android.http.AsyncHttpClient; |
| | | import com.loopj.android.http.JsonHttpResponseHandler; |
| | | import com.loopj.android.http.RequestParams; |
| | | |
| | | public class ApkUtil { |
| | | |
| | | public static void openApk(Context context, String packageName, |
| | | String mainActivity) { |
| | | try { |
| | | Intent intent = new Intent(); |
| | | ComponentName cmp = new ComponentName(packageName, mainActivity); |
| | | intent.setAction(Intent.ACTION_MAIN); |
| | | intent.addCategory(Intent.CATEGORY_LAUNCHER); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | intent.setComponent(cmp); |
| | | |
| | | context.startActivity(intent); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 检查某个应用是否安装 |
| | | public static boolean checkAPP(Context context, String packageName) { |
| | | if (packageName == null || "".equals(packageName)) |
| | | return false; |
| | | try { |
| | | context.getPackageManager() |
| | | .getApplicationInfo(packageName, |
| | | PackageManager.GET_UNINSTALLED_PACKAGES); |
| | | return true; |
| | | } catch (NameNotFoundException e) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | // public static void OpenListeners(int id, String type) { |
| | | // final String mType = type; |
| | | // final int mId = id; |
| | | // Map<String, String> params = new HashMap<String, String>(); |
| | | // params.put("Method", "setMoney"); |
| | | //// params.put("Uid", AppContext.userInfo.getId() + ""); |
| | | // params.put("Id", id + ""); |
| | | // params.put("Type", type); |
| | | //// RandomCode = AppContext.userInfo.getRandomCode(); |
| | | // params.put("RCode", RandomCode); |
| | | // params.put("Platform", platform); |
| | | // post("http://123.57.155.55:8080/YouHuiZhuan/API/money", params, null, |
| | | // new JsonHttpResponseHandler() { |
| | | // |
| | | // @Override |
| | | // public void onStart() { |
| | | // super.onStart(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onFinish() { |
| | | // super.onFinish(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onSuccess(int statusCode, Header[] headers, |
| | | // JSONObject response) { |
| | | // // TODO Auto-generated method stub |
| | | // super.onSuccess(statusCode, headers, response); |
| | | // Log.i("tasklist", response.toString()); |
| | | // if (mType.equalsIgnoreCase("1")) { |
| | | //// AppContext.startRecord(mId, 3 + ""); |
| | | // } |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onFailure(int statusCode, Header[] headers, |
| | | // Throwable throwable, JSONArray errorResponse) { |
| | | // super.onFailure(statusCode, headers, throwable, |
| | | // errorResponse); |
| | | // // UIUtils.showToast(context, "请求服务器失败"); |
| | | // } |
| | | // }); |
| | | // } |
| | | |
| | | public static String RandomCode; |
| | | final static String platform = "Android"; |
| | | private static AsyncHttpClient client = new AsyncHttpClient(); |
| | | |
| | | // public static void money(Map<String, String> params, |
| | | // JsonHttpResponseHandler handler) { |
| | | // if (StringUtils.isNullOrEmpty(RandomCode) |
| | | // && AppContext.userInfo != null) { |
| | | // RandomCode = AppContext.userInfo.getRandomCode(); |
| | | // } |
| | | // RandomCode = AppContext.userInfo.getRandomCode(); |
| | | // params.put("RCode", RandomCode); |
| | | // params.put("Platform", platform); |
| | | // post("http://123.57.155.55:8080/YouHuiZhuan/API/money", params, null, |
| | | // handler); |
| | | // } |
| | | |
| | | public static void post(String url, Map<String, String> map, |
| | | HashMap<String, File> fileMap, JsonHttpResponseHandler handler) { |
| | | RequestParams params = new RequestParams(); |
| | | TreeSet<String> treeSet = new TreeSet<String>(); |
| | | Set<String> set = map.keySet(); |
| | | Iterator<String> it = set.iterator(); |
| | | String sign = ""; |
| | | String org = ""; |
| | | JSONObject object = new JSONObject(); |
| | | while (it.hasNext()) { |
| | | String key = it.next(); |
| | | treeSet.add(key); |
| | | } |
| | | it = treeSet.iterator(); |
| | | while (it.hasNext()) { |
| | | String key = it.next(); |
| | | try { |
| | | object.put(key, map.get(key)); |
| | | } catch (JSONException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | // if (!StringUtils.isNullOrEmpty(map.get(key))) |
| | | // org += map.get(key) + "---"; |
| | | } |
| | | |
| | | // sign = StringUtils.MD5(org + "youHUIzhuan2015"); |
| | | try { |
| | | String iSign = URLDecoder.decode(sign, "UTF-8"); |
| | | object.put("Sign", iSign); |
| | | } catch (Exception e2) { |
| | | // TODO Auto-generated catch block |
| | | e2.printStackTrace(); |
| | | } |
| | | params.put("Data", object.toString()); |
| | | if (fileMap != null) { |
| | | Set<String> fileSet = fileMap.keySet(); |
| | | it = fileSet.iterator(); |
| | | |
| | | while (it.hasNext()) { |
| | | String key = it.next(); |
| | | try { |
| | | params.put(key, fileMap.get(key)); |
| | | } catch (FileNotFoundException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | client.post(url, params, handler); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.downutils; |
| | | |
| | | //常量 |
| | | public class Contents { |
| | | // 根目�? |
| | | public static String ROOT = "kkshow"; |
| | | // 消息缓存目录 |
| | | public final static String CHATINFO = "Chat"; |
| | | // 消息图片缓存目录 |
| | | public final static String CHATIMG = "Image"; |
| | | // 消息声音缓存目录 |
| | | public final static String CHATVOICE = "Voice"; |
| | | // 缩略图缓存目�? |
| | | public final static String THUMBIMAGE = "ThumbImage"; |
| | | // 消息接收过滤�? |
| | | public final static String CHAT_MESSAGE_RECIVER_FILTER = "chat_message_reciver_filter"; |
| | | // 图片缓存 |
| | | public final static String CACHE = "Chche"; |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.downutils; |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.net.Uri; |
| | | import android.os.AsyncTask; |
| | | import android.os.Build; |
| | | import androidx.core.content.FileProvider; |
| | | import android.util.Log; |
| | | |
| | | import com.hanju.video.app.BuildConfig; |
| | | import com.hanju.video.app.services.DownLoadFileService; |
| | | |
| | | import java.io.File; |
| | | |
| | | /** |
| | | * @author weikou2015 下载工具类 |
| | | */ |
| | | public class DownFiles extends AsyncTask<String, Integer, String> implements |
| | | DownLoadFile.FileProgressListener { |
| | | private static final String TAG = "DownFiles"; |
| | | // TextView tv; |
| | | Context context; |
| | | IProgress progress; |
| | | |
| | | public DownFiles(Context context, IProgress progress) { |
| | | // this.tv = tv; |
| | | this.context = context; |
| | | this.progress = progress; |
| | | } |
| | | |
| | | @Override |
| | | protected void onProgressUpdate(Integer... values) { |
| | | super.onProgressUpdate(values); |
| | | Log.i(TAG, "下载进度:" + values[0]); |
| | | if (progress != null) |
| | | progress.getProgress(values[0]); |
| | | |
| | | // if (values[0] == 100) { |
| | | // tv.setText("完成"); |
| | | // } else { |
| | | // tv.setText("下载" + values[0] + "%"); |
| | | // } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected String doInBackground(String... params) { |
| | | String url = params[0]; |
| | | // 下载 |
| | | DownLoadFile dl = new DownLoadFile(); |
| | | String[] urls = url.split("/"); |
| | | String name = ""; |
| | | if (urls.length > 0) |
| | | name = FileUtils.getRootPath(context) + File.separator |
| | | + urls[urls.length - 1]; |
| | | else |
| | | name = FileUtils.getRootPath(context) + File.separator |
| | | + System.currentTimeMillis() + ".apk"; |
| | | System.out.println("APK名称:" + name); |
| | | try { |
| | | File f = dl.downLoadFile(this, name, url, context); |
| | | return f.getPath(); |
| | | } catch (Exception e) { |
| | | DownLoadFileService.j = -1; |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | // 完成网络请求 |
| | | @Override |
| | | protected void onPostExecute(String result) { |
| | | super.onPostExecute(result); |
| | | if (!StringUtils.isNullOrEmpty(result) && result.endsWith(".apk")) { |
| | | Intent intent = new Intent(Intent.ACTION_VIEW); |
| | | File file = new File(result); |
| | | |
| | | //判断是否是AndroidN以及更高的版本 |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
| | | intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| | | Uri contentUri = FileProvider.getUriForFile(context.getApplicationContext(), BuildConfig.APPLICATION_ID + ".fileprovider", file); |
| | | intent.setDataAndType(contentUri, "application/vnd.android.package-archive"); |
| | | } else { |
| | | Uri uri = Uri.fromFile(file); |
| | | intent.setDataAndType(uri, "application/vnd.android.package-archive"); |
| | | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | } |
| | | context.startActivity(intent); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void update(int progress) { |
| | | publishProgress(progress); |
| | | } |
| | | |
| | | public interface IProgress { |
| | | void getProgress(int p); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.downutils; |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.net.Uri; |
| | | import android.os.AsyncTask; |
| | | import android.os.Build; |
| | | import androidx.core.content.FileProvider; |
| | | import android.util.Log; |
| | | |
| | | import com.hanju.video.app.BuildConfig; |
| | | import com.hanju.video.app.entity.ad.AdType; |
| | | import com.hanju.video.app.services.DownLoadFileService; |
| | | |
| | | import java.io.File; |
| | | |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | | /** |
| | | * @author weikou2015 下载工具类 |
| | | */ |
| | | public class DownLoadApks extends AsyncTask<String, Integer, String> implements |
| | | DownLoadFile.FileProgressListener { |
| | | private static final String TAG = "DownLoadApks"; |
| | | // TextView tv; |
| | | Context context; |
| | | IProgress progress; |
| | | String apkType; |
| | | |
| | | public DownLoadApks(Context context, IProgress progress, String apkType) { |
| | | // this.tv = tv; |
| | | this.context = context; |
| | | this.progress = progress; |
| | | this.apkType = apkType; |
| | | } |
| | | |
| | | int sopro = 0; |
| | | |
| | | @Override |
| | | protected void onProgressUpdate(Integer... values) { |
| | | super.onProgressUpdate(values); |
| | | Log.i(TAG, "下载进度:" + values[0]); |
| | | if (progress != null) { |
| | | if (isSo) { |
| | | AdType adType = new AdType(); |
| | | adType.setProgress(values[0]); |
| | | EventBus.getDefault().post(adType); |
| | | } |
| | | progress.getProgress(values[0]); |
| | | } |
| | | // if (values[0] == 100) { |
| | | // tv.setText("完成"); |
| | | // } else { |
| | | // tv.setText("下载" + values[0] + "%"); |
| | | // } |
| | | |
| | | } |
| | | |
| | | private boolean isSo = false; |
| | | |
| | | @Override |
| | | protected String doInBackground(String... params) { |
| | | String url = params[0]; |
| | | // 下载 |
| | | DownLoadFile dl = new DownLoadFile(); |
| | | String[] urls = url.split("/"); |
| | | String name = ""; |
| | | if (urls.length > 0) |
| | | if (urls[urls.length - 1].contains(".so")) { |
| | | name = FileUtils.getAppRootPath(context) + File.separator |
| | | + urls[urls.length - 1]; |
| | | } else { |
| | | name = FileUtils.getRootPath(context) + File.separator |
| | | + urls[urls.length - 1]; |
| | | } |
| | | else |
| | | name = FileUtils.getRootPath(context) + File.separator |
| | | + System.currentTimeMillis() + ".apk"; |
| | | System.out.println("APK名称:" + name); |
| | | Log.i(TAG, "APK名称:" + urls[urls.length - 1]); |
| | | if (name.contains(".so")) |
| | | isSo = true; |
| | | try { |
| | | File f = dl.downLoadFile(this, name, url, context); |
| | | return f.getPath(); |
| | | } catch (Exception e) { |
| | | DownLoadFileService.j = -1; |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | // 完成网络请求 |
| | | @Override |
| | | protected void onPostExecute(String result) { |
| | | super.onPostExecute(result); |
| | | if ((!ApkUtil.checkAPP(context, apkType)) && (!isSo)) { |
| | | Intent intent = new Intent(Intent.ACTION_VIEW); |
| | | File file = new File(result); |
| | | |
| | | //判断是否是AndroidN以及更高的版本 |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
| | | intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| | | Uri contentUri = FileProvider.getUriForFile(context.getApplicationContext(), BuildConfig.APPLICATION_ID + ".fileprovider", file); |
| | | intent.setDataAndType(contentUri, "application/vnd.android.package-archive"); |
| | | } else { |
| | | Uri uri = Uri.fromFile(file); |
| | | intent.setDataAndType(uri, "application/vnd.android.package-archive"); |
| | | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | } |
| | | context.startActivity(intent); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void update(int progress) { |
| | | publishProgress(progress); |
| | | } |
| | | |
| | | public interface IProgress { |
| | | void getProgress(int p); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.downutils; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | |
| | | import android.content.Context; |
| | | |
| | | public class DownLoadFile { |
| | | public File downLoadFile(FileProgressListener listener, String filePath, |
| | | String _urlStr, Context context) throws Exception { |
| | | // 准备拼接新的文件名(保存在存储卡后的文件名) |
| | | // String newFilename = _urlStr.substring(_urlStr.lastIndexOf("/") + 1); |
| | | // UIUtils.showMiddleToast(context, "文件开始下载"); |
| | | File file = new File((filePath + "").trim()); |
| | | // 如果目标文件已经存在,则删除。产生覆盖旧文件的效果 |
| | | |
| | | // 构造URL |
| | | URL url = new URL(_urlStr); |
| | | System.out.println("下载地址:" + _urlStr); |
| | | // 打开连接 |
| | | URLConnection con = url.openConnection(); |
| | | // 获得文件的长度 |
| | | int contentLength = con.getContentLength(); |
| | | if (file.exists() && Math.abs(file.length() - contentLength) < 100) { |
| | | return file; |
| | | } else { |
| | | if (file.exists()) |
| | | file.delete(); |
| | | } |
| | | if (file.exists()) { |
| | | // file.delete(); |
| | | } else { |
| | | try { |
| | | file.createNewFile(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | System.out.println("长度 :" + contentLength); |
| | | // 输入流 |
| | | InputStream is = con.getInputStream(); |
| | | // 1K的数据缓冲 |
| | | byte[] bs = new byte[1024]; |
| | | // 读取到的数据长度 |
| | | int len; |
| | | int count = 0; |
| | | // 输出的文件流 |
| | | OutputStream os = new FileOutputStream((filePath + "").trim()); |
| | | // 开始读取 |
| | | while ((len = is.read(bs)) != -1) { |
| | | os.write(bs, 0, len); |
| | | count += len; |
| | | if (listener != null) |
| | | listener.update((int) ((float) count / contentLength * 100)); |
| | | } |
| | | // 完毕,关闭所有链接 |
| | | os.close(); |
| | | is.close(); |
| | | |
| | | return file; |
| | | } |
| | | |
| | | public interface FileProgressListener { |
| | | void update(int parent); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.downutils; |
| | | |
| | | import android.content.Context; |
| | | import android.database.Cursor; |
| | | |
| | | import com.mozillaonline.providers.DownloadManager; |
| | | import com.hanju.video.app.database.DownloadTable; |
| | | |
| | | public class DownloadUtils { |
| | | |
| | | public static String getOfflinePath(Context context, String videoId, |
| | | String videoDetailId) { |
| | | String offlinePath = null; |
| | | Cursor downloadCursor = context.getContentResolver().query( |
| | | DownloadTable.CONTENT_URI, |
| | | null, |
| | | DownloadTable.VIDEO_ID + " = ? AND " |
| | | + DownloadTable.VIDEO_DETAIL_ID + " = ? ", |
| | | new String[] { videoId, videoDetailId }, null); |
| | | if (downloadCursor.moveToFirst()) { |
| | | DownloadManager downloadManager = new DownloadManager( |
| | | context.getContentResolver(), context.getPackageName()); |
| | | downloadManager.setAccessAllDownloads(true); |
| | | DownloadManager.Query baseQuery = new DownloadManager.Query() |
| | | .setOnlyIncludeVisibleInDownloadsUi(true); |
| | | baseQuery.setFilterById(downloadCursor.getLong(downloadCursor |
| | | .getColumnIndex(DownloadTable.TASK_ID))); |
| | | Cursor c = downloadManager.query(baseQuery); |
| | | if (c.moveToFirst()) { |
| | | int status = c.getInt(c |
| | | .getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS)); |
| | | if (status == DownloadManager.STATUS_SUCCESSFUL) { |
| | | offlinePath = c |
| | | .getString(c |
| | | .getColumnIndexOrThrow(DownloadManager.COLUMN_LOCAL_URI)); |
| | | } |
| | | } |
| | | c.close(); |
| | | } |
| | | downloadCursor.close(); |
| | | return offlinePath; |
| | | } |
| | | |
| | | public static boolean isOffline(Context context, String videoId, |
| | | String videoDetailId) { |
| | | Cursor downloadCursor = context.getContentResolver().query( |
| | | DownloadTable.CONTENT_URI, |
| | | null, |
| | | DownloadTable.VIDEO_ID + " = ? AND " |
| | | + DownloadTable.VIDEO_DETAIL_ID + " = ? ", |
| | | new String[] { videoId, videoDetailId }, null); |
| | | if (downloadCursor.moveToFirst()) { |
| | | return true; |
| | | } |
| | | downloadCursor.close(); |
| | | return false; |
| | | } |
| | | |
| | | public static String getSaveDir(Context context) { |
| | | |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.downutils; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | |
| | | import com.hanju.video.app.entity.common.SDCardEntity; |
| | | import com.hanju.video.app.util.ui.SDCardUtil; |
| | | |
| | | import android.content.Context; |
| | | import android.graphics.Bitmap; |
| | | import android.os.Environment; |
| | | import android.os.StatFs; |
| | | import android.util.Log; |
| | | |
| | | public class FileUtils { |
| | | // 获取sd卡路径 |
| | | public static String getSDCardPath() { |
| | | if (Environment.getExternalStorageState().equals( |
| | | Environment.MEDIA_MOUNTED)) { |
| | | File file = new File(Environment.getExternalStorageDirectory() |
| | | .getPath()); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } else |
| | | return null; |
| | | } |
| | | |
| | | // 获取根目录 |
| | | public static String getAppRootPath(Context context) { |
| | | |
| | | if (StringUtils.isNullOrEmpty(getSDCardPath())) { |
| | | File file = null; |
| | | |
| | | SDCardEntity entity = SDCardUtil.getSDCardPath(context); |
| | | if (entity != null) |
| | | file = context.getExternalFilesDir("pptv"); |
| | | if (file == null) |
| | | return null; |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } else { |
| | | File file = context.getExternalFilesDir("pptv"); |
| | | if (file.getFreeSpace() == 0) { |
| | | SDCardEntity entity = SDCardUtil.getSDCardPath(context); |
| | | if (entity != null) |
| | | file = context.getExternalFilesDir("pptv"); |
| | | } |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | Log.i("mResult", "我的路径是:" + file.getPath()); |
| | | return file.getPath(); |
| | | } |
| | | } |
| | | |
| | | // 获取根目录 |
| | | public static String getRootPath(Context context) { |
| | | |
| | | if (StringUtils.isNullOrEmpty(getSDCardPath())) { |
| | | File file = null; |
| | | SDCardEntity entity = SDCardUtil.getSDCardPath(context); |
| | | if (entity != null) |
| | | file = new File(entity.getPath() + File.separator |
| | | + Contents.ROOT); |
| | | if (file == null) |
| | | return null; |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } else { |
| | | File file = new File(getSDCardPath() + File.separator |
| | | + Contents.ROOT); |
| | | if (file.getFreeSpace() == 0) { |
| | | SDCardEntity entity = SDCardUtil.getSDCardPath(context); |
| | | if (entity != null) |
| | | file = new File(entity.getPath() + File.separator |
| | | + Contents.ROOT); |
| | | } |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } |
| | | } |
| | | |
| | | // 获取消息缓存文件夹 |
| | | public static String getChatInfoPath(Context context) { |
| | | if (StringUtils.isNullOrEmpty(getRootPath(context))) { |
| | | return null; |
| | | } else { |
| | | File file = new File(getRootPath(context) + File.separator |
| | | + Contents.CHATINFO); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | return file.getPath(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 写文本文�?在Android系统中,文件保存�?/data/data/PACKAGE_NAME/files 目录�? |
| | | * |
| | | * @param context |
| | | */ |
| | | public static void write(Context context, String fileName, String content) { |
| | | if (content == null) |
| | | content = ""; |
| | | |
| | | try { |
| | | FileOutputStream fos = context.openFileOutput(fileName, |
| | | Context.MODE_PRIVATE); |
| | | fos.write(content.getBytes()); |
| | | |
| | | fos.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 读取文本文件 |
| | | * |
| | | * @param context |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static String read(Context context, String fileName) { |
| | | try { |
| | | FileInputStream in = context.openFileInput(fileName); |
| | | return readInStream(in); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | private static String readInStream(FileInputStream inStream) { |
| | | try { |
| | | ByteArrayOutputStream outStream = new ByteArrayOutputStream(); |
| | | byte[] buffer = new byte[512]; |
| | | int length = -1; |
| | | while ((length = inStream.read(buffer)) != -1) { |
| | | outStream.write(buffer, 0, length); |
| | | } |
| | | |
| | | outStream.close(); |
| | | inStream.close(); |
| | | return outStream.toString(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static File createFile(String folderPath, String fileName) { |
| | | File destDir = new File(folderPath); |
| | | if (!destDir.exists()) { |
| | | destDir.mkdirs(); |
| | | } |
| | | return new File(folderPath, fileName + fileName); |
| | | } |
| | | |
| | | public static void copyFile(InputStream in, File file) { |
| | | |
| | | if (!file.exists()) { |
| | | try { |
| | | file.createNewFile(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | if (file.exists()) { |
| | | try { |
| | | FileOutputStream os = new FileOutputStream(file); |
| | | |
| | | byte[] b = new byte[1024]; |
| | | |
| | | int len = -1; |
| | | |
| | | while ((len = in.read(b)) != -1) { |
| | | os.write(b, 0, len); |
| | | } |
| | | |
| | | in.close(); |
| | | os.close(); |
| | | |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 向手机写图片 |
| | | * |
| | | * @param buffer |
| | | * @param folder |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static boolean writeFile(byte[] buffer, String folder, |
| | | String fileName) { |
| | | boolean writeSucc = false; |
| | | |
| | | boolean sdCardExist = Environment.getExternalStorageState().equals( |
| | | android.os.Environment.MEDIA_MOUNTED); |
| | | |
| | | String folderPath = ""; |
| | | if (sdCardExist) { |
| | | folderPath = Environment.getExternalStorageDirectory() |
| | | + File.separator + folder + File.separator; |
| | | } else { |
| | | writeSucc = false; |
| | | } |
| | | |
| | | File fileDir = new File(folderPath); |
| | | if (!fileDir.exists()) { |
| | | fileDir.mkdirs(); |
| | | } |
| | | |
| | | File file = new File(folderPath + fileName); |
| | | FileOutputStream out = null; |
| | | try { |
| | | out = new FileOutputStream(file); |
| | | out.write(buffer); |
| | | writeSucc = true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | out.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | return writeSucc; |
| | | } |
| | | |
| | | /** |
| | | * 根据文件绝对路径获取文件名 |
| | | * |
| | | * @param filePath |
| | | * @return |
| | | */ |
| | | public static String getFileName(String filePath) { |
| | | if (StringUtils.isNullOrEmpty(filePath)) |
| | | return ""; |
| | | return filePath.substring(filePath.lastIndexOf(File.separator) + 1); |
| | | } |
| | | |
| | | /** |
| | | * 根据文件的绝对路径获取文件名但不包含扩展名 |
| | | * |
| | | * @param filePath |
| | | * @return |
| | | */ |
| | | public static String getFileNameNoFormat(String filePath) { |
| | | if (StringUtils.isNullOrEmpty(filePath)) { |
| | | return ""; |
| | | } |
| | | int point = filePath.lastIndexOf('.'); |
| | | return filePath.substring(filePath.lastIndexOf(File.separator) + 1, |
| | | point); |
| | | } |
| | | |
| | | /** |
| | | * 获取文件扩展名 |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static String getFileFormat(String fileName) { |
| | | if (StringUtils.isNullOrEmpty(fileName)) |
| | | return ""; |
| | | |
| | | int point = fileName.lastIndexOf('.'); |
| | | return fileName.substring(point + 1); |
| | | } |
| | | |
| | | /** |
| | | * 获取文件大小 |
| | | * |
| | | * @param filePath |
| | | * @return |
| | | */ |
| | | public static long getFileSize(String filePath) { |
| | | long size = 0; |
| | | |
| | | File file = new File(filePath); |
| | | if (file != null && file.exists()) { |
| | | size = file.length(); |
| | | } |
| | | return size; |
| | | } |
| | | |
| | | /** |
| | | * 获取文件大小 |
| | | * |
| | | * @param size 字节 |
| | | * @return |
| | | */ |
| | | public static String getFileSize(long size) { |
| | | if (size <= 0) |
| | | return "0"; |
| | | java.text.DecimalFormat df = new java.text.DecimalFormat("##.##"); |
| | | float temp = (float) size / 1024; |
| | | if (temp >= 1024) { |
| | | return df.format(temp / 1024) + "M"; |
| | | } else { |
| | | return df.format(temp) + "K"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换文件大小 |
| | | * |
| | | * @param fileS |
| | | * @return B/KB/MB/GB |
| | | */ |
| | | public static String formatFileSize(long fileS) { |
| | | java.text.DecimalFormat df = new java.text.DecimalFormat("#.00"); |
| | | String fileSizeString = ""; |
| | | if (fileS < 1024) { |
| | | fileSizeString = df.format((double) fileS) + "B"; |
| | | } else if (fileS < 1048576) { |
| | | fileSizeString = df.format((double) fileS / 1024) + "KB"; |
| | | } else if (fileS < 1073741824) { |
| | | fileSizeString = df.format((double) fileS / 1048576) + "MB"; |
| | | } else { |
| | | fileSizeString = df.format((double) fileS / 1073741824) + "G"; |
| | | } |
| | | return fileSizeString; |
| | | } |
| | | |
| | | /** |
| | | * 获取目录文件大小 |
| | | * |
| | | * @param dir |
| | | * @return |
| | | */ |
| | | public static long getDirSize(File dir) { |
| | | if (dir == null) { |
| | | return 0; |
| | | } |
| | | if (!dir.isDirectory()) { |
| | | return 0; |
| | | } |
| | | long dirSize = 0; |
| | | File[] files = dir.listFiles(); |
| | | for (File file : files) { |
| | | if (file.isFile()) { |
| | | dirSize += file.length(); |
| | | } else if (file.isDirectory()) { |
| | | dirSize += file.length(); |
| | | dirSize += getDirSize(file); // 递归调用继续统计 |
| | | } |
| | | } |
| | | return dirSize; |
| | | } |
| | | |
| | | /** |
| | | * 获取目录文件个数 |
| | | * |
| | | * @return |
| | | */ |
| | | public long getFileList(File dir) { |
| | | long count = 0; |
| | | File[] files = dir.listFiles(); |
| | | count = files.length; |
| | | for (File file : files) { |
| | | if (file.isDirectory()) { |
| | | count = count + getFileList(file);// 递归 |
| | | count--; |
| | | } |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | public static byte[] toBytes(InputStream in) throws IOException { |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | int ch; |
| | | while ((ch = in.read()) != -1) { |
| | | out.write(ch); |
| | | } |
| | | byte[] buffer = out.toByteArray(); |
| | | out.close(); |
| | | return buffer; |
| | | } |
| | | |
| | | /** |
| | | * �?��文件是否存在 |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public static boolean checkFileExists(String name) { |
| | | boolean status; |
| | | if (!name.equals("")) { |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | File newPath = new File(path.toString() + name); |
| | | status = newPath.exists(); |
| | | } else { |
| | | status = false; |
| | | } |
| | | return status; |
| | | } |
| | | |
| | | public static boolean existFile(String path) { |
| | | |
| | | File file = new File(path); |
| | | |
| | | return file.isFile() && file.exists(); |
| | | } |
| | | |
| | | /** |
| | | * 计算SD卡的剩余空间 |
| | | * |
| | | * @return 返回-1,说明没有安装sd�? |
| | | */ |
| | | public static long getFreeDiskSpace() { |
| | | String status = Environment.getExternalStorageState(); |
| | | long freeSpace = 0; |
| | | if (status.equals(Environment.MEDIA_MOUNTED)) { |
| | | try { |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | StatFs stat = new StatFs(path.getPath()); |
| | | long blockSize = stat.getBlockSize(); |
| | | long availableBlocks = stat.getAvailableBlocks(); |
| | | freeSpace = availableBlocks * blockSize / 1024; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | return -1; |
| | | } |
| | | return (freeSpace); |
| | | } |
| | | |
| | | /** |
| | | * 新建目录 |
| | | * |
| | | * @param directoryName |
| | | * @return |
| | | */ |
| | | public static boolean createDirectory(String directoryName) { |
| | | boolean status; |
| | | if (!directoryName.equals("")) { |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | File newPath = new File(path.toString() + directoryName); |
| | | status = newPath.mkdir(); |
| | | status = true; |
| | | } else |
| | | status = false; |
| | | return status; |
| | | } |
| | | |
| | | /** |
| | | * �?��是否安装SD�? |
| | | * |
| | | * @return |
| | | */ |
| | | public static boolean checkSaveLocationExists() { |
| | | String sDCardStatus = Environment.getExternalStorageState(); |
| | | boolean status; |
| | | status = sDCardStatus.equals(Environment.MEDIA_MOUNTED); |
| | | return status; |
| | | } |
| | | |
| | | /** |
| | | * 删除目录(包括:目录里的所有文�? |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static boolean deleteDirectory(String fileName) { |
| | | boolean status; |
| | | SecurityManager checker = new SecurityManager(); |
| | | |
| | | if (!fileName.equals("")) { |
| | | |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | File newPath = new File(path.toString() + fileName); |
| | | checker.checkDelete(newPath.toString()); |
| | | if (newPath.isDirectory()) { |
| | | String[] listfile = newPath.list(); |
| | | // delete all files within the specified directory and then |
| | | // delete the directory |
| | | try { |
| | | for (int i = 0; i < listfile.length; i++) { |
| | | File deletedFile = new File(newPath.toString() + "/" |
| | | + listfile[i]); |
| | | deletedFile.delete(); |
| | | } |
| | | newPath.delete(); |
| | | |
| | | status = true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | status = false; |
| | | } |
| | | |
| | | } else |
| | | status = false; |
| | | } else |
| | | status = false; |
| | | return status; |
| | | } |
| | | |
| | | /** |
| | | * 删除文件 |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static boolean deleteFile(String fileName) { |
| | | boolean status; |
| | | SecurityManager checker = new SecurityManager(); |
| | | |
| | | if (!fileName.equals("")) { |
| | | |
| | | File path = Environment.getExternalStorageDirectory(); |
| | | File newPath = new File(path.toString() + fileName); |
| | | checker.checkDelete(newPath.toString()); |
| | | if (newPath.isFile()) { |
| | | try { |
| | | |
| | | newPath.delete(); |
| | | status = true; |
| | | } catch (SecurityException se) { |
| | | se.printStackTrace(); |
| | | status = false; |
| | | } |
| | | } else |
| | | status = false; |
| | | } else |
| | | status = false; |
| | | return status; |
| | | } |
| | | |
| | | public static final String getTempFilePath(Context context) { |
| | | |
| | | return context.getCacheDir() + File.separator + "temp"; |
| | | |
| | | } |
| | | |
| | | public static String getSDPath() { |
| | | File sdDir = null; |
| | | boolean sdCardExist = Environment.getExternalStorageState().equals( |
| | | Environment.MEDIA_MOUNTED); // 判断sd卡是否存�? |
| | | if (sdCardExist) { |
| | | sdDir = Environment.getExternalStorageDirectory();// 获取跟目�? |
| | | } |
| | | return sdDir.getPath(); |
| | | } |
| | | |
| | | // 将图片保存到指定的路径 |
| | | public static String savePic(String filePath, String name, Bitmap bitmap) { |
| | | File file = new File(filePath); |
| | | if (!file.exists()) |
| | | file.mkdirs(); |
| | | |
| | | File f = new File(filePath + File.separator + name); |
| | | try { |
| | | f.createNewFile(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FileOutputStream fOut = null; |
| | | try { |
| | | fOut = new FileOutputStream(f); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); |
| | | try { |
| | | fOut.flush(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | fOut.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return f.getPath(); |
| | | } |
| | | |
| | | // 将图片保存到指定的路径 |
| | | public static String savePic(String filePath, Bitmap bitmap) { |
| | | File f = new File(filePath); |
| | | try { |
| | | f.createNewFile(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FileOutputStream fOut = null; |
| | | try { |
| | | fOut = new FileOutputStream(f); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); |
| | | try { |
| | | fOut.flush(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | fOut.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return f.getPath(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.downutils; |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.text.DecimalFormat; |
| | | import java.util.List; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import android.content.Context; |
| | | import android.os.Build; |
| | | import android.telephony.TelephonyManager; |
| | | import android.text.Spannable; |
| | | import android.text.SpannableStringBuilder; |
| | | import android.text.style.ForegroundColorSpan; |
| | | import android.text.style.RelativeSizeSpan; |
| | | import android.widget.TextView; |
| | | |
| | | public class StringUtils { |
| | | |
| | | public static boolean isInt(String text) { |
| | | if (text == null || text.length() == 0) { |
| | | return false; |
| | | } |
| | | try { |
| | | Integer.parseInt(text); |
| | | return true; |
| | | } catch (Exception e) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public static final String[] imageEndWiths = new String[] { ".jpg", ".gif", |
| | | ".png", ".bmp" }; |
| | | |
| | | public static boolean isEmail(String email) { |
| | | String regex = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"; |
| | | Pattern p = Pattern.compile(regex); |
| | | Matcher m = p.matcher(email); |
| | | return m.find(); |
| | | } |
| | | |
| | | /** |
| | | * 是否是正确的电话号码 |
| | | * |
| | | * @param mobile |
| | | * @return |
| | | */ |
| | | public static boolean isMobile(String mobile) { |
| | | |
| | | String regex = "^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$"; |
| | | Pattern p = Pattern.compile(regex); |
| | | Matcher m = p.matcher(mobile); |
| | | |
| | | if (mobile == null || mobile.equals("") || mobile.length() != 11) { |
| | | |
| | | return false; |
| | | |
| | | } else { |
| | | return m.find(); |
| | | } |
| | | } |
| | | |
| | | public static boolean isVoice(String text) { |
| | | |
| | | return text.toLowerCase().endsWith(".amr"); |
| | | |
| | | } |
| | | |
| | | public static boolean isImage(String text) { |
| | | text = text.toLowerCase(); |
| | | for (int i = 0; i < imageEndWiths.length; i++) { |
| | | String endWidth = imageEndWiths[i]; |
| | | if (text.endsWith(endWidth)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public static String createNewFileName(String fileName) { |
| | | |
| | | int i = fileName.lastIndexOf("."); |
| | | |
| | | String end = fileName.substring(i); |
| | | |
| | | return System.currentTimeMillis() + end; |
| | | |
| | | } |
| | | |
| | | public static boolean isTrimEmpty(String text) { |
| | | return text == null || text.trim().length() == 0; |
| | | } |
| | | |
| | | public static boolean isNullOrEmpty(String text) { |
| | | return text == null || text.length() == 0 || text.equals("null"); |
| | | } |
| | | |
| | | public static String itrim(String beginTimeDis) { |
| | | if (beginTimeDis != null) { |
| | | int length = beginTimeDis.length(); |
| | | StringBuffer buffer = new StringBuffer(); |
| | | for (int i = 0; i < length; i++) { |
| | | char c = beginTimeDis.charAt(i); |
| | | if (c != ':') { |
| | | buffer.append(c); |
| | | } else { |
| | | buffer.append(":"); |
| | | } |
| | | } |
| | | return buffer.toString(); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | public static String getLocationDis(double distance) { |
| | | if (distance < 0) { |
| | | return "0m"; |
| | | } else if (distance < 100) { |
| | | int d = (int) distance; |
| | | return d + "m"; |
| | | } else { |
| | | String desc = ""; |
| | | |
| | | double f = distance / 1000d; |
| | | |
| | | DecimalFormat df = new DecimalFormat("#.###"); |
| | | |
| | | desc = df.format(f); |
| | | |
| | | return desc + "km"; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | public static int toInt(String nextText, int i) { |
| | | try { |
| | | int value = Integer.parseInt(nextText); |
| | | return value; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | | * 身份证验�? |
| | | * |
| | | * @param card |
| | | * @return |
| | | */ |
| | | public static boolean isIdCard(String card) { |
| | | Pattern p = Pattern.compile("^(\\d{14}|\\d{17})(\\d|[xX])$"); |
| | | Matcher matcher = p.matcher(card); |
| | | return matcher.matches(); |
| | | } |
| | | |
| | | public static boolean isCharecter(String str) { |
| | | String regEx = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#�?…�?&*()—�?+|{}【�?‘;:�?“�?。,、?]"; |
| | | Pattern p = Pattern.compile(regEx); |
| | | Matcher m = p.matcher(str); |
| | | return m.find(); |
| | | } |
| | | |
| | | private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', |
| | | '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; |
| | | |
| | | private static String toHexString(byte[] b) { |
| | | // String to byte |
| | | StringBuilder sb = new StringBuilder(b.length * 2); |
| | | for (int i = 0; i < b.length; i++) { |
| | | sb.append(HEX_DIGITS[(b[i] & 0xf0) >>> 4]); |
| | | sb.append(HEX_DIGITS[b[i] & 0x0f]); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /* |
| | | * MD5加密 |
| | | */ |
| | | public static String MD5(String s) { |
| | | try { |
| | | // Create MD5 Hash |
| | | MessageDigest digest = java.security.MessageDigest |
| | | .getInstance("MD5"); |
| | | digest.update(s.getBytes()); |
| | | byte[] messageDigest = digest.digest(); |
| | | |
| | | return toHexString(messageDigest); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return ""; |
| | | } |
| | | |
| | | public static String getSimpleString(String st) { |
| | | if (isNullOrEmpty(st)) { |
| | | return "暂无"; |
| | | } |
| | | return st; |
| | | } |
| | | |
| | | // 判断List是否为空 |
| | | |
| | | public static boolean listIsNullOrEmpty(List<String> list) { |
| | | return list == null || list.size() == 0; |
| | | } |
| | | |
| | | // 获取手机型号 |
| | | public static String PeopleModel() { |
| | | Build bd = new Build(); |
| | | String model = Build.MODEL; |
| | | return model; |
| | | } |
| | | |
| | | public static String PeopleDeviceId(Context context) { |
| | | TelephonyManager tm = (TelephonyManager) context |
| | | .getSystemService(Context.TELEPHONY_SERVICE); |
| | | String deviceid = tm.getDeviceId(); |
| | | return deviceid; |
| | | } |
| | | |
| | | public static void getdiffrentColor(TextView tv, int color, int start, |
| | | int end) { |
| | | SpannableStringBuilder style = new SpannableStringBuilder(tv.getText()); |
| | | ForegroundColorSpan redSpan = new ForegroundColorSpan(color); |
| | | style.setSpan(redSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | tv.setText(style); |
| | | } |
| | | |
| | | public static void getdiffrentColor(TextView tv, int color, int size, |
| | | int start, int end) { |
| | | SpannableStringBuilder style = new SpannableStringBuilder(tv.getText()); |
| | | ForegroundColorSpan redSpan = new ForegroundColorSpan(color); |
| | | style.setSpan(redSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | RelativeSizeSpan sizeSpan = new RelativeSizeSpan(size); |
| | | style.setSpan(sizeSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | tv.setText(style); |
| | | } |
| | | |
| | | public static String get2Number(int number) { |
| | | if (number >= 0 && number < 10) |
| | | return "0" + number; |
| | | else |
| | | return number + ""; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.http; |
| | | |
| | | import com.hanju.lib.library.util.security.DEScrypt; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import okhttp3.Call; |
| | | import okhttp3.Callback; |
| | | import okhttp3.Response; |
| | | |
| | | public abstract class BasicTextHttpResponseCallback implements Callback { |
| | | |
| | | private static final String TAG = "BasicTextHttpResponseHandler"; |
| | | |
| | | public abstract void onSuccessPerfect(int statusCode, Header[] headers, |
| | | JSONObject jsonObject) throws Exception; |
| | | |
| | | public void onResponse(Call var1, Response var2) throws IOException { |
| | | try { |
| | | if (var2.isSuccessful()) { |
| | | String responseString=var2.body().string(); |
| | | responseString = DEScrypt.decode(responseString); |
| | | JSONObject jsonObject = new JSONObject(responseString); |
| | | onSuccessPerfect(var2.code(), null, jsonObject); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(Call call, IOException e) { |
| | | |
| | | } |
| | | // @Override |
| | | // public void onSuccess(int statusCode, Header[] headers, |
| | | // String responseString) { |
| | | // try { |
| | | // responseString = DEScrypt.decode(responseString); |
| | | // JSONObject jsonObject = new JSONObject(responseString); |
| | | // onSuccessPerfect(statusCode, headers, jsonObject); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void onFailure(int statusCode, Header[] headers, |
| | | // String responseString, Throwable throwable) { |
| | | // responseString = DEScrypt.decode(responseString); |
| | | // } |
| | | // |
| | | // private String toHeadersString(Header[] headers) { |
| | | // StringBuilder builder = new StringBuilder(); |
| | | // if (headers != null) { |
| | | // for (Header header : headers) { |
| | | // builder.append(header.toString() + ";"); |
| | | // } |
| | | // } |
| | | // return builder.toString(); |
| | | // } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.http; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import com.hanju.lib.library.util.security.DEScrypt; |
| | | import com.loopj.android.http.TextHttpResponseHandler; |
| | | |
| | | public abstract class BasicTextHttpResponseHandler extends |
| | | TextHttpResponseHandler { |
| | | |
| | | private static final String TAG = "BasicTextHttpResponseHandler"; |
| | | |
| | | public abstract void onSuccessPerfect(int statusCode, Header[] headers, |
| | | JSONObject jsonObject) throws Exception; |
| | | |
| | | @Override |
| | | public void onSuccess(int statusCode, Header[] headers, |
| | | String responseString) { |
| | | try { |
| | | responseString = DEScrypt.decode(responseString); |
| | | JSONObject jsonObject = new JSONObject(responseString); |
| | | onSuccessPerfect(statusCode, headers, jsonObject); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | onFailure(statusCode, headers, responseString, new Exception("json解析出错")); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, |
| | | String responseString, Throwable throwable) { |
| | | responseString = DEScrypt.decode(responseString); |
| | | } |
| | | |
| | | private String toHeadersString(Header[] headers) { |
| | | StringBuilder builder = new StringBuilder(); |
| | | if (headers != null) { |
| | | for (Header header : headers) { |
| | | builder.append(header.toString() + ";"); |
| | | } |
| | | } |
| | | return builder.toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.http; |
| | | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | import android.util.Log; |
| | | import android.widget.Toast; |
| | | |
| | | import com.hanju.video.app.BuildConfig; |
| | | import com.hanju.video.app.HanJuApplication; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.hanju.lib.library.util.common.PackageUtils2; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.security.MD5Utils; |
| | | import com.loopj.android.http.AsyncHttpClient; |
| | | import com.loopj.android.http.RequestParams; |
| | | import com.loopj.android.http.ResponseHandlerInterface; |
| | | import com.loopj.android.http.SyncHttpClient; |
| | | import com.ut.device.UTDevice; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map.Entry; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import okhttp3.Call; |
| | | import okhttp3.Callback; |
| | | import okhttp3.FormBody; |
| | | import okhttp3.MediaType; |
| | | import okhttp3.OkHttpClient; |
| | | import okhttp3.Request; |
| | | import okhttp3.RequestBody; |
| | | |
| | | public class HttpApiUtil { |
| | | |
| | | public static final boolean isDebug = false; |
| | | |
| | | private static final String TAG = "HttpApiUtil"; |
| | | |
| | | public static String ERROR_NOTICE = ""; |
| | | |
| | | public static String BASE_URL = HanJuConstant.HOST + "/BuWan/api/"; |
| | | |
| | | public static String BASE_URL_V2 = HanJuConstant.HOST + "/BuWan/api/v2/"; |
| | | |
| | | public static String BASE_URL_V3 = HanJuConstant.HOST + "/BuWan/api/v3/"; |
| | | |
| | | private static AsyncHttpClient asyncHttpClient = new AsyncHttpClient(); |
| | | |
| | | private static SyncHttpClient syncHttpClient = new SyncHttpClient(); |
| | | |
| | | private static AsyncHttpClient sortTimeAsyncHttpClient = new AsyncHttpClient(); |
| | | |
| | | static { |
| | | |
| | | mOkHttpClient = new OkHttpClient().newBuilder() |
| | | .connectTimeout(10 * 1000, TimeUnit.SECONDS)//设置超时时间 |
| | | .readTimeout(10 * 1000, TimeUnit.SECONDS)//设置读取超时时间 |
| | | .writeTimeout(10 * 1000, TimeUnit.SECONDS)//设置写入超时时间 |
| | | .build(); |
| | | asyncHttpClient.setTimeout(60 * 1000); |
| | | syncHttpClient.setTimeout(60 * 1000); |
| | | //5s |
| | | sortTimeAsyncHttpClient.setTimeout(5 * 1000); |
| | | |
| | | asyncHttpClient.setURLEncodingEnabled(false); |
| | | syncHttpClient.setURLEncodingEnabled(false); |
| | | sortTimeAsyncHttpClient.setURLEncodingEnabled(false); |
| | | } |
| | | |
| | | public static void getUid(Context context, String channel, String device, |
| | | String imei, String mac, String lat, String lng, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Device", device); |
| | | params.put("Imei", imei); |
| | | params.put("Mac", mac); |
| | | params.put("Lat", lat); |
| | | params.put("Lng", lng); |
| | | params.put("Channel", channel); |
| | | if (!StringUtils.isBlank(HanJuApplication.deviceNumber)) { |
| | | params.put("DeviceName", HanJuApplication.deviceName); |
| | | params.put("DeviceNumber", HanJuApplication.deviceNumber); |
| | | } |
| | | commonPost(context, BASE_URL + "user/getUid", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取配置信息 |
| | | * |
| | | * @param context |
| | | * @param handler |
| | | */ |
| | | public static void getConfig(Context context, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | if (!StringUtils.isBlank(HanJuApplication.deviceNumber)) { |
| | | params.put("DeviceName", HanJuApplication.deviceName); |
| | | params.put("DeviceNumber", HanJuApplication.deviceNumber); |
| | | } |
| | | commonPost(context, BASE_URL + "config/getConfig", params, null, handler, true, true); |
| | | } |
| | | |
| | | /** |
| | | * 获取推荐页面右面广告状态 |
| | | * |
| | | * @param context |
| | | * @param handler |
| | | */ |
| | | public static void getAdRecommendRight(Context context, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | commonPost(context, BASE_URL + "other/adRecommendRight", params, handler); |
| | | } |
| | | |
| | | public static void suggestSearch(Context context, String uid, String key, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Key", key); |
| | | commonPost(context, BASE_URL + "user/suggestSearch", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 用户登录 |
| | | * |
| | | * @param context |
| | | * @param uid 用户uid |
| | | * @param name 用户名称 |
| | | * @param openId 用户第三方登录唯一识别码 |
| | | * @param portrait 头像 |
| | | * @param sex 性别 |
| | | * @param loginType 登录类型:1 QQ |
| | | * @param handler |
| | | */ |
| | | public static void userLogin(Context context, String uid, String name, |
| | | String openId, String portrait, String sex, String province, String city, String loginType, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Name", name); |
| | | params.put("OpenId", openId); |
| | | params.put("Portrait", portrait); |
| | | params.put("Province", province); |
| | | params.put("City", city); |
| | | params.put("Sex", sex); |
| | | params.put("LoginType", loginType); |
| | | commonPost(context, BASE_URL + "comment/userLogin", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信登录 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param code |
| | | * @param handler |
| | | */ |
| | | public static void wxLogin(Context context, String uid, String code, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Code", code); |
| | | commonPost(context, BASE_URL + "comment/wxLogin", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 获取专题列表 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param page 分页数 |
| | | * @param handler |
| | | */ |
| | | public static void getSpecialList(Context context, String uid, String page, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Page", page); |
| | | commonPost(context, BASE_URL + "class/getSpecialList", params, handler); |
| | | } |
| | | |
| | | public static void search(Context context, String uid, String key, |
| | | String contentType, String page, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Key", key); |
| | | params.put("Type", contentType); |
| | | params.put("Page", page); |
| | | commonPost(context, BASE_URL + "user/searchNew", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 获取商品详情 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void getWareDetail(Context context, String uid, String id, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Id", id); |
| | | commonPost(context, BASE_URL + "shop/getGoodsItemDetail", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 获取商品评论列表 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void getWareCommentList(Context context, String uid, String id, String page, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Id", id); |
| | | params.put("Page", page); |
| | | commonPost(context, BASE_URL + "shop/getCommentList", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 发表评论 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void addComment(Context context, String uid, String id, String loginID, String content, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Id", id); |
| | | params.put("LoginUid", loginID); |
| | | params.put("Content", content); |
| | | commonPost(context, BASE_URL + "shop/addComment", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 添加收藏 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void addGoodsFavourite(Context context, String uid, String loginUid, String id, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Id", id); |
| | | params.put("LoginUid", loginUid); |
| | | commonPost(context, BASE_URL + "shop/addCollect", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 取消收藏 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void cancelGoodsFavourite(Context context, String uid, String loginUid, String id, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Id", id); |
| | | params.put("LoginUid", loginUid); |
| | | commonPost(context, BASE_URL + "shop/cancelCollect", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 淘宝客收藏列表 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void getCollectList(Context context, String uid, String loginUid, String page, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("LoginUid", loginUid); |
| | | params.put("Page", page); |
| | | commonPost(context, BASE_URL + "shop/getCollectList", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * Email登录 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void emailLogin(Context context, String uid, String name, |
| | | String pwd, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Email", name); |
| | | params.put("Pwd", pwd); |
| | | commonPost(context, BASE_URL + "user/login", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 获取验证码 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void getVerficationCode(Context context, String uid, String name, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Email", name); |
| | | commonPost(context, BASE_URL + "user/sendVerifyCode", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * Email注册 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param name |
| | | * @param handler |
| | | */ |
| | | public static void emailRegister(Context context, String uid, String email, String pwd, String verficationCode, String name, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Email", email); |
| | | params.put("Pwd", pwd); |
| | | params.put("VerifyCode", verficationCode); |
| | | params.put("NickName", name); |
| | | commonPost(context, BASE_URL + "user/register", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 获取个人信息 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void getPersonInfo(Context context, String uid, String loginUid, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("LoginUid", loginUid); |
| | | commonPost(context, BASE_URL + "user/getLoginUserInfo", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 上传个人信息 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void upLoadPersonInfo(Context context, String uid, String loginUid, String sex, String birthday, |
| | | String personSign, String portrait, String nickName, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("LoginUid", loginUid); |
| | | params.put("Sex", sex); |
| | | params.put("BirthDay", birthday); |
| | | params.put("PersonalSign", personSign); |
| | | params.put("Portrait", portrait); |
| | | params.put("NickName", nickName); |
| | | commonPost(context, BASE_URL + "user/updateLoginUserInfo", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 修改密码 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void revisePwd(Context context, String uid, String email, String verfycode, String pwd, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Email", email); |
| | | params.put("Pwd", pwd); |
| | | params.put("VerifyCode", verfycode); |
| | | commonPost(context, BASE_URL + "user/setPwd", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 美女直播热门 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void getLiveCategoryList(Context context, String uid, String id, String page, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Type", id); |
| | | params.put("Page", page); |
| | | commonPost(context, BASE_URL + "zhibo/getLiveListByType", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void sendLiveClick(Context context, String uid, String type, String roomid, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Type", type); |
| | | params.put("RoomId", roomid); |
| | | commonPost(context, BASE_URL + "zhibo/addStatistics", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 广告点击上报 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void reportCommonAd(Context context, String uid, String pId, String adId, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Pid", pId); |
| | | params.put("AdId", adId); |
| | | params.put("Type", "3"); |
| | | commonPost(context, BASE_URL + "ad/reportCommonAd", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void getHotSearch(Context context, String uid, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | commonPost(context, BASE_URL + "user/getHotSearch", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取我是否拥有新消息 |
| | | */ |
| | | public static void getReadState(Context context, String uid, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | commonPost(context, BASE_URL + "comment/getReadState", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 首页猜你喜欢 |
| | | * |
| | | * @param context |
| | | * @param page |
| | | * @param handler |
| | | */ |
| | | public static void getGuessLike(Context context, String page, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Page", page); |
| | | commonPost(context, BASE_URL + "found/guessLike", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 相关视频 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param videoId |
| | | * @param handler |
| | | */ |
| | | public static void getRelativeVideos(Context context, String uid, |
| | | String videoId, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("VideoId", videoId); |
| | | params.put("Uid", uid); |
| | | commonPost(context, BASE_URL + "user/getRelativeVideos", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 猜你喜欢 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param videoId |
| | | * @param handler |
| | | */ |
| | | public static void guessLike(Context context, String uid, String videoId, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("VideoId", videoId); |
| | | params.put("Uid", uid); |
| | | commonPost(context, BASE_URL + "user/guessLike", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void getCollectedVideo(Context context, String uid, String loginUid, |
| | | String page, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("LoginUid", loginUid); |
| | | params.put("Page", page); |
| | | commonPost(context, BASE_URL + "user/getCollectedVideo", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void getScoreOpen(Context context, String uid, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | commonPost(context, BASE_URL + "user/getScoreOpen", params, handler); |
| | | } |
| | | |
| | | public static void getScoreWatch(Context context, String uid, |
| | | String videoDetailId, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("VideoDetailId", videoDetailId); |
| | | commonPost(context, BASE_URL + "user/getScoreWatch", params, handler); |
| | | } |
| | | |
| | | public static void getScoreSave(Context context, String uid, |
| | | String videoDetailId, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("VideoDetailId", videoDetailId); |
| | | commonPost(context, BASE_URL + "user/getScoreSave", params, handler); |
| | | } |
| | | |
| | | public static void getScoreCollect(Context context, String uid, String LoginUid, |
| | | String videoId, String thirdType, String type, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("LoginUid", LoginUid); |
| | | params.put("VideoId", videoId); |
| | | params.put("ThirdType", thirdType); |
| | | params.put("Type", type); |
| | | commonPost(context, BASE_URL + "user/getScoreCollect", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void getHomeAd(Context context, String uid, String vtid, String dataKey, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Method", "getHomeAd"); |
| | | params.put("Uid", uid); |
| | | params.put("Vtid", vtid); |
| | | if (dataKey != null) { |
| | | params.put("DataKey", dataKey); |
| | | } |
| | | commonPost(context, BASE_URL_V2 + "recommend", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void getRecommendSearchSpecial(Context context, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | String uid = UserUtil.getUid(context); |
| | | params.put("Method", "getRecommendSearchSpecial"); |
| | | if (uid != null) |
| | | params.put("Uid", uid); |
| | | commonPost(context, BASE_URL_V2 + "recommend", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 获取搜索专题视频 |
| | | * |
| | | * @param context |
| | | * @param id |
| | | * @param handler |
| | | */ |
| | | public static void getSearchSpecialVideos(Context context, String id, int page, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | String uid = UserUtil.getUid(context); |
| | | params.put("Method", "getSpecialVideo"); |
| | | params.put("key", id); |
| | | params.put("page", page + ""); |
| | | if (uid != null) |
| | | params.put("Uid", uid); |
| | | commonPost(context, BASE_URL_V2 + "search", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加关注 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void addAttention(Context context, String uid, String loginId, String videoId, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("LoginUid", loginId); |
| | | params.put("VideoId", videoId); |
| | | commonPost(context, BASE_URL + "attention/addAttention", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 取消关注 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void cancelAttention(Context context, String uid, String loginId, String videoId, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("LoginUid", loginId); |
| | | params.put("VideoId", videoId); |
| | | commonPost(context, BASE_URL + "attention/cancelAttention", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取关注列表 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param loginId |
| | | * @param page |
| | | * @param handler |
| | | */ |
| | | public static void getAttentionList(Context context, String uid, String loginId, String page, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("LoginUid", loginId); |
| | | params.put("Page", page); |
| | | commonPost(context, BASE_URL + "attention/getAttentionList", params, handler); |
| | | } |
| | | |
| | | public static void getCategoryBanner(Context context, String uid, String cateId, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Type", cateId); |
| | | commonPost(context, BASE_URL + "class/getRecommendCategoryVideoBanner", params, handler); |
| | | } |
| | | |
| | | public static void getHomeType(Context context, String uid, String vtid, String dataKey, int page, int pageSize, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Method", "getHomeTypeNew"); |
| | | params.put("Uid", uid); |
| | | params.put("Vtid", vtid); |
| | | params.put("Page", page + ""); |
| | | params.put("PageSize", pageSize + ""); |
| | | if (dataKey != null) { |
| | | params.put("DataKey", dataKey); |
| | | } |
| | | commonPost(context, BASE_URL_V2 + "recommend", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void getMoreVideo(Context context, String uid, String type, |
| | | String page, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Type", type); |
| | | params.put("Page", page); |
| | | commonPost(context, BASE_URL + "recommend/getMoreVideo", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 主页分类 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void getClass(Context context, String uid, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | commonPost(context, BASE_URL + "class/getNewClass", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 精选分类 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void getChoiceClass(Context context, String uid, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Method", "getHomeClass"); |
| | | params.put("Uid", uid); |
| | | commonPost(context, BASE_URL_V2 + "class", params, handler); |
| | | } |
| | | |
| | | public static void getHotStars(Context context, String uid, String page, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Page", page); |
| | | commonPost(context, BASE_URL + "class/getHotStars", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 发现页明星合辑 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void getRecommendStars(Context context, String uid, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | commonPost(context, BASE_URL + "found/getHotStarMainList", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void getHotStarsVideo(Context context, String uid, |
| | | String starId, String page, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("StarId", starId); |
| | | params.put("Page", page); |
| | | commonPost(context, BASE_URL + "class/getHotStarsVideo", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 获取真实播放路劲 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void getPlayUrl(Context context, String uid, String type, String videoId, |
| | | String vid, String resourceId, String eId, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Type", type); |
| | | params.put("VideoId", videoId); |
| | | params.put("Id", vid); |
| | | params.put("EId", eId); |
| | | params.put("ResourceId", resourceId); |
| | | commonPost(context, BASE_URL + "recommend/getPlayUrl", params, handler); |
| | | } |
| | | |
| | | public static void getVideoList(Context context, String uid, String starId, |
| | | String homeType, String videoType, String page, |
| | | String category_two, String categoryType, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("StarId", starId); |
| | | params.put("HomeType", homeType); |
| | | params.put("VideoType", videoType); |
| | | params.put("Page", page); |
| | | params.put("Order", category_two); |
| | | params.put("CategoryType", categoryType); |
| | | commonPost(context, BASE_URL + "class/getVideoList", params, handler); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 分类首页推荐 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param categoryType |
| | | * @param handler |
| | | */ |
| | | public static void getCategoryRecommend(Context context, String uid, String categoryType, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Type", categoryType); |
| | | commonPost(context, BASE_URL + "class", params, handler); |
| | | |
| | | } |
| | | |
| | | public static void getMVideoList(Context context, String uid, String id, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Id", id); |
| | | commonPost(context, BASE_URL + "other/getIntersection", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 专题详情 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param id |
| | | * @param handler |
| | | */ |
| | | public static void getSpecialDetail(Context context, String uid, String id, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Id", id); |
| | | commonPost(context, BASE_URL + "class/getSpecialDetail", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 明星详情 |
| | | * |
| | | * @param context |
| | | * @param id |
| | | * @param handler |
| | | */ |
| | | public static void getHotStarDetail(Context context, String uid, String id, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Id", id); |
| | | commonPost(context, BASE_URL + "class/getHotStarDetail", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * 视频评论列表 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void getVideoCommentList(Context context, String uid, |
| | | String videoId, String thirdType, String Page, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("VideoId", videoId); |
| | | params.put("ThirdType", thirdType); |
| | | params.put("Page", Page); |
| | | commonPost(context, BASE_URL + "comment/getVideoCommentList", params, handler); |
| | | } |
| | | |
| | | public static void getFirstChildType(Context context, String ParentId, |
| | | String uid, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("ParentId", ParentId); |
| | | params.put("Uid", uid); |
| | | commonPost(context, BASE_URL + "class/getFirstChildTypeNew", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 么么直播数据请求 |
| | | * |
| | | * @param context |
| | | * @param page |
| | | * @param handler |
| | | */ |
| | | public static void getMeMeVideoLiveList(Context context, String page, |
| | | ResponseHandlerInterface handler) { |
| | | RequestParams params = new RequestParams(); |
| | | asyncHttpClient.post(context, |
| | | "http://api.memeyule.com/union/star_json?from=mugua_2&page=" |
| | | + page + "&size=20&sort=1", params, handler); |
| | | } |
| | | |
| | | public static void getVideoDetail(Context context, String uid, |
| | | String ResourceId, String videoId, String loginid, String type, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("LoginUid", loginid); |
| | | params.put("VideoId", videoId); |
| | | params.put("ResourceId", ResourceId); |
| | | params.put("Type", type); |
| | | commonPost(context, BASE_URL + "recommend/getVideoDetail", params, handler); |
| | | |
| | | } |
| | | |
| | | public static void advice(Context context, String uid, String content, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Content", content); |
| | | commonPost(context, BASE_URL + "other/advice", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void isCollect(Context context, String uid, String videoId, |
| | | String thirdType, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | params.put("Id", videoId); |
| | | params.put("ThirdType", thirdType); |
| | | commonPost(context, BASE_URL + "recommend/isCollect", params, handler); |
| | | } |
| | | |
| | | public static void getNotice(Context context, String uid, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Uid", uid); |
| | | commonPost(context, BASE_URL + "other/getNotice", params, handler); |
| | | } |
| | | |
| | | public static void getUserVideoDataCount(Context context, String uid, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Method", "getUserVideoDataCount"); |
| | | params.put("Uid", uid); |
| | | String loginUid = UserUtil.getLoginUid(context); |
| | | if (loginUid != null) { |
| | | params.put("LoginUid", loginUid); |
| | | } |
| | | commonPost(context, BASE_URL_V2 + "userVideo", params, handler); |
| | | } |
| | | |
| | | public static void getSearchVideoType(Context context, String pid, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Method", "getSearchVideoType"); |
| | | if (UserUtil.getUid(context) != null) |
| | | params.put("Uid", UserUtil.getUid(context)); |
| | | params.put("pid", pid); |
| | | String loginUid = UserUtil.getLoginUid(context); |
| | | if (loginUid != null) { |
| | | params.put("LoginUid", loginUid); |
| | | } |
| | | commonPost(context, BASE_URL_V2 + "search", params, handler); |
| | | } |
| | | |
| | | |
| | | public static LinkedHashMap<String, String> validateParams( |
| | | LinkedHashMap<String, String> params, Context context) { |
| | | params.put("System", "1"); |
| | | StringBuilder sign = new StringBuilder(); |
| | | // for (Entry<String, String> entry : params.entrySet()) { |
| | | // sign.append(entry.getValue()); |
| | | // } |
| | | sign.append(params.get("Method")) |
| | | .append(StringUtils.isEmpty(params.get("Uid")) ? params.get("Device") |
| | | : params.get("Uid")).append(params.get("System")); |
| | | if (BuildConfig.DEBUG) { |
| | | Log.i(TAG, "sign: " + sign); |
| | | } |
| | | params.put("Sign", MD5Utils.getMD532(sign.toString())); |
| | | params.put("Platform", "Android"); |
| | | params.put("Channel", ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL")); |
| | | return params; |
| | | } |
| | | |
| | | @SuppressWarnings("unused") |
| | | private static void commonGet(Context context, String url, |
| | | LinkedHashMap<String, String> params, |
| | | ResponseHandlerInterface handler) { |
| | | commonGet(context, url, params, handler, true); |
| | | } |
| | | |
| | | public static void commonGet(Context context, String url, |
| | | LinkedHashMap<String, String> params, |
| | | ResponseHandlerInterface handler, boolean asyn) { |
| | | params.put("Package", context.getPackageName()); |
| | | LinkedHashMap<String, String> map = validateParams(params, context); |
| | | |
| | | RequestParams requestParams = new RequestParams(map); |
| | | if (BuildConfig.DEBUG) { |
| | | Log.i(TAG, "get url: " + url + "?" + requestParams.toString()); |
| | | } |
| | | if (asyn) { |
| | | (asyncHttpClient).get(context, url, requestParams, handler); |
| | | } else { |
| | | (syncHttpClient).get(context, url, requestParams, handler); |
| | | } |
| | | } |
| | | |
| | | private static void commonPost(Context context, String url, |
| | | LinkedHashMap<String, String> params, |
| | | ResponseHandlerInterface handler) { |
| | | if (HanJuConstant.isDisableProxy()) { |
| | | commonPost(context, url, params, null, handler); |
| | | } else { |
| | | Toast.makeText(context, "服务器拒绝访问,请查看是否禁用了代理服务器!", |
| | | Toast.LENGTH_SHORT).show(); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | private static void commonPost1(Context context, String url, |
| | | LinkedHashMap<String, String> params, |
| | | ResponseHandlerInterface handler) { |
| | | if (HanJuConstant.isDisableProxy()) { |
| | | commonPost1(context, url, params, null, handler); |
| | | } else { |
| | | Toast.makeText(context, "服务器拒绝访问,请查看是否禁用了代理服务器!", |
| | | Toast.LENGTH_SHORT).show(); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | private static void commonPost(Context context, String url, |
| | | LinkedHashMap<String, String> params, HashMap<String, File> files, |
| | | ResponseHandlerInterface handler) { |
| | | commonPost(context, url, params, files, handler, true, false); |
| | | } |
| | | |
| | | private static void commonPost1(Context context, String url, |
| | | LinkedHashMap<String, String> params, HashMap<String, File> files, |
| | | ResponseHandlerInterface handler) { |
| | | commonPost(context, url, params, files, handler, false, false); |
| | | } |
| | | |
| | | /** |
| | | * 测试 |
| | | * |
| | | * @param context |
| | | * @param url |
| | | * @param params |
| | | * @param files |
| | | * @param handler |
| | | */ |
| | | private static void commonPostTest(Context context, String url, |
| | | LinkedHashMap<String, String> params, HashMap<String, File> files, |
| | | Callback handler) { |
| | | requestPostByAsynWithForm(context, url, params, files, handler, false); |
| | | } |
| | | |
| | | private static final MediaType MEDIA_TYPE_JSON = MediaType.parse("application/x-www-form-urlencoded; charset=utf-8");//mdiatype 这个需要和服务端保持一致 |
| | | |
| | | private static void commonPost(Context context, String url, |
| | | LinkedHashMap<String, String> params, |
| | | Callback handler) { |
| | | |
| | | |
| | | if (HanJuConstant.isDisableProxy()) { |
| | | commonPostTest(context, url, params, null, handler); |
| | | } else { |
| | | Toast.makeText(context, "服务器拒绝访问,请查看是否禁用了代理服务器!", |
| | | Toast.LENGTH_SHORT).show(); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * okHttp post异步请求表单提交 |
| | | * |
| | | * @param actionUrl 接口地址 |
| | | * @param paramsMap 请求参数 |
| | | * @param callBack 请求返回数据回调 |
| | | * @param <T> 数据泛型 |
| | | * @return |
| | | */ |
| | | private static OkHttpClient mOkHttpClient = new OkHttpClient();//okHttpClient 实例 |
| | | |
| | | private static void requestPostByAsynWithForm(Context context, String url, |
| | | LinkedHashMap<String, String> params, HashMap<String, File> files, |
| | | Callback handler, boolean asyn) { |
| | | |
| | | try { |
| | | params.put("Package", context.getPackageName()); |
| | | int version = PackageUtils2.getVersionCode(context); |
| | | params.put("Version", version + ""); |
| | | params.put("Device", getDeviceId(context)); |
| | | |
| | | LinkedHashMap<String, String> map = validateParams(params, context); |
| | | FormBody.Builder builder = new FormBody.Builder(); |
| | | for (String key : map.keySet()) { |
| | | params.put(key, map.get(key)); |
| | | } |
| | | |
| | | RequestBody formBody = builder.build(); |
| | | Request.Builder builder1 = new Request.Builder(); |
| | | final Request request = builder1.url(url).post(formBody).build(); |
| | | final Call call = mOkHttpClient.newCall(request); |
| | | call.enqueue(handler); |
| | | } catch (Exception e) { |
| | | Log.e(TAG, e.toString()); |
| | | } |
| | | } |
| | | |
| | | public static String getDeviceId(Context context) { |
| | | SharedPreferences deviceInfo = context.getSharedPreferences("deviceInfo", Context.MODE_PRIVATE); |
| | | String deviceId = deviceInfo.getString("device", ""); |
| | | if (StringUtils.isEmpty(deviceId)) { |
| | | deviceId = UTDevice.getUtdid(context); |
| | | if (!StringUtils.isEmpty(deviceId)) { |
| | | SharedPreferences.Editor editor = deviceInfo.edit(); |
| | | editor.putString("device", deviceId); |
| | | editor.commit(); |
| | | } |
| | | } |
| | | return deviceId; |
| | | } |
| | | |
| | | private static void commonPost(Context context, String url, |
| | | LinkedHashMap<String, String> params, HashMap<String, File> files, |
| | | ResponseHandlerInterface handler, boolean asyn, boolean shortTime) { |
| | | params.put("Package", context.getPackageName()); |
| | | int version = PackageUtils2.getVersionCode(context); |
| | | params.put("Version", version + ""); |
| | | params.put("Device", getDeviceId(context)); |
| | | LinkedHashMap<String, String> map = validateParams(params, context); |
| | | RequestParams requestParams = new RequestParams(map); |
| | | if (BuildConfig.DEBUG) { |
| | | Log.i(TAG, "post url: " + url + "?" + requestParams.toString()); |
| | | } |
| | | if (files != null) { |
| | | for (Entry<String, File> entry : files.entrySet()) { |
| | | try { |
| | | requestParams.put(entry.getKey(), entry.getValue()); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | if (asyn) { |
| | | // asyncHttpClient.setProxy("192.168.1.122", 8888); |
| | | if (!shortTime) |
| | | asyncHttpClient.post(context, url, requestParams, handler); |
| | | else { |
| | | sortTimeAsyncHttpClient.post(context, url, requestParams, handler); |
| | | } |
| | | |
| | | } else { |
| | | // syncHttpClient.post(context, url, requestParams, handler); |
| | | // asyncHttpClient.setProxy("192.168.1.122", 8888); |
| | | final Context context2 = context; |
| | | final String url2 = url; |
| | | final RequestParams requestParams2 = requestParams; |
| | | final ResponseHandlerInterface handler2 = handler; |
| | | |
| | | syncHttpClient.post(context2, url2, requestParams2, handler2); |
| | | |
| | | } |
| | | } |
| | | |
| | | public static void commonGet(Context context, String url, |
| | | RequestParams params, ResponseHandlerInterface handler, boolean asyn) { |
| | | if (asyn) { |
| | | asyncHttpClient.get(context, url, params, handler); |
| | | } else { |
| | | syncHttpClient.get(context, url, params, handler); |
| | | } |
| | | } |
| | | |
| | | public static void commonGet(Context context, String url, |
| | | ResponseHandlerInterface handler, boolean asyn) { |
| | | if (asyn) { |
| | | asyncHttpClient.get(context, url, handler); |
| | | } else { |
| | | syncHttpClient.get(context, url, handler); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.ui; |
| | | |
| | | import android.content.Context; |
| | | import android.content.res.TypedArray; |
| | | import android.graphics.Bitmap; |
| | | import android.graphics.BitmapShader; |
| | | import android.graphics.Canvas; |
| | | import android.graphics.Color; |
| | | import android.graphics.Matrix; |
| | | import android.graphics.Paint; |
| | | import android.graphics.RectF; |
| | | import android.graphics.Shader; |
| | | import android.graphics.drawable.BitmapDrawable; |
| | | import android.graphics.drawable.ColorDrawable; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.net.Uri; |
| | | import android.util.AttributeSet; |
| | | import android.widget.ImageView; |
| | | |
| | | import com.hanju.video.app.R; |
| | | |
| | | public class CircleImageView extends ImageView { |
| | | |
| | | private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP; |
| | | |
| | | private static final Bitmap.Config BITMAP_CONFIG = Bitmap.Config.ARGB_8888; |
| | | private static final int COLORDRAWABLE_DIMENSION = 1; |
| | | |
| | | private static final int DEFAULT_BORDER_WIDTH = 0; |
| | | private static final int DEFAULT_BORDER_COLOR = Color.BLACK; |
| | | |
| | | private final RectF mDrawableRect = new RectF(); |
| | | private final RectF mBorderRect = new RectF(); |
| | | |
| | | private final Matrix mShaderMatrix = new Matrix(); |
| | | private final Paint mBitmapPaint = new Paint(); |
| | | private final Paint mBorderPaint = new Paint(); |
| | | |
| | | private int mBorderColor = DEFAULT_BORDER_COLOR; |
| | | private int mBorderWidth = DEFAULT_BORDER_WIDTH; |
| | | |
| | | private Bitmap mBitmap; |
| | | private BitmapShader mBitmapShader; |
| | | private int mBitmapWidth; |
| | | private int mBitmapHeight; |
| | | |
| | | private float mDrawableRadius; |
| | | private float mBorderRadius; |
| | | |
| | | private boolean mReady; |
| | | private boolean mSetupPending; |
| | | |
| | | public CircleImageView(Context context) { |
| | | super(context); |
| | | |
| | | init(); |
| | | } |
| | | |
| | | public CircleImageView(Context context, AttributeSet attrs) { |
| | | this(context, attrs, 0); |
| | | } |
| | | |
| | | public CircleImageView(Context context, AttributeSet attrs, int defStyle) { |
| | | super(context, attrs, defStyle); |
| | | |
| | | TypedArray a = context.obtainStyledAttributes(attrs, |
| | | R.styleable.CircleImageView, defStyle, 0); |
| | | |
| | | mBorderWidth = a.getDimensionPixelSize( |
| | | R.styleable.CircleImageView_border_width, DEFAULT_BORDER_WIDTH); |
| | | mBorderColor = a.getColor(R.styleable.CircleImageView_border_color, |
| | | DEFAULT_BORDER_COLOR); |
| | | |
| | | a.recycle(); |
| | | |
| | | init(); |
| | | } |
| | | |
| | | private void init() { |
| | | super.setScaleType(SCALE_TYPE); |
| | | mReady = true; |
| | | |
| | | if (mSetupPending) { |
| | | setup(); |
| | | mSetupPending = false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public ScaleType getScaleType() { |
| | | return SCALE_TYPE; |
| | | } |
| | | |
| | | @Override |
| | | public void setScaleType(ScaleType scaleType) { |
| | | if (scaleType != SCALE_TYPE) { |
| | | throw new IllegalArgumentException(String.format( |
| | | "ScaleType %s not supported.", scaleType)); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void onDraw(Canvas canvas) { |
| | | if (getDrawable() == null) { |
| | | return; |
| | | } |
| | | |
| | | canvas.drawCircle(getWidth() / 2, getHeight() / 2, mDrawableRadius, |
| | | mBitmapPaint); |
| | | if (mBorderWidth != 0) { |
| | | canvas.drawCircle(getWidth() / 2, getHeight() / 2, mBorderRadius, |
| | | mBorderPaint); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void onSizeChanged(int w, int h, int oldw, int oldh) { |
| | | super.onSizeChanged(w, h, oldw, oldh); |
| | | setup(); |
| | | } |
| | | |
| | | public int getBorderColor() { |
| | | return mBorderColor; |
| | | } |
| | | |
| | | public void setBorderColor(int borderColor) { |
| | | if (borderColor == mBorderColor) { |
| | | return; |
| | | } |
| | | |
| | | mBorderColor = borderColor; |
| | | mBorderPaint.setColor(mBorderColor); |
| | | invalidate(); |
| | | } |
| | | |
| | | public int getBorderWidth() { |
| | | return mBorderWidth; |
| | | } |
| | | |
| | | public void setBorderWidth(int borderWidth) { |
| | | if (borderWidth == mBorderWidth) { |
| | | return; |
| | | } |
| | | |
| | | mBorderWidth = borderWidth; |
| | | setup(); |
| | | } |
| | | |
| | | @Override |
| | | public void setImageBitmap(Bitmap bm) { |
| | | super.setImageBitmap(bm); |
| | | mBitmap = bm; |
| | | setup(); |
| | | } |
| | | |
| | | @Override |
| | | public void setImageDrawable(Drawable drawable) { |
| | | super.setImageDrawable(drawable); |
| | | mBitmap = getBitmapFromDrawable(drawable); |
| | | setup(); |
| | | } |
| | | |
| | | @Override |
| | | public void setImageResource(int resId) { |
| | | super.setImageResource(resId); |
| | | mBitmap = getBitmapFromDrawable(getDrawable()); |
| | | setup(); |
| | | } |
| | | |
| | | @Override |
| | | public void setImageURI(Uri uri) { |
| | | super.setImageURI(uri); |
| | | mBitmap = getBitmapFromDrawable(getDrawable()); |
| | | setup(); |
| | | } |
| | | |
| | | private Bitmap getBitmapFromDrawable(Drawable drawable) { |
| | | if (drawable == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (drawable instanceof BitmapDrawable) { |
| | | return ((BitmapDrawable) drawable).getBitmap(); |
| | | } |
| | | |
| | | try { |
| | | Bitmap bitmap; |
| | | |
| | | if (drawable instanceof ColorDrawable) { |
| | | bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, |
| | | COLORDRAWABLE_DIMENSION, BITMAP_CONFIG); |
| | | } else { |
| | | bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), |
| | | drawable.getIntrinsicHeight(), BITMAP_CONFIG); |
| | | } |
| | | |
| | | Canvas canvas = new Canvas(bitmap); |
| | | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); |
| | | drawable.draw(canvas); |
| | | return bitmap; |
| | | } catch (OutOfMemoryError e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private void setup() { |
| | | if (!mReady) { |
| | | mSetupPending = true; |
| | | return; |
| | | } |
| | | |
| | | if (mBitmap == null) { |
| | | return; |
| | | } |
| | | |
| | | mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, |
| | | Shader.TileMode.CLAMP); |
| | | |
| | | mBitmapPaint.setAntiAlias(true); |
| | | mBitmapPaint.setShader(mBitmapShader); |
| | | |
| | | mBorderPaint.setStyle(Paint.Style.STROKE); |
| | | mBorderPaint.setAntiAlias(true); |
| | | mBorderPaint.setColor(mBorderColor); |
| | | mBorderPaint.setStrokeWidth(mBorderWidth); |
| | | |
| | | mBitmapHeight = mBitmap.getHeight(); |
| | | mBitmapWidth = mBitmap.getWidth(); |
| | | |
| | | mBorderRect.set(0, 0, getWidth(), getHeight()); |
| | | mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, |
| | | (mBorderRect.width() - mBorderWidth) / 2); |
| | | |
| | | mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() |
| | | - mBorderWidth, mBorderRect.height() - mBorderWidth); |
| | | mDrawableRadius = Math.min(mDrawableRect.height() / 2, |
| | | mDrawableRect.width() / 2); |
| | | |
| | | updateShaderMatrix(); |
| | | invalidate(); |
| | | } |
| | | |
| | | private void updateShaderMatrix() { |
| | | float scale; |
| | | float dx = 0; |
| | | float dy = 0; |
| | | |
| | | mShaderMatrix.set(null); |
| | | |
| | | if (mBitmapWidth * mDrawableRect.height() > mDrawableRect.width() |
| | | * mBitmapHeight) { |
| | | scale = mDrawableRect.height() / (float) mBitmapHeight; |
| | | dx = (mDrawableRect.width() - mBitmapWidth * scale) * 0.5f; |
| | | } else { |
| | | scale = mDrawableRect.width() / (float) mBitmapWidth; |
| | | dy = (mDrawableRect.height() - mBitmapHeight * scale) * 0.5f; |
| | | } |
| | | |
| | | mShaderMatrix.setScale(scale, scale); |
| | | mShaderMatrix.postTranslate((int) (dx + 0.5f) + mBorderWidth, |
| | | (int) (dy + 0.5f) + mBorderWidth); |
| | | |
| | | mBitmapShader.setLocalMatrix(mShaderMatrix); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.ui; |
| | | |
| | | import android.app.Activity; |
| | | import android.app.Dialog; |
| | | import android.content.Context; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import com.hanju.video.app.entity.ad.AdPositionEnum; |
| | | import com.hanju.lib.library.util.SystemCommon; |
| | | import com.qq.e.ads.nativ.NativeADDataRef; |
| | | import com.qq.e.ads.nativ.NativeExpressAD; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.ad.ExpressAdManager; |
| | | import com.hanju.video.app.util.ad.ExpressAdManager.IAdEventListener; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2017/2/28. |
| | | */ |
| | | |
| | | public class ExitDialog extends Dialog { |
| | | public ExitDialog(Context context) { |
| | | super(context); |
| | | this.setCancelable(false); |
| | | } |
| | | |
| | | public ExitDialog(Context context, int theme) { |
| | | super(context, theme); |
| | | this.setCancelable(false); |
| | | } |
| | | |
| | | |
| | | public static class Builder { |
| | | private Activity context; |
| | | private String positiveButtonText; |
| | | private String negativeButtonText; |
| | | private OnClickListener positiveButtonClickListener; |
| | | private OnClickListener negativeButtonClickListener; |
| | | ExpressAdManager expressAdManager; |
| | | |
| | | public Builder(Activity context) { |
| | | this.context = context; |
| | | expressAdManager = new ExpressAdManager(AdUtil.getAdType(context, AdPositionEnum.exitApp), context); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set the positive button resource and it's listener |
| | | * |
| | | * @param positiveButtonText |
| | | * @return |
| | | */ |
| | | public Builder setPositiveButton(int positiveButtonText, |
| | | OnClickListener listener) { |
| | | this.positiveButtonText = (String) context |
| | | .getText(positiveButtonText); |
| | | this.positiveButtonClickListener = listener; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setPositiveButton(String positiveButtonText, |
| | | OnClickListener listener) { |
| | | this.positiveButtonText = positiveButtonText; |
| | | this.positiveButtonClickListener = listener; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setNegativeButton(int negativeButtonText, |
| | | OnClickListener listener) { |
| | | this.negativeButtonText = (String) context |
| | | .getText(negativeButtonText); |
| | | this.negativeButtonClickListener = listener; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setNegativeButton(String negativeButtonText, |
| | | OnClickListener listener) { |
| | | this.negativeButtonText = negativeButtonText; |
| | | this.negativeButtonClickListener = listener; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 广点通广告 |
| | | */ |
| | | private FrameLayout fl_advertisement; |
| | | |
| | | private TextView tv_content; |
| | | |
| | | private ExpressAdContainer expressAdContainer; |
| | | |
| | | public ExitDialog create() { |
| | | LayoutInflater inflater = (LayoutInflater) context |
| | | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
| | | // instantiate the dialog with the custom Theme |
| | | final ExitDialog dialog = new ExitDialog(context, R.style.Dialog); |
| | | View layout = inflater.inflate(R.layout.item_exit, null); |
| | | fl_advertisement = layout.findViewById(R.id.fl_advertisement); |
| | | tv_content = layout.findViewById(R.id.tv_content); |
| | | loadAd(); |
| | | dialog.addContentView(layout, new FrameLayout.LayoutParams( |
| | | FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT)); |
| | | // set the confirm button |
| | | layout.findViewById(R.id.tv_login) |
| | | .setOnClickListener(new View.OnClickListener() { |
| | | public void onClick(View v) { |
| | | dialog.dismiss(); |
| | | context.finish(); |
| | | |
| | | } |
| | | }); |
| | | layout.findViewById(R.id.tv_cancle) |
| | | .setOnClickListener(new View.OnClickListener() { |
| | | public void onClick(View v) { |
| | | dialog.dismiss(); |
| | | } |
| | | }); |
| | | |
| | | layout.findViewById(R.id.iv_close) |
| | | .setOnClickListener(new View.OnClickListener() { |
| | | public void onClick(View v) { |
| | | dialog.dismiss(); |
| | | } |
| | | }); |
| | | dialog.setContentView(layout); |
| | | |
| | | android.view.WindowManager.LayoutParams params = dialog.getWindow() |
| | | .getAttributes(); |
| | | params.width = (int) ((SystemCommon.getScreenWidth(context) * 3) / 4); |
| | | params.height = android.view.WindowManager.LayoutParams.WRAP_CONTENT; |
| | | dialog.getWindow().setAttributes(params); |
| | | dialog.setCanceledOnTouchOutside(false); |
| | | return dialog; |
| | | } |
| | | |
| | | NativeADDataRef adDataRef; |
| | | |
| | | private NativeExpressAD nativeExpressAD; |
| | | |
| | | // 1.加载广告,先设置加载上下文环境和条件 |
| | | private void loadAd() { |
| | | |
| | | expressAdManager.loadAppExitAd(new ExpressAdManager.IAdLoadListener() { |
| | | @Override |
| | | public void onSuccess(List<ExpressAdContainer> adList) { |
| | | if (adList != null && adList.size() > 0) { |
| | | |
| | | ExpressAdManager.renderAd(context, adList.get(0), new ExpressAdManager.IAdRenderListener() { |
| | | @Override |
| | | public void onRenderSuccess(List<ExpressAdContainer> adList) { |
| | | expressAdContainer = adList.get(0); |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderFail(List<ExpressAdContainer> adList) { |
| | | |
| | | } |
| | | }, null); |
| | | |
| | | } |
| | | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | public void showAd() { |
| | | if (expressAdContainer != null) { |
| | | ExpressAdManager.bindCloseListener(context, expressAdContainer, new IAdEventListener() { |
| | | |
| | | @Override |
| | | public void closeAd(ExpressAdContainer ad) { |
| | | fl_advertisement.removeAllViews(); |
| | | } |
| | | }); |
| | | if (tv_content != null) |
| | | tv_content.setVisibility(View.GONE); |
| | | ExpressAdManager.fillAd(expressAdContainer, fl_advertisement); |
| | | } |
| | | } |
| | | |
| | | public void refreshAd() { |
| | | loadAd(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void show() { |
| | | super.show(); |
| | | } |
| | | } |
app/src/com/hanju/video/app/util/ui/GlideCircleTransform.java
app/src/com/hanju/video/app/util/ui/GlideRoundTransform.java
app/src/com/hanju/video/app/util/ui/GlideUtil.java
app/src/com/hanju/video/app/util/ui/GoReviewDialog.java
app/src/com/hanju/video/app/util/ui/SDCardUtil.java
app/src/com/hanju/video/app/util/ui/SlidingMenu.java
app/src/com/hanju/video/app/util/ui/StorageList.java
app/src/com/hanju/video/app/util/video/VideoUtil.java
app/src/com/hanju/video/app/util/x5/WebViewJavaScriptFunction.java (deleted)
app/src/com/hanju/video/app/util/x5/X5WebView.java (deleted)
app/src/com/hanju/video/app/util/x5web/X5WebView.java
app/src/com/hanju/video/app/widget/BadgeView.java (deleted)
app/src/com/hanju/video/app/widget/CustomWebView.java (deleted)
app/src/com/hanju/video/app/widget/CycleViewPager.java (deleted)
app/src/com/hanju/video/app/widget/FullyGridLayoutManager.java (deleted)
app/src/com/hanju/video/app/widget/FullyLinearLayoutManager.java (deleted)
app/src/com/hanju/video/app/widget/GifMovieView.java (deleted)
app/src/com/hanju/video/app/widget/MyRefreshLayout.java (deleted)
app/src/com/hanju/video/app/widget/StatusBar.java (deleted)
app/src/com/hanju/video/wxapi/WXEntryActivity.java
build.gradle
gallery/src/main/java/com/lzj/gallery/library/adapter/BannerPagerAdapter.java
gallery/src/main/res/layout/banner_img_layout.xml
gradle.properties
gradle/wrapper/gradle-wrapper.properties
library-ViewPagerIndicator/res/drawable-hdpi/v1_video_review_click.png
library-ViewPagerIndicator/src/com/viewpagerindicator/LxyPageIndicator.java
library-ViewPagerIndicator/src/com/viewpagerindicator/MTabPageIndicator.java
library-ViewPagerIndicator/src/com/viewpagerindicator/TabPageIndicator.java
library-mine/src/com/hanju/lib/library/DatabaseContext.java
library-mine/src/com/hanju/lib/library/DeviceUuidFactory.java
library-mine/src/com/hanju/lib/library/Installation.java
library-mine/src/com/hanju/lib/library/PhoneCallReceiver.java
library-mine/src/com/hanju/lib/library/RetainViewFragment.java
library-mine/src/com/hanju/lib/library/animation/Rotate3dAnimation.java
library-mine/src/com/hanju/lib/library/content/ConnectivityChangeHelper.java
library-mine/src/com/hanju/lib/library/content/CursorLoader.java
library-mine/src/com/hanju/lib/library/dialog/BottomDialog.java
library-mine/src/com/hanju/lib/library/dialog/SlidingDialog.java
library-mine/src/com/hanju/lib/library/drawable/CircleDrawable.java
library-mine/src/com/hanju/lib/library/drawable/CrossFadeDrawable.java
library-mine/src/com/hanju/lib/library/drawable/FastBitmapDrawable.java
library-mine/src/com/hanju/lib/library/drawable/LayerDrawable.java
library-mine/src/com/hanju/lib/library/drawable/SpotlightDrawable.java
library-mine/src/com/hanju/lib/library/drawable/TransitionDrawable.java
library-mine/src/com/hanju/lib/library/emotion/EmotionEditText.java
library-mine/src/com/hanju/lib/library/emotion/EmotionGridFragment.java
library-mine/src/com/hanju/lib/library/emotion/EmotionHandler.java
library-mine/src/com/hanju/lib/library/emotion/EmotionSpan.java
library-mine/src/com/hanju/lib/library/emotion/EmotionTextView.java
library-mine/src/com/hanju/lib/library/emotion/EmotionsFragment.java
library-mine/src/com/hanju/lib/library/entity/ClipCopyContent.java
library-mine/src/com/hanju/lib/library/entity/IsSeeking.java
library-mine/src/com/hanju/lib/library/okhttp/OkHttpUtils.java
library-mine/src/com/hanju/lib/library/okhttp/builder/GetBuilder.java
library-mine/src/com/hanju/lib/library/okhttp/builder/HasParamsable.java
library-mine/src/com/hanju/lib/library/okhttp/builder/HeadBuilder.java
library-mine/src/com/hanju/lib/library/okhttp/builder/OkHttpRequestBuilder.java
library-mine/src/com/hanju/lib/library/okhttp/builder/OtherRequestBuilder.java
library-mine/src/com/hanju/lib/library/okhttp/builder/PostFileBuilder.java
library-mine/src/com/hanju/lib/library/okhttp/builder/PostFormBuilder.java
library-mine/src/com/hanju/lib/library/okhttp/builder/PostStringBuilder.java
library-mine/src/com/hanju/lib/library/okhttp/callback/BitmapCallback.java
library-mine/src/com/hanju/lib/library/okhttp/callback/Callback.java
library-mine/src/com/hanju/lib/library/okhttp/callback/FileCallBack.java
library-mine/src/com/hanju/lib/library/okhttp/callback/GenericsCallback.java
library-mine/src/com/hanju/lib/library/okhttp/callback/IGenericsSerializator.java
library-mine/src/com/hanju/lib/library/okhttp/callback/StringCallback.java
library-mine/src/com/hanju/lib/library/okhttp/cookie/CookieJarImpl.java
library-mine/src/com/hanju/lib/library/okhttp/cookie/store/CookieStore.java
library-mine/src/com/hanju/lib/library/okhttp/cookie/store/HasCookieStore.java
library-mine/src/com/hanju/lib/library/okhttp/cookie/store/MemoryCookieStore.java
library-mine/src/com/hanju/lib/library/okhttp/cookie/store/PersistentCookieStore.java
library-mine/src/com/hanju/lib/library/okhttp/cookie/store/SerializableHttpCookie.java
library-mine/src/com/hanju/lib/library/okhttp/https/HttpsUtils.java
library-mine/src/com/hanju/lib/library/okhttp/log/LoggerInterceptor.java
library-mine/src/com/hanju/lib/library/okhttp/request/CountingRequestBody.java
library-mine/src/com/hanju/lib/library/okhttp/request/GetRequest.java
library-mine/src/com/hanju/lib/library/okhttp/request/OkHttpRequest.java
library-mine/src/com/hanju/lib/library/okhttp/request/OtherRequest.java
library-mine/src/com/hanju/lib/library/okhttp/request/PostFileRequest.java
library-mine/src/com/hanju/lib/library/okhttp/request/PostFormRequest.java
library-mine/src/com/hanju/lib/library/okhttp/request/PostStringRequest.java
library-mine/src/com/hanju/lib/library/okhttp/request/RequestCall.java
library-mine/src/com/hanju/lib/library/okhttp/utils/Exceptions.java
library-mine/src/com/hanju/lib/library/okhttp/utils/ImageUtils.java
library-mine/src/com/hanju/lib/library/okhttp/utils/L.java
library-mine/src/com/hanju/lib/library/okhttp/utils/Platform.java
library-mine/src/com/hanju/lib/library/upgrade/CheckUpdateService.java
library-mine/src/com/hanju/lib/library/upgrade/UpdateActivity.java
library-mine/src/com/hanju/lib/library/upgrade/UpdateService.java
library-mine/src/com/hanju/lib/library/upgrade/Version.java
library-mine/src/com/hanju/lib/library/util/Environment.java
library-mine/src/com/hanju/lib/library/util/FragmentSwitchHelper.java
library-mine/src/com/hanju/lib/library/util/ImageChooseHelper.java
library-mine/src/com/hanju/lib/library/util/ManifestDataUtil.java
library-mine/src/com/hanju/lib/library/util/MarketUtils.java
library-mine/src/com/hanju/lib/library/util/RefreshLayout.java
library-mine/src/com/hanju/lib/library/util/ScreenUtils.java
library-mine/src/com/hanju/lib/library/util/SingleToast.java
library-mine/src/com/hanju/lib/library/util/SystemCommon.java
library-mine/src/com/hanju/lib/library/util/cache/DiskLruCache.java
library-mine/src/com/hanju/lib/library/util/cache/ImageFileCache.java
library-mine/src/com/hanju/lib/library/util/cache/ImageMemoryCache.java
library-mine/src/com/hanju/lib/library/util/cache/StrictLineReader.java
library-mine/src/com/hanju/lib/library/util/cache/Util.java
library-mine/src/com/hanju/lib/library/util/common/BitmapUtils.java
library-mine/src/com/hanju/lib/library/util/common/ClipboardUtil.java
library-mine/src/com/hanju/lib/library/util/common/ConnectionUtils.java
library-mine/src/com/hanju/lib/library/util/common/DateUtils.java
library-mine/src/com/hanju/lib/library/util/common/DimenUtils.java
library-mine/src/com/hanju/lib/library/util/common/FileUtils.java
library-mine/src/com/hanju/lib/library/util/common/IClipboardContentListener.java
library-mine/src/com/hanju/lib/library/util/common/ObjectUtils.java
library-mine/src/com/hanju/lib/library/util/common/PackageUtils2.java
library-mine/src/com/hanju/lib/library/util/common/RandomUtils.java
library-mine/src/com/hanju/lib/library/util/common/SerializeUtils.java
library-mine/src/com/hanju/lib/library/util/common/SoftKeyboardUtils.java
library-mine/src/com/hanju/lib/library/util/common/StorageUtils.java
library-mine/src/com/hanju/lib/library/util/common/StringUtils.java
library-mine/src/com/hanju/lib/library/util/security/AESOperator.java
library-mine/src/com/hanju/lib/library/util/security/AEScrypt.java
library-mine/src/com/hanju/lib/library/util/security/DEScrypt.java
library-mine/src/com/hanju/lib/library/util/security/MD5Utils.java
library-mine/src/com/hanju/lib/library/widget/AdaptiveListView.java
library-mine/src/com/hanju/lib/library/widget/ArcMeun.java
library-mine/src/com/hanju/lib/library/widget/DashLine.java
library-mine/src/com/hanju/lib/library/widget/ExtendEditText.java
library-mine/src/com/hanju/lib/library/widget/IndexableListView.java
library-mine/src/com/hanju/lib/library/widget/IsPad.java
library-mine/src/com/hanju/lib/library/widget/MyGridView.java
library-mine/src/com/hanju/lib/library/widget/MyListView.java
library-mine/src/com/hanju/lib/library/widget/MyViewPager.java
library-mine/src/com/hanju/lib/library/widget/ProgressWebView.java
library-mine/src/com/hanju/lib/library/widget/RatioLayout.java
library-mine/src/com/hanju/lib/library/widget/RefreshView.java
library-mine/src/com/hanju/lib/library/widget/ResizableImageView.java
library-mine/src/com/hanju/lib/library/widget/ShelfView.java
library-mine/src/com/hanju/lib/library/widget/SystemBarTintManager.java
library-mine/src/com/hanju/lib/library/widget/TagCloudLayout.java
library-mine/src/com/hanju/lib/library/widget/UnderLineTextView.java
library-mine/src/com/hanju/lib/library/widget/myswiperefreshlayout/BakedBezierInterpolator.java
library-mine/src/com/hanju/lib/library/widget/myswiperefreshlayout/MySwipeRefreshLayout.java
library-mine/src/com/hanju/lib/library/widget/myswiperefreshlayout/SwipeProgressBar.java
library-mine/src/com/hanju/lib/library/widget/verticalviewpager/ExtendedWebView.java
library-mine/src/com/hanju/lib/library/widget/verticalviewpager/PagerAdapter.java
library-mine/src/com/lcjian/library/DatabaseContext.java (deleted)
library-mine/src/com/lcjian/library/DeviceUuidFactory.java (deleted)
library-mine/src/com/lcjian/library/Installation.java (deleted)
library-mine/src/com/lcjian/library/PhoneCallReceiver.java (deleted)
library-mine/src/com/lcjian/library/RetainViewFragment.java (deleted)
library-mine/src/com/lcjian/library/animation/Rotate3dAnimation.java (deleted)
library-mine/src/com/lcjian/library/content/ConnectivityChangeHelper.java (deleted)
library-mine/src/com/lcjian/library/content/CursorLoader.java (deleted)
library-mine/src/com/lcjian/library/dialog/BottomDialog.java (deleted)
library-mine/src/com/lcjian/library/dialog/SlidingDialog.java (deleted)
library-mine/src/com/lcjian/library/drawable/CircleDrawable.java (deleted)
library-mine/src/com/lcjian/library/drawable/CrossFadeDrawable.java (deleted)
library-mine/src/com/lcjian/library/drawable/FastBitmapDrawable.java (deleted)
library-mine/src/com/lcjian/library/drawable/LayerDrawable.java (deleted)
library-mine/src/com/lcjian/library/drawable/SpotlightDrawable.java (deleted)
library-mine/src/com/lcjian/library/drawable/TransitionDrawable.java (deleted)
library-mine/src/com/lcjian/library/emotion/EmotionEditText.java (deleted)
library-mine/src/com/lcjian/library/emotion/EmotionGridFragment.java (deleted)
library-mine/src/com/lcjian/library/emotion/EmotionHandler.java (deleted)
library-mine/src/com/lcjian/library/emotion/EmotionSpan.java (deleted)
library-mine/src/com/lcjian/library/emotion/EmotionTextView.java (deleted)
library-mine/src/com/lcjian/library/emotion/EmotionsFragment.java (deleted)
library-mine/src/com/lcjian/library/entity/ClipCopyContent.java (deleted)
library-mine/src/com/lcjian/library/entity/IsSeeking.java (deleted)
library-mine/src/com/lcjian/library/okhttp/OkHttpUtils.java (deleted)
library-mine/src/com/lcjian/library/okhttp/builder/GetBuilder.java (deleted)
library-mine/src/com/lcjian/library/okhttp/builder/HasParamsable.java (deleted)
library-mine/src/com/lcjian/library/okhttp/builder/HeadBuilder.java (deleted)
library-mine/src/com/lcjian/library/okhttp/builder/OkHttpRequestBuilder.java (deleted)
library-mine/src/com/lcjian/library/okhttp/builder/OtherRequestBuilder.java (deleted)
library-mine/src/com/lcjian/library/okhttp/builder/PostFileBuilder.java (deleted)
library-mine/src/com/lcjian/library/okhttp/builder/PostFormBuilder.java (deleted)
library-mine/src/com/lcjian/library/okhttp/builder/PostStringBuilder.java (deleted)
library-mine/src/com/lcjian/library/okhttp/callback/BitmapCallback.java (deleted)
library-mine/src/com/lcjian/library/okhttp/callback/Callback.java (deleted)
library-mine/src/com/lcjian/library/okhttp/callback/FileCallBack.java (deleted)
library-mine/src/com/lcjian/library/okhttp/callback/GenericsCallback.java (deleted)
library-mine/src/com/lcjian/library/okhttp/callback/IGenericsSerializator.java (deleted)
library-mine/src/com/lcjian/library/okhttp/callback/StringCallback.java (deleted)
library-mine/src/com/lcjian/library/okhttp/cookie/CookieJarImpl.java (deleted)
library-mine/src/com/lcjian/library/okhttp/cookie/store/CookieStore.java (deleted)
library-mine/src/com/lcjian/library/okhttp/cookie/store/HasCookieStore.java (deleted)
library-mine/src/com/lcjian/library/okhttp/cookie/store/MemoryCookieStore.java (deleted)
library-mine/src/com/lcjian/library/okhttp/cookie/store/PersistentCookieStore.java (deleted)
library-mine/src/com/lcjian/library/okhttp/cookie/store/SerializableHttpCookie.java (deleted)
library-mine/src/com/lcjian/library/okhttp/https/HttpsUtils.java (deleted)
library-mine/src/com/lcjian/library/okhttp/log/LoggerInterceptor.java (deleted)
library-mine/src/com/lcjian/library/okhttp/request/CountingRequestBody.java (deleted)
library-mine/src/com/lcjian/library/okhttp/request/GetRequest.java (deleted)
library-mine/src/com/lcjian/library/okhttp/request/OkHttpRequest.java (deleted)
library-mine/src/com/lcjian/library/okhttp/request/OtherRequest.java (deleted)
library-mine/src/com/lcjian/library/okhttp/request/PostFileRequest.java (deleted)
library-mine/src/com/lcjian/library/okhttp/request/PostFormRequest.java (deleted)
library-mine/src/com/lcjian/library/okhttp/request/PostStringRequest.java (deleted)
library-mine/src/com/lcjian/library/okhttp/request/RequestCall.java (deleted)
library-mine/src/com/lcjian/library/okhttp/utils/Exceptions.java (deleted)
library-mine/src/com/lcjian/library/okhttp/utils/ImageUtils.java (deleted)
library-mine/src/com/lcjian/library/okhttp/utils/L.java (deleted)
library-mine/src/com/lcjian/library/okhttp/utils/Platform.java (deleted)
library-mine/src/com/lcjian/library/upgrade/CheckUpdateService.java (deleted)
library-mine/src/com/lcjian/library/upgrade/UpdateActivity.java (deleted)
library-mine/src/com/lcjian/library/upgrade/UpdateService.java (deleted)
library-mine/src/com/lcjian/library/upgrade/Version.java (deleted)
library-mine/src/com/lcjian/library/util/Environment.java (deleted)
library-mine/src/com/lcjian/library/util/FragmentSwitchHelper.java (deleted)
library-mine/src/com/lcjian/library/util/ImageChooseHelper.java (deleted)
library-mine/src/com/lcjian/library/util/ManifestDataUtil.java (deleted)
library-mine/src/com/lcjian/library/util/MarketUtils.java (deleted)
library-mine/src/com/lcjian/library/util/RefreshLayout.java (deleted)
library-mine/src/com/lcjian/library/util/ScreenUtils.java (deleted)
library-mine/src/com/lcjian/library/util/SingleToast.java (deleted)
library-mine/src/com/lcjian/library/util/SystemCommon.java (deleted)
library-mine/src/com/lcjian/library/util/cache/DiskLruCache.java (deleted)
library-mine/src/com/lcjian/library/util/cache/ImageFileCache.java (deleted)
library-mine/src/com/lcjian/library/util/cache/ImageMemoryCache.java (deleted)
library-mine/src/com/lcjian/library/util/cache/StrictLineReader.java (deleted)
library-mine/src/com/lcjian/library/util/cache/Util.java (deleted)
library-mine/src/com/lcjian/library/util/common/BitmapUtils.java (deleted)
library-mine/src/com/lcjian/library/util/common/ClipboardUtil.java (deleted)
library-mine/src/com/lcjian/library/util/common/ConnectionUtils.java (deleted)
library-mine/src/com/lcjian/library/util/common/DateUtils.java (deleted)
library-mine/src/com/lcjian/library/util/common/DimenUtils.java (deleted)
library-mine/src/com/lcjian/library/util/common/FileUtils.java (deleted)
library-mine/src/com/lcjian/library/util/common/IClipboardContentListener.java (deleted)
library-mine/src/com/lcjian/library/util/common/ObjectUtils.java (deleted)
library-mine/src/com/lcjian/library/util/common/PackageUtils2.java (deleted)
library-mine/src/com/lcjian/library/util/common/RandomUtils.java (deleted)
library-mine/src/com/lcjian/library/util/common/SerializeUtils.java (deleted)
library-mine/src/com/lcjian/library/util/common/SoftKeyboardUtils.java (deleted)
library-mine/src/com/lcjian/library/util/common/StorageUtils.java (deleted)
library-mine/src/com/lcjian/library/util/common/StringUtils.java (deleted)
library-mine/src/com/lcjian/library/util/security/AESOperator.java (deleted)
library-mine/src/com/lcjian/library/util/security/AEScrypt.java (deleted)
library-mine/src/com/lcjian/library/util/security/DEScrypt.java (deleted)
library-mine/src/com/lcjian/library/util/security/MD5Utils.java (deleted)
library-mine/src/com/lcjian/library/widget/AdaptiveListView.java (deleted)
library-mine/src/com/lcjian/library/widget/ArcMeun.java (deleted)
library-mine/src/com/lcjian/library/widget/DashLine.java (deleted)
library-mine/src/com/lcjian/library/widget/ExtendEditText.java (deleted)
library-mine/src/com/lcjian/library/widget/IndexableListView.java (deleted)
library-mine/src/com/lcjian/library/widget/IsPad.java (deleted)
library-mine/src/com/lcjian/library/widget/MyGridView.java (deleted)
library-mine/src/com/lcjian/library/widget/MyListView.java (deleted)
library-mine/src/com/lcjian/library/widget/MyViewPager.java (deleted)
library-mine/src/com/lcjian/library/widget/ProgressWebView.java (deleted)
library-mine/src/com/lcjian/library/widget/RatioLayout.java (deleted)
library-mine/src/com/lcjian/library/widget/RefreshView.java (deleted)
library-mine/src/com/lcjian/library/widget/ResizableImageView.java (deleted)
library-mine/src/com/lcjian/library/widget/ShelfView.java (deleted)
library-mine/src/com/lcjian/library/widget/SystemBarTintManager.java (deleted)
library-mine/src/com/lcjian/library/widget/TagCloudLayout.java (deleted)
library-mine/src/com/lcjian/library/widget/UnderLineTextView.java (deleted)
library-mine/src/com/lcjian/library/widget/myswiperefreshlayout/BakedBezierInterpolator.java (deleted)
library-mine/src/com/lcjian/library/widget/myswiperefreshlayout/MySwipeRefreshLayout.java (deleted)
library-mine/src/com/lcjian/library/widget/myswiperefreshlayout/SwipeProgressBar.java (deleted)
library-mine/src/com/lcjian/library/widget/verticalviewpager/ExtendedWebView.java (deleted)
library-mine/src/com/lcjian/library/widget/verticalviewpager/PagerAdapter.java (deleted)
social_sdk_library_project/build.gradle
social_sdk_library_project/libs/umeng-asms-armeabi-v1.1.3.aar (deleted)
social_sdk_library_project/libs/umeng-common-9.2.4.jar (deleted)
social_sdk_library_project/libs/umeng-crash-armeabi-v0.0.4.aar (deleted)
social_sdk_library_project/libs/umeng-share-QQ-full-7.1.1.jar (deleted)
social_sdk_library_project/libs/umeng-share-QQ-full-7.1.6.jar
social_sdk_library_project/libs/umeng-share-core-7.1.1.jar (deleted)
social_sdk_library_project/libs/umeng-share-core-7.1.6.jar
social_sdk_library_project/libs/umeng-share-sina-full-7.1.1.jar (deleted)
social_sdk_library_project/libs/umeng-share-sina-full-7.1.6.jar
social_sdk_library_project/libs/umeng-share-wechat-full-7.1.1.jar (deleted)
social_sdk_library_project/libs/umeng-share-wechat-full-7.1.6.jar
social_sdk_library_project/libs/umeng-shareboard-widget-7.1.6.jar
social_sdk_library_project/libs/umeng-sharetool-7.1.1.jar (deleted)
social_sdk_library_project/libs/umeng-sharetool-7.1.6.jar |