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
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.util.Log
import android.view.Gravity
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.fastjson.JSON
import com.alibaba.fastjson.JSONObject
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.childFragments.PendingPagerFragment
import com.rudian.homebozz.home.myJobs.AssignedBean
import com.rudian.homebozz.home.myJobs.MyJobsAdapter
import com.rudian.homebozz.home.myJobs.ViewJobDelegate
import com.rudian.homebozz.home.pending.PropertyDetailsDelegate
import com.rudian.homebozz.home.profileSetting.ProfileSettingDelegate
import com.rudian.homebozz.login.LoginActivity
import com.rudian.library.app.AccountManager
import com.rudian.library.delagete.base.HomeBozzDelegate
import com.rudian.library.delagete.base.startScanWithPermissionCheck
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.ui.dialog.BottomDialog
import com.rudian.library.ui.recycler.ItemType
import com.rudian.library.ui.recycler.MultipleFields
import com.rudian.library.ui.recycler.MultipleItemEntity
import com.rudian.library.ui.recycler.MultipleRecyclerAdapter
import com.rudian.library.util.callback.CallbackManager
import com.rudian.library.util.callback.CallbackType
import com.rudian.library.util.callback.IGlobalCallback
import com.rudian.library.util.language.Util
import kotlinx.android.synthetic.main.delegate_home.*
/**
* Created on 2019-08-22
* Created by xuelimin
*/
class HomeDelegate : HomeBozzDelegate(), MultipleRecyclerAdapter.OnItemClickListener {
override fun onItemClickListener(position: Int, entity: MultipleItemEntity) {
mJobStatusTv.text = entity.getField(MultipleFields.TEXT) as String
mJobstatusStr = entity.getField(MultipleFields.TITLE) as String
getMyJobListing(1, mJobstatusStr, myJobs)
bottomDialog!!.dismiss()
}
companion object {
val PROFILE_SETTING_RESULT_CODE = 1111
val PROFILE_SET_DEATILS_RESULT_CODE = 1112
val JOB_DEATILS = 1113
val MY_JOBS_ONLY = "1"
val MY_JOBS_all = "0"
}
private var isMyJob = false
private var myJobs = MY_JOBS_all//Default: 1 1 (show jobs assigned to user only), 0 (show all jobs if user has access right)
private var bottomDialog: BottomDialog? = null
override fun onBindView(savedInstanceState: Bundle?) {
mDrawerLayout.setScrimColor(Color.TRANSPARENT)
Glide.with(context!!).load(AccountManager.getUserImagesThumbnail())
.apply(RequestOptions().centerCrop().skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)).into(mIvUserAvatar)
mLeftMenu.setOnClickListener {
mDrawerLayout.openDrawer(Gravity.LEFT)
}
mLogoutLayout.setOnClickListener {
logout()
}
mHomeImage.setOnClickListener {
myJobs = MY_JOBS_all
getMyJobListing(1, mJobstatusStr, myJobs)
if (AccountManager.getIsManager()) {
mTvTitle.text = getString(R.string.str_manage_jobs)
mPropertiesLayout.visibility = View.VISIBLE
isMyJob = false
} else {
mTvTitle.text = getString(R.string.str_my_jobs)
mPropertiesLayout.visibility = View.GONE
isMyJob = true
}
}
mJobsLayout.setOnClickListener {
mDrawerLayout.closeDrawer(Gravity.LEFT)
isMyJob = true
myJobs = MY_JOBS_ONLY
mTvTitle.text = getString(R.string.str_my_jobs)
getMyJobListing(1, mJobstatusStr, myJobs)
}
if (AccountManager.getIsManager()) {
mTvTitle.text = getString(R.string.str_manage_jobs)
mPropertiesLayout.visibility = View.VISIBLE
isMyJob = false
} else {
mTvTitle.text = getString(R.string.str_my_jobs)
mPropertiesLayout.visibility = View.GONE
isMyJob = true
}
val entitens = ArrayList<MultipleItemEntity>()
val jobStatusArray = JSON.parseArray(AccountManager.getJobStatus())
// AccountManager.setJobStatus(jobStatusArray.toString())
for (i in 0 until jobStatusArray.size) {
val jobStatus = jobStatusArray.getJSONObject(i)
val entity = MultipleItemEntity.builder()
entity.setItemType(ItemType.TEXT)
jobStatus.keys.forEach {
entity.setField(MultipleFields.TITLE, it)
}
jobStatus.values.forEach {
entity.setField(MultipleFields.TEXT, it)
}
entitens.add(entity.build())
}
val mDialogAdapter = MultipleRecyclerAdapter(entitens)
bottomDialog = BottomDialog(context!!, mDialogAdapter!!, this)
mJobTypeLayout.setOnClickListener {
bottomDialog!!.show()
}
mEditProfileLayout.setOnClickListener {
mDrawerLayout.closeDrawer(Gravity.LEFT)
supportDelegate.startForResult(ProfileSettingDelegate(), PROFILE_SETTING_RESULT_CODE)
}
mTvUserName.text = AccountManager.getUserName()
mTvFirstName.text = AccountManager.getEthnicLastName()
mTvLastName.text = AccountManager.getEthnicGivenName()
mQRCoderImage.setOnClickListener {
startScanWithPermissionCheck(this)
}
CallbackManager.instance.addCallback(CallbackType.ON_SCAN, object : IGlobalCallback<Any> {
override fun executeCallback(args: Any) {
val data = args as String
if (data.contains("homebozz://property/")) {
val propertyId = data.substring(data.lastIndexOf("property/") + "property/".length, data.lastIndexOf("/"))
Log.i("HomeDelegate", "args $args")
Log.i("HomeDelegate", "propertyId $propertyId")
property(propertyId)
} else {
}
}
})
mJobStatusTv.text = "All"
getMyJobListing(1, mJobstatusStr, myJobs)
val layoutManager = LinearLayoutManager(context)
layoutManager.orientation = LinearLayoutManager.VERTICAL
mContentRV.layoutManager = layoutManager
adapter = MyJobsAdapter(entities)
adapter!!.setItemClick(object : MyJobsAdapter.ItemOnClick {
override fun itemOnClick(entity: MultipleItemEntity) {
val delegate = ViewJobDelegate()
val bundle = Bundle()
bundle.putString(MyJobsAdapter.Field.JOB_ID.name, entity.getField(MyJobsAdapter.Field.JOB_ID) as String)
bundle.putBoolean("isMyJob", isMyJob)
delegate.arguments = bundle
supportDelegate.startForResult(delegate, JOB_DEATILS)
}
})
mContentRV.adapter = adapter
}
val entities = ArrayList<MultipleItemEntity>()
var adapter: MyJobsAdapter? = null
var page = 1
var isRefreshing = true
var mJobstatusStr = ""
private fun getMyJobListing(page: Int, status: String, my_jobs: String) {
val maps = HashMap<String, String>()
maps["status"] = status
maps["order_by"] = "time_status_updated"
maps["direction"] = "ASC"
maps["keyword"] = ""
maps["my_jobs"] = my_jobs
maps["page"] = "$page"
RestClient.builder().url("job/getJobListing.php")
.loader(context!!)
.formDataParams(true, maps)
.success(object : ISuccess {
override fun onSuccess(response: String) {
Log.i("PendingPagerFragment", "response$response")
entities.clear()
val jsonData = JSON.parseObject(response)
if (jsonData.containsKey("data")) {
var jsonArray = jsonData.getJSONObject("data").getJSONArray("jobs")
if (page == 1) {
entities.clear()
}
for (i in 0 until jsonArray.size) {
val entity = MultipleItemEntity.builder().setItemType(MyJobsAdapter.ITEM_TYPE)
val jsonObject = jsonArray.getJSONObject(i)
val jobId = getJsonObjectItem(jsonObject, "job_id")
val jobTypeObject = jsonObject.getJSONObject("job_type")
val jobType = jobTypeObject.getString("label")
val value = jobTypeObject.getString("value")
val status = getJsonObjectItem(jsonObject, "status")
val timeRequired = getJsonObjectItem(jsonObject, "time_required")
val propertyId = getJsonObjectItem(jsonObject, "property_id")
val propertyName = getJsonObjectItem(jsonObject, "property_name")
val timeStatusUpdated = getJsonObjectItem(jsonObject, "time_status_updated")
val timeScheduled = getJsonObjectItem(jsonObject, "time_scheduled")
val referenceId = getJsonObjectItem(jsonObject, "reference_id")
val description = getJsonObjectItem(jsonObject, "description")
val timeCreated = getJsonObjectItem(jsonObject, "time_created")
val bookmarked = getJsonObjectItem(jsonObject, "bookmarked")
entity.setField(MyJobsAdapter.Field.JOB_ID, jobId)
entity.setField(MyJobsAdapter.Field.JOB_TYPE, jobType)
entity.setField(MyJobsAdapter.Field.JOB_TYPE_VALUE, value)
entity.setField(MyJobsAdapter.Field.STATUS, status)
entity.setField(MyJobsAdapter.Field.TIME_REQUIRED, timeRequired)
entity.setField(MyJobsAdapter.Field.PROPERTY_ID, propertyId)
entity.setField(MyJobsAdapter.Field.PROPERTY_NAME, propertyName)
entity.setField(MyJobsAdapter.Field.TIME_STATUS_UPDATED, timeStatusUpdated)
entity.setField(MyJobsAdapter.Field.TIME_SCHEDULED, timeScheduled)
entity.setField(MyJobsAdapter.Field.REFERENCE_ID, referenceId)
entity.setField(MyJobsAdapter.Field.DESCRIPTION, description)
entity.setField(MyJobsAdapter.Field.TIME_CREATED, timeCreated)
entity.setField(MyJobsAdapter.Field.BOOKMARKED, bookmarked)
val priorityJson = jsonObject.getJSONObject("priority")
val priorityLabel = getJsonObjectItem(priorityJson, "label")
val priorityRGB = getJsonObjectItem(priorityJson, "rgb")
entity.setField(MyJobsAdapter.Field.PRIORITY_LABEL, priorityLabel)
entity.setField(MyJobsAdapter.Field.PRIORITY_RGB, priorityRGB)
val messagesJson = jsonObject.getJSONObject("messages")
val unread = getJsonObjectItem(messagesJson, "total_unread")
entity.setField(MyJobsAdapter.Field.MESSAGES_UNREAD, unread)
val assignedJSONArray = jsonObject.getJSONArray("assigned_to")
if (!assignedJSONArray.isNullOrEmpty()) {
val assigned = ArrayList<AssignedBean>()
for (j in 0 until assignedJSONArray.size) {
val assignedBean = AssignedBean()
val assignedJson = assignedJSONArray.getJSONObject(j)
val assignedToUserId = getJsonObjectItem(assignedJson, "user_id")
val assignedToAccepted = getJsonObjectItem(assignedJson, "accepted")
val assignedToFirstName = getJsonObjectItem(assignedJson, "FirstName")
val assignedToLastName = getJsonObjectItem(assignedJson, "LastName")
val assignedToEthnicGivenName = getJsonObjectItem(assignedJson, "EthnicGivenName")
val assignedToEthnicLastName = getJsonObjectItem(assignedJson, "EthnicLastName")
val assignedToProfileImage = getJsonObjectItem(assignedJson, "profile_image")
val assignedToFullName = getJsonObjectItem(assignedJson, "FullName")
val assignedToProfileImageUrl = getJsonObjectItem(assignedJson, "image_url")
assignedBean.ASSIGNED_TO_USER_ID = assignedToUserId
assignedBean.ASSIGNED_TO_ACCEPTED = assignedToAccepted
assignedBean.ASSIGNED_TO_FIRST_NAME = assignedToFirstName
assignedBean.ASSIGNED_TO_LAST_NAME = assignedToLastName
assignedBean.ASSIGNED_TO_ETHNIC_GIVEN_NAME = assignedToEthnicGivenName
assignedBean.ASSIGNED_TO_ETHNIC_LAST_NAME = assignedToEthnicLastName
assignedBean.ASSIGNED_TO_PROFILE_IMAGE = assignedToProfileImage
assignedBean.ASSIGNED_TO_PROFILE_FULLNAME = assignedToFullName
assignedBean.ASSIGNED_TO_PROFILE_IMAGE_URL = assignedToProfileImageUrl
assigned.add(assignedBean)
}
entity.setField(MyJobsAdapter.Field.ASSIGNED_TO, assigned)
}
entities.add(entity.build())
}
adapter!!.notifyDataSetChanged()
}
}
})
.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 {
""
}
}
private fun property(propertyId: String) {
val body = HashMap<String, String>()
body["meta[language]"] = Util.getLanguage()
val hashStr = AccountManager.getUserID() + Util.getSecondTimestamp() + AccountManager.getPHPSESSID()
body["meta[hash]"] = Util.sha512(hashStr)
body["meta[user_id]"] = AccountManager.getUserID()
body["meta[timestamp]"] = Util.getSecondTimestamp().toString()
RestClient.builder().url("property/$propertyId/scan/").loader(context!!)
.formDataParams(false, body)
.success(object : ISuccess {
override fun onSuccess(response: String) {
Log.i("HomeDelegate", "response $response")
val jsonObject = JSON.parseObject(response)
if (jsonObject.containsKey("data")) {
val dataJson = jsonObject.getJSONArray("data")
if (!dataJson.isNullOrEmpty() && dataJson.size > 0) {
val size = dataJson.size
if (size > 1) {
} else {
val delegate = PropertyDetailsDelegate()
val bundle = Bundle()
bundle.putString("jobId", dataJson.getJSONObject(0).getString("job_id"))
delegate.arguments = bundle
supportDelegate.start(delegate)
}
} else {
if (jsonObject.containsKey("add_job")) {
val addJob = jsonObject.getString("add_job")
if (addJob == "0") {//0=没有访问权限
} else if (addJob == "1") {//1=获得访问权限(显示“添加新作业”按钮)
}
}
}
}
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
Log.i("HomeDelegate", "msg $msg")
}
})
.failure(object : IFailure {
override fun onFailure() {
Log.i("HomeDelegate", "onFailure")
}
}).build().post()
}
override fun onFragmentResult(requestCode: Int, resultCode: Int, data: Bundle) {
Log.i("onFragmentResult", "HomeDelegate requestCode $requestCode")
if (requestCode == PROFILE_SETTING_RESULT_CODE) {
val isUpdateImage = data.getBoolean("isUpdateImage")
Log.i("onFragmentResult", "HomeDelegate isUpdateImage $isUpdateImage")
if (isUpdateImage) {
Glide.with(context!!).load(AccountManager.getUserImagesThumbnail()).apply(RequestOptions().centerCrop().skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)).into(mIvUserAvatar)
}
super.onFragmentResult(requestCode, resultCode, data)
} else if (requestCode == JOB_DEATILS) {
// adapter!!.getChildFragment().onFragmentResult(requestCode, resultCode, data)
}
}
private fun logout() {
RestClient.builder().url("user/logout.php").loader(context!!)
.raw("1")
.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) {
}
})
.failure(object : IFailure {
override fun onFailure() {
}
}).build().post()
}
override fun setLayout(): Any {
return R.layout.delegate_home
}
}
\ No newline at end of file
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.childFragments
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.alibaba.fastjson.JSON
import com.alibaba.fastjson.JSONObject
import com.rudian.homebozz.R
import com.rudian.homebozz.home.adpter.PendingAdapter
import com.rudian.homebozz.home.pending.PropertyDetailsDelegate
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 com.rudian.library.ui.recycler.MultipleItemEntity
import kotlinx.android.synthetic.main.fragment_pager_pending.*
import me.yokeyword.fragmentation.SupportFragment
/**
* Created on 2019-09-10
* Created by xuelimin
*/
class PendingPagerFragment : SupportFragment(), SwipeRefreshLayout.OnRefreshListener
, PendingAdapter.OnItemClickListener {
override fun onItemClickListener(entity: MultipleItemEntity, position: Int) {
// Log.i("PendingPagerFragment", "position$position")
val delegate = PropertyDetailsDelegate()
val bundle = Bundle()
bundle.putString("jobId", entity.getField(PendingAdapter.Field.JOB_ID) as String)
delegate.arguments = bundle
parentDelegate!!.startForResult(delegate, REQUEST_CODE)
}
companion object {
val REQUEST_CODE = 1211
var parentDelegate: HomeBozzDelegate? = null
fun newInstance(delegate: HomeBozzDelegate): PendingPagerFragment {
val args = Bundle()
val fragment = PendingPagerFragment()
fragment.arguments = args
parentDelegate = delegate
return fragment
}
}
override fun onFragmentResult(requestCode: Int, resultCode: Int, data: Bundle?) {
Log.i("PendingPagerFragment", "REQUEST_CODE$requestCode $resultCode")
super.onFragmentResult(requestCode, resultCode, data)
}
override fun onRefresh() {
mRefreshLayout.postDelayed({
mRefreshLayout.isRefreshing = false
isRefreshing = true
page = 0
getMyJobListing(page)
}, 200)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_pager_pending, container, false)
}
val entities = ArrayList<MultipleItemEntity>()
var adapter: PendingAdapter? = null
var page = 0
var isRefreshing = true
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
mRefreshLayout.setOnRefreshListener(this)
val layoutManager = LinearLayoutManager(context)
layoutManager.orientation = LinearLayoutManager.VERTICAL
mContentRV.layoutManager = layoutManager
if (entities.size == 0) {
getMyJobListing(page)
} else {
mContentRV.adapter = adapter
}
}
private fun getMyJobListing(page: Int) {
val maps = HashMap<String, String>()
maps["data[current]"] = "accepted"
RestClient.builder().url("job/getMyJobListing.php")
.formDataParams(true, maps)
.success(object : ISuccess {
override fun onSuccess(response: String) {
Log.i("PendingPagerFragment", "response$response")
val jsonData = JSON.parseObject(response)
if (jsonData.containsKey("data")) {
var jsonArray = jsonData.getJSONArray("data")
jsonArray = if (jsonArray != null && jsonArray.size > 0) {
JSON.parseObject(response).getJSONArray("data")
} else {
JSON.parseObject(string).getJSONArray("data")
}
if (page == 0) {
entities.clear()
}
for (i in 0 until jsonArray.size) {
val entity = MultipleItemEntity.builder()
.setItemType(PendingAdapter.ITEM_TYPE)
val jsonObject = jsonArray.getJSONObject(i)
val jobId = getJsonObjectItem(jsonObject, "job_id")
val jobType = getJsonObjectItem(jsonObject, "job_type")
val timeRequired = getJsonObjectItem(jsonObject, "time_required")
val propertyId = getJsonObjectItem(jsonObject, "property_id")
val propertyName = getJsonObjectItem(jsonObject, "propertyName")
val address1Local = getJsonObjectItem(jsonObject, "address1Local")
val address2Local = getJsonObjectItem(jsonObject, "address2Local")
val cityLocal = getJsonObjectItem(jsonObject, "cityLocal")
val regionLocal = getJsonObjectItem(jsonObject, "regionLocal")
val postcode = getJsonObjectItem(jsonObject, "postcode")
val shortName = getJsonObjectItem(jsonObject, "short_name")
entity.setField(PendingAdapter.Field.JOB_ID, jobId)
entity.setField(PendingAdapter.Field.JOB_TYPE, jobType)
entity.setField(PendingAdapter.Field.TIME_REQUIRED, timeRequired)
entity.setField(PendingAdapter.Field.PROPERTY_ID, propertyId)
entity.setField(PendingAdapter.Field.PROPERTY_NAME, propertyName)
entity.setField(PendingAdapter.Field.ADDRESS1LOCAL, address1Local)
entity.setField(PendingAdapter.Field.ADDRESS2LOCAL, address2Local)
entity.setField(PendingAdapter.Field.CITY_LOCAL, cityLocal)
entity.setField(PendingAdapter.Field.REGION_LOCAL, regionLocal)
entity.setField(PendingAdapter.Field.POSTCODE, postcode)
entity.setField(PendingAdapter.Field.SHORT_NAME, shortName)
val profileImageJSON = getProfileImageJSON(jsonObject, "profile_image")
if (!profileImageJSON.isNullOrEmpty()) {
if (profileImageJSON.containsKey("standard")) {
val standardJson = profileImageJSON.getJSONObject("standard")
val standardUrl = getJsonObjectItem(standardJson, "url")
val standardWidth = getJsonObjectItem(standardJson, "width")
val standardHeight = getJsonObjectItem(standardJson, "height")
entity.setField(PendingAdapter.Field.PROFILE_IMAGE_STANDARD_URL, standardUrl)
entity.setField(PendingAdapter.Field.PROFILE_IMAGE_STANDARD_WIDTH, standardWidth)
entity.setField(PendingAdapter.Field.PROFILE_IMAGE_STANDARD_HEIGHT, standardHeight)
}
if (profileImageJSON.containsKey("thumbnail")) {
val thumbnailJson = profileImageJSON.getJSONObject("thumbnail")
val thumbnailUrl = getJsonObjectItem(thumbnailJson, "url")
val thumbnailWidth = getJsonObjectItem(thumbnailJson, "width")
val thumbnailHeight = getJsonObjectItem(thumbnailJson, "height")
entity.setField(PendingAdapter.Field.PROFILE_IMAGE_THUMBNAIL_URL, thumbnailUrl)
entity.setField(PendingAdapter.Field.PROFILE_IMAGE_THUMBNAIL_WIDTH, thumbnailWidth)
entity.setField(PendingAdapter.Field.PROFILE_IMAGE_THUMBNAIL_HEIGHT, thumbnailHeight)
}
if (profileImageJSON.containsKey("medium")) {
val mediumJson = profileImageJSON.getJSONObject("medium")
val mediumUrl = getJsonObjectItem(mediumJson, "url")
val mediumWidth = getJsonObjectItem(mediumJson, "width")
val mediumHeight = getJsonObjectItem(mediumJson, "height")
entity.setField(PendingAdapter.Field.PROFILE_IMAGE_MEDIUM_URL, mediumUrl)
entity.setField(PendingAdapter.Field.PROFILE_IMAGE_MEDIUM_WIDTH, mediumWidth)
entity.setField(PendingAdapter.Field.PROFILE_IMAGE_MEDIUM_HEIGHT, mediumHeight)
}
if (profileImageJSON.containsKey("high")) {
val highJson = profileImageJSON.getJSONObject("high")
val highUrl = getJsonObjectItem(highJson, "url")
val highWidth = getJsonObjectItem(highJson, "width")
val highHeight = getJsonObjectItem(highJson, "height")
entity.setField(PendingAdapter.Field.PROFILE_IMAGE_HIGH_URL, highUrl)
entity.setField(PendingAdapter.Field.PROFILE_IMAGE_HIGH_WIDTH, highWidth)
entity.setField(PendingAdapter.Field.PROFILE_IMAGE_HIGH_HEIGHT, highHeight)
}
}
entities.add(entity.build())
}
if (adapter == null) {
adapter = PendingAdapter(entities)
adapter!!.setOnItemClickListener(this@PendingPagerFragment)
}
mContentRV.adapter = adapter
}
}
})
.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 {
""
}
}
private fun getProfileImageJSON(jsonObject: JSONObject, key: String): JSONObject? {
return if (jsonObject.containsKey(key)) {
if (!jsonObject.getJSONObject(key).isNullOrEmpty()) {
jsonObject.getJSONObject(key)
} else {
null
}
} else {
null
}
}
val string = "{\n" +
" \"return_code\":0,\n" +
" \"data\":[\n" +
" {\n" +
" \"job_id\":\"1000006\",\n" +
" \"job_type\":\"cleaning\",\n" +
" \"time_required\":\"1568511000\",\n" +
" \"property_id\":\"10001\",\n" +
" \"propertyName\":\"Hanazono\",\n" +
" \"address1Local\":\"虻田郡旭(字)305番44\",\n" +
" \"address2Local\":null,\n" +
" \"cityLocal\":\"俱知安町\",\n" +
" \"regionLocal\":\"北海道\",\n" +
" \"postcode\":\"044-0083\",\n" +
" \"short_name\":\"Peace of Mind\",\n" +
" \"profile_image\":{\n" +
" \"standard\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" },\n" +
" \"thumbnail\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/tn/\",\n" +
" \"width\":\"160\",\n" +
" \"height\":\"160\"\n" +
" },\n" +
" \"medium\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/med/\",\n" +
" \"width\":\"266\",\n" +
" \"height\":\"400\"\n" +
" },\n" +
" \"high\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" }\n" +
" }\n" +
" },\n" +
" {\n" +
" \"job_id\":\"1000006\",\n" +
" \"job_type\":\"cleaning\",\n" +
" \"time_required\":\"1568511000\",\n" +
" \"property_id\":\"10001\",\n" +
" \"propertyName\":\"Hanazono\",\n" +
" \"address1Local\":\"虻田郡旭(字)305番44\",\n" +
" \"address2Local\":null,\n" +
" \"cityLocal\":\"俱知安町\",\n" +
" \"regionLocal\":\"北海道\",\n" +
" \"postcode\":\"044-0083\",\n" +
" \"short_name\":\"Peace of Mind\",\n" +
" \"profile_image\":{\n" +
" \"standard\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" },\n" +
" \"thumbnail\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/tn/\",\n" +
" \"width\":\"160\",\n" +
" \"height\":\"160\"\n" +
" },\n" +
" \"medium\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/med/\",\n" +
" \"width\":\"266\",\n" +
" \"height\":\"400\"\n" +
" },\n" +
" \"high\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" }\n" +
" }\n" +
" },\n" +
" {\n" +
" \"job_id\":\"1000006\",\n" +
" \"job_type\":\"cleaning\",\n" +
" \"time_required\":\"1568511000\",\n" +
" \"property_id\":\"10001\",\n" +
" \"propertyName\":\"Hanazono\",\n" +
" \"address1Local\":\"虻田郡旭(字)305番44\",\n" +
" \"address2Local\":null,\n" +
" \"cityLocal\":\"俱知安町\",\n" +
" \"regionLocal\":\"北海道\",\n" +
" \"postcode\":\"044-0083\",\n" +
" \"short_name\":\"Peace of Mind\",\n" +
" \"profile_image\":{\n" +
" \"standard\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" },\n" +
" \"thumbnail\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/tn/\",\n" +
" \"width\":\"160\",\n" +
" \"height\":\"160\"\n" +
" },\n" +
" \"medium\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/med/\",\n" +
" \"width\":\"266\",\n" +
" \"height\":\"400\"\n" +
" },\n" +
" \"high\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" }\n" +
" }\n" +
" },\n" +
" {\n" +
" \"job_id\":\"1000006\",\n" +
" \"job_type\":\"cleaning\",\n" +
" \"time_required\":\"1568511000\",\n" +
" \"property_id\":\"10001\",\n" +
" \"propertyName\":\"Hanazono\",\n" +
" \"address1Local\":\"虻田郡旭(字)305番44\",\n" +
" \"address2Local\":null,\n" +
" \"cityLocal\":\"俱知安町\",\n" +
" \"regionLocal\":\"北海道\",\n" +
" \"postcode\":\"044-0083\",\n" +
" \"short_name\":\"Peace of Mind\",\n" +
" \"profile_image\":{\n" +
" \"standard\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" },\n" +
" \"thumbnail\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/tn/\",\n" +
" \"width\":\"160\",\n" +
" \"height\":\"160\"\n" +
" },\n" +
" \"medium\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/med/\",\n" +
" \"width\":\"266\",\n" +
" \"height\":\"400\"\n" +
" },\n" +
" \"high\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" }\n" +
" }\n" +
" },\n" +
" {\n" +
" \"job_id\":\"1000006\",\n" +
" \"job_type\":\"cleaning\",\n" +
" \"time_required\":\"1568511000\",\n" +
" \"property_id\":\"10001\",\n" +
" \"propertyName\":\"Hanazono\",\n" +
" \"address1Local\":\"虻田郡旭(字)305番44\",\n" +
" \"address2Local\":null,\n" +
" \"cityLocal\":\"俱知安町\",\n" +
" \"regionLocal\":\"北海道\",\n" +
" \"postcode\":\"044-0083\",\n" +
" \"short_name\":\"Peace of Mind\",\n" +
" \"profile_image\":{\n" +
" \"standard\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" },\n" +
" \"thumbnail\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/tn/\",\n" +
" \"width\":\"160\",\n" +
" \"height\":\"160\"\n" +
" },\n" +
" \"medium\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/med/\",\n" +
" \"width\":\"266\",\n" +
" \"height\":\"400\"\n" +
" },\n" +
" \"high\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" }\n" +
" }\n" +
" },\n" +
" {\n" +
" \"job_id\":\"1000006\",\n" +
" \"job_type\":\"cleaning\",\n" +
" \"time_required\":\"1568511000\",\n" +
" \"property_id\":\"10001\",\n" +
" \"propertyName\":\"Hanazono\",\n" +
" \"address1Local\":\"虻田郡旭(字)305番44\",\n" +
" \"address2Local\":null,\n" +
" \"cityLocal\":\"俱知安町\",\n" +
" \"regionLocal\":\"北海道\",\n" +
" \"postcode\":\"044-0083\",\n" +
" \"short_name\":\"Peace of Mind\",\n" +
" \"profile_image\":{\n" +
" \"standard\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" },\n" +
" \"thumbnail\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/tn/\",\n" +
" \"width\":\"160\",\n" +
" \"height\":\"160\"\n" +
" },\n" +
" \"medium\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/med/\",\n" +
" \"width\":\"266\",\n" +
" \"height\":\"400\"\n" +
" },\n" +
" \"high\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" }\n" +
" }\n" +
" },\n" +
" {\n" +
" \"job_id\":\"1000008\",\n" +
" \"job_type\":\"repair\",\n" +
" \"time_required\":\"1568158200\",\n" +
" \"property_id\":\"10001\",\n" +
" \"propertyName\":\"Hanazono\",\n" +
" \"address1Local\":\"虻田郡旭(字)305番44\",\n" +
" \"address2Local\":null,\n" +
" \"cityLocal\":\"俱知安町\",\n" +
" \"regionLocal\":\"北海道\",\n" +
" \"postcode\":\"044-0083\",\n" +
" \"short_name\":\"Peace of Mind\",\n" +
" \"profile_image\":{\n" +
" \"standard\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" },\n" +
" \"thumbnail\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/tn/\",\n" +
" \"width\":\"160\",\n" +
" \"height\":\"160\"\n" +
" },\n" +
" \"medium\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/med/\",\n" +
" \"width\":\"266\",\n" +
" \"height\":\"400\"\n" +
" },\n" +
" \"high\":{\n" +
" \"url\":\"https://devel.homeboss.co.jp/endpoints/photo/10092/std/\",\n" +
" \"width\":\"532\",\n" +
" \"height\":\"800\"\n" +
" }\n" +
" }\n" +
" }\n" +
" ]\n" +
"}"
}
\ 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.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.util.Log
import android.view.View
import com.bumptech.glide.Glide
import com.chauthai.swipereveallayout.SwipeRevealLayout
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 kotlinx.android.synthetic.main.iteam_my_jobs.view.*
import java.text.SimpleDateFormat
import java.util.*
import kotlin.collections.ArrayList
/**
* Created on 2019-11-25
* Created by xuelimin
*/
class MyJobsAdapter(data: ArrayList<MultipleItemEntity>) : MultipleRecyclerAdapter(data) {
companion object {
var ITEM_TYPE = 12
}
init {
addItemType(ITEM_TYPE, R.layout.iteam_my_jobs)
}
private var itemClick: ItemOnClick? = null
interface ItemOnClick {
fun itemOnClick(entity: MultipleItemEntity)
}
fun setItemClick(itemClick: ItemOnClick) {
this.itemClick = itemClick
}
enum class Field {
JOB_ID, REFERENCE_ID, DESCRIPTION,STATUS,
JOB_TYPE, JOB_TYPE_VALUE,PRIORITY_LABEL,
PRIORITY_RGB, TIME_CREATED, TIME_STATUS_UPDATED, TIME_SCHEDULED,
TIME_REQUIRED, PROPERTY_ID, PROPERTY_NAME, BOOKMARKED, ASSIGNED_TO,
MESSAGES_UNREAD
}
override fun convert(holder: MultipleViewHolder, entity: MultipleItemEntity) {
super.convert(holder, entity)
when (entity.itemType) {
ITEM_TYPE -> {
val mTvStarted = holder.itemView.mTvStarted
val mIvShowFlag = holder.itemView.mIvShowFlag
val mJobType = holder.itemView.mJobType
val mTvCompletedByTime = holder.itemView.mTvCompletedByTime
val mJobId = holder.itemView.mJobId
val mPropertyName = holder.itemView.mPropertyName
val mPropertyLastTime = holder.itemView.mPropertyLastTime
val mPropertyLastTimeData = holder.itemView.mPropertyLastTimeData
val mTvContent = holder.itemView.mTvContent
val mRightBookmark = holder.itemView.mRightBookmark
val itemTopLayout = holder.itemView.item_top_layout
val mMyJobItemCount = holder.itemView.mMyJobItemCount
val mMyJobItemUnRead = holder.itemView.mMyJobItemUnRead
val gdOne = itemTopLayout.background as GradientDrawable
gdOne.setColor(Color.parseColor(entity.getField(Field.PRIORITY_RGB) as String))
var requiredTime = entity.getField(Field.TIME_REQUIRED) as String
if (!requiredTime.isNullOrEmpty()) {
val requiredTimeStr = SimpleDateFormat("hh:mm MM/dd/yyy").format(requiredTime.toLong() * 1000)
mTvCompletedByTime.text = requiredTimeStr
} else {
mTvCompletedByTime.text = ""
}
var showUpdatedTime: String = if (!(entity.getField(Field.TIME_STATUS_UPDATED) as String).isNullOrEmpty()) {
entity.getField(Field.TIME_STATUS_UPDATED) as String
} else {
entity.getField(Field.TIME_CREATED) as String
}
val updatedTimeDay = Date(showUpdatedTime.toLong() * 1000)
val updatedTimeFormat = SimpleDateFormat("MM/dd/yyyy")
val updatetimeFormat = SimpleDateFormat("hh:mm ")
val updatedTimeStr = updatedTimeFormat.format(updatedTimeDay)
val updatedtimeStr = updatetimeFormat.format(updatedTimeDay)
mPropertyLastTime.text = updatedTimeStr
mPropertyLastTimeData.text = updatedtimeStr
mTvStarted.text = entity.getField(Field.STATUS) as String
mJobType.text = entity.getField(Field.JOB_TYPE) as String
mJobId.text = entity.getField(Field.JOB_ID) as String
mPropertyName.text = entity.getField(Field.PROPERTY_NAME) as String
mTvContent.text = entity.getField(Field.DESCRIPTION) as String
if ((entity.getField(Field.BOOKMARKED) as String) == "1") {
mIvShowFlag.visibility = View.VISIBLE
mRightBookmark.setImageResource(R.drawable.bookmark_2)
} else {
mIvShowFlag.visibility = View.GONE
mRightBookmark.setImageResource(R.drawable.bookmark)
}
val unRead = (entity.getField(Field.MESSAGES_UNREAD) as String).toInt()
if (unRead > 0) {
mMyJobItemUnRead.visibility = View.VISIBLE
mMyJobItemUnRead.text = unRead.toString()
} else {
mMyJobItemUnRead.visibility = View.GONE
}
val mJobTypeAvatar_4 = holder.itemView.mJobTypeAvatar_4
val mJobTypeAvatar_3 = holder.itemView.mJobTypeAvatar_3
val mJobTypeAvatar_2 = holder.itemView.mJobTypeAvatar_2
val mJobTypeAvatar_1 = holder.itemView.mJobTypeAvatar_1
val assignedList = entity.getField(Field.ASSIGNED_TO) as ArrayList<AssignedBean>
val size = assignedList.size
when {
size > 4 -> {
mMyJobItemCount.text = "+" + (size - 4)
mMyJobItemCount.visibility = View.VISIBLE
mJobTypeAvatar_4.visibility = View.VISIBLE
mJobTypeAvatar_3.visibility = View.VISIBLE
mJobTypeAvatar_2.visibility = View.VISIBLE
mJobTypeAvatar_1.visibility = View.VISIBLE
val url1 = assignedList[0].ASSIGNED_TO_PROFILE_IMAGE_URL
val url2 = assignedList[1].ASSIGNED_TO_PROFILE_IMAGE_URL
val url3 = assignedList[2].ASSIGNED_TO_PROFILE_IMAGE_URL
val url4 = assignedList[3].ASSIGNED_TO_PROFILE_IMAGE_URL
Glide.with(mContext).load(url1).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_1)
Glide.with(mContext).load(url2).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_2)
Glide.with(mContext).load(url3).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_3)
Glide.with(mContext).load(url4).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_4)
}
size == 4 -> {
mMyJobItemCount.visibility = View.GONE
mJobTypeAvatar_4.visibility = View.VISIBLE
mJobTypeAvatar_3.visibility = View.VISIBLE
mJobTypeAvatar_2.visibility = View.VISIBLE
mJobTypeAvatar_1.visibility = View.VISIBLE
val url1 = assignedList[0].ASSIGNED_TO_PROFILE_IMAGE_URL
val url2 = assignedList[1].ASSIGNED_TO_PROFILE_IMAGE_URL
val url3 = assignedList[2].ASSIGNED_TO_PROFILE_IMAGE_URL
val url4 = assignedList[3].ASSIGNED_TO_PROFILE_IMAGE_URL
Glide.with(mContext).load(url1).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_1)
Glide.with(mContext).load(url2).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_2)
Glide.with(mContext).load(url3).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_3)
Glide.with(mContext).load(url4).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_4)
}
size == 3 -> {
mMyJobItemCount.visibility = View.GONE
mJobTypeAvatar_4.visibility = View.GONE
mJobTypeAvatar_3.visibility = View.VISIBLE
mJobTypeAvatar_2.visibility = View.VISIBLE
mJobTypeAvatar_1.visibility = View.VISIBLE
val url1 = assignedList[0].ASSIGNED_TO_PROFILE_IMAGE_URL
val url2 = assignedList[1].ASSIGNED_TO_PROFILE_IMAGE_URL
val url3 = assignedList[2].ASSIGNED_TO_PROFILE_IMAGE_URL
Glide.with(mContext).load(url1).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_1)
Glide.with(mContext).load(url2).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_2)
Glide.with(mContext).load(url3).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_3)
}
size == 2 -> {
mMyJobItemCount.visibility = View.GONE
mJobTypeAvatar_4.visibility = View.GONE
mJobTypeAvatar_3.visibility = View.GONE
mJobTypeAvatar_2.visibility = View.VISIBLE
mJobTypeAvatar_1.visibility = View.VISIBLE
val url1 = assignedList[0].ASSIGNED_TO_PROFILE_IMAGE_URL
val url2 = assignedList[1].ASSIGNED_TO_PROFILE_IMAGE_URL
Glide.with(mContext).load(url1).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_1)
Glide.with(mContext).load(url2).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_2)
}
size == 1 -> {
mMyJobItemCount.visibility = View.GONE
mJobTypeAvatar_4.visibility = View.GONE
mJobTypeAvatar_3.visibility = View.GONE
mJobTypeAvatar_2.visibility = View.GONE
mJobTypeAvatar_1.visibility = View.VISIBLE
val url1 = assignedList[0].ASSIGNED_TO_PROFILE_IMAGE_URL
Glide.with(mContext).load(url1).apply(RECYCLER_OPTIONS).into(mJobTypeAvatar_1)
}
size < 1 -> {
mMyJobItemCount.visibility = View.GONE
mJobTypeAvatar_4.visibility = View.GONE
mJobTypeAvatar_3.visibility = View.GONE
mJobTypeAvatar_2.visibility = View.GONE
mJobTypeAvatar_1.visibility = View.GONE
}
}
holder.itemView.swipe_layout.setSwipeListener(object : SwipeRevealLayout.SwipeListener {
override fun onOpened(view: SwipeRevealLayout?) {
Log.i("MyJobsAdapter", "onOpened")
}
override fun onClosed(view: SwipeRevealLayout?) {
Log.i("MyJobsAdapter", "onClosed")
}
override fun onSlide(view: SwipeRevealLayout?, slideOffset: Float) {
Log.i("MyJobsAdapter", "onSlide")
}
})
holder.itemView.front_layout.setOnClickListener {
itemClick!!.itemOnClick(entity)
}
}
}
}
}
\ 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.os.Bundle
import android.text.Editable
import android.util.Log
import android.widget.Toast
import com.alibaba.fastjson.JSON
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 com.rudian.library.ui.dialog.BottomDialog
import com.rudian.library.ui.recycler.ItemType
import com.rudian.library.ui.recycler.MultipleFields
import com.rudian.library.ui.recycler.MultipleItemEntity
import com.rudian.library.ui.recycler.MultipleRecyclerAdapter
import kotlinx.android.synthetic.main.delegate_edit_profile.*
/**
* Created on 2019-08-23
* Created by xuelimin
*/
class EditProfileDelegate : HomeBozzDelegate(), MultipleRecyclerAdapter.OnItemClickListener {
override fun onItemClickListener(position: Int, entity: MultipleItemEntity) {
if (bottomDialog != null) {
mMobilePhoneCC = entity.getField(MultipleFields.TITLE) as String
mSpMobilePhoneCC.text = "+ $mMobilePhoneCC"
bottomDialog!!.dismiss()
}
}
var strFirstName = ""
var strLastName = ""
var strEthnicGivenName = ""
var strEmail = ""
var strEthnicLastName = ""
var strPhone = ""
var isSave = false
var isUnlock = true
var mMobilePhoneCC = ""
var mDialogAdapter: MultipleRecyclerAdapter? = null
var bottomDialog: BottomDialog? = null
override fun onBindView(savedInstanceState: Bundle?) {
setSaveEnabled(false)
getUser()
mEditProfileBack.setOnClickListener {
setBundleData()
pop()
}
mFirstName.text = Editable.Factory.getInstance().newEditable(AccountManager.getFirstName())
mLastName.text = Editable.Factory.getInstance().newEditable(AccountManager.getLastName())
mEditEmail.text = Editable.Factory.getInstance().newEditable(AccountManager.getEmail())
if (!AccountManager.getEthnicGivenName().isNullOrEmpty()) {
mEthnicGivenName.text = Editable.Factory.getInstance().newEditable(AccountManager.getEthnicGivenName())
}
if (!AccountManager.getEthnicLastName().isNullOrEmpty())
mEthnicLastName.text = Editable.Factory.getInstance().newEditable(AccountManager.getEthnicLastName())
mMobilePhoneCC = AccountManager.getUserMobilePhoneCC()
mSpMobilePhoneCC.text = "+ $mMobilePhoneCC"
mSpMobilePhoneCC.setOnClickListener {
bottomDialog!!.show()
}
mEtMobilePhone.text = Editable.Factory.getInstance().newEditable(AccountManager.getUserMobilePhone())
mEditProfileSave.setOnClickListener {
if (isSave) {
if (checkView()) {
updateUser(strEmail, mMobilePhoneCC, strPhone, strFirstName, strLastName, strEthnicGivenName, strEthnicLastName)
}
} else {
}
}
}
private fun setBundleData() {
val bundle = Bundle()
setFragmentResult(HomeDelegate.PROFILE_SET_DEATILS_RESULT_CODE, bundle)
}
private fun setSaveEnabled(isSave: Boolean) {
mEditProfileSave.isEnabled = isSave
this.isSave = isSave
}
override fun onBackPressedSupport(): Boolean {
if (isUnlock)
unlockUser()
setBundleData()
return super.onBackPressedSupport()
}
/**
* 获取用户信息
*/
private fun getUser() {
RestClient.builder().url("user/getUser.php")
.formDataParams(true, null)
.success(object : ISuccess {
override fun onSuccess(response: String) {
Log.i("ProfileSettingDelegate", "response$response")
setSaveEnabled(true)
val objects = JSON.parseObject(response)
if (objects.containsKey("data")) {
}
if (objects.containsKey("options")) {
val optionsArray = objects.getJSONObject("options").getJSONArray("MobilePhoneCC")
val entitens = ArrayList<MultipleItemEntity>()
for (i in 0 until optionsArray.size) {
val entity = MultipleItemEntity.builder()
val objects = optionsArray.getJSONObject(i)
for (key in objects.keys) {
val value = objects.getString(key)
if (value.isNotEmpty()) {
entity.setField(MultipleFields.TEXT, value)
entity.setItemType(ItemType.TEXT)
entity.setField(MultipleFields.TITLE, key)
entitens.add(entity.build())
}
}
}
mDialogAdapter = MultipleRecyclerAdapter(entitens)
bottomDialog = BottomDialog(context!!, mDialogAdapter!!, this@EditProfileDelegate)
}
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
setSaveEnabled(false)
}
})
.failure(object : IFailure {
override fun onFailure() {
Log.i("ProfileSettingDelegate", "onFailure")
setSaveEnabled(false)
}
}).build().post()
}
private fun unlockUser() {
RestClient.builder().url("user/unlockUser.php")
.formDataParams(true, null)
.success(object : ISuccess {
override fun onSuccess(response: String) {
Log.i("EditProfileDelegate", "response$response")
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
Log.i("ProfileSettingDelegate", "onError$msg")
}
})
.failure(object : IFailure {
override fun onFailure() {
Log.i("ProfileSettingDelegate", "onFailure")
}
}).build().post()
}
private fun updateUser(email: String, MobilePhoneCC: String, MobilePhone: String,
FirstName: String, LastName: String, EthnicGivenName: String, EthnicLastName: String) {
val maps = HashMap<String, String>()
maps["data[Email]"] = email
maps["data[MobilePhoneCC]"] = MobilePhoneCC
maps["data[MobilePhone]"] = MobilePhone
maps["data[FirstName]"] = FirstName
maps["data[LastName]"] = LastName
maps["data[EthnicGivenName]"] = EthnicGivenName
maps["data[EthnicLastName]"] = EthnicLastName
RestClient.builder().url("user/updateUser.php")
.loader(context!!)
.formDataParams(true, maps)
.success(object : ISuccess {
override fun onSuccess(response: String) {
Log.i("EditProfileDelegate", "response$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"))
AccountManager.setFirstName(userJson.getString("FirstName"))
AccountManager.setLastName(userJson.getString("LastName"))
AccountManager.setEthnicGivenName(userJson.getString("EthnicGivenName"))
AccountManager.setEthnicLastName(userJson.getString("EthnicLastName"))
isUnlock = false
pop()
}
}
}
})
.error(object : IError {
override fun onError(code: Int, msg: String) {
// mEditProfileError.text = msg
}
})
.failure(object : IFailure {
override fun onFailure() {
Log.i("ProfileSettingDelegate", "onFailure")
}
}).build().post()
}
private fun checkView(): Boolean {
strEmail = mEditEmail.text.toString()
strPhone = mEtMobilePhone.text.toString()
strLastName = mLastName.text.toString()
strFirstName = mFirstName.text.toString()
strEthnicGivenName = mEthnicGivenName.text.toString()
strEthnicLastName = mEthnicLastName.text.toString()
when {
strFirstName.isEmpty() -> {
mFirstName.error = getString(R.string.error_login_user)
return false
}
strLastName.isEmpty() -> {
mLastName.error = getString(R.string.error_login_user)
return false
}
strEthnicGivenName.isEmpty() -> {
mEthnicGivenName.error = getString(R.string.error_login_user)
return false
}
strEthnicLastName.isEmpty() -> {
mEthnicLastName.error = getString(R.string.error_login_user)
return false
}
strPhone.isEmpty() -> {
mEtMobilePhone.error = getString(R.string.error_login_user)
return false
}
strEmail.isEmpty() -> {
mEditEmail.error = getString(R.string.error_login_user_password)
return false
}
else -> return true
}
}
override fun setLayout(): Any {
return R.layout.delegate_edit_profile
}
}
\ 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