Commit b817f80d authored by 刘明明's avatar 刘明明

福利一份购

parents
/build/
/fusion_sdk/build/
/app/build/
/halomobi_sdk/build/
/1.0.0.0.iml
/fs_1.2.4.0.iml
/.idea/
/.gradle/
/fusion_sdk/.gradle/
/halomobi_sdk/.gradle/
2068725
2068729
2068731
2068735
2069603
2069604
2069605
2069606
2069607
2069608
2069609
2069610
2069611
2069612
2069613
2069614
2069615
2069616
2069617
2069618
2069619
2069620
2069621
2069622
2069623
2069624
2069625
2069626
2069627
2069628
2069629
2069678
2069679
2069680
2069681
2069682
2069683
2069684
2069685
2069686
2069687
2069688
2069689
2069690
2069691
2069692
2069693
2069694
2069695
2069696
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
//noinspection GradleDependency
compileSdkVersion 32
signingConfigs {
config {
keyAlias 'key0'
keyPassword '123456'
storeFile file('D:\\Halomobi\\HaloDemoSigin\\halotao.jks')
storePassword '123456'
}
}
defaultConfig {
applicationId "com.halo.tb"
minSdkVersion 24
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
buildConfigField "String", "TASK_ID", project.taskId
minifyEnabled true
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
sourceSets {
main {
jni {
srcDirs 'src\\main\\jni'
}
}
}
buildToolsVersion '28.0.3'
flavorDimensions "market"
def values = new File('D:\\Halomobi\\HaloDemo\\app\\build-values.txt').readLines()
values.each { value ->
productFlavors.create("${value}") {
buildConfigField "String", "CHANNEL_NAME", "\"${value}\""
}
}
productFlavors.all {
dimension "market"
}
}
repositories {
flatDir {
dirs 'libs' // 申明本地库
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
api 'com.github.gzu-liyujiang:Android_CN_OAID:4.2.12'
api 'com.google.zxing:core:3.4.1'
// 对于编码和解码功能
api 'com.journeyapps:zxing-android-embedded:4.2.0'
}
task executeAssembleRelease {
//先执行打包任务
dependsOn 'assembleRelease'
//在操作apk包
doLast {
android.applicationVariants.all { variant ->
if ('release'.equalsIgnoreCase(variant.buildType.name)) {
println '------------------------------>release包'
// 打包完成后复制到的目录
def outputFileDir = "${project.projectDir.absolutePath}/${variant.buildType.name}/"
println "------------------------------$outputFileDir"
variant.assembleProvider.configure {
File out = new File(outputFileDir)
variant.outputs.forEach { file ->
def newFileName = "halodhh-${variant.flavorName.replace('"', '')}.apk"
copy {
from file.outputFile
into out
rename { String fileName -> newFileName }
}
println '------------------------------>打包完成'
println "------------------------------>包名称:${newFileName}"
println "------------------------------>地址:${out}"
}
}
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.jdd</groupId>
<artifactId>open_demo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>open_demo</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<skipTests>true</skipTests>
<profiles.dir>src/main/profiles</profiles.dir>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.13</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<profile.dir>${profiles.dir}/dev</profile.dir>
<env>dev</env>
</properties>
<build>
<resources>
<resource>
<directory>${profiles.dir}/dev</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>test</id>
<properties>
<profile.dir>${profiles.dir}/test</profile.dir>
<env>test</env>
</properties>
<build>
<resources>
<resource>
<directory>${profiles.dir}/test</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>pre</id>
<properties>
<profile.dir>${profiles.dir}/pre</profile.dir>
<env>pre</env>
</properties>
<build>
<resources>
<resource>
<directory>${profiles.dir}/pre</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>product</id>
<properties>
<profile.dir>${profiles.dir}/prod</profile.dir>
<env>product</env>
</properties>
<build>
<resources>
<resource>
<directory>src/main/profiles/prod</directory>
</resource>
</resources>
</build>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>deploy</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/bin</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/bin</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.zjkj.gtm">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<!--可选权限-->
<!--获取设备的电话状态信息-->
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<!--获取位置信息权限-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:name="com.halo.tb.MyApplication"
android:allowBackup="false"
android:icon="@drawable/demo_icon"
android:label="@string/app_name"
android:roundIcon="@drawable/demo_icon"
android:supportsRtl="true"
android:hardwareAccelerated="true"
android:resizeableActivity="false"
android:extractNativeLibs="true"
android:networkSecurityConfig="@xml/network_security_config"
android:usesCleartextTraffic="true"
tools:replace="android:theme,android:resizeableActivity,android:allowBackup"
android:theme="@style/AppTheme"
tools:ignore="DiscouragedApi,UnusedAttribute">
<uses-library android:name="org.apache.http.legacy" android:required="false" />
<activity
android:name="com.halo.tb.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity">
<intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
This diff is collapsed.
package com.halo.tb;
import android.app.Application;
import com.github.gzuliyujiang.oaid.DeviceIdentifier;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
DeviceIdentifier.register(this);
}
@Override
public void onTerminate() {
super.onTerminate();
}
}
package com.halo.tb.http;
import android.annotation.SuppressLint;
import java.security.cert.X509Certificate;
import javax.net.ssl.X509TrustManager;
@SuppressLint("CustomX509TrustManager")
public class MyX509TrustManager implements X509TrustManager {
@SuppressLint("TrustAllX509TrustManager")
public void checkClientTrusted(X509Certificate[] chain, String authType) {
}
@SuppressLint("TrustAllX509TrustManager")
public void checkServerTrusted(X509Certificate[] chain, String authType) {
}
public X509Certificate[] getAcceptedIssuers() {
return new java.security.cert.X509Certificate[]{};
}
}
package com.halo.tb.http;
import android.annotation.SuppressLint;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
public class TrustAnyHostnameVerifier implements HostnameVerifier {
@SuppressLint("BadHostnameVerifier")
public boolean verify(String hostname, SSLSession session) {
return true;
}
}
package com.halo.tb.request.config;
public class ConfigResult {
public static String deepLink;
public static String h5Url;
public static String qcCodeMsg;
public static String qcCode;
public static String qcCodeUrl;
}
package com.halo.tb.request.config;
import com.zjkj.gtm.BuildConfig;
public interface ConstantPool {
String UA_KEY = "UA_KEY_web";
String CHANNEL= BuildConfig.CHANNEL_NAME;
String TASKID= BuildConfig.TASK_ID;
interface EroType {
// --------统计的错误------
int EXCEPTION = 1001;
}
}
package com.halo.tb.request.config;
import java.io.Closeable;
import java.io.IOException;
public class FileUtils {
/**
* 关闭流
*/
public static void close(Closeable... io) {
for (Closeable closeable : io) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
package com.halo.tb.request.config;
public class HttpUrlSetting {
/**
* 获取Host
*
* @return 根据不同环境返回不同Host
*/
private static String getHost() {
return "http://adx-test.halomobi.com/bid/cb/tui/";
}
/**
* 获取请求
*/
public static String getRequestClickUrl() {
return getHost() + "click/dhh?";
}
public static String getRequestbudget() {
return getHost() + "check/dhh?";
}
public static String getRequestqcCode() {
return getHost() + "status/dhh?";
}
}
package com.halo.tb.request.config;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.zip.GZIPInputStream;
import java.util.zip.InflaterInputStream;
public class Utils {
private static final String SP_KEY_NAME = "_info";
public static Context mContext;
public static String mConfigInfo = "";
public static Context getContext() {
return mContext;
}
public static SharedPreferences getSp() {
return getContext().getSharedPreferences(SP_KEY_NAME, 0);
}
public static BufferedInputStream decodeInputStream(InputStream inputStream, String contentEncoding) throws IOException {
if (TextUtils.isEmpty(contentEncoding)) {
return new BufferedInputStream(inputStream);
} else if (contentEncoding.toLowerCase().equals("gzip")) {
return new BufferedInputStream(new GZIPInputStream(inputStream));
} else if (contentEncoding.toLowerCase().equals("deflate")) {
return new BufferedInputStream(new InflaterInputStream(inputStream));
} else {
return new BufferedInputStream(inputStream);
}
}
public static String parseInputString(BufferedInputStream inputStream) throws Exception {
String response = null;
if (inputStream != null) {
BufferedReader reader = null;
try {
StringBuilder sb = new StringBuilder();
reader = new BufferedReader(new InputStreamReader(
inputStream, "UTF-8"));
String line = null;
while ((line = reader.readLine()) != null) {
// LogUtils.d(line);
sb.append(line);
}
response = new String(sb);
} finally {
FileUtils.close(inputStream);
FileUtils.close(reader);
}
}
return response;
}
}
package com.halo.tb.request.deeptask;
public abstract class AbsNetProcessor implements NetTaskListener {
private TaskManager mTaskManager = null;
protected abstract AbsNetTask createNetTask();
public void process() {
AbsNetTask netTask = createNetTask();
netTask.setListener(this);
// 默认是自启动模式.
if (mTaskManager != null) {
mTaskManager.addTask(netTask);
return;
}
ThreadManager.getLongPool().execute(netTask);
}
}
package com.halo.tb.request.deeptask;
import static com.halo.tb.request.config.ConstantPool.EroType.EXCEPTION;
import static com.halo.tb.request.config.ConstantPool.UA_KEY;
import android.text.TextUtils;
import com.halo.tb.http.MyX509TrustManager;
import com.halo.tb.http.TrustAnyHostnameVerifier;
import com.halo.tb.request.config.FileUtils;
import com.halo.tb.request.config.Utils;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
/**
* 网络加载抽象任务类
*/
public abstract class AbsNetTask implements ITask {
private ReqType reqType;
private NetTaskListener mListener;
private boolean isGzipRequest = false;
/**
* HTTP链接超时时间
*/
private static final int HTTP_TIMEOUT = 100 * 1000;
/**
* 请求获取数据超时时间
*/
private static final int SOCKET_TIMEOUT = 100 * 1000;
/**
* 是否通过IP对应关系重发网络请求
*/
private boolean isReTry = false;
/**
* 设置是否可以通过IP对应关系进行重发网络请求
*
* @param reTry 是否重发
*/
protected void setReTry(boolean reTry) {
isReTry = reTry;
}
public AbsNetTask(ReqType type) {
this.reqType = type;
}
@Override
public void run() {
if (!NetworkUtils.isNetworkConnected(Utils.getContext())) {
if (mListener != null) {
mListener.onNetworkError();
}
return;
}
execute();
}
protected abstract byte[] getEntity();
protected abstract String getUrl() throws Exception;
public void setListener(NetTaskListener netTaskListener) {
this.mListener = netTaskListener;
}
protected abstract void onAddHeaders(HttpURLConnection urlConnection);
private void execute() {
HttpResult httpResult = null;
try {
String url = getUrl();
HttpURLConnection connection = openConnection(url);
httpResult = getHttpResult(connection, 1, 1);
if (httpResult == null) {
onErrorReceived("httpResult is Empty ",1);
return;
}
int resultCode = httpResult.getCode();
if (resultCode < 200 || resultCode >= 400) { // 大于400 网络错误
onErrorReceived("NetException:" + HttpResult.getMsgByErrorCode(resultCode), resultCode);
return;
}
if (mListener != null) { //200<=resultCode<=300代表请求成功
mListener.onDataReceived(httpResult);
}
} catch (Exception e) {
onErrorReceived("httpPost is Exception ",2);
e.printStackTrace();
} finally {
if (httpResult != null) {
httpResult.close();
}
}
}
private HttpResult getHttpResult(HttpURLConnection connection, int RedirectsNum, int reTryNum) throws Exception {
if (connection == null) {
if (mListener != null) {
mListener.onNetworkError();
}
return null;
}
if (RedirectsNum >= 5) {
onErrorReceived("循环重定向超过5次: " + getUrl(), EXCEPTION);
return null;
}
HttpResult httpResult;
try {
httpResult = new HttpResult(connection);
int resultCode = httpResult.getCode();
// 广告请求成功
if (resultCode > 300 && resultCode < 400) {
String location = connection.getHeaderField("Location");
if (!TextUtils.isEmpty(location)) {
httpResult = getHttpResult(openConnection(location), ++RedirectsNum, reTryNum);
} else {
}
}
} catch (SocketTimeoutException e) {
if (reTryNum >= 3) {
throw e;
}
httpResult = getHttpResult(openConnection(getUrl()), RedirectsNum, ++reTryNum);
e.printStackTrace();
}
return httpResult;
}
protected void setGzipRequest(boolean isGzipRequest) {
this.isGzipRequest = isGzipRequest;
}
public HttpURLConnection openConnection(String url) throws Exception {
if (TextUtils.isEmpty(url)) {
return null;
}
URL Url = new URL(url);
String str_http = url.substring(0, url.indexOf(":"));
HttpURLConnection connection;
if (str_http.equals("https")) {
connection = getHttpsURLConnection(Url);
} else {
connection = getHttpURLConnection(Url);
}
return dealWithHttpConnection(connection);
}
private HttpURLConnection dealWithHttpConnection(HttpURLConnection connection) throws Exception {
if (isGzipRequest) {
connection.addRequestProperty("Content-Type", "text/html");
connection.addRequestProperty("Accept-Encoding", "gzip,deflate");
} else {
connection.addRequestProperty("Accept-Encoding", "");
connection.setRequestProperty("Content-Type", "application/json;charset=utf-8");
}
String ua = Utils.getSp().getString(UA_KEY, "");
if (!TextUtils.isEmpty(ua)) {
connection.addRequestProperty("User-agent", ua);
}
onAddHeaders(connection);
switch (reqType) {
case Get:
connection.setRequestMethod("GET");
break;
case Post:
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setDoInput(true);
OutputStream outputStream = null;
try {
outputStream = connection.getOutputStream();
byte[] entity = getEntity();
if (entity != null && entity.length > 0) {
outputStream.write(entity);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
FileUtils.close(outputStream);
}
break;
default:
break;
}
return connection;
}
private HttpURLConnection getHttpURLConnection(URL url) throws IOException {
HttpURLConnection httpURLConnection;
httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setConnectTimeout(SOCKET_TIMEOUT);
httpURLConnection.setReadTimeout(HTTP_TIMEOUT);
httpURLConnection.setInstanceFollowRedirects(true);
httpURLConnection.setRequestProperty("Accept-Charset", "UTF-8");
return httpURLConnection;
}
private HttpsURLConnection getHttpsURLConnection(URL url) throws IOException, NoSuchAlgorithmException, KeyManagementException {
HttpsURLConnection httpsURLConnection;
httpsURLConnection = (HttpsURLConnection) url.openConnection();
httpsURLConnection.setConnectTimeout(SOCKET_TIMEOUT);
httpsURLConnection.setReadTimeout(HTTP_TIMEOUT);
TrustManager[] tm = {new MyX509TrustManager()};
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, tm, null);
System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");
httpsURLConnection.setSSLSocketFactory(sslContext.getSocketFactory());
httpsURLConnection.setHostnameVerifier(new TrustAnyHostnameVerifier());
httpsURLConnection.setInstanceFollowRedirects(true);
httpsURLConnection.setRequestProperty("Accept-Charset", "UTF-8");
return httpsURLConnection;
}
public enum ReqType {
Get, Post
}
/**
* 请求发生错误
*
* @param eroMsg 错误信息
* @param eroCode 错误码
*/
private void onErrorReceived(String eroMsg, int eroCode) {
if (mListener != null) {
mListener.onErrorReceived(eroMsg, eroCode);
}
}
}
package com.halo.tb.request.deeptask;
import android.text.TextUtils;
import com.halo.tb.request.config.FileUtils;
import com.halo.tb.request.config.Utils;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
/**
* Created by liuzheng on 2017/2/28.
*/
public class HttpResult {
private static final String[] httpCode3XXs = {"多选项", "永久移动", "临时移动",
"参见其他", "未改动", "使用代理", "", "暂时重定向"};
private static final String[] httpCode4XXs = {"错误请求", "未授权", "要求付费", "禁止",
"未找到", "不允许的方法", "不被采纳", "要求代理授权", "请求超时", "冲突", "过期的", "要求的长度",
"前提不成立", "请求实例太大", "请求URI太大", "不支持的媒体类型", "无法满足的请求范围", "失败的预期"};
private static final String[] httpCode5XXs = {"内部服务器错误", "未被使用", "网关错误",
"不可用的服务", "网关超时", "HTTP版本未被支持"};
private HttpURLConnection mConnection;
private InputStream mIn;
private String mStr;
private int mCode;
public HttpResult(HttpURLConnection connection) throws IOException {
mConnection = connection;
mCode = connection.getResponseCode();
}
/**
* @param statusCode 状态码
* @return ErrorMsg
*/
public static String getMsgByErrorCode(int statusCode) {
String resultMsg = "";
if (300 <= statusCode && statusCode < 400) {
resultMsg = "重定向:" + statusCode;
int code = statusCode - 300;
if (code < httpCode3XXs.length) {
resultMsg += "----->" + httpCode3XXs[code];
}
}
if (400 <= statusCode && statusCode < 500) {
resultMsg = "客户端错误:" + statusCode;
int code = statusCode - 400;
if (code < httpCode4XXs.length) {
resultMsg += "----->" + httpCode4XXs[code];
}
} else if (500 <= statusCode) {
resultMsg = "服务器错误:" + statusCode;
int code = statusCode - 500;
if (code < httpCode5XXs.length) {
resultMsg += "----->" + httpCode5XXs[code];
}
}
return resultMsg;
}
public HttpURLConnection getHttpResponse() {
return mConnection;
}
public int getCode() {
return mCode;
}
/**
* 从结果中获取字符串,一旦获取,会自动关流,并且把字符串保存,方便下次获取
*/
public String getString() {
if (!TextUtils.isEmpty(mStr)) {
return mStr;
}
InputStream inputStream = getInputStream();
String contentEncoding = mConnection.getContentEncoding();
try {
mStr = Utils.parseInputString(Utils.decodeInputStream(inputStream, contentEncoding));
if (TextUtils.isEmpty(mStr)) {
mStr = mConnection.getResponseMessage();
}
} catch (Exception e) {
e.printStackTrace();
}
return mStr;
}
/**
* 获取文件长度
*/
public long getLength() {
if (getCode() >= 200 && getCode() < 400) {
return mConnection.getContentLength();
}
return 0;
}
/**
* 获取流,需要使用完毕后调用close方法关闭网络连接
*/
public InputStream getInputStream() {
if (mIn == null && getCode() < 400) {
try {
mIn = mConnection.getInputStream();
} catch (Exception e) {
e.printStackTrace();
}
}
return mIn;
}
/**
* 关闭网络连接
*/
public void close() {
FileUtils.close(mIn);
if (mConnection != null) {
mConnection.disconnect();
}
}
}
package com.halo.tb.request.deeptask;
public interface ITask extends Runnable {
LaunchMode getLaunchMode();
String getName();
/**
* 启动模式
*/
enum LaunchMode {
/**
* 更新旧的Task(按照TaskName,先删掉旧的,再添加新的)
*/
REPLACE_OLD,
/**
* 添加新的Task
*/
ADD_NEW,
}
}
package com.halo.tb.request.deeptask;
public interface NetTaskListener {
/**
* 获得服务器返回数据(可能是正确数据,也可能是错误数据,这里不做检验)
*/
void onDataReceived(HttpResult result) throws Exception;
/**
* 返回错误
*
* @param eroMsg 错误信息
* @param eroCode 错误码
*/
void onErrorReceived(String eroMsg, int eroCode);
/**
* 网络异常(HTTP返回码不为200时,均认为网络异常)
*/
void onNetworkError();
}
\ No newline at end of file
package com.halo.tb.request.deeptask;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public class NetworkUtils {
/**
* 当前网络是否可用
*
* @param cxt Context
* @return activeNetInfo.isConnected();
*/
public static boolean isNetworkConnected(Context cxt) {
ConnectivityManager connectivityManager = (ConnectivityManager) cxt
.getApplicationContext().getSystemService(
Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetInfo != null) {
return activeNetInfo.isConnected();
}
return false;
}
}
package com.halo.tb.request.deeptask;
import android.content.Context;
public class RequestManager {
private static RequestManager mInstance;
public static Context mContext;
private RequestManager() {
}
public static synchronized RequestManager getInstance(Context context) {
mContext=context;
if (mInstance == null) {
mInstance = new RequestManager();
}
return mInstance;
}
/**
* 请求
*/
public void request(ResultListener listener,String type) {
new RequestProcessor(mContext,listener,type).process();
}
}
package com.halo.tb.request.deeptask;
import android.content.Context;
import android.text.TextUtils;
import com.halo.tb.request.config.ConfigResult;
import org.json.JSONException;
import org.json.JSONObject;
class RequestProcessor extends AbsNetProcessor {
private Context mContext;
private ResultListener resultListener;
private String mType;
RequestProcessor(Context context, ResultListener listener, String type) {
mContext = context;
resultListener = listener;
mType = type;
}
@Override
protected AbsNetTask createNetTask() {
return new RequestTask(mContext, mType);
}
@Override
public void onDataReceived(HttpResult result) {
try {
JSONObject object = new JSONObject(result.getString());
switch (mType) {
case "budget":
JSONObject hostData = object.optJSONObject("data");
if (hostData != null) {
ConfigResult.h5Url = hostData.getString("h5");
resultListener.successCallback(ConfigResult.h5Url);
} else {
resultListener.failedCallback("result is empty");
}
break;
case "click":
resultListener.successCallback("data post success" + result.getString());
break;
case "qcCode":
JSONObject codeData = object.optJSONObject("data");
if (codeData != null) {
ConfigResult.qcCodeMsg = codeData.getString("msg");
ConfigResult.qcCode = codeData.getString("code");
ConfigResult.qcCodeUrl = codeData.getString("url");
if(!TextUtils.isEmpty(ConfigResult.qcCode) && !TextUtils.isEmpty(ConfigResult.qcCodeMsg) && !TextUtils.isEmpty(ConfigResult.qcCodeUrl)) {
resultListener.successCallback(ConfigResult.qcCodeMsg, ConfigResult.qcCode, ConfigResult.qcCodeUrl);
}else {
resultListener.failedCallback("result is empty");
}
} else {
resultListener.failedCallback("result is empty");
}
break;
}
} catch (Exception e) {
e.printStackTrace();
resultListener.failedCallback("json exception");
}
}
@Override
public void onErrorReceived(String eroMsg, int eroCode) {
resultListener.failedCallback("errorMsg:" + eroMsg + ":errorCode:" + eroCode);
}
@Override
public void onNetworkError() {
resultListener.failedCallback("network exception");
}
@Override
public void process() {
super.process();
}
}
package com.halo.tb.request.deeptask;
import android.app.Activity;
import android.content.Context;
import android.widget.Toast;
import com.github.gzuliyujiang.oaid.DeviceIdentifier;
import com.halo.tb.request.config.ConstantPool;
import com.halo.tb.request.config.HttpUrlSetting;
import java.net.HttpURLConnection;
class RequestTask extends AbsNetTask {
private static Context mContext;
private String mType;
RequestTask(Context context, String type) {
super(ReqType.Get);
mContext = context;
mType = type;
}
@Override
protected byte[] getEntity() {
return new byte[0];
}
@Override
protected String getUrl() {
switch (mType) {
case "budget":
return HttpUrlSetting.getRequestbudget() + "oaid=" + DeviceIdentifier.getOAID(mContext) + "&slotid=" + ConstantPool.CHANNEL + "&taskid=" + ConstantPool.TASKID;
case "click":
return HttpUrlSetting.getRequestClickUrl() + "oaid=" + DeviceIdentifier.getOAID(mContext) + "&slotid=" + ConstantPool.CHANNEL + "&taskid=" + ConstantPool.TASKID;
case "qcCode":
return HttpUrlSetting.getRequestqcCode() + "oaid=" + DeviceIdentifier.getOAID(mContext) + "&slotid=" + ConstantPool.CHANNEL + "&taskid=" + ConstantPool.TASKID;
}
return null;
}
@Override
protected void onAddHeaders(HttpURLConnection connection) {
}
@Override
public LaunchMode getLaunchMode() {
return LaunchMode.ADD_NEW;
}
@Override
public String getName() {
return getClass().getSimpleName();
}
}
package com.halo.tb.request.deeptask;
public interface ResultListener {
void successCallback(String result);
void successCallback(String msg,String code,String url);
void failedCallback(String error);
}
package com.halo.tb.request.deeptask;
import java.util.HashMap;
public class TaskManager {
private HashMap<String, ITask> mTaskQueue;
private ThreadManager.ThreadPoolProxy mThreadPoolProxy;
public TaskManager() {
mTaskQueue = new HashMap<>();
mThreadPoolProxy = ThreadManager.getSinglePool(hashCode() + "");
}
/**
* 添加任务到队列
*
* @param task 任务
*/
public synchronized void addTask(ITask task) {
// 根据Task启动模式,控制添加方式.
if (task.getLaunchMode() == ITask.LaunchMode.REPLACE_OLD) {
ITask lastTAsk = mTaskQueue.put(task.getName(), task);
mThreadPoolProxy.cancel(lastTAsk);
}
mThreadPoolProxy.execute(task);
}
}
package com.halo.tb.request.deeptask;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.ThreadPoolExecutor.AbortPolicy;
import java.util.concurrent.TimeUnit;
public class ThreadManager {
private static final String DEFAULT_SINGLE_POOL_NAME = "DEFAULT_SINGLE_POOL_NAME";
private static ThreadPoolProxy mLongPool = null;
private static ThreadPoolProxy mShortPool = null;
private static ThreadPoolProxy mDownloadPool = null;
private static ThreadPoolProxy mCheckViewPool = null;
private static ThreadPoolProxy mRequestAdPool = null;
private static Map<String, ThreadPoolProxy> mMap = new HashMap<>();
private static final Object mSingleLock = new Object();
/**
* 请求广告线程
*/
public synchronized static ThreadPoolProxy getRequestAdPool() {
if (mRequestAdPool == null) {
mRequestAdPool = new ThreadPoolProxy(3, 5, 5L);
}
return mRequestAdPool;
}
/**
* 获取下载线程
*/
public synchronized static ThreadPoolProxy getDownloadPool() {
if (mDownloadPool == null) {
mDownloadPool = new ThreadPoolProxy(3, 3, 5L);
}
return mDownloadPool;
}
public synchronized static ThreadPoolProxy getCheckViewPool() {
if (mCheckViewPool == null) {
mCheckViewPool = new ThreadPoolProxy(3, 3, 5L);
}
return mCheckViewPool;
}
/**
* 获取一个用于执行长耗时任务的线程池,避免和短耗时任务处在同一个队列而阻塞了重要的短耗时任务,通常用来联网操作
*/
public synchronized static ThreadPoolProxy getLongPool() {
if (mLongPool == null) {
mLongPool = new ThreadPoolProxy(3, 5, 5L);
}
return mLongPool;
}
/**
* 获取一个用于执行短耗时任务的线程池,避免因为和耗时长的任务处在同一个队列而长时间得不到执行,通常用来执行本地的IO/SQL
*/
public synchronized static ThreadPoolProxy getShortPool() {
if (mShortPool == null) {
mShortPool = new ThreadPoolProxy(2, 2, 5L);
}
return mShortPool;
}
/**
* 获取一个单线程池,所有任务将会被按照加入的顺序执行,免除了同步开销的问题
*/
public static ThreadPoolProxy getSinglePool() {
return getSinglePool(DEFAULT_SINGLE_POOL_NAME);
}
/**
* 获取一个单线程池,所有任务将会被按照加入的顺序执行,免除了同步开销的问题
*/
public static ThreadPoolProxy getSinglePool(String name) {
synchronized (mSingleLock) {
ThreadPoolProxy singlePool = mMap.get(name);
if (singlePool == null) {
singlePool = new ThreadPoolProxy(1, 1, 1L);
mMap.put(name, singlePool);
}
return singlePool;
}
}
public static void onDestroy() {
Set<Map.Entry<String, ThreadPoolProxy>> entries = mMap.entrySet();
for (Map.Entry<String, ThreadPoolProxy> entry : entries) {
entry.getValue().shutdown();
}
mMap.clear();
getCheckViewPool().stop();
}
public static class ThreadPoolProxy {
private ThreadPoolExecutor mPool;
private int mCorePoolSize;
private int mMaximumPoolSize;
private long mKeepAliveTime;
private ThreadPoolProxy(int corePoolSize, int maximumPoolSize, long keepAliveTime) {
mCorePoolSize = corePoolSize;
mMaximumPoolSize = maximumPoolSize;
mKeepAliveTime = keepAliveTime;
}
/**
* 执行任务,当线程池处于关闭,将会重新创建新的线程池
*/
public synchronized void execute(Runnable task) {
if (task == null) {
return;
}
if (mPool == null || mPool.isShutdown()) {
mPool = new ThreadPoolExecutor(mCorePoolSize, mMaximumPoolSize, mKeepAliveTime,
TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
Executors.defaultThreadFactory(), new AbortPolicy());
}
mPool.execute(task);
}
/**
* 取消线程池中某个还未执行的任务
*/
public synchronized boolean cancel(Runnable run) {
return mPool != null && (!mPool.isShutdown() || mPool.isTerminating()) && mPool.getQueue().remove(run);
}
/**
* 判断队列中是否包含该任务
*/
public synchronized boolean contains(Runnable run) {
return mPool != null && (!mPool.isShutdown() || mPool.isTerminating()) && mPool.getQueue().contains(run);
}
/**
* 立刻关闭线程池,并且正在执行的任务也将会被中断
*/
synchronized void stop() {
if (mPool != null && (!mPool.isShutdown() || mPool.isTerminating())) {
mPool.shutdownNow();
}
}
/**
* 平缓关闭单任务线程池,但是会确保所有已经加入的任务都将会被执行完毕才关闭
*/
synchronized void shutdown() {
if (mPool != null && (!mPool.isShutdown() || mPool.isTerminating())) {
mPool.shutdown();
}
}
}
}
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeColor="#00000000"
android:strokeWidth="1">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0"/>
<item
android:color="#00000000"
android:offset="1.0"/>
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeColor="#00000000"
android:strokeWidth="1"/>
</vector>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<ImageView
android:id="@+id/imbg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/budgetbcakground"
android:importantForAccessibility="no" />
<TextView
android:id="@+id/text_code_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:paddingTop="60dp"
android:textColor="#000000"
android:textSize="30sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="@+id/text_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text_code_state"
android:layout_centerHorizontal="true"
android:paddingTop="20dp"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="gone" />
<ImageView
android:id="@+id/img_qrcode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text_code"
android:layout_centerHorizontal="true"
android:importantForAccessibility="no"
android:paddingTop="20dp"
android:visibility="gone" />
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<TextView
android:id="@+id/failed_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/FailedTitle"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="gone" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/large_qr_code_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:importantForAccessibility="no" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white">#ffffff</color>
</resources>
\ No newline at end of file
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="title_h">49dp</dimen>
<dimen name="home_btn_w">322dp</dimen>
<dimen name="home_btn_h">56dp</dimen>
<dimen name="home_btn_margin_b">19dp</dimen>
<dimen name="banner_pag_btn_w">131dp</dimen>
<dimen name="banner_pag_btn_h">36dp</dimen>
<dimen name="setting_btn_padding">14dp</dimen>
<dimen name="setting_inputs_margin_t">45dp</dimen>
<dimen name="safe_dimen">10dp</dimen>
<dimen name="safe_dimen_small">6dp</dimen>
<dimen name="line_w">346dp</dimen>
<dimen name="d_btn_w">68dp</dimen>
<dimen name="d_btn_h">29dp</dimen>
<dimen name="iv_source_w">25dp</dimen>
<dimen name="iv_source_h">13dp</dimen>
<!-- item_imag_small -->
<dimen name="imag_small_img_120">60dp</dimen>
<dimen name="imag_small_imgw">113dp</dimen>
<dimen name="imag_small_imgh">85dp</dimen>
<dimen name="imag_small_title_margin_l">11dp</dimen>
<!-- item_imag_small -->
<!-- item_imag_big -->
<dimen name="imag_big_imgw">340dp</dimen>
<dimen name="imag_big_imgh">171dp</dimen>
<dimen name="imag_big_imgw_600">300dp</dimen>
<dimen name="imag_big_imgh_400">200dp</dimen>
<dimen name="imag_big_margin_t">8dp</dimen>
<!-- item_imag_big -->
<!-- item_imags -->
<dimen name="item_imags_imgw">105dp</dimen>
<dimen name="item_imags_imgh">79dp</dimen>
<dimen name="item_imags_margin_l">13dp</dimen>
<!-- item_imags -->
<!-- setting pag -->
<dimen name="setting_pag_margin_title">45dp</dimen>
<dimen name="setting_pag_input_margin_b">30dp</dimen>
<dimen name="setting_pag_cbtn_margin_t">38dp</dimen>
<dimen name="setting_pag_input_w">300dp</dimen>
<dimen name="setting_pag_input_h">39dp</dimen>
<dimen name="setting_pag_cbtn_w">82dp</dimen>
<dimen name="setting_pag_cbtn_h">35dp</dimen>
<!-- setting pag -->
<!-- text_size -->
<dimen name="text_size_title">24sp</dimen>
<dimen name="text_size_btn_name">18sp</dimen>
<dimen name="text_size_item_source">10sp</dimen>
<dimen name="text_size_item_title">22sp</dimen>
<dimen name="text_size_item_title_small">20sp</dimen>
<dimen name="text_size_item_title_detail">16sp</dimen>
<!-- text_size -->
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">福利一分购</string>
<string name="FailedTitle">未检测到oaid,获取链接失败</string>
</resources>
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="home_pag_btn" parent="android:Widget.Holo.Light.Button">
<item name="android:layout_width">@dimen/home_btn_w</item>
<item name="android:layout_height">@dimen/home_btn_h</item>
<item name="android:textColor">@color/white</item>
<item name="android:textSize">@dimen/text_size_btn_name</item>
<item name="android:layout_marginBottom">@dimen/home_btn_margin_b</item>
</style>
<!-- <style name="setting_input" parent="android:Widget.Holo.Light.EditText">-->
<!-- <item name="android:layout_width">@dimen/setting_pag_input_w</item>-->
<!-- <item name="android:layout_height">@dimen/setting_pag_input_h</item>-->
<!-- <item name="android:background">@drawable/input_border</item>-->
<!-- <item name="android:inputType">number</item>-->
<!-- <item name="android:digits">1234567890</item>-->
<!-- <item name="android:layout_marginBottom">@dimen/setting_pag_input_margin_b</item>-->
<!-- <item name="android:padding">8dp</item>-->
<!-- <item name="android:textSize">@dimen/text_size_btn_name</item>-->
<!-- </style>-->
<style name="SplashTheme" parent="AppBaseTheme">
<!-- 欢迎页背景引用刚才写好的 -->
<item name="android:windowFullscreen">true</item>
<!-- <item name="android:windowIsTranslucent">true</item>-->
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:ns1="urn:oasis:names:tc:xliff:document:1.2">
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.41'
repositories {
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
maven { url "https://jitpack.io" }
maven { url 'https://developer.huawei.com/repo/' }
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.17'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
flatDir {
dirs 'libs'
}
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://developer.hihonor.com/repo' }
google()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://developer.huawei.com/repo/' }
}
}
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.injected.testOnly=false
android.enableR8.libraries = false
android.useAndroidX=true
android.enableJetifier=true
channelName = ""
taskId="219955634"
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Apr 01 15:21:29 CST 2025
sdk.dir=C\:\\Users\\EDY\\AppData\\Local\\Android\\Sdk
include ':app',':appDemo'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment