Commit dd846972 authored by xuelimin's avatar xuelimin

分批7

parent 6bb9804e
Pipeline #1098 failed with stages
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WizardSettings">
<option name="children">
<map>
<entry key="imageWizard">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="imageAssetPanel">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="actionbar">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="clipArt">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="color" value="000000" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
<option name="values">
<map>
<entry key="theme" value="HOLO_DARK" />
<entry key="themeColor" value="ffffff" />
</map>
</option>
</PersistentState>
</value>
</entry>
<entry key="launcher">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="foregroundImage">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="color" value="000000" />
<entry key="scalingPercent" value="63" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
<option name="values">
<map>
<entry key="backgroundAssetType" value="COLOR" />
<entry key="backgroundColor" value="ffffff" />
<entry key="foregroundImage" value="$USER_HOME$/Desktop/Logo icon square@3x.png" />
</map>
</option>
</PersistentState>
</value>
</entry>
<entry key="launcherLegacy">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="clipArt">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="color" value="000000" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
<entry key="notification">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="clipArt">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="color" value="000000" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</component>
</project>
\ No newline at end of file
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/library" />
<option value="$PROJECT_DIR$/loopview" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="testRunner" value="PLATFORM" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Homebozz.iml" filepath="$PROJECT_DIR$/Homebozz.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/library/library.iml" filepath="$PROJECT_DIR$/library/library.iml" />
<module fileurl="file://$PROJECT_DIR$/loopview/loopview.iml" filepath="$PROJECT_DIR$/loopview/loopview.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.rudian.homebozz"
minSdkVersion 16
targetSdkVersion 29
versionCode 6
versionName "4.0.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
// server_url : "https://devel.homeboss.co.jp/endpoints/",
server_url : "https://demo.homebozz.com/endpoints/",
google_value: "https://devel.homeboss.co.jp/endpoints/"]
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
signingConfigs {
release {
storeFile file('/Users/xuelimin/homebozz/homebozzkey.store')
storePassword 'homebozz'
keyAlias 'key'
keyPassword 'homebozz'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// implementation 'com.android.support:design:28.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
// implementation 'com.google.android.material:material:1.1.0-alpha10'
// implementation 'com.alibaba:fastjson:1.2.60'
// androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(path: ':library')
implementation 'com.google.android.gms:play-services-maps:17.0.0'
// 地图操作工具类,添加标记等
implementation 'com.google.maps.android:android-maps-utils:0.6.2'
// implementation 'com.google.android.material:material:1.1.0-alpha02'
implementation 'com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.1'
}
# 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
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
\ No newline at end of file
package com.rudian.homebozz
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
/**
* 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.getTargetContext()
assertEquals("com.rudian.homebozz", appContext.packageName)
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.rudian.homebozz">
<application
android:name=".application.HomeBozzAPP"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning"
tools:targetApi="n">
<activity android:name=".launcher.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".login.LoginActivity">
</activity>
<activity android:name=".home.HomeActivity">
</activity>
<!-- 默认服务器地址-->
<meta-data
android:name="server_url"
android:value="${server_url}" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${google_value}" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider" />
</provider>
</application>
</manifest>
\ No newline at end of file
package com.rudian.homebozz.application
import android.content.pm.PackageManager
import androidx.multidex.MultiDexApplication
import com.rudian.homebozz.R
import com.rudian.library.app.HomeBozz
import com.rudian.library.net.interceptors.DebugInterceptor
/**
* Created on 2019-08-21
* Created by xuelimin
*/
class HomeBozzAPP : MultiDexApplication() {
override fun onCreate() {
super.onCreate()
val appInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
// val packageInfo = packageManager.getPackageInfo(packageName, 0)
HomeBozz.init(applicationContext)
.withApiHost(appInfo.metaData.getString("server_url").toString())
.withLoaderDelayed(500)
.withInterceptor(DebugInterceptor("test", R.raw.test))
.withJavascriptInterface("latte")
.configure();
}
}
\ No newline at end of file
package com.rudian.homebozz.home
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import com.rudian.homebozz.R
import com.rudian.library.activites.ProxyActivity
import com.rudian.library.app.HomeBozz
import qiu.niorgai.StatusBarCompat
class HomeActivity : ProxyActivity() {
// 再点一次退出程序时间设置
private val WAIT_TIME = 2000L
private var TOUCH_TIME: Long = 0
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val actionBar = supportActionBar
actionBar?.hide()
HomeBozz.getConfigurator().withActivity(this)
StatusBarCompat.translucentStatusBar(this, true)
loadRootFragment(R.id.fl_container, HomeDelegate())
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
Log.i("onActivityResult", "HomeActivity requestCode$requestCode resultCode$resultCode ")
super.onActivityResult(requestCode, resultCode, data)
}
override fun onBackPressedSupport() {
if (supportFragmentManager.backStackEntryCount > 1) {
pop()
} else {
if (System.currentTimeMillis() - TOUCH_TIME < WAIT_TIME) {
finish()
} else {
TOUCH_TIME = System.currentTimeMillis()
Toast.makeText(this, "双击退出" + getString(R.string.app_name), Toast.LENGTH_SHORT).show()
}
}
}
}
package com.rudian.homebozz.home.adpter
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import android.view.ViewGroup
import com.rudian.homebozz.home.childFragments.AcceptedPagerFragment
import com.rudian.homebozz.home.childFragments.GoToPagerFragment
import com.rudian.homebozz.home.childFragments.PendingPagerFragment
import com.rudian.library.delagete.base.HomeBozzDelegate
import me.yokeyword.fragmentation.SupportFragment
/**
* Created on 2019-09-10
* Created by xuelimin
*/
class PagerFragmentAdapter(fm: FragmentManager, titles: ArrayList<String>) : FragmentPagerAdapter(fm) {
private var parentDelegate: HomeBozzDelegate? = null
private var mCurrentFragment: SupportFragment? = null
private var mTitles = ArrayList<String>()
fun setParentDelegate(delegate: HomeBozzDelegate) {
parentDelegate = delegate
}
init {
mTitles = titles
}
override fun getItem(p: Int): Fragment {
return when (p) {
0 -> PendingPagerFragment.newInstance(parentDelegate!!)
1 -> AcceptedPagerFragment()
else -> GoToPagerFragment()
}
}
fun getChildFragment(): SupportFragment {
return mCurrentFragment!!
}
override fun getCount(): Int {
return mTitles.size
}
override fun getPageTitle(position: Int): CharSequence? {
return mTitles[position]
}
override fun setPrimaryItem(container: ViewGroup, position: Int, `object`: Any) {
mCurrentFragment = `object` as SupportFragment
super.setPrimaryItem(container, position, `object`)
}
}
\ No newline at end of file
package com.rudian.homebozz.home.adpter
import android.annotation.SuppressLint
import androidx.appcompat.widget.AppCompatTextView
import com.bumptech.glide.Glide
import com.rudian.homebozz.R
import com.rudian.library.ui.recycler.MultipleItemEntity
import com.rudian.library.ui.recycler.MultipleRecyclerAdapter
import com.rudian.library.ui.recycler.MultipleViewHolder
import de.hdodenhof.circleimageview.CircleImageView
import java.text.SimpleDateFormat
import java.util.*
/**
* Created on 2019-09-11
* Created by xuelimin
*/
class PendingAdapter(data: ArrayList<MultipleItemEntity>) : MultipleRecyclerAdapter(data) {
companion object {
val ITEM_TYPE = 10
}
interface OnItemClickListener {
fun onItemClickListener(entity: MultipleItemEntity, position: Int)
}
private var mItemClickListener: OnItemClickListener? = null
fun setOnItemClickListener(listener: OnItemClickListener) {
mItemClickListener = listener
}
enum class Field {
JOB_ID, JOB_TYPE, TIME_REQUIRED, PROPERTY_ID, PROPERTY_NAME, ADDRESS1LOCAL, ADDRESS2LOCAL,
CITY_LOCAL, REGION_LOCAL, POSTCODE, SHORT_NAME,
PROFILE_IMAGE_STANDARD_URL, PROFILE_IMAGE_STANDARD_WIDTH, PROFILE_IMAGE_STANDARD_HEIGHT,
PROFILE_IMAGE_THUMBNAIL_URL, PROFILE_IMAGE_THUMBNAIL_WIDTH, PROFILE_IMAGE_THUMBNAIL_HEIGHT,
PROFILE_IMAGE_MEDIUM_URL, PROFILE_IMAGE_MEDIUM_WIDTH, PROFILE_IMAGE_MEDIUM_HEIGHT,
PROFILE_IMAGE_HIGH_URL, PROFILE_IMAGE_HIGH_WIDTH, PROFILE_IMAGE_HIGH_HEIGHT,
}
init {
addItemType(ITEM_TYPE, R.layout.iteam_home_pending)
}
@SuppressLint("SetTextI18n")
override fun convert(holder: MultipleViewHolder, entity: MultipleItemEntity) {
super.convert(holder, entity)
when (entity.itemType) {
ITEM_TYPE -> {
val jobType = entity.getField(Field.JOB_TYPE) as String
val propertyName = entity.getField(Field.PROPERTY_NAME) as String
val regionLocal = entity.getField(Field.REGION_LOCAL) as String
val cityLocal = entity.getField(Field.CITY_LOCAL) as String
val address1Local = entity.getField(Field.ADDRESS1LOCAL) as String
val shortName = entity.getField(Field.SHORT_NAME) as String
val timeRequired = entity.getField(Field.TIME_REQUIRED) as String
val profileImageUrl = entity.getField(Field.PROFILE_IMAGE_THUMBNAIL_URL) as String
val mPropertyName = holder.getView<AppCompatTextView>(R.id.mPropertyName)
mPropertyName.text = propertyName
val mJobType = holder.getView<AppCompatTextView>(R.id.mJobType)
mJobType.text = jobType
val mPropertyAddress = holder.getView<AppCompatTextView>(R.id.mPropertyAddress)
mPropertyAddress.text = "$regionLocal $cityLocal$address1Local"
val mShortName = holder.getView<AppCompatTextView>(R.id.mShortName)
mShortName.text = shortName
val mCiUserAvatar = holder.getView<CircleImageView>(R.id.mCiUserAvatar)
Glide.with(mContext).load(profileImageUrl).apply(RECYCLER_OPTIONS).into(mCiUserAvatar)
val mWeekTv = holder.getView<AppCompatTextView>(R.id.mWeekTv)
val mDayTv = holder.getView<AppCompatTextView>(R.id.mDayTv)
val monthTv = holder.getView<AppCompatTextView>(R.id.monthTv)
val mTime = holder.getView<AppCompatTextView>(R.id.mTime)
val day = Date(timeRequired.toLong())
// val day = Date()
val weekFormat = SimpleDateFormat("E")
val dayOfTheWeek = weekFormat.format(day)
mWeekTv.text = dayOfTheWeek
val dayFormat = SimpleDateFormat("d")
val dayOfTheDay = dayFormat.format(day)
mDayTv.text = dayOfTheDay
val monthFormat = SimpleDateFormat("MMM")
val dayOfTheMonth = monthFormat.format(day)
monthTv.text = dayOfTheMonth
val timeFormat = SimpleDateFormat("hh:mm a")
val dayOfTheTime = timeFormat.format(day)
mTime.text = dayOfTheTime
holder.itemView.setOnClickListener {
mItemClickListener?.onItemClickListener(entity, holder.layoutPosition)
}
}
}
}
}
\ No newline at end of file
package com.rudian.homebozz.home.childFragments
import android.os.Bundle
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.rudian.homebozz.R
import com.rudian.homebozz.login.LogInDelegate
import com.rudian.library.net.RestClient
import com.rudian.library.net.callback.IError
import com.rudian.library.net.callback.IFailure
import com.rudian.library.net.callback.ISuccess
import me.yokeyword.fragmentation.SupportFragment
/**
* Created on 2019-09-10
* Created by xuelimin
*/
class AcceptedPagerFragment : SupportFragment(), SwipeRefreshLayout.OnRefreshListener {
override fun onRefresh() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_pager_accepted, container, false)
return view
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
private fun getMyJobListing() {
val maps = HashMap<String, String>()
maps["data[current]"] = "assigned"
RestClient.builder().url("job/getMyJobListing.php")
.formDataParams(true, maps)
.success(object : ISuccess {
override fun onSuccess(response: String) {
supportDelegate.startWithPop(LogInDelegate())
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
}
})
.failure(object : IFailure {
override fun onFailure() {
}
}).build().post()
}
}
\ No newline at end of file
package com.rudian.homebozz.home.childFragments
import android.os.Bundle
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.rudian.homebozz.R
import com.rudian.homebozz.login.LogInDelegate
import com.rudian.library.net.RestClient
import com.rudian.library.net.callback.IError
import com.rudian.library.net.callback.IFailure
import com.rudian.library.net.callback.ISuccess
import me.yokeyword.fragmentation.SupportFragment
/**
* Created on 2019-09-10
* Created by xuelimin
*/
class GoToPagerFragment : SupportFragment(), SwipeRefreshLayout.OnRefreshListener {
override fun onRefresh() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_pager_goto, container, false)
return view
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
private fun getMyJobListing() {
val maps = HashMap<String, String>()
maps["data[current]"] = "assigned"
RestClient.builder().url("job/getMyJobListing.php")
.formDataParams(true, maps)
.success(object : ISuccess {
override fun onSuccess(response: String) {
supportDelegate.startWithPop(LogInDelegate())
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
}
})
.failure(object : IFailure {
override fun onFailure() {
}
}).build().post()
}
}
\ No newline at end of file
package com.rudian.homebozz.home.myJobs
/**
* Created on 2019-11-25
* Created by xuelimin
*/
class AssignedBean {
var ASSIGNED_TO_USER_ID = ""
var ASSIGNED_TO_ACCEPTED = ""
var ASSIGNED_TO_FIRST_NAME = ""
var ASSIGNED_TO_LAST_NAME = ""
var ASSIGNED_TO_ETHNIC_GIVEN_NAME = ""
var ASSIGNED_TO_ETHNIC_LAST_NAME = ""
var ASSIGNED_TO_PROFILE_IMAGE = ""
var ASSIGNED_TO_PROFILE_FULLNAME = ""
var ASSIGNED_TO_PROFILE_IMAGE_URL = ""
}
package com.rudian.homebozz.home.myJobs
import android.os.Bundle
import com.rudian.homebozz.R
import com.rudian.library.delagete.base.HomeBozzDelegate
/**
* Created on 2019-12-01
* Created by xuelimin
*/
class ExpensesDelegate : HomeBozzDelegate() {
override fun onBindView(savedInstanceState: Bundle?) {
}
override fun setLayout(): Any {
return R.layout.delegate_job_expenses
}
}
\ No newline at end of file
package com.rudian.homebozz.home.myJobs
import android.graphics.drawable.GradientDrawable
import android.os.Bundle
import android.util.Log
import com.alibaba.fastjson.JSON
import com.alibaba.fastjson.JSONObject
import com.rudian.homebozz.R
import com.rudian.homebozz.home.HomeDelegate
import com.rudian.library.app.AccountManager
import com.rudian.library.delagete.base.HomeBozzDelegate
import com.rudian.library.net.RestClient
import com.rudian.library.net.callback.IError
import com.rudian.library.net.callback.IFailure
import com.rudian.library.net.callback.ISuccess
import kotlinx.android.synthetic.main.delegate_job_info.*
/**
* Created on 2019-11-28
* Created by xuelimin
*/
class JobInfoDelegate : HomeBozzDelegate() {
var isMyJob = false
var gdOne: GradientDrawable? = null
override fun onBindView(savedInstanceState: Bundle?) {
if (arguments != null) {
gdOne = mJobCategoryRgb.background as GradientDrawable
getJobDetails((arguments!!.getString(MyJobsAdapter.Field.JOB_ID.name)) as String)
isMyJob = arguments!!.getBoolean("isMyJob")
}
// if (AccountManager.getIsManager()) {
// mJobInfoCancelBtn.visibility = View.VISIBLE
// mJobInfoOnHoldBtn.visibility = View.VISIBLE
// mJobInfoStatusLayout.visibility = View.VISIBLE
// mJobInfoAcceptBtn.visibility = View.GONE
// mJobInfoDeclineBtn.visibility = View.GONE
// mJobInfoEdit.visibility = View.VISIBLE
// mJobInfoCopy.visibility = View.VISIBLE
//
// } else {
// mJobInfoCancelBtn.visibility = View.GONE
// mJobInfoOnHoldBtn.visibility = View.GONE
// mJobInfoStatusLayout.visibility = View.GONE
// mJobInfoAcceptBtn.visibility = View.VISIBLE
// mJobInfoDeclineBtn.visibility = View.VISIBLE
// mJobInfoEdit.visibility = View.GONE
// mJobInfoCopy.visibility = View.GONE
// }
mJobInfoBack.setOnClickListener {
setBundleData()
pop()
}
mJobInfoEdit.setOnClickListener {
val delegate = JobInfoEditDelegate()
delegate.arguments = arguments
startForResult(delegate, HomeDelegate.JOB_DEATILS)
}
mJobInfoCancelBtn.setOnClickListener {
val dialog = JobInfoTipsDialog(context!!, R.style.dialog, getString(R.string.str_job_info_cancel_tips), object : JobInfoTipsDialog.YesListener {
override fun yesListener() {
}
})
dialog.show()
}
mJobInfoOnHoldBtn.setOnClickListener {
val dialog = JobInfoTipsDialog(context!!, R.style.dialog, getString(R.string.str_job_info_on_hold_tips), object : JobInfoTipsDialog.YesListener {
override fun yesListener() {
}
})
dialog.show()
}
mJobInfoAcceptBtn.setOnClickListener {
}
mJobInfoDeclineBtn.setOnClickListener {
}
}
override fun onBackPressedSupport(): Boolean {
setBundleData()
return super.onBackPressedSupport()
}
var bundle = Bundle()
private fun setBundleData() {
setFragmentResult(HomeDelegate.JOB_DEATILS, bundle)
}
private fun getJobDetails(jobId: String) {
val maps = HashMap<String, String>()
maps["job_id"] = jobId
RestClient.builder().url("job/getJobDetails.php")
.formDataParams(true, maps)
.success(object : ISuccess {
override fun onSuccess(response: String) {
Log.i("JobInfoDelegate", "response $response")
val jsonObject = JSON.parseObject(response).getJSONObject("data").getJSONObject("job")
val jobId = getJsonObjectItem(jsonObject, "job_id")
val referenceId = getJsonObjectItem(jsonObject, "reference_id")
val jobTypeObject = jsonObject.getJSONObject("job_type")
val jobType = jobTypeObject.getString("label")
val value = jobTypeObject.getString("value")
val priorityJson = jsonObject.getJSONObject("priority")
val priorityLabel = getJsonObjectItem(priorityJson, "label")
val priorityRGB = getJsonObjectItem(priorityJson, "rgb")
val timeCreated = getJsonObjectItem(jsonObject, "time_created")
val timeRequired = getJsonObjectItem(jsonObject, "time_required")
val timeStatusUpdated = getJsonObjectItem(jsonObject, "time_status_updated")
val timeScheduled = getJsonObjectItem(jsonObject, "time_scheduled")
val description = getJsonObjectItem(jsonObject, "description")
val status = getJsonObjectItem(jsonObject, "status")
val budgetedCost = getJsonObjectItem(jsonObject, "budgeted_cost")
val budgetedEffort = getJsonObjectItem(jsonObject, "budgeted_effort")
val roundingMethod = getJsonObjectItem(jsonObject, "rounding_method")
val roundingUnit = getJsonObjectItem(jsonObject, "rounding_unit")
val owner_visible = getJsonObjectItem(jsonObject, "owner_visible")
if (AccountManager.getIsManager()) {
val adminActions = jsonObject.getJSONArray("admin_actions")
for (i in 0 until adminActions.size) {
}
}
val userActions = jsonObject.getJSONArray("user_actions")
// val propertyId = getJsonObjectItem(jsonObject, "property_id")
//
// val propertyName = getJsonObjectItem(jsonObject, "property_name")
//
//
// val bookmarked = getJsonObjectItem(jsonObject, "bookmarked")
//
// val messagesJson = jsonObject.getJSONObject("messages")
// val unread = getJsonObjectItem(messagesJson, "total_unread")
// mTimeCreated
// mJobType
// mJobCategory
//
// gdOne!!.setColor(Color.parseColor("#dd3333"))
// mReferenceID
// mDescription
// mRequiredTime
// mEstimatedStart
// mBudget
// mTimeRounding
// mVisibleToOwner
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
Log.i("ViewJobDelegate", "msg $msg")
}
})
.failure(object : IFailure {
override fun onFailure() {
}
})
.build().post()
}
private fun getJsonObjectItem(jsonObject: JSONObject, key: String): String {
return if (jsonObject.containsKey(key)) {
if (!jsonObject.getString(key).isNullOrEmpty()) {
jsonObject.getString(key)
} else {
""
}
} else {
""
}
}
override fun setLayout(): Any {
return R.layout.delegate_job_info
}
}
\ No newline at end of file
package com.rudian.homebozz.home.myJobs
import android.graphics.Color
import android.os.Bundle
import com.rudian.homebozz.R
import com.rudian.homebozz.home.HomeDelegate
import com.rudian.library.delagete.base.HomeBozzDelegate
import com.rudian.library.ui.loopview.OnItemSelectedListener
import kotlinx.android.synthetic.main.delegate_job_info_edit.*
/**
* Created on 2019-11-29
* Created by xuelimin
*/
class JobInfoEditDelegate : HomeBozzDelegate() {
override fun setLayout(): Any {
return R.layout.delegate_job_info_edit
}
override fun onBackPressedSupport(): Boolean {
setBundleData()
return super.onBackPressedSupport()
}
var bundle = Bundle()
private fun setBundleData() {
setFragmentResult(HomeDelegate.JOB_DEATILS, bundle)
}
override fun onBindView(savedInstanceState: Bundle?) {
val labelHashMap = HashMap<String, Int>()
labelHashMap["Grey"] = Color.parseColor("#999999")
labelHashMap["Black"] = Color.BLACK
labelHashMap["Blue"] = Color.BLUE
labelHashMap["Green"] = Color.GREEN
labelHashMap["Yellow"] = Color.YELLOW
labelHashMap["Red"] = Color.RED
val labelData = ArrayList<String>()
labelData.add("Grey")
labelData.add("Black")
labelData.add("Blue")
labelData.add("Green")
labelData.add("Yellow")
labelData.add("Red")
val jobTypeData = ArrayList<String>()
jobTypeData.add("Cleaning")
jobTypeData.add("Snow Clearing")
jobTypeData.add("Repair")
jobTypeData.add("Transport")
jobTypeData.add("Other")
val days = ArrayList<String>()
days.add("Days")
days.add("Hour")
days.add("Minute")
val rounding = ArrayList<String>()
rounding.add("Round Up")
rounding.add("4 Down/5 Up")
rounding.add("Round Down")
mBudgetedTimeLayout.setOnClickListener {
val dialog = JobInfoEditShowDialog(context!!, R.style.dialog, mBudgetedTimeTv.text.toString(),
days.indexOf(mBudgetedDay.text), days, object : OnItemSelectedListener {
override fun onItemSelected(index: Int) {
mBudgetedDay.text = days[index]
}
})
dialog.show()
}
mRoundingUnitLayout.setOnClickListener {
val dialog = JobInfoEditShowDialog(context!!, R.style.dialog, mBudgetedTimeTv.text.toString(),
rounding.indexOf(mUnit.text), rounding, object : OnItemSelectedListener {
override fun onItemSelected(index: Int) {
mUnit.text = rounding[index]
}
})
dialog.show()
}
mJobTypeSelect.setOnClickListener {
val dialog = JobInfoEditShowDialog(context!!, R.style.dialog, mJobTypeTv.text.toString(),
jobTypeData.indexOf(mJobTypeSelect.text),jobTypeData, object : OnItemSelectedListener {
override fun onItemSelected(index: Int) {
mJobTypeSelect.text = jobTypeData[index]
}
})
dialog.show()
}
mJobPriorityLayout.setOnClickListener {
val dialog = JobInfoEditShowDialog(context!!, R.style.dialog, mJobPriorityTv.text.toString(),
labelData.indexOf(mJobPriorityLabel.text),labelData, object : OnItemSelectedListener {
override fun onItemSelected(index: Int) {
mJobPriorityLabel.text = labelData[index]
val color = labelHashMap[labelData[index]]
mJobPriorityRgb.setBackgroundColor(color!!)
}
})
dialog.show()
}
mJobInfoEditBack.setOnClickListener {
setBundleData()
pop()
}
mVisibleToOwnerYes.setOnClickListener {
mVisibleToOwnerYes.setBackgroundResource(R.drawable.owner_yes_circle_select)
mVisibleToOwnerYes.setTextColor(Color.WHITE)
mVisibleToOwnerNo.setBackgroundResource(R.drawable.owner_no_circle_un_select)
mVisibleToOwnerNo.setTextColor(resources.getColor(R.color.edit_hint_color))
}
mVisibleToOwnerNo.setOnClickListener {
mVisibleToOwnerNo.setBackgroundResource(R.drawable.owner_no_circle_select)
mVisibleToOwnerNo.setTextColor(Color.WHITE)
mVisibleToOwnerYes.setBackgroundResource(R.drawable.owner_yes_circle_un_select)
mVisibleToOwnerYes.setTextColor(resources.getColor(R.color.edit_hint_color))
}
}
}
package com.rudian.homebozz.home.myJobs
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import androidx.appcompat.widget.AppCompatButton
import androidx.appcompat.widget.AppCompatTextView
import com.rudian.homebozz.R
import com.rudian.library.ui.loopview.LoopView
import com.rudian.library.ui.loopview.OnItemSelectedListener
/**
* Created on 2019-11-29
* Created by xuelimin
*/
class JobInfoEditShowDialog : Dialog {
private var datas = ArrayList<String>()
private var loopView: LoopView? = null
private var title: AppCompatTextView? = null
private var strTitle = ""
private var listener: OnItemSelectedListener? = null
private var initPosition: Int = 0
constructor(context: Context, title: String, initPosition: Int, datas: ArrayList<String>, listener: OnItemSelectedListener) : super(context, R.style.ShareDialog) {
this.datas = datas
this.listener = listener
this.strTitle = title
this.initPosition = initPosition
}
constructor(context: Context, themeStyle: Int, title: String, initPosition: Int, datas: ArrayList<String>, listener: OnItemSelectedListener) : super(context, themeStyle) {
this.datas = datas
this.listener = listener
this.strTitle = title
this.initPosition = initPosition
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.dialog_job_info_edit_show)
loopView = findViewById(R.id.loop_view)
if (loopView != null) {
loopView!!.setItems(datas)
loopView!!.setInitPosition(initPosition)
loopView!!.setListener(listener)
// loopView!!.setCenterTextColor(Color.RED)
// loopView!!.setOuterTextColor(Color.BLACK)
}
title = findViewById(R.id.loop_view_top_title)
if (title != null) {
title!!.text = strTitle
// loopView!!.setCenterTextColor(Color.RED)
// loopView!!.setOuterTextColor(Color.BLACK)
}
val btn = findViewById<AppCompatButton>(R.id.loop_view_top_save)
btn.setOnClickListener {
dismiss()
}
// 设置Dialog参数
window!!.attributes.width = WindowManager.LayoutParams.MATCH_PARENT
window!!.attributes.height = WindowManager.LayoutParams.WRAP_CONTENT
window!!.attributes.gravity = Gravity.CENTER
window!!.attributes = window!!.attributes
}
}
\ No newline at end of file
package com.rudian.homebozz.home.myJobs
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import androidx.appcompat.widget.AppCompatButton
import androidx.appcompat.widget.AppCompatTextView
import com.rudian.homebozz.R
/**
* Created on 2019-11-29
* Created by xuelimin
*/
class JobInfoEditTimePickerDialog : Dialog {
private var strTitle = ""
private var yesListener: YesListener? = null
interface YesListener {
fun yesListener()
}
constructor(context: Context, tips: String, yesListener: YesListener) : super(context, R.style.ShareDialog) {
this.yesListener = yesListener
this.strTitle = tips
}
constructor(context: Context, themeStyle: Int, tips: String, yesListener: YesListener) : super(context, themeStyle) {
this.yesListener = yesListener
this.strTitle = tips
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.dialog_job_info_edit_ime_picker)
// 设置Dialog参数
window!!.attributes.width = WindowManager.LayoutParams.MATCH_PARENT
window!!.attributes.height = WindowManager.LayoutParams.WRAP_CONTENT
window!!.attributes.gravity = Gravity.CENTER
window!!.attributes = window!!.attributes
}
}
\ No newline at end of file
package com.rudian.homebozz.home.myJobs
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import androidx.appcompat.widget.AppCompatButton
import androidx.appcompat.widget.AppCompatTextView
import com.rudian.homebozz.R
/**
* Created on 2019-11-29
* Created by xuelimin
*/
class JobInfoTipsDialog : Dialog {
private var strTitle = ""
private var yesListener: YesListener? = null
interface YesListener {
fun yesListener()
}
constructor(context: Context, tips: String, yesListener: YesListener) : super(context, R.style.ShareDialog) {
this.yesListener = yesListener
this.strTitle = tips
}
constructor(context: Context, themeStyle: Int, tips: String, yesListener: YesListener) : super(context, themeStyle) {
this.yesListener = yesListener
this.strTitle = tips
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.dialog_job_info_tips)
val title = findViewById<AppCompatTextView>(R.id.title_tips)
title!!.text = strTitle
val yesBtn = findViewById<AppCompatButton>(R.id.yes_btn)
yesBtn.setOnClickListener {
yesListener!!.yesListener()
dismiss()
}
val btn = findViewById<AppCompatButton>(R.id.no_btn)
btn.setOnClickListener {
dismiss()
}
// 设置Dialog参数
window!!.attributes.width = WindowManager.LayoutParams.MATCH_PARENT
window!!.attributes.height = WindowManager.LayoutParams.WRAP_CONTENT
window!!.attributes.gravity = Gravity.CENTER
window!!.attributes = window!!.attributes
}
}
\ No newline at end of file
package com.rudian.homebozz.home.myJobs
import android.os.Bundle
import com.rudian.homebozz.R
import com.rudian.library.delagete.base.HomeBozzDelegate
/**
* Created on 2019-11-26
* Created by xuelimin
*/
class MyJobDetailsDelegate : HomeBozzDelegate() {
override fun onBindView(savedInstanceState: Bundle?) {
}
override fun setLayout(): Any {
return R.layout.delegate_my_job_details
}
}
\ No newline at end of file
package com.rudian.homebozz.home.myJobs
import android.os.Bundle
import android.util.Log
import com.alibaba.fastjson.JSON
import com.rudian.homebozz.R
import com.rudian.homebozz.home.HomeDelegate
import com.rudian.library.delagete.base.HomeBozzDelegate
import com.rudian.library.net.RestClient
import com.rudian.library.net.callback.IError
import com.rudian.library.net.callback.IFailure
import com.rudian.library.net.callback.ISuccess
import kotlinx.android.synthetic.main.delegate_job_info.*
import kotlinx.android.synthetic.main.delegate_view_job.*
/**
* Created on 2019-11-26
* Created by xuelimin
*/
class ViewJobDelegate : HomeBozzDelegate() {
private var jobJsonStr = ""
private var propertyJsonStr = ""
private var assignmentsJsonStr=""
private var isOnClick = false
override fun onBindView(savedInstanceState: Bundle?) {
mJobViewInfoBack.setOnClickListener {
setBundleData()
pop()
}
mJobInfoLayout.setOnClickListener {
// if (isOnClick) {
val delegate = JobInfoDelegate()
delegate.arguments = arguments
startForResult(delegate, HomeDelegate.JOB_DEATILS)
// }
}
// getJobDetails((arguments!!.getString(MyJobsAdapter.Field.JOB_ID.name)) as String)
}
override fun onBackPressedSupport(): Boolean {
setBundleData()
return super.onBackPressedSupport()
}
var bundle = Bundle()
private fun setBundleData() {
setFragmentResult(HomeDelegate.JOB_DEATILS, bundle)
}
override fun setLayout(): Any {
return R.layout.delegate_view_job
}
private fun getJobDetails(jobId: String) {
val maps = HashMap<String, String>()
maps["job_id"] = jobId
RestClient.builder().url("job/getJobDetails.php")
.loader(context!!)
.formDataParams(true, maps)
.success(object : ISuccess {
override fun onSuccess(response: String) {
Log.i("JobInfoDelegate", "response $response")
isOnClick = true
val jsonObject = JSON.parseObject(response).getJSONObject("data")
jobJsonStr = jsonObject.getJSONObject("job").toJSONString()
propertyJsonStr= jsonObject.getJSONObject("property").toJSONString()
assignmentsJsonStr= jsonObject.getJSONObject("assignments").toJSONString()
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
Log.i("ViewJobDelegate", "msg $msg")
}
})
.failure(object : IFailure {
override fun onFailure() {
}
})
.build().post()
}
}
\ No newline at end of file
package com.rudian.homebozz.home.pending
import android.os.Bundle
import android.util.Log
import com.alibaba.fastjson.JSON
import com.alibaba.fastjson.JSONObject
import com.rudian.homebozz.R
import com.rudian.homebozz.home.childFragments.PendingPagerFragment
import com.rudian.library.delagete.base.HomeBozzDelegate
import com.rudian.library.net.RestClient
import com.rudian.library.net.callback.IError
import com.rudian.library.net.callback.IFailure
import com.rudian.library.net.callback.ISuccess
import kotlinx.android.synthetic.main.delegate_property_details.*
/**
* Created on 2019-09-16
* Created by xuelimin
*/
class PropertyDetailsDelegate : HomeBozzDelegate() {
override fun onBindView(savedInstanceState: Bundle?) {
mRightMessage.setOnClickListener {
start(PropertyDetailsMapDelegate())
}
mPropertyDetailsBack.setOnClickListener {
setBundleData()
pop()
}
getMyJobListing()
}
override fun onBackPressedSupport(): Boolean {
setBundleData()
return super.onBackPressedSupport()
}
private fun setBundleData() {
val bundle = Bundle()
setFragmentResult(PendingPagerFragment.REQUEST_CODE, bundle)
}
private fun getMyJobListing() {
val maps = HashMap<String, String>()
maps["job_id"] = arguments!!.getString("jobId").toString()
RestClient.builder().url("job/getJobDetails.php")
.formDataParams(true, maps)
.success(object : ISuccess {
override fun onSuccess(response: String) {
Log.i("PropertyDetailsDelegate", "response$response")
val jsonObject = JSON.parseObject(response)
if (jsonObject.containsKey("data")) {
val dataJSON = jsonObject.getJSONObject("data")
if (dataJSON.containsKey("job")) {
// val jobData = dataJSON.getJSONObject("job")
// val jobId = getJsonObjectItem(jobData, "job_id")
// val jobType = getJsonObjectItem(jobData, "job_type")
// val description = getJsonObjectItem(jobData, "description")
// val timeRequired = getJsonObjectItem(jobData, "time_required")
// val timeScheduled = getJsonObjectItem(jobData, "time_scheduled")
// val status = getJsonObjectItem(jobData, "status")
}
if (dataJSON.containsKey("property")) {
// val propertyData = dataJSON.getJSONObject("property")
// val propertyId = getJsonObjectItem(propertyData, "property_id")
// val propertyName = getJsonObjectItem(propertyData, "propertyName")
// val address1Local = getJsonObjectItem(propertyData, "address1Local")
// val address2Local = getJsonObjectItem(propertyData, "address2Local")
// val cityLocal = getJsonObjectItem(propertyData, "cityLocal")
// val regionLocal = getJsonObjectItem(propertyData, "regionLocal")
// val postcode = getJsonObjectItem(propertyData, "postcode")
// val short_name = getJsonObjectItem(propertyData, "short_name")
// val longitude = getJsonObjectItem(propertyData, "longitude").toDouble()
// val latitude = getJsonObjectItem(propertyData, "latitude").toDouble()
// val image = getJsonObjectItem(propertyData, "image")
}
}
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
Log.i("PendingPagerFragment", "IError$msg")
}
})
.failure(object : IFailure {
override fun onFailure() {
Log.i("PendingPagerFragment", "onFailure")
}
}).build().post()
}
private fun getJsonObjectItem(jsonObject: JSONObject, key: String): String {
return if (jsonObject.containsKey(key)) {
if (!jsonObject.getString(key).isNullOrEmpty()) {
jsonObject.getString(key)
} else {
""
}
} else {
""
}
}
override fun setLayout(): Any {
return R.layout.delegate_property_details
}
}
\ No newline at end of file
package com.rudian.homebozz.home.pending
import android.os.Bundle
import com.rudian.homebozz.R
import com.rudian.homebozz.home.childFragments.PendingPagerFragment
import com.rudian.library.delagete.base.HomeBozzDelegate
/**
* Created on 2019-09-16
* Created by xuelimin
*/
class PropertyDetailsMapDelegate : HomeBozzDelegate() {
override fun onBindView(savedInstanceState: Bundle?) {
}
override fun onBackPressedSupport(): Boolean {
setBundleData()
return super.onBackPressedSupport()
}
private fun setBundleData() {
val bundle = Bundle()
setFragmentResult(PendingPagerFragment.REQUEST_CODE, bundle)
}
override fun setLayout(): Any {
return R.layout.delegate_property_details_map
}
}
\ No newline at end of file
package com.rudian.homebozz.home.profileSetting
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import com.rudian.homebozz.R
import com.rudian.homebozz.login.LogInDelegate
import com.rudian.homebozz.login.LoginActivity
import com.rudian.library.delagete.base.HomeBozzDelegate
import com.rudian.library.net.RestClient
import com.rudian.library.net.callback.IError
import com.rudian.library.net.callback.IFailure
import com.rudian.library.net.callback.ISuccess
import kotlinx.android.synthetic.main.delegate_edit_profile_password.*
/**
* Created on 2019-08-23
* Created by xuelimin
*/
class EditProfilePasswordDelegate : HomeBozzDelegate() {
override fun onBindView(savedInstanceState: Bundle?) {
mEditProfilePasswordBack.setOnClickListener { pop() }
mEditProfilePasswordSave.setOnClickListener {
if (checkView()) {
changePassword(strCurrentPassword, strNewPassword)
}
}
}
override fun setLayout(): Any {
return R.layout.delegate_edit_profile_password
}
var strCurrentPassword = ""
var strNewPassword = ""
var strConfirmNewPassword = ""
private fun checkView(): Boolean {
var isCheck: Boolean
strCurrentPassword = mCurrentPassword.text.toString()
strNewPassword = mNewPassword.text.toString()
strConfirmNewPassword = mConfirmNewPassword.text.toString()
if (strCurrentPassword.isEmpty()) {
mCurrentPassword.error = getString(R.string.error_login_user_password)
}
if (strConfirmNewPassword.isEmpty()) {
mConfirmNewPassword.error = getString(R.string.error_login_user_password)
}
if (strNewPassword.isEmpty()) {
mNewPassword.error = getString(R.string.error_login_user_password)
isCheck = false
} else {
isCheck = true
}
if (strConfirmNewPassword.isNotEmpty() && strNewPassword.isNotEmpty()) {
if (strConfirmNewPassword != strNewPassword) {
Toast.makeText(context!!, getString(R.string.error_login_user_new_password), Toast.LENGTH_LONG).show()
return false
}
}
return isCheck
}
private fun changePassword(currentPassword: String, newPassword: String) {
val maps = HashMap<String, String>()
maps["data[current]"] = currentPassword
maps["data[new]"] = newPassword
RestClient.builder().url("user/changePassword.php")
.loader(context!!)
.formDataParams(true, maps)
.success(object : ISuccess {
override fun onSuccess(response: String) {
startActivity(Intent(context, LoginActivity::class.java))
mActivity.finish()
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
mEditProfilePasswordError.text = msg
}
})
.failure(object : IFailure {
override fun onFailure() {
}
}).build().post()
}
}
\ No newline at end of file
package com.rudian.homebozz.home.profileSetting
import android.net.Uri
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import com.alibaba.fastjson.JSON
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.request.RequestOptions
import com.rudian.homebozz.R
import com.rudian.homebozz.home.HomeDelegate
import com.rudian.library.app.AccountManager
import com.rudian.library.delagete.base.HomeBozzDelegate
import com.rudian.library.delagete.base.applyPermissionWithPermissionCheck
import com.rudian.library.net.RestClient
import com.rudian.library.net.callback.IError
import com.rudian.library.net.callback.IFailure
import com.rudian.library.net.callback.ISuccess
import com.rudian.library.util.base64.Base64Util
import com.rudian.library.util.callback.CallbackManager
import com.rudian.library.util.callback.CallbackType
import com.rudian.library.util.callback.IGlobalCallback
import kotlinx.android.synthetic.main.delegate_edit_profile_photo.*
/**
* Created on 2019-08-23
* Created by xuelimin
*/
class EditProfilePhotoDelegate : HomeBozzDelegate() {
var isEdit = true
var imagePath = ""
var imageBase64Str = ""
var isUpdateImage = false
override fun onBindView(savedInstanceState: Bundle?) {
imagePath = AccountManager.getUserImagesmedium()
Glide.with(context!!).load(imagePath).apply(RequestOptions().centerCrop().skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)).into(mEditProfilePhotoAvatar)
mEditProfilePhotoBack.setOnClickListener {
setBundleData()
supportDelegate.pop()
}
mEditProfilePhotoSave.setOnClickListener {
if (isEdit) {
applyPermissionWithPermissionCheck()
openPhoto()
} else {
mEditProfilePhotoSave.isEnabled = false
updateUserImage(imageBase64Str)
}
}
}
override fun onBackPressedSupport(): Boolean {
setBundleData()
return super.onBackPressedSupport()
}
private fun setBundleData() {
val bundle = Bundle()
bundle.putBoolean("isUpdateImage", isUpdateImage)
setFragmentResult(HomeDelegate.PROFILE_SETTING_RESULT_CODE, bundle)
}
private fun openPhoto() {
//开始照相机或选择图片
CallbackManager.instance
.addCallback(CallbackType.ON_CROP, object : IGlobalCallback<Any> {
override fun executeCallback(args: Any) {
imagePath = (args as Uri).path.toString()
// mEditProfilePhotoSave.text = getString(R.string.str_save_changes)
val name = imagePath.substring(imagePath.lastIndexOf(".") + 1, imagePath.length)
isEdit = false
Glide.with(context!!).load(imagePath).apply(RequestOptions().centerCrop().skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)).into(mEditProfilePhotoAvatar)
imageBase64Str = "data:image/" + name + ";base64," + Base64Util.GetImageStr(imagePath)
}
})
}
private fun updateUserImage(image: String) {
val maps = HashMap<String, String>()
maps["data[image]"] = image
RestClient.builder().url("user/updateUserImage.php")
.loader(context!!)
.formDataParams(true, maps)
.success(object : ISuccess {
override fun onSuccess(response: String) {
Log.i("ProfilePhotoDelegate", "UserImageresponse$response")
val objects = JSON.parseObject(response)
if (objects.containsKey("data")) {
val dataObjects = objects.getJSONObject("data")
// if (dataObjects.containsKey("user")) {
// val userJson = dataObjects.getJSONObject("user")
// AccountManager.setUserID(userJson.getString("user_id"))
// AccountManager.setUserMobilePhone(userJson.getString("MobilePhone"))
// AccountManager.setUserMobilePhoneCC(userJson.getString("MobilePhoneCC"))
// AccountManager.setEmail(userJson.getString("Email"))
// }
if (dataObjects.containsKey("images")) {
val imagesJson = dataObjects.getJSONObject("images")
val standardJson = imagesJson.getJSONObject("standard")
val thumbnailJson = imagesJson.getJSONObject("thumbnail")
val mediumJson = imagesJson.getJSONObject("medium")
val highJson = imagesJson.getJSONObject("high")
val standardUrl = standardJson.getString("url")
val thumbedUrl = thumbnailJson.getString("url")
val mediumUrl = mediumJson.getString("url")
val highUrl = highJson.getString("url")
AccountManager.setUserUserImagesStandard(standardUrl)
AccountManager.setUserImagesThumbnail(thumbedUrl)
AccountManager.setUserImagesmedium(mediumUrl)
AccountManager.setUserImagesHigh(highUrl)
}
}
isUpdateImage = true
setBundleData()
pop()
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
mEditProfilePhotoError.text = msg
Log.i("ProfilePhotoDelegate", "UserImageonError$msg")
mEditProfilePhotoSave.isEnabled = true
}
})
.failure(object : IFailure {
override fun onFailure() {
Log.i("ProfilePhotoDelegate", "UserImageonFailure")
mEditProfilePhotoSave.isEnabled = true
}
}).build().post()
}
override fun setLayout(): Any {
return R.layout.delegate_edit_profile_photo
}
}
\ No newline at end of file
package com.rudian.homebozz.home.profileSetting
import android.os.Bundle
import android.util.Log
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.request.RequestOptions
import com.rudian.homebozz.R
import com.rudian.homebozz.home.HomeDelegate
import com.rudian.library.app.AccountManager
import com.rudian.library.delagete.base.HomeBozzDelegate
import kotlinx.android.synthetic.main.delegate_profile_setting.*
import me.yokeyword.fragmentation.SupportFragment
/**
* Created on 2019-08-22
* Created by xuelimin
*/
class ProfileSettingDelegate : HomeBozzDelegate() {
override fun onBindView(savedInstanceState: Bundle?) {
mBtnEditProfile.setOnClickListener {
supportDelegate.startForResult(EditProfileDelegate(), HomeDelegate.PROFILE_SET_DEATILS_RESULT_CODE)
}
mUserPasswordInfoLayout.setOnClickListener {
supportDelegate.start(EditProfilePasswordDelegate(), SupportFragment.SINGLETASK)
}
mProfileBack.setOnClickListener {
setBundleData()
supportDelegate.pop()
}
mEditUserAvatar.setOnClickListener {
supportDelegate.startForResult(EditProfilePhotoDelegate(), HomeDelegate.PROFILE_SETTING_RESULT_CODE)
}
mTvProfileUserName.text = AccountManager.getUserName()
mTvProfileUserLastName.text = AccountManager.getEthnicGivenName()
mTvProfileUserMobilePhone.text = "+ " + AccountManager.getUserMobilePhoneCC() + AccountManager.getUserMobilePhone()
mTvProfileMail.text = AccountManager.getEmail()
Glide.with(context!!).load(AccountManager.getUserImagesThumbnail()).apply(RequestOptions().centerCrop().skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)).into(mCiUserAvatar)
}
override fun onBackPressedSupport(): Boolean {
setBundleData()
return super.onBackPressedSupport()
}
var bundle = Bundle()
private fun setBundleData() {
setFragmentResult(HomeDelegate.PROFILE_SETTING_RESULT_CODE, bundle)
}
override fun onFragmentResult(requestCode: Int, resultCode: Int, data: Bundle) {
if (requestCode == HomeDelegate.PROFILE_SETTING_RESULT_CODE) {
val isUpdateImage = data.getBoolean("isUpdateImage")
Log.i("onFragmentResult", "ProfileSettingDelegate isUpdateImage $isUpdateImage")
if (isUpdateImage) {
bundle = data
Glide.with(context!!).load(AccountManager.getUserImagesThumbnail())
.apply(RequestOptions().centerCrop().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE))
.into(mCiUserAvatar)
}
} else if (requestCode == HomeDelegate.PROFILE_SET_DEATILS_RESULT_CODE) {
mTvProfileUserName.text = AccountManager.getUserName()
mTvProfileUserLastName.text = AccountManager.getEthnicGivenName()
mTvProfileUserMobilePhone.text = "+ " + AccountManager.getUserMobilePhoneCC() + AccountManager.getUserMobilePhone()
mTvProfileMail.text = AccountManager.getEmail()
}
super.onFragmentResult(requestCode, resultCode, data)
}
override fun setLayout(): Any {
return R.layout.delegate_profile_setting
}
}
\ No newline at end of file
package com.rudian.homebozz.launcher
import android.content.Intent
import android.os.Bundle
import android.util.Log
import com.rudian.homebozz.R
import com.rudian.library.activites.ProxyActivity
import com.rudian.library.app.HomeBozz
import qiu.niorgai.StatusBarCompat
/**
* Created on 2019-11-24
* Created by xuelimin
*/
class LauncherActivity : ProxyActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val actionBar = supportActionBar
actionBar?.hide()
HomeBozz.getConfigurator().withActivity(this)
StatusBarCompat.translucentStatusBar(this, true)
loadRootFragment(R.id.fl_container, LauncherDelegate())
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
Log.i("onActivityResult", "HomeActivity requestCode$requestCode resultCode$resultCode ")
super.onActivityResult(requestCode, resultCode, data)
}
override fun onBackPressedSupport() {
}
}
\ No newline at end of file
package com.rudian.homebozz.launcher
import android.content.Intent
import android.os.Bundle
import com.rudian.homebozz.R
import com.rudian.homebozz.login.LoginActivity
import com.rudian.library.delagete.base.HomeBozzDelegate
import com.rudian.library.ui.timer.BaserTimerTask
import com.rudian.library.ui.timer.ITimerListener
import kotlinx.android.synthetic.main.delegate_launcher.*
import java.text.MessageFormat
import java.util.*
/**
* Created on 2019/02/01 15:34
* Created by 薛立民
* TEL 13262933389
*/
class LauncherDelegate : HomeBozzDelegate(), ITimerListener {
private var mTimer: Timer? = null
private var mCount = 3
override fun onBindView(savedInstanceState: Bundle?) {
initTimer()
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
tv_time.setOnClickListener {
startIndexDelegate()
}
}
private fun startIndexDelegate() {
val intent = Intent(context, LoginActivity::class.java)
mActivity.startActivity(intent)
mActivity.finish()
}
private fun initTimer() {
mTimer = Timer()
val task = BaserTimerTask(this)
mTimer!!.schedule(task, 0, 1000)
}
override fun setLayout(): Any {
return R.layout.delegate_launcher
}
override fun onTimer() {
mActivity.runOnUiThread {
if (tv_time != null) {
tv_time!!.text = MessageFormat.format("{0}s", mCount)
mCount--
if (mCount < 0) {
if (mTimer != null) {
mTimer!!.cancel()
mTimer = null
startIndexDelegate()
}
}
}
}
}
}
package com.rudian.homebozz.login
import android.os.Bundle
import android.os.CountDownTimer
import android.util.Log
import android.widget.Toast
import androidx.appcompat.widget.AppCompatEditText
import com.alibaba.fastjson.JSON
import com.rudian.homebozz.R
import com.rudian.library.app.AccountManager
import com.rudian.library.delagete.base.HomeBozzDelegate
import com.rudian.library.net.RestClient
import com.rudian.library.net.callback.IError
import com.rudian.library.net.callback.IFailure
import com.rudian.library.net.callback.ISuccess
import kotlinx.android.synthetic.main.delegate_forgot_password.*
/**
* Created on 2019-10-15
* Created by xuelimin
*/
class ForgotPasswordDelegate : HomeBozzDelegate() {
var mailStr = ""
var codeStr = ""
override fun onBindView(savedInstanceState: Bundle?) {
mForgotPasswordSubmitBtn.setOnClickListener {
mailStr = mForgotPasswordEmailEdit.text.toString()
if (check(mForgotPasswordEmailEdit, getString(R.string.str_forgot_password_input_id_error))) {
requestOTP(mailStr)
}
}
mForgotPasswordResendPasscodeBtn.setOnClickListener {
requestOTP(mailStr)
}
mForgotPasswordSubmitPasscodeBtn.setOnClickListener {
codeStr = mForgotPasswordPasscodeEdit.text.toString()
if (check(mForgotPasswordPasscodeEdit, getString(R.string.str_forgot_password_input_id_error))) {
verifyOTP(mailStr, codeStr)
}
}
mForgotPasswordPasscodeEdit.isEnabled = false
mForgotPasswordSubmitPasscodeBtn.isEnabled = false
mForgotPasswordResendPasscodeBtn.isEnabled = false
}
private fun requestOTP(user: String) {
val hashMap = HashMap<String, String>()
hashMap["login"] = user
RestClient.builder().url("user/requestOTP.php").loader(context!!)
.formDataParams(false, hashMap)
.success(object : ISuccess {
override fun onSuccess(response: String) {
btnStaic()
}
})
.failure(object : IFailure {
override fun onFailure() {
Toast.makeText(context, "获取失败", Toast.LENGTH_SHORT).show()
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
Log.i("error", "code $code msg $msg")
if (code == 9 && msg == "Error (9): File requestOTP.php, error too_many_attempts") {
btnStaic()
} else {
Toast.makeText(context, "获取失败:$msg", Toast.LENGTH_SHORT).show()
}
}
}).build().post()
}
private fun btnStaic() {
mForgotPasswordSubmitBtn.isEnabled = false
val countDownTimer = object : CountDownTimer(30 * 1000, 1000) {
override fun onFinish() {
mForgotPasswordSubmitBtn.isEnabled = true
mForgotPasswordSubmitBtn.text = "Submit"
}
override fun onTick(p0: Long) {
mForgotPasswordSubmitBtn.text = "" + p0 / 1000 + "s"
}
}
countDownTimer.start()
mForgotPasswordPasscodeEdit.isEnabled = true
mForgotPasswordSubmitPasscodeBtn.isEnabled = true
mForgotPasswordResendPasscodeBtn.isEnabled = true
}
private fun verifyOTP(user: String, OTP: String) {
val hashMap = HashMap<String, String>()
hashMap["login"] = user
hashMap["OTP"] = OTP
RestClient.builder().url("user/verifyOTP.php").loader(context!!)
.formDataParams(false, hashMap)
.success(object : ISuccess {
override fun onSuccess(response: String) {
Log.i("ForgotPassword", "response$response")
val objects = JSON.parseObject(response)
if (objects.containsKey("data")) {
val dataObjects = objects.getJSONObject("data")
if (dataObjects.containsKey("images")) {
val imagesJson = dataObjects.getJSONObject("images")
val standardJson = imagesJson.getJSONObject("standard")
val thumbnailJson = imagesJson.getJSONObject("thumbnail")
val mediumJson = imagesJson.getJSONObject("medium")
val highJson = imagesJson.getJSONObject("high")
val standardUrl = standardJson.getString("url")
val thumbedUrl = thumbnailJson.getString("url")
val mediumUrl = mediumJson.getString("url")
val highUrl = highJson.getString("url")
AccountManager.setUserUserImagesStandard(standardUrl)
AccountManager.setUserImagesThumbnail(thumbedUrl)
AccountManager.setUserImagesmedium(mediumUrl)
AccountManager.setUserImagesHigh(highUrl)
}
if (dataObjects.containsKey("CMS")) {
dataObjects.getJSONObject("CMS")
}
if (dataObjects.containsKey("PHPSESSID")) {
val PHPSESSID = dataObjects.getString("PHPSESSID")
AccountManager.setPHPSESSID(PHPSESSID)
}
if (dataObjects.containsKey("user")) {
val userJson = dataObjects.getJSONObject("user")
if (userJson.containsKey("Username"))
AccountManager.setUserName(userJson.getString("Username"))
if (userJson.containsKey("user_id"))
AccountManager.setUserID(userJson.getString("user_id"))
if (userJson.containsKey("FirstName"))
AccountManager.setFirstName(userJson.getString("FirstName"))
if (userJson.containsKey("LastName"))
AccountManager.setLastName(userJson.getString("LastName"))
if (userJson.containsKey("Email"))
AccountManager.setEmail(userJson.getString("Email"))
if (userJson.containsKey("Role")) {
val role = userJson.getString("Role")
if (role.contains("Manager")) {
AccountManager.isManager(true)
} else {
AccountManager.isManager(false)
}
}
}
start(LoginNewPasswordDelegate())
}
}
})
.failure(object : IFailure {
override fun onFailure() {
Log.i("ForgotPassword", "IFailure")
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
Log.i("ForgotPassword", "msg $msg")
}
}).build().post()
}
private fun check(editVIew: AppCompatEditText, error: String): Boolean {
// mailStr = mForgotPasswordEmailEdit.text.toString()
return if (editVIew.text.isNullOrEmpty()) {
editVIew.error = error
false
} else {
editVIew.error = null
true
}
}
override fun setLayout(): Any {
return R.layout.delegate_forgot_password
}
}
\ No newline at end of file
package com.rudian.homebozz.login
import android.content.Intent
import android.os.Bundle
import android.text.Editable
import android.util.Log
import com.alibaba.fastjson.JSON
import com.rudian.homebozz.R
import com.rudian.homebozz.home.HomeActivity
import com.rudian.library.app.AccountManager
import com.rudian.library.delagete.base.HomeBozzDelegate
import com.rudian.library.net.RestClient
import com.rudian.library.net.callback.IError
import com.rudian.library.net.callback.IFailure
import com.rudian.library.net.callback.ISuccess
import kotlinx.android.synthetic.main.delegate_login.*
/**
* Created on 2019-08-21
* Created by xuelimin
*/
class LogInDelegate : HomeBozzDelegate(), ISuccess, IError, IFailure {
override fun onSuccess(response: String) {
val objects = JSON.parseObject(response)
if (objects.containsKey("options")) {
val jobStatusArray = objects.getJSONObject("options")
.getJSONArray("job_status")
AccountManager.setJobStatus(jobStatusArray.toString())
// for (i in 0 until jobStatusArray.size) {
// val jobStatus = jobStatusArray.getJSONObject(i)
// jobStatus.values.forEach {
// Log.i("LogInDelegate", "vjobStatus $it")
// }
// if (jobStatus.containsKey("")) {
// val value = jobStatus.getString("")
// Log.i("LogInDelegate", "value==null $value")
// } else {
// val value = jobStatus.getString("")
// Log.i("LogInDelegate", "value!=null$value")
// }
// }
}
if (objects.containsKey("data")) {
val dataObjects = objects.getJSONObject("data")
if (dataObjects.containsKey("images")) {
val imagesJson = dataObjects.getJSONObject("images")
val standardJson = imagesJson.getJSONObject("standard")
val thumbnailJson = imagesJson.getJSONObject("thumbnail")
val mediumJson = imagesJson.getJSONObject("medium")
val highJson = imagesJson.getJSONObject("high")
val standardUrl = standardJson.getString("url")
val thumbedUrl = thumbnailJson.getString("url")
val mediumUrl = mediumJson.getString("url")
val highUrl = highJson.getString("url")
AccountManager.setUserUserImagesStandard(standardUrl)
AccountManager.setUserImagesThumbnail(thumbedUrl)
AccountManager.setUserImagesmedium(mediumUrl)
AccountManager.setUserImagesHigh(highUrl)
}
if (dataObjects.containsKey("CMS")) {
dataObjects.getJSONObject("CMS")
}
if (dataObjects.containsKey("PHPSESSID")) {
val PHPSESSID = dataObjects.getString("PHPSESSID")
AccountManager.setPHPSESSID(PHPSESSID)
}
if (dataObjects.containsKey("user")) {
val userJson = dataObjects.getJSONObject("user")
if (userJson.containsKey("Username"))
AccountManager.setUserName(userJson.getString("Username"))
if (userJson.containsKey("user_id"))
AccountManager.setUserID(userJson.getString("user_id"))
if (userJson.containsKey("FirstName"))
AccountManager.setFirstName(userJson.getString("FirstName"))
if (userJson.containsKey("LastName"))
AccountManager.setLastName(userJson.getString("LastName"))
if (userJson.containsKey("EthnicGivenName")) {
val mEthnicGivenName = userJson.getString("EthnicGivenName")
if (mEthnicGivenName.isNullOrEmpty()) {
AccountManager.setEthnicGivenName("")
} else {
AccountManager.setEthnicGivenName(mEthnicGivenName)
}
}
if (userJson.containsKey("EthnicLastName")) {
val mEthnicLastName = userJson.getString("EthnicLastName")
if (mEthnicLastName.isNullOrEmpty()) {
AccountManager.setEthnicLastName("")
} else {
AccountManager.setEthnicLastName(mEthnicLastName)
}
}
if (userJson.containsKey("Email"))
AccountManager.setEmail(userJson.getString("Email"))
// supportDelegate.start(TermsContentDelegate())
// supportDelegate.start(LoginNewPasswordDelegate())
// supportDelegate.start(TermsContentDelegate())
if (userJson.containsKey("Role")) {
val role = userJson.getString("Role")
if (role.contains("Manager")) {
AccountManager.isManager(true)
} else {
AccountManager.isManager(false)
}
}
if (mRememberMeCB.isChecked) {
AccountManager.setLoginUserName(strUserName)
AccountManager.setLoginPassword(strPassword)
AccountManager.isRememberMe(true)
} else {
AccountManager.setLoginUserName("")
AccountManager.setLoginPassword("")
AccountManager.isRememberMe(false)
}
//转到“我的工作列表”屏幕
// startActivity(Intent(context, HomeActivity::class.java))
// mActivity.finish()
if (userJson.containsKey("update_password") && userJson.containsKey("ask_terms_acceptance")) {
val updatePassword = userJson.getInteger("update_password")
val askTermsAcceptance = userJson.getInteger("ask_terms_acceptance")
if (updatePassword == 1 && askTermsAcceptance == 1) {
//转到“iv_new password”屏幕
supportDelegate.start(LoginNewPasswordDelegate())
} else if (updatePassword == 0 && askTermsAcceptance == 1) {
//转到“terms and condition”屏幕
supportDelegate.start(TermsContentDelegate())
} else if (updatePassword == 0 && askTermsAcceptance == 0) {
//转到“我的工作列表”屏幕
startActivity(Intent(context, HomeActivity::class.java))
mActivity.finish()
}
}
}
}
mBtnLogin.isEnabled = true
Log.i("LogInDelegate", "response$response")
}
override fun onError(code: Int, msg: String) {
mTvError.text = msg
mBtnLogin.isEnabled = true
}
override fun onFailure() {
mBtnLogin.isEnabled = true
}
var strPassword = ""
var strUserName = ""
override fun onBindView(savedInstanceState: Bundle?) {
mBtnLogin.setOnClickListener {
mTvError.text = ""
if (checkLogin()) {
login(strUserName, strPassword)
mBtnLogin.isEnabled = false
}
}
if (AccountManager.getisRememberMe()) {
mRememberMeCB.isChecked = true
mEditPassword.text = Editable.Factory.getInstance().newEditable(AccountManager.getLoginPassword())
mEditUser.text = Editable.Factory.getInstance().newEditable(AccountManager.getLoginUserName())
}
mTvForgotPassword.setOnClickListener {
supportDelegate.start(ForgotPasswordDelegate())
}
}
private fun login(user: String, password: String) {
val hashMap = HashMap<String, String>()
hashMap["login"] = user
hashMap["password"] = password
RestClient.builder().url("user/login.php").loader(context!!)
.formDataParams(false, hashMap)
.success(this)
.failure(this)
.error(this).build().post()
}
/**
* 检查账户密码是否为空
*/
private fun checkLogin(): Boolean {
var isCheck: Boolean
strPassword = mEditPassword.text.toString()
strUserName = mEditUser.text.toString()
if (strUserName.isEmpty()) {
mEditUser.error = getString(R.string.error_login_user)
}
if (strPassword.isEmpty()) {
mEditPassword.error = getString(R.string.error_login_user_password)
isCheck = false
} else {
isCheck = true
}
return isCheck
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
}
override fun onFragmentResult(requestCode: Int, resultCode: Int, data: Bundle) {
Log.i("onFragmentResult", "LogInDelegate requestCode$requestCode resultCode$resultCode")
supportDelegate.onFragmentResult(requestCode, resultCode, data)
}
override fun setLayout(): Any {
return R.layout.delegate_login
}
}
\ No newline at end of file
package com.rudian.homebozz.login
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import com.rudian.homebozz.R
import com.rudian.library.activites.ProxyActivity
import com.rudian.library.app.HomeBozz
import qiu.niorgai.StatusBarCompat
/**
* Created on 2019-11-24
* Created by xuelimin
*/
class LoginActivity : ProxyActivity() {
// 再点一次退出程序时间设置
private val WAIT_TIME = 2000L
private var TOUCH_TIME: Long = 0
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val actionBar = supportActionBar
actionBar?.hide()
HomeBozz.getConfigurator().withActivity(this)
StatusBarCompat.translucentStatusBar(this, true)
loadRootFragment(R.id.fl_container, LogInDelegate())
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
Log.i("onActivityResult", "HomeActivity requestCode$requestCode resultCode$resultCode ")
super.onActivityResult(requestCode, resultCode, data)
}
override fun onBackPressedSupport() {
if (supportFragmentManager.backStackEntryCount > 1) {
pop()
} else {
if (System.currentTimeMillis() - TOUCH_TIME < WAIT_TIME) {
finish()
} else {
TOUCH_TIME = System.currentTimeMillis()
Toast.makeText(this, "双击退出" + getString(R.string.app_name), Toast.LENGTH_SHORT).show()
}
}
}
}
\ No newline at end of file
package com.rudian.homebozz.login
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import com.rudian.homebozz.R
import com.rudian.library.delagete.base.HomeBozzDelegate
import com.rudian.library.net.RestClient
import com.rudian.library.net.callback.IError
import com.rudian.library.net.callback.IFailure
import com.rudian.library.net.callback.ISuccess
import kotlinx.android.synthetic.main.delegate_login_new_password.*
import kotlinx.android.synthetic.main.delegate_login_new_password.mConfirmNewPassword
import kotlinx.android.synthetic.main.delegate_login_new_password.mNewPassword
/**
* Created on 2019-09-12
* Created by xuelimin
*/
class LoginNewPasswordDelegate : HomeBozzDelegate() {
override fun onBindView(savedInstanceState: Bundle?) {
mLoginNewPasswordBack.setOnClickListener { pop() }
mLoginNewPasswordSave.setOnClickListener {
// supportDelegate.startWithPop(TermsContentDelegate())
if (checkView()) {
resetPassword(strNewPassword)
}
}
}
var strNewPassword = ""
var strConfirmNewPassword = ""
private fun checkView(): Boolean {
var isCheck: Boolean
strNewPassword = mNewPassword.text.toString()
strConfirmNewPassword = mConfirmNewPassword.text.toString()
if (strConfirmNewPassword.isEmpty()) {
mConfirmNewPassword.error = getString(R.string.error_login_user_password)
}
if (strNewPassword.isEmpty()) {
mNewPassword.error = getString(R.string.error_login_user_password)
isCheck = false
} else {
isCheck = true
}
if (strConfirmNewPassword.isNotEmpty() && strNewPassword.isNotEmpty()) {
if (strConfirmNewPassword != strNewPassword) {
Toast.makeText(context!!, getString(R.string.error_login_user_new_password), Toast.LENGTH_LONG).show()
return false
}
}
return isCheck
}
private fun resetPassword(newPassword: String) {
val maps = HashMap<String, String>()
maps["data[new]"] = newPassword
RestClient.builder().url("user/resetPassword.php")
.loader(context!!)
.formDataParams(true, maps)
.success(object : ISuccess {
override fun onSuccess(response: String) {
Log.i("LoginNewPassword", "response$response")
supportDelegate.startWithPop(TermsContentDelegate())
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
mLoginNewPasswordError.text = msg
}
})
.failure(object : IFailure {
override fun onFailure() {
}
}).build().post()
}
override fun setLayout(): Any {
return R.layout.delegate_login_new_password
}
}
\ No newline at end of file
package com.rudian.homebozz.login
import android.content.Intent
import android.os.Bundle
import android.text.Html
import android.util.Log
import com.alibaba.fastjson.JSON
import com.rudian.homebozz.R
import com.rudian.homebozz.home.HomeActivity
import com.rudian.homebozz.home.HomeDelegate
import com.rudian.library.delagete.base.HomeBozzDelegate
import com.rudian.library.net.RestClient
import com.rudian.library.net.callback.IError
import com.rudian.library.net.callback.IFailure
import com.rudian.library.net.callback.ISuccess
import kotlinx.android.synthetic.main.delegate_terms_content.*
/**
* Created on 2019-09-12
* Created by xuelimin
*/
class TermsContentDelegate : HomeBozzDelegate() {
override fun onBindView(savedInstanceState: Bundle?) {
getTermContents()
mTipsTv.text = Html.fromHtml(getString(R.string.str_term_contents_tips))
mDisagreeBtn.setOnClickListener {
pop()
}
mAgreeBtn.setOnClickListener {
acceptTerms()
}
}
private fun acceptTerms() {
val maps = HashMap<String, String>()
maps["agree"] = "1"
RestClient.builder().url("user/acceptTerms.php")
.loader(context!!)
.formDataParams(true, maps)
.success(object : ISuccess {
override fun onSuccess(response: String) {
startActivity(Intent(context, HomeActivity::class.java))
mActivity.finish()
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
// mLoginNewPasswordError.text = msg
}
})
.failure(object : IFailure {
override fun onFailure() {
}
}).build().post()
}
private fun getTermContents() {
RestClient.builder().url("user/getTerms.php")
.loader(context!!)
.formDataParams(true, null)
.success(object : ISuccess {
override fun onSuccess(response: String) {
Log.i("TermsContentDelegate", "getTermContentsResponse$response")
val jsonObject = JSON.parseObject(response)
if (jsonObject.containsKey("data")) {
val dataJson = jsonObject.getJSONObject("data")
if (dataJson.containsKey("content")) {
// mContentStr=dataJson.getString("content")
mContentTv.text = Html.fromHtml(dataJson.getString("content"))
}
}
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
// mLoginNewPasswordError.text = msg
}
})
.failure(object : IFailure {
override fun onFailure() {
}
}).build().post()
}
override fun setLayout(): Any {
return R.layout.delegate_terms_content
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/color_my_theme" />
<corners android:radius="1000dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/white" />
<corners android:radius="1000dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#C0C0C2" />
<corners android:radius="1000dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/white" />
<stroke
android:width="1dp"
android:color="@android:color/white" />
<corners android:radius="10dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent" />
<stroke
android:width="1dp"
android:color="#C0C0C2" />
<corners android:radius="5dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#E7EAF0" />
<stroke
android:width="1dp"
android:color="#E7EAF0" />
<corners android:radius="6dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent" />
<stroke
android:width="1dp"
android:color="#84868B" />
<corners android:radius="5dp" />
</shape>
\ 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:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillColor="#26A69A"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#AEDE81" />
<corners android:radius="5dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/color_my_theme" />
<corners android:radius="5dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#2ABCD5" />
<corners android:radius="5dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#C0C0C2" />
<corners android:radius="5dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
<solid android:color="@android:color/transparent" />
<stroke
android:width="1dp"
android:color="@android:color/transparent" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#00D6D8" />
<stroke
android:width="1dp"
android:color="#00D6D8" />
<corners android:radius="5dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#f6f7f9" />
<stroke
android:width="1dp"
android:color="#f6f7f9" />
<corners android:radius="5dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent" />
<stroke
android:width="1dp"
android:color="#C0C0C2" />
<corners android:radius="5dp" />
</shape>
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.60'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
## 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.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -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
#Fri Aug 23 17:23:19 CST 2019
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M"
# 需要在gradle.properties中添加下面两行代码
# 这是因为混合支持库。通过添加这些行选择androidX作为您的支持库
#android.useAndroidX=true
#android.enableJetifier=true
\ No newline at end of file
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# 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
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# 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
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" ] ; 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, switch paths to Windows format before running java
if $cygwin ; 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=$((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
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
@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
@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=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
include ':app', ':library', ':loopview'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment