提交 2f4f8fa5 作者: enjoy

init

上级
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
.idea
\ No newline at end of file
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
boolean applicationFlag = rootProject.ext.info.applicationFlag.toBoolean()
android {
namespace 'com.juling.juliao'
compileSdk 33
defaultConfig {
applicationId "com.juling.juliao"
minSdk 25
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17//VERSION_1_8
targetCompatibility JavaVersion.VERSION_17//VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'17'//'1.8'
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
kapt rootProject.ext.android.arouter_kapt
if(!applicationFlag){
api project(path:":pro_juliao")
}
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.juling.juliao
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.juling.juliao", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
tools:replace="android:name"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Juliao"
tools:targetApi="31"
android:name=".App">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.juling.juliao
import android.app.Application
import com.alibaba.android.arouter.launcher.ARouter
import com.work.provide_tool.app.IApp
import com.work.provide_tool.general.General
class App :IApp(){
override fun onCreate() {
super.onCreate()
initial()
}
private fun initial(){
try {
for (value in General.widgetArray){
val clazz = Class.forName(value)
(clazz.getConstructor().newInstance() as IApp).init(app,false)
}
}catch (e:Exception){}
}
override fun init(app: Application, applicationFlag: Boolean) {
initRouter()
initAdapterUi()
}
private fun initRouter(){
ARouter.init(app)
}
private fun initAdapterUi(){
// 看官方例子
}
}
\ No newline at end of file
package com.juling.juliao
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.alibaba.android.arouter.launcher.ARouter
import com.work.provide_tool.general.RouterPath.WIDGET_MAIN
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
ARouter.getInstance().build(WIDGET_MAIN).navigation()
}
}
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
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="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.Juliao" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">juliao</string>
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.Juliao" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>
<style name="Theme.Juliao" parent="Base.Theme.Juliao" />
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>
\ No newline at end of file
package com.juling.juliao
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
}
apply from:"provide.gradle"
\ No newline at end of file
# 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=-Xmx2048m -Dfile.encoding=UTF-8
# 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
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
\ No newline at end of file
#Mon Nov 06 10:11:03 CST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-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 execute
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 execute
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
: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 %*
: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
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
plugins {
// id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
boolean applicationFlag = rootProject.ext.info.applicationFlag.toBoolean()
if(applicationFlag){
apply plugin: 'com.android.application'
}else {
apply plugin: 'com.android.library'
}
android {
namespace 'com.juling.pro_juliao'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
targetCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'1.8'
}
dataBinding{
enabled = true
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
kapt rootProject.ext.android.arouter_kapt
if(!applicationFlag){
api project(path:':widget_onepage')
api project(path:':widget_u_info')
api project(path:':widget_friend')
api project(path:':widget_login')
}
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.juling.pro_juliao
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.juling.pro_juliao.test", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:name=".app.JlApp">
<activity android:name="com.juling.pro_juliao.ui.Tt"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.juling.pro_juliao.app
import android.app.Application
import com.work.provide_tool.app.IApp
class JlApp :IApp(){
override fun init(app: Application, applicationFlag: Boolean) {
}
}
\ No newline at end of file
package com.juling.pro_juliao.ui
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.facade.annotation.Route
import com.juling.pro_juliao.R
import com.work.provide_tool.general.RouterPath.WIDGET_MAIN
@Route(path = WIDGET_MAIN)
class Tt :AppCompatActivity(){
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.tta)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="359dp"
android:layout_height="100dp"
android:background="#f00"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
package com.juling.pro_juliao
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
ext{
info=[
"applicationFlag":false
]
android=[
"vCode":1,
"verName":"1.0",
"lowSdk":22,
"targetSdk":34,
"sdkTool":34,
//ARouter
"arouter_api":"com.alibaba:arouter-api:1.5.2",
"arouter_kapt":"com.alibaba:arouter-compiler:1.5.2",
"retrofit2":"com.squareup.retrofit2:retrofit:2.9.0",
"retrofit2_gson":"com.squareup.retrofit2:converter-gson:2.9.0",
"livedata":"androidx.lifecycle:lifecycle-livedata-ktx:2.5.1",
"viewmodel":"androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1",
"androidx_kt":"androidx.core:core-ktx:1.7.0",
"androidx_app":"androidx.appcompat:appcompat:1.6.1",
// glide
"glide":"com.github.bumptech.glide:glide:4.11.0",
"glide_annotation":"com.github.bumptech.glide:compiler:4.11.0",
"glide_integration":"com.github.bumptech.glide:okhttp3-integration:4.11.0",
"view_adapter_helper":"com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.10",
//paging3
"paging":"androidx.paging:paging-runtime:3.1.1",
"paging_t":"androidx.paging:paging-common:3.1.1",
"android_activity_ktx":"androidx.activity:activity-ktx:1.2.0",
//invoke : ToastUtils.init(app)
"t":"com.github.getActivity:ToastUtils:9.5",
//jet 数据库
"api_room":"androidx.room:room-runtime:2.5.0",
"annotation_room":"androidx.room:room-compiler:2.5.0",
"kt_room":"androidx.room:room-ktx:2.5.0",
"kp_room":"androidx.room:room-compiler:2.5.0",
"paging_room":"androidx.room:room-paging:2.5.0",
//java v
"java_v":JavaVersion.VERSION_17,
"j_target":"17",
//适配
"auto_ui":"com.github.JessYanCoding:AndroidAutoSize:v1.2.1",
]
}
\ No newline at end of file
/build
\ No newline at end of file
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.work.provide_data'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17//VERSION_1_8
targetCompatibility JavaVersion.VERSION_17//VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'17'//'1.8'
}
}
dependencies {
implementation rootProject.ext.android.androidx_kt//'androidx.core:core-ktx:1.7.0'
implementation rootProject.ext.android.androidx_app//'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.work.provide_data
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.work.provide_data.test", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.work.provide_data">
</manifest>
\ No newline at end of file
package com.work.provide_data
//{"weatherinfo":
// {"city":"北京","cityid":"101010100","temp":"27.9","WD":"南风","WS":"小于3级",
// "SD":"28%","AP":"1002hPa","njd":"暂无实况","WSE":"<3","time":"17:55","sm":"2.1","isRadar":"1","Radar":"JC_RADAR_AZ9010_JB"}}
data class WeatherData(var weatherinfo: WeatherDataDetail) {
// var id:ObservableField<Int> = ObservableField<Int>()
// var city:ObservableField<String> = ObservableField<String>()
// constructor():this(0,"sz","gd")
data class WeatherDataDetail(var city:String = "city",var temp:String = "temp",var WD:String = "WD",
var SD:String = "SD",var AP:String = "AP",var njd:String = "njd")
}
\ No newline at end of file
package com.work.provide_data.origin
data class HttpArriveData<T>(val a:T,val info:String,val id:Int)
\ No newline at end of file
package com.work.provide_data.origin
data class HttpReqData(val reqInfo: HttpReqDataWithAgent){
data class HttpReqDataWithAgent(val info:Any)
}
\ No newline at end of file
package com.work.provide_data
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
/build
\ No newline at end of file
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.work.provide_general'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_17//VERSION_1_8
targetCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_17//VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'17'//'1.8'
}
}
dependencies {
implementation rootProject.ext.android.androidx_kt//'androidx.core:core-ktx:1.7.0'
implementation rootProject.ext.android.androidx_app//'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
api project(path: ':provide_tool')
api project(path: ':provide_net')
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.work.provide_general
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.work.provide_general.test", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.work.provide_general">
</manifest>
\ No newline at end of file
package com.work.provide_general
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
/build
\ No newline at end of file
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.work.longnet'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
targetCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.work.longnet
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.work.longnet.test", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
\ No newline at end of file
package com.work.longnet
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
/build
\ No newline at end of file
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.work.provide_net'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_17//VERSION_1_8
targetCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_17//VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'17'//'1.8'
}
}
dependencies {
implementation rootProject.ext.android.androidx_kt//'androidx.core:core-ktx:1.7.0'
implementation rootProject.ext.android.androidx_app//'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
api project(path: ':provide_data')
api(rootProject.ext.android.retrofit2)
api(rootProject.ext.android.retrofit2_gson)
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.work.provide_net
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.work.provide_net.test", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.work.provide_net">
</manifest>
\ No newline at end of file
package com.work.provide_net.net
import com.work.provide_data.WeatherData
import retrofit2.http.GET
import retrofit2.http.Path
interface Api {
@GET("/data/sk/{id}.html")
suspend fun getWeatherInfo(@Path("id") id:String):WeatherData
}
\ No newline at end of file
package com.work.provide_net.net
import com.work.provide_data.WeatherData
//NetHelper.netHelper.init(AppUrl.netUrl)调用这个即可
class NetHelper : Api {
private val netWorkEngine: NetWorkEngine = NetWorkEngine()
//java中的双重判断
companion object{
val netHelper: NetHelper by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
NetHelper()
}
}
fun init(reqUrl:String){
netWorkEngine.init(reqUrl)
}
override suspend fun getWeatherInfo(id:String): WeatherData {
return netWorkEngine.getWeatherInfo(id)
}
}
\ No newline at end of file
package com.work.provide_net.net
import com.work.provide_data.WeatherData
import com.work.provide_net.util.GsonConverterFactory
import okhttp3.OkHttpClient
import retrofit2.Retrofit
//import retrofit2.converter.gson.GsonConverterFactory
import java.lang.NullPointerException
class NetWorkEngine : Api {
private lateinit var retrofit:Retrofit
private lateinit var reqUrl:String
private var api: Api? = null
get() {
if(!::reqUrl.isInitialized){
throw NullPointerException("url hasn't init , invoke NetWorkEngine#init()")
}
return field
}
fun init(reqUrl:String){
reqUrl.let {
this@NetWorkEngine.reqUrl = it
initRetrofit(it)
}
}
private fun initRetrofit(reqUrl: String){
retrofit = Retrofit.Builder()
.baseUrl(reqUrl)
.client(provideClient())
// .addCallAdapterFactory()
.addConverterFactory(GsonConverterFactory.create())
.build()
api = retrofit.create(Api::class.java)
}
private fun provideClient():OkHttpClient{
return OkHttpClient.Builder()
.build()
}
override suspend fun getWeatherInfo(id:String): WeatherData {
return api!!.getWeatherInfo(id)
}
}
\ No newline at end of file
/*
* Copyright (C) 2015 Square, Inc.
*
* 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
*
* http://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.
*/
package com.work.provide_net.util;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.reflect.TypeToken;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Converter;
import retrofit2.Retrofit;
/**
* A {@linkplain Converter.Factory converter} which uses Gson for JSON.
*
* <p>Because Gson is so flexible in the types it supports, this converter assumes that it can
* handle all types. If you are mixing JSON serialization with something else (such as protocol
* buffers), you must {@linkplain Retrofit.Builder#addConverterFactory(Converter.Factory) add this
* instance} last to allow the other converters a chance to see their types.
*/
public final class GsonConverterFactory extends Converter.Factory {
/**
* Create an instance using a default {@link Gson} instance for conversion. Encoding to JSON and
* decoding from JSON (when no charset is specified by a header) will use UTF-8.
*/
public static GsonConverterFactory create() {
return create(new Gson());
}
/**
* Create an instance using {@code gson} for conversion. Encoding to JSON and decoding from JSON
* (when no charset is specified by a header) will use UTF-8.
*/
@SuppressWarnings("ConstantConditions") // Guarding public API nullability.
public static GsonConverterFactory create(Gson gson) {
if (gson == null) throw new NullPointerException("gson == null");
return new GsonConverterFactory(gson);
}
private final Gson gson;
private GsonConverterFactory(Gson gson) {
this.gson = gson;
}
@Override
public Converter<ResponseBody, ?> responseBodyConverter(
Type type, Annotation[] annotations, Retrofit retrofit) {
TypeAdapter<?> adapter = gson.getAdapter(TypeToken.get(type));
return new GsonResponseBodyConverter<>(gson, adapter);
}
@Override
public Converter<?, RequestBody> requestBodyConverter(
Type type,
Annotation[] parameterAnnotations,
Annotation[] methodAnnotations,
Retrofit retrofit) {
TypeAdapter<?> adapter = gson.getAdapter(TypeToken.get(type));
return new GsonRequestBodyConverter<>(gson, adapter);
}
}
/*
* Copyright (C) 2015 Square, Inc.
*
* 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
*
* http://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.
*/
package com.work.provide_net.util;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.Charset;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okio.Buffer;
import retrofit2.Converter;
final class GsonRequestBodyConverter<T> implements Converter<T, RequestBody> {
private static final MediaType MEDIA_TYPE = MediaType.get("application/json; charset=UTF-8");
private static final Charset UTF_8 = Charset.forName("UTF-8");
private final Gson gson;
private final TypeAdapter<T> adapter;
GsonRequestBodyConverter(Gson gson, TypeAdapter<T> adapter) {
this.gson = gson;
this.adapter = adapter;
}
@Override
public RequestBody convert(T value) throws IOException {
Buffer buffer = new Buffer();
Writer writer = new OutputStreamWriter(buffer.outputStream(), UTF_8);
JsonWriter jsonWriter = gson.newJsonWriter(writer);
adapter.write(jsonWriter, value);
jsonWriter.close();
return RequestBody.create(MEDIA_TYPE, buffer.readByteString());
}
}
/*
* Copyright (C) 2015 Square, Inc.
*
* 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
*
* http://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.
*/
package com.work.provide_net.util;
import com.google.gson.Gson;
import com.google.gson.JsonIOException;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import okhttp3.ResponseBody;
import retrofit2.Converter;
final class GsonResponseBodyConverter<T> implements Converter<ResponseBody, T> {
private final Gson gson;
private final TypeAdapter<T> adapter;
GsonResponseBodyConverter(Gson gson, TypeAdapter<T> adapter) {
this.gson = gson;
this.adapter = adapter;
}
@Override
public T convert(ResponseBody value) throws IOException {
String readerInfo = convertStreamToString(value.byteStream());
try {
JSONObject j = new JSONObject(readerInfo);
//TODO1
JsonReader jsonReader = gson.newJsonReader(new StringReader(j.toString()));
T result = adapter.read(jsonReader);
if (jsonReader.peek() != JsonToken.END_DOCUMENT) {
throw new JsonIOException("JSON document was not fully consumed.");
}
return result;
} catch (Exception e) {
e.printStackTrace();
} finally {
value.close();
}
return null;
}
private String convertStreamToString(InputStream is) {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line;
try {
while ((line = reader.readLine()) != null) {
sb.append(line).append("\n");
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return sb.toString();
}
}
package com.work.provide_net
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
/build
\ No newline at end of file
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.work.provide_origin'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_17//VERSION_1_8
targetCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_17//VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'17'//'1.8'
}
dataBinding{
enabled = true
}
}
dependencies {
implementation rootProject.ext.android.androidx_kt//'androidx.core:core-ktx:1.7.0'
implementation rootProject.ext.android.androidx_app//'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
api project(path: ':provide_general')
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.work.provide_origin
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.work.provide_origin.test", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.work.provide_origin">
</manifest>
\ No newline at end of file
package com.work.provide_origin.inf
interface IModel {
}
\ No newline at end of file
package com.work.provide_origin.inf
interface Viewer {
}
\ No newline at end of file
package com.work.provide_origin.origin
import android.view.LayoutInflater
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.work.provide_origin.R
import com.work.provide_origin.databinding.ActivityGeneralBinding
abstract class GeneralAgentActivity<VM: GeneralViewModel,DB:ViewDataBinding>: GeneralVMActivity<VM>() {
lateinit var iDataBinding: DB
/**
*
*/
override fun initDataBinding() {
activityGeneralBinding = DataBindingUtil.setContentView(this, R.layout.activity_general)
iDataBinding = DataBindingUtil.bind(LayoutInflater.from(activity).inflate(layout,null))!!
activityGeneralBinding.fl.addView(iDataBinding.root)
//TODO1
/**
* 如果使用jetpack 中的 liveData 来完成绑定,则需要使用另外一套观察者模式来接管更新,这里 databinding 的观察者模式不会通知到 livedata , 需要我们在绑定 livedata 时使用具体的 ViewDataBinding 实现来调用 ViewDataBinding.setLifecycleOwner(this); 开启。这局话可以卸载 activity 的onCreate方法里。(具体以后需要整理一份 jetpack ViewModel 资料)
* https://www.cnblogs.com/summer-xx/p/13997646.html?ivk_sa=1024320u
*/
activityGeneralBinding.lifecycleOwner = this
iDataBinding.lifecycleOwner = this
}
}
\ No newline at end of file
package com.work.provide_origin.origin
import android.app.Activity
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModelProvider
import com.work.provide_origin.R
import com.work.provide_origin.databinding.ActivityGeneralBinding
import com.work.provide_origin.util.getVmClazz
abstract class GeneralVMActivity<VM : GeneralViewModel>:AppCompatActivity() {
// protected lateinit var iViewModel:VM
protected lateinit var activity:Activity
lateinit var activityGeneralBinding: ActivityGeneralBinding
protected abstract var layout:Int
protected var titleFlag: Boolean = true
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
activity = this
initDataBinding()
initDo()
// iViewModel = ()
createLooker()
initTitle(activityGeneralBinding.includeGeneralTitle)
initUi()
initData()
initEvent()
}
protected open fun initDo(){
}
protected open fun initTitle(titleView:View){
if(titleFlag){
titleView.visibility = View.VISIBLE
titleView.findViewById<View>(R.id.free_iv).run {
setOnClickListener {
finish()
}
}
titleView.findViewById<View>(R.id.finish).visibility = View.GONE
}else {
titleView.visibility = View.GONE
}
}
protected fun setTitleNa(value:String){
activityGeneralBinding.includeGeneralTitle.findViewById<TextView>(R.id.title).run {
text = value
}
}
protected fun getRightTv():TextView{
return activityGeneralBinding.includeGeneralTitle.findViewById<TextView>(R.id.finish)
}
abstract fun initDataBinding()
abstract fun createLooker()
abstract fun initUi()
abstract fun initData()
abstract fun initEvent()
}
\ No newline at end of file
package com.work.provide_origin.origin
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
open class GeneralViewModel : ViewModel(){
fun <T> request(
work:suspend ()-> T,
respond:(T)->Unit,
error:(Throwable)->Unit
){
viewModelScope.launch {
kotlin.runCatching {
withContext(Dispatchers.IO){
work()
}
}.onSuccess {
respond(it)
}.onFailure {
error(it)
}
}
}
}
\ No newline at end of file
package com.work.provide_origin.util
import java.lang.reflect.ParameterizedType
@Suppress("UNCHECKED_CAST")
fun <VM> getVmClazz(obj: Any): VM {
return (obj.javaClass.genericSuperclass as ParameterizedType).actualTypeArguments[0] as VM
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data></data>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- wrap_content-->
<include
android:id="@+id/include_general_title"
layout="@layout/general_title"
android:layout_width="0dp"
android:layout_height="70dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<FrameLayout
android:id="@+id/fl"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/include_general_title">
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/finish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ok"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.96"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/free_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/free_iv"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.06"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
package com.work.provide_origin
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
/build
\ No newline at end of file
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
android {
namespace 'com.work.provide_tool'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
buildConfigField("Boolean", "APPLICATION_FLAG", "${rootProject.ext.info.applicationFlag}")
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_17//VERSION_1_8
targetCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_17//VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'17'//'1.8'
}
dataBinding{
enabled = true
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
dependencies {
implementation rootProject.ext.android.androidx_kt//'androidx.core:core-ktx:1.7.0'
implementation rootProject.ext.android.androidx_app//'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
//所有依赖可解耦
api rootProject.ext.android.livedata
api rootProject.ext.android.viewmodel
// api("androidx.lifecycle:lifecycle-extensions:2.5.1")
//ARouter
api rootProject.ext.android.arouter_api
kapt rootProject.ext.android.arouter_kapt
// glide
api rootProject.ext.android.glide
annotationProcessor rootProject.ext.android.glide_annotation
api rootProject.ext.android.glide_integration
api rootProject.ext.android.view_adapter_helper
//paging3
api rootProject.ext.android.paging
// alternatively - without Android dependencies for tests
testApi rootProject.ext.android.paging_t
api rootProject.ext.android.android_activity_ktx
//invoke : ToastUtils.init(app)
api rootProject.ext.android.t
//jet 数据库
api rootProject.ext.android.api_room
annotationProcessor rootProject.ext.android.annotation_room
api rootProject.ext.android.kt_room
kapt rootProject.ext.android.kp_room
api rootProject.ext.android.paging_room
api rootProject.ext.android.auto_ui
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.work.provide_tool
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.work.provide_tool.test", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.work.provide_tool">
<application>
<meta-data
android:name="design_width_in_dp"
android:value="375"/>
<meta-data
android:name="design_height_in_dp"
android:value="640"/>
</application>
</manifest>
\ No newline at end of file
package com.work.provide_tool.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.paging.PagingDataAdapter
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import androidx.viewbinding.ViewBinding
import com.work.provide_tool.databinding.GroupDetailWidgetBinding
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
abstract class GeneralPagingAdapter<T:Any,V:ViewBinding>(
private val context: Context,
diffCallback: DiffUtil.ItemCallback<T>,
mainDispatcher: CoroutineDispatcher = Dispatchers.Main,
workerDispatcher: CoroutineDispatcher = Dispatchers.Default): PagingDataAdapter<T,GeneralPagingAdapter.Holder<V>>(
diffCallback
,mainDispatcher
,workerDispatcher) {
var onClick:(View,T?,Int)->Unit = {view,t,p->}//点击
var onLongClick:(View,T?,Int)->Unit = {view,t,p->}//长按
var onChildClick:(View,T?,Int)->Unit = {view, t, i -> }//子view
protected abstract var layout:Int
protected abstract fun onBindViewHolderWork(holder: Holder<V>,t:T?,position: Int)
protected fun onChildClickProvide(v:View?,t:T?,p:Int){
v?.run {
setOnClickListener {
onChildClick(v,t,p)
}
}
}
override fun onBindViewHolder(holder: Holder<V>, position: Int) {
onBindViewHolderWork(holder,getItem(position),position)
holder.rootViewType?.run {
root.setOnClickListener {v->
onClick(v,getItem(position),position)
}
root.setOnLongClickListener {v->
onLongClick(v,getItem(position),position)
true
}
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder<V> {
return Holder(LayoutInflater.from(context).inflate(layout,null))
}
class Holder<V:ViewBinding>(itView: View):RecyclerView.ViewHolder(itView){
val rootViewType:V? = DataBindingUtil.bind(itView)
}
}
\ No newline at end of file
package com.work.provide_tool.app
class AppUrl {
companion object{
val netUrl = "http://www.weather.com.cn"
}
}
\ No newline at end of file
package com.work.provide_tool.app
import android.app.Activity
import android.app.Application
import android.os.Bundle
import android.util.Log
import com.work.provide_tool.BuildConfig
import com.work.provide_tool.util.AppActivityLeader
abstract class IApp : Application() {
companion object{
lateinit var app:Application
}
override fun onCreate() {
super.onCreate()
app = this
init(this, BuildConfig.APPLICATION_FLAG)
initAppActivity()
}
private fun initAppActivity(){
registerActivityLifecycleCallbacks(object: ActivityLifecycleCallbacks{
override fun onActivityCreated(p0: Activity, p1: Bundle?) {
AppActivityLeader.addActivity(p0)
}
override fun onActivityStarted(p0: Activity) {
}
override fun onActivityResumed(p0: Activity) {
AppActivityLeader.pullActivity(p0)
}
override fun onActivityPaused(p0: Activity) {
}
override fun onActivityStopped(p0: Activity) {
}
override fun onActivitySaveInstanceState(p0: Activity, p1: Bundle) {
}
override fun onActivityDestroyed(p0: Activity) {
AppActivityLeader.freeActivity(p0)
}
})
}
//在这里配置init即可 applicationFlag为true和false,都会跑这里的且只会跑一回
abstract fun init(app:Application,applicationFlag:Boolean)
}
\ No newline at end of file
package com.work.provide_tool.data.entity
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "note_pvp_data")
data class NotePVPDataEntity(var data:String,var rId:Long){
@PrimaryKey
var nId:Long? = null
}
\ No newline at end of file
package com.work.provide_tool.data.entity
import android.os.Parcel
import android.os.Parcelable
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey
@Entity(tableName = "player_data")
data class PlayerDataEntity(var rId:Long,
var pNa:String = "player",
var totalIntegral:Int = 0,//总积分
var iIntegral:Int = 0,//当前积分
var forwardIntegralArray:List<String>? = null,//前3轮积分
var afterIntegralArray:List<String>? = null//后3轮积分
) : Parcelable {
@PrimaryKey
var pId:Long? = null
@Ignore
var inputIntegral:String? = null
constructor(parcel: Parcel) : this(
parcel.readLong(),
parcel.readString()!!,
parcel.readInt(),
parcel.readInt(),
parcel.createStringArrayList(),
parcel.createStringArrayList()
) {
pId = parcel.readValue(Long::class.java.classLoader) as? Long
inputIntegral = parcel.readString()
}
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeLong(rId)
parcel.writeString(pNa)
parcel.writeInt(totalIntegral)
parcel.writeInt(iIntegral)
parcel.writeStringList(forwardIntegralArray)
parcel.writeStringList(afterIntegralArray)
parcel.writeValue(pId)
parcel.writeString(inputIntegral)
}
override fun describeContents(): Int {
return 0
}
companion object CREATOR : Parcelable.Creator<PlayerDataEntity> {
override fun createFromParcel(parcel: Parcel): PlayerDataEntity {
return PlayerDataEntity(parcel)
}
override fun newArray(size: Int): Array<PlayerDataEntity?> {
return arrayOfNulls(size)
}
}
}
\ No newline at end of file
package com.work.provide_tool.data.entity
import android.os.Parcel
import android.os.Parcelable
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "ro_group")
data class RoGroupEntity(var roGroupNa:String,
var roGroupIdWithDraw:Long): Parcelable {
@PrimaryKey var rId:Long? = null
constructor(parcel: Parcel) : this(
parcel.readString()!!,
parcel.readLong()
) {
rId = parcel.readValue(Long::class.java.classLoader) as? Long
}
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeString(roGroupNa)
parcel.writeLong(roGroupIdWithDraw)
parcel.writeValue(rId)
}
override fun describeContents(): Int {
return 0
}
companion object CREATOR : Parcelable.Creator<RoGroupEntity> {
override fun createFromParcel(parcel: Parcel): RoGroupEntity {
return RoGroupEntity(parcel)
}
override fun newArray(size: Int): Array<RoGroupEntity?> {
return arrayOfNulls(size)
}
}
}
\ No newline at end of file
package com.work.provide_tool.general
object General {
var widgetArray = arrayOf("com.juling.juliao.App","com.juling.pro_juliao.app"
,"com.juling.widget_friend.FriendApp","com.juling.widget_login.LgApp"
,"com.juling.work_onepage.OneApp","com.juling.widget_u_info.UApp")
}
\ No newline at end of file
package com.work.provide_tool.general;
public interface RouterPath {
String WIDGET_MAIN = "/widget/main";
String WIDGET_TALK = "/widget/talk";
String WIDGET_ZJF = "/widget/zjf";
}
package com.work.provide_tool.util
import android.app.Activity
import java.lang.ref.WeakReference
object AppActivityLeader {
private var arr:ArrayList<Activity>? = null
private var topActivityWeak:WeakReference<Activity>? = null
fun addActivity(activity:Activity){
arr = (arr?:ArrayList()).apply {
this.add(activity)
}
}
fun pullActivity(activity: Activity){
topActivityWeak = WeakReference(activity)
}
fun getActivity():Activity?{
return topActivityWeak?.get()
}
fun freeActivity(activity: Activity){
arr = (arr?:ArrayList()).apply {
this.remove(activity)
}
}
fun getAllActivity():ArrayList<Activity>?{
return arr
}
}
\ No newline at end of file
package com.work.provide_tool.util
class AppUtil
\ No newline at end of file
package com.work.provide_tool.util
import android.content.Context
import android.speech.tts.TextToSpeech
import android.speech.tts.UtteranceProgressListener
import android.util.Log
import android.widget.Toast
import java.io.File
import java.util.*
//文字转语音
class TTSHelper(private var context: Context,
var talkValue: String = "请输入文字",
var locale:Locale = Locale.CHINA,
var tone:Float = 1.0f,
var rate:Float = 1.0f) {
private var tSpeek:TextToSpeech? = null
init {
tSpeek = TextToSpeech(context){state->
if(state == TextToSpeech.SUCCESS){
var ret = tSpeek?.setLanguage(locale)
if(ret != TextToSpeech.LANG_AVAILABLE && ret != TextToSpeech.LANG_COUNTRY_AVAILABLE){
Toast.makeText(context,"don't read this language", Toast.LENGTH_SHORT).show()
}
}
}
tSpeek?.run {
setPitch(tone)//音调
setSpeechRate(rate)//速率
setOnUtteranceProgressListener(object: UtteranceProgressListener(){
override fun onStart(p0: String?) {
Log.i("eee", "start = $p0")
}
override fun onDone(p0: String?) {
Log.i("eee", "do = $p0")
}
override fun onError(p0: String?) {
Log.i("eee", "err = $p0")
}
})
}
}
private fun talk(){
var req_tag = Random().nextInt(10001).toString() // [0,1000) int
//setOnUtteranceProgressListener看进度
tSpeek?.speak(talkValue,TextToSpeech.QUEUE_ADD,null,req_tag)
}
private fun note(){
var req_tag = Random().nextInt(10001).toString() // 0-1001 int
var file = context.getExternalFilesDir("audio")
//setOnUtteranceProgressListener看进度
var ret = tSpeek?.synthesizeToFile(talkValue,null, File(file,"aa.wav"),req_tag)// ret ok ?
}
private fun release(){
tSpeek?.shutdown()
}
}
\ No newline at end of file
package com.work.provide_tool.util
import com.hjq.toast.ToastUtils
class ToastUtil {
companion object{
fun show(value:String){
ToastUtils.show(value)
}
}
}
\ No newline at end of file
package com.work.provide_tool.util
import android.annotation.SuppressLint
import android.widget.ImageView
import androidx.core.content.ContextCompat
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.work.provide_tool.R
import com.work.provide_tool.app.IApp.Companion.app
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
fun getAppColor(id:Int): Int {
return ContextCompat.getColor(app,id)
}
fun getDrawIdentifier(idStr:String):Int{
return app.resources.getIdentifier(idStr,"mipmap", app.packageName)
}
//keep 数据在刷ui的
fun keepDataUpdateWithUi(lfo: LifecycleOwner,otherThread:suspend ()->Unit,uiOfThread:()->Unit = {}){
lfo.lifecycleScope.launch {
lfo.lifecycleScope.async (Dispatchers.IO) {
otherThread()
}.await().apply {
uiOfThread()
}
}
}
//-----------------------------------------Glide----------------------------------------------
var TPYER_CROP = "crop"
var TPYE_FIT = "fit"
//长方形
fun glideLoadRectangle(url: Any?,iv:ImageView?,tag: String = TPYER_CROP){
glideGeneralOption(url,iv, getOptionGlide(tag, R.mipmap.icon_default_rectangle,R.mipmap.icon_default_rectangle))
}
//正方形
fun glideLoad(url: Any?,iv:ImageView?,tag: String = TPYER_CROP){
glideGeneralOption(url,iv, getOptionGlide(tag, R.mipmap.icon_default,R.mipmap.icon_default))
}
//圆
fun glideLoadRound(url: Any?,iv:ImageView?,tag: String = TPYER_CROP){
glideGeneralOption(url,iv, getOptionGlide(tag, R.mipmap.icon_default_round,R.mipmap.icon_default_round))
}
@SuppressLint("CheckResult")
private fun getOptionGlide(tag: String, placeholder:Int = 0, unload:Int = 0,doWork:RequestOptions.()->RequestOptions = {this}):RequestOptions{
return RequestOptions().apply {
when(tag){
TPYER_CROP -> centerCrop()
TPYE_FIT -> fitCenter()
else -> centerCrop()
}
if(placeholder != 0){
placeholder(placeholder)
}
if(unload != 0){
error(unload)
}
}.doWork()
}
private fun glideGeneralOption(url:Any?,iv:ImageView?,requestOptions:RequestOptions){
if(url == null){
return
}
if(iv == null){
return
}
if(url is String){
url.run {
if(isEmpty()){
return
}
if(startsWith("https")){
replace("https","http")
}
}
}else if(url is Int){
url.run {
if(this == 0){
return
}
}
}else{
ToastUtil.show("glide load $url ??")
}
Glide.with(app).load(url).apply(requestOptions).into(iv)
}
//-----------------------------------------/Glide----------------------------------------------
\ No newline at end of file
package com.work.provide_tool.widget;
import android.graphics.Rect;
import android.util.Log;
import android.view.View;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.Objects;
//只能用于Grid
public class GridSpacingItemWithDecoration extends RecyclerView.ItemDecoration {
private boolean aroundTop;//top
private boolean includeEdge;
private boolean aroundLeft;//left
private int interval;//间
public GridSpacingItemWithDecoration(int interval){
this(interval,true);
}
public GridSpacingItemWithDecoration(int interval, boolean includeEdge){
this(interval,includeEdge,includeEdge);
}
public GridSpacingItemWithDecoration(int interval, boolean aroundLeft,boolean aroundTop) {
this.interval= interval;
this.aroundLeft = aroundLeft;
this.aroundTop = aroundTop;
}
@Override
public void getItemOffsets(Rect outRect, View view,RecyclerView recyclerView,RecyclerView.State state) {
int position = recyclerView.getChildAdapterPosition(view);
int total = Objects.requireNonNull(recyclerView.getAdapter()).getItemCount();
GridLayoutManager gridLayoutManager = (GridLayoutManager) recyclerView.getLayoutManager();
assert gridLayoutManager != null;
int iCount = gridLayoutManager.getSpanCount();
int column = position % iCount;
if (aroundLeft) {
outRect.left = interval - column * interval / iCount;
outRect.right = (column + 1) * interval / iCount;
if (position < iCount) {
outRect.top = interval;
}
outRect.bottom = interval;
} else {
outRect.left = column * interval / iCount;
outRect.right = interval - (column + 1) * interval / iCount;
if (position < iCount) {
outRect.top = interval;
}
outRect.bottom = interval;
}
if(!aroundTop){
if(position <iCount){
outRect.top = 0;
}
if(position+iCount>total-1){
outRect.bottom = 0;
}
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<data></data>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</layout>
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data></data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
tools:srcCompat="@tools:sample/avatars" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView2" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.109"
tools:srcCompat="@tools:sample/avatars" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="talking"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.479"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.269" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="note"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.459" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="red">#ff0000</color>
<color name="color_0ff0f0">#0ff0f0</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">jetpak</string>
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Jetpak" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
\ No newline at end of file
package com.work.provide_tool
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "juliao"
//工作: 配置 -> hilt -> jet ->
include ':app'
include ':provide_data'
include ':provide_net'
include ':provide_origin'
include ':provide_general'
include ':provide_tool'
include ':provide_longnet'
include ':widget_onepage'
include ':pro_juliao'
include ':widget_login'
include ':widget_friend'
include ':widget_u_info'
/build
\ No newline at end of file
plugins {
// id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
boolean applicationFlag = rootProject.ext.info.applicationFlag.toBoolean()
if(applicationFlag){
apply plugin: 'com.android.application'
}else {
apply plugin: 'com.android.library'
}
android {
namespace 'com.juling.widget_friend'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
targetCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'1.8'
}
dataBinding{
enabled = true
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
api project(path: ':provide_origin')
kapt rootProject.ext.android.arouter_kapt
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.juling.widget_friend
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.juling.widget_friend.test", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
\ No newline at end of file
package com.juling.widget_friend
import android.app.Application
import com.work.provide_tool.app.IApp
class FriendApp : IApp(){
override fun init(app: Application, applicationFlag: Boolean) {
}
}
\ No newline at end of file
package com.juling.widget_friend
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
/build
\ No newline at end of file
plugins {
// id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
boolean applicationFlag = rootProject.ext.info.applicationFlag.toBoolean()
if(applicationFlag){
apply plugin: 'com.android.application'
}else {
apply plugin: 'com.android.library'
}
android {
namespace 'com.juling.widget_login'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
targetCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'1.8'
}
dataBinding{
enabled = true
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
api project(path: ':provide_origin')
kapt rootProject.ext.android.arouter_kapt
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.juling.widget_login
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.juling.widget_login.test", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
\ No newline at end of file
package com.juling.widget_login
import android.app.Application
import com.work.provide_tool.app.IApp
class LgApp : IApp(){
override fun init(app: Application, applicationFlag: Boolean) {
}
}
\ No newline at end of file
package com.juling.widget_login
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
/build
\ No newline at end of file
plugins {
// id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
boolean applicationFlag = rootProject.ext.info.applicationFlag.toBoolean()
if(applicationFlag){
apply plugin: 'com.android.application'
}else {
apply plugin: 'com.android.library'
}
android {
namespace 'com.juling.work_onepage'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
targetCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'1.8'
}
dataBinding{
enabled = true
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
api project(path: ':provide_origin')
kapt rootProject.ext.android.arouter_kapt
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.juling.work_onepage
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.juling.work_onepage.test", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
\ No newline at end of file
package com.juling.work_onepage
import android.app.Application
import com.work.provide_tool.app.IApp
class OneApp :IApp(){
override fun init(app: Application, applicationFlag: Boolean) {
}
}
\ No newline at end of file
package com.juling.work_onepage
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
/build
\ No newline at end of file
plugins {
// id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
boolean applicationFlag = rootProject.ext.info.applicationFlag.toBoolean()
if(applicationFlag){
apply plugin: 'com.android.application'
}else {
apply plugin: 'com.android.library'
}
android {
namespace 'com.juling.widget_u_info'
compileSdk rootProject.ext.android.sdkTool
defaultConfig {
minSdk rootProject.ext.android.lowSdk
targetSdk rootProject.ext.android.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
targetCompatibility rootProject.ext.android.java_v//JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = rootProject.ext.android.j_target//'1.8'
}
dataBinding{
enabled = true
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
api project(path: ':provide_origin')
kapt rootProject.ext.android.arouter_kapt
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.juling.widget_u_info
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.juling.widget_u_info.test", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
\ No newline at end of file
package com.juling.widget_u_info
import android.app.Application
import com.work.provide_tool.app.IApp
class UApp : IApp(){
override fun init(app: Application, applicationFlag: Boolean) {
}
}
\ No newline at end of file
package com.juling.widget_u_info
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
|-provide_longnet |->provide_data
|-provide_longnet |->provide_data
引用的链路: provide_origin ->provide_general-> |-provide_net |->provide_data
|-provide_tool
功能组件:
统一以provide为开头;
该App中用到的组件:
provide_origin:android组件(Activity等)的基类
provide_general:所有功能的引用
provide_net:网络类
provide_tool:工具类
provide_data:数据类
业务组件:
统一以widget为开头;
当增加widget,要增加一个IApp的子类(init的作用例如第三方库的init),可仿照widget_onepage:
1.配置build.gradle文件
2.搭一个IApp之类
com.work.provide_tool.general.General的widgetArray增该类全路径
该App中用到的组件:
widget_onepage:聊天
widget_login:登录
widget_friend:联络人
widget_u_info:用户
App组件:
统一以pro开头;
当增加pro,要增加一个IApp的子类(init的作用例如第三方库的init),可仿照widget_onepage:
1.配置build.gradle文件 2.搭一个IApp之类
com.work.provide_tool.general.General的widgetArray增该类全路径
该App中用到的组件:
pro_juliao:聊天v1.0的功能
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论