Initial Commit

parents
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
# Default ignored files
/shelf/
/workspace.xml
Solar App
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<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" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</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_8" default="true" 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="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
/build
\ No newline at end of file
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-parcelize'
id 'kotlin-kapt'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.sibatel.solarapp"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures{
viewBinding true
}
kotlinOptions {
jvmTarget = '1.8'
}
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "com.github.bumptech.glide:glide:4.12.0"
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
//Retrofit
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
implementation 'br.com.simplepass:loading-button-android:2.2.0'
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.sibatel.solarapp
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.sibatel.solarapp", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sibatel.solarapp">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<queries>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
</queries>
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@drawable/logo_sibatel"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.SolarApp"
android:usesCleartextTraffic="true">
<activity android:name=".ui.maintenance.MaintenanceMenu"></activity>
<activity android:name=".ui.maintenance.MaintenanceActivity" />
<activity
android:name=".ui.mentoring.solar.pengambilan.MenuPengambilanSolar"
android:screenOrientation="portrait" />
<activity
android:name=".ui.mentoring.solar.pengambilan.PengambilanSolarLjtn"
android:screenOrientation="portrait" />
<activity
android:name=".ui.LoginActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.SolarApp.NoActionBar" />
<activity
android:name=".ui.MainActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.mentoring.MentoringSolar"
android:screenOrientation="portrait" />
<activity
android:name=".ui.keuangan.Keuangan"
android:screenOrientation="portrait" />
<activity
android:name=".ui.mentoring.solar.penggunaan.MenuPenggunaanSolar"
android:screenOrientation="portrait" />
<activity
android:name=".ui.mentoring.solar.penggunaan.LaporanPengisianSolar"
android:screenOrientation="portrait" />
<activity
android:name=".ui.mentoring.solar.penggunaan.PenggunaanSolarMTC"
android:screenOrientation="portrait" />
<activity
android:name=".ui.user.Profil"
android:screenOrientation="portrait" />
<activity
android:name=".ui.mobil.DataMobil"
android:label="@string/title_activity_mentoring_solar"
android:screenOrientation="portrait" />
<activity
android:name=".ui.SplashActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.SolarApp.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
</application>
</manifest>
\ No newline at end of file
package com.sibatel.solarapp.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.sibatel.solarapp.data.model.tower.Maintenance
import com.sibatel.solarapp.databinding.ListMaintenanceBinding
class MaintenanceAdapter(var listMaintenance : ArrayList<Maintenance>?):RecyclerView.Adapter<MaintenanceAdapter.MaintenanceViewHolder> (){
inner class MaintenanceViewHolder(private val binding: ListMaintenanceBinding) : RecyclerView.ViewHolder(binding.root){
val tanggal = binding.tanggal
val site = binding.site
}
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): MaintenanceAdapter.MaintenanceViewHolder {
val view = ListMaintenanceBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return MaintenanceViewHolder(view)
}
override fun onBindViewHolder(holder: MaintenanceAdapter.MaintenanceViewHolder, position: Int) {
holder.tanggal.text = "Tanggal : "+listMaintenance?.get(position)?.tanggal.toString()
holder.site.text = listMaintenance?.get(position)?.tujuanSite
}
override fun getItemCount(): Int {
return listMaintenance?.size ?: 0
}
}
\ No newline at end of file
package com.sibatel.solarapp.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.sibatel.solarapp.data.model.mobil.Mobil
import com.sibatel.solarapp.databinding.ListMobilBinding
class MobilAdapter(var listMobil : ArrayList<Mobil>?) : RecyclerView.Adapter<MobilAdapter.MobilViewHolder>(){
inner class MobilViewHolder(private val binding: ListMobilBinding) : RecyclerView.ViewHolder(binding.root){
val jenis = binding.mobilJenis
val nama = binding.mobilNama
val status = binding.mobilStatus
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MobilViewHolder {
val view = ListMobilBinding.inflate(LayoutInflater.from(parent.context), parent,false)
return MobilViewHolder(view)
}
override fun onBindViewHolder(holder: MobilViewHolder, position: Int) {
holder.nama.text = listMobil?.get(position)?.namaUser
holder.jenis.text = listMobil?.get(position)?.role
val sts = listMobil?.get(position)?.status
var tujuanSite = listMobil?.get(position)?.tujuanSite
if (tujuanSite == null){
tujuanSite = listMobil?.get(position)?.tujuanPengambilan
}
if (sts == "Sedang Berjalan"){
holder.status.text = sts+" ke "+tujuanSite
}else{
holder.status.text = "Standby"
}
}
override fun getItemCount(): Int {
return listMobil?.size ?: 0
}
}
\ No newline at end of file
package com.sibatel.solarapp.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.sibatel.solarapp.data.model.solar.pengambilansolar.PengambilanSolar
import com.sibatel.solarapp.databinding.FragmentPengambilanSolarBinding
import com.sibatel.solarapp.databinding.ListMentoringSolarBinding
import com.sibatel.solarapp.databinding.ListPenggunaanSolarBinding
class PengambilanSolarAdapter(var listPengambilanSolar : ArrayList<PengambilanSolar>?) : RecyclerView.Adapter<PengambilanSolarAdapter.PengambilanSolarViewHolder>() {
inner class PengambilanSolarViewHolder(private val binding: ListMentoringSolarBinding) : RecyclerView.ViewHolder(binding.root){
val tanggal = binding.tanggal
val jlh_pendonor_sdh = binding.jlhPendonorSdh
val jlh_solar_diambil = binding.jlhSolarDiambil
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PengambilanSolarViewHolder {
val view = ListMentoringSolarBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return PengambilanSolarViewHolder(view)
}
override fun onBindViewHolder(holder: PengambilanSolarViewHolder, position: Int) {
holder.tanggal.text = listPengambilanSolar?.get(position)?.tanggal
holder.jlh_pendonor_sdh.text = "Jumlah Solar terakhir di tangki pendonor: "+listPengambilanSolar?.get(position)?.jlhPendonorSdh+"L"
holder.jlh_solar_diambil.text = "+"+listPengambilanSolar?.get(position)?.jlhSolarDiambil+" Liter"
}
override fun getItemCount(): Int {
return listPengambilanSolar?.size ?:0
}
}
\ No newline at end of file
package com.sibatel.solarapp.adapter
import android.graphics.Color
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.sibatel.solarapp.R
import com.sibatel.solarapp.data.model.solar.penggunaansolar.PenggunaanSolar
import com.sibatel.solarapp.databinding.ListPenggunaanSolarBinding
import java.text.SimpleDateFormat
class PenggunaanSolarAdapter(private val listPenggunaanSolar : ArrayList<PenggunaanSolar>?):RecyclerView.Adapter<PenggunaanSolarAdapter.PenggunaanSolarViewHolder>(){
inner class PenggunaanSolarViewHolder(private val binding: ListPenggunaanSolarBinding) : RecyclerView.ViewHolder(binding.root){
val tujuanSite = binding.tujuanSite
val tanggal = binding.tanggal
val hmAkhir = binding.hmAkhir
val status = binding.status
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PenggunaanSolarViewHolder {
val view = ListPenggunaanSolarBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return PenggunaanSolarViewHolder(view)
}
override fun onBindViewHolder(holder: PenggunaanSolarViewHolder, position: Int) {
holder.hmAkhir.text = listPenggunaanSolar?.get(position)?.hmAkhir
holder.tanggal.text = listPenggunaanSolar?.get(position)?.tanggal
holder.tujuanSite.text = "Tujuan : "+listPenggunaanSolar?.get(position)?.tujuanSite
if (listPenggunaanSolar?.get(position)?.status.equals("1")){
holder.status.text = "Proses"
}else if(listPenggunaanSolar?.get(position)?.status.equals("2")){
holder.status.text = "Selesai"
holder.status.setTextColor(Color.GREEN)
}else if(listPenggunaanSolar?.get(position)?.status.equals("3")){
holder.status.text = "Batal"
holder.status.setTextColor(Color.RED)
}
}
override fun getItemCount(): Int {
return listPenggunaanSolar?.size ?: 0
}
}
\ No newline at end of file
package com.sibatel.solarapp.adapter
import android.content.Intent
import android.net.Uri
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.sibatel.solarapp.data.model.user.User
import com.sibatel.solarapp.databinding.ListProfilBinding
class UserAdapter(var listUser : ArrayList<User>?) : RecyclerView.Adapter<UserAdapter.UserViewHolder>() {
inner class UserViewHolder(private val binding : ListProfilBinding) : RecyclerView.ViewHolder(binding.root){
val nama = binding.userNama
val status = binding.userStatus
val wa = binding.userWhatsapp
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): UserViewHolder {
val view = ListProfilBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return UserViewHolder(view)
}
override fun onBindViewHolder(holder: UserViewHolder, position: Int) {
holder.nama.text = listUser?.get(position)?.nama
holder.status.text = listUser?.get(position)?.role
var cek = listUser?.get(position)?.noHp?.substring(0,1)
var inWa = "0"
if (cek.equals("0")){
inWa = "https://api.whatsapp.com/send?phone=+62"+listUser?.get(position)?.noHp;
}else{
inWa = "https://api.whatsapp.com/send?phone="+listUser?.get(position)?.noHp;
}
holder.wa.setOnClickListener{
val intent = Intent(Intent.ACTION_VIEW)
intent.setData(Uri.parse(inWa))
it.context.startActivity(intent)
}
}
override fun getItemCount(): Int {
return listUser?.size ?: 0
}
}
\ No newline at end of file
package com.sibatel.solarapp.data
import android.util.Log
import com.sibatel.solarapp.data.model.mobil.Mobil
import com.sibatel.solarapp.data.model.mobil.MobilResponse
import com.sibatel.solarapp.data.model.solar.pengambilansolar.PengambilanSolar
import com.sibatel.solarapp.data.model.solar.pengambilansolar.PengambilanSolarResponse
import com.sibatel.solarapp.data.model.solar.penggunaansolar.PenggunaanSolar
import com.sibatel.solarapp.data.model.solar.penggunaansolar.PenggunaanSolarResponse
import com.sibatel.solarapp.data.model.tower.Maintenance
import com.sibatel.solarapp.data.model.tower.MaintenanceResponse
import com.sibatel.solarapp.data.model.user.User
import com.sibatel.solarapp.data.model.user.UserResponse
import com.sibatel.solarapp.network.RetrofitClient
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class RemoteDataSource {
companion object{
@Volatile
private var instance : RemoteDataSource? = null
fun getInstance(): RemoteDataSource =
instance ?: synchronized(this){
instance ?: RemoteDataSource()
}
}
fun getMobilData(callback: loadDataMobilListCallback){
RetrofitClient.apiInstance
.getMobileData()
.enqueue(object : Callback<MobilResponse> {
override fun onResponse(
call: Call<MobilResponse>,
response: Response<MobilResponse>
) {
callback.onLoadMobil(response.body()?.results)
}
override fun onFailure(call: Call<MobilResponse>, t: Throwable) {
t.message?.let { Log.d("error Server", it) }
}
})
}
fun getUserData(callback: loadDataUserListCallback){
RetrofitClient.apiInstance
.getAllUser()
.enqueue(object : Callback<UserResponse>{
override fun onResponse(
call: Call<UserResponse>,
response: Response<UserResponse>
) {
callback.onLoadUser(response.body()?.result)
}
override fun onFailure(call: Call<UserResponse>, t: Throwable) {
t.message?.let { Log.d("error Server", it) }
}
})
}
fun getPengambilanSolarData(id:Int,callback: loadDataPengambilanSolarCallback){
RetrofitClient.apiInstance
.getAllPengambilanSolar(id)
.enqueue(object : Callback<PengambilanSolarResponse>{
override fun onResponse(
call: Call<PengambilanSolarResponse>,
response: Response<PengambilanSolarResponse>
) {
callback.onLoadPengambilanSolar(response.body()?.result)
}
override fun onFailure(call: Call<PengambilanSolarResponse>, t: Throwable) {
t.message?.let { Log.d("error Server", it) }
}
})
}
fun getPenggunaanSolarData(id:Int,callback: loadDataPenggunaanSolarCallback){
RetrofitClient.apiInstance
.getAllPenggunaanSolar(id)
.enqueue(object : Callback<PenggunaanSolarResponse>{
override fun onResponse(
call: Call<PenggunaanSolarResponse>,
response: Response<PenggunaanSolarResponse>
) {
callback.onLoadPenggunaanSolar(response.body()?.result)
}
override fun onFailure(call: Call<PenggunaanSolarResponse>, t: Throwable) {
t.message?.let { Log.d("error Server", it) }
}
})
}
fun getMaintenanceData(id: Int, callback: loadDataMaintenanceCallback){
RetrofitClient.apiInstance
.getAllMaintenance(id)
.enqueue(object : Callback<MaintenanceResponse>{
override fun onResponse(
call: Call<MaintenanceResponse>,
response: Response<MaintenanceResponse>
) {
callback.onLoadMaintenance(response.body()?.result)
}
override fun onFailure(call: Call<MaintenanceResponse>, t: Throwable) {
t.message?.let { Log.d("error Server", it) }
}
})
}
interface loadDataMobilListCallback{
fun onLoadMobil(response: ArrayList<Mobil>?)
}
interface loadDataUserListCallback{
fun onLoadUser(response: ArrayList<User>?)
}
interface loadDataPengambilanSolarCallback{
fun onLoadPengambilanSolar(response: ArrayList<PengambilanSolar>?)
}
interface loadDataPenggunaanSolarCallback{
fun onLoadPenggunaanSolar(response: ArrayList<PenggunaanSolar>?)
}
interface loadDataMaintenanceCallback{
fun onLoadMaintenance(response: ArrayList<Maintenance>?)
}
}
\ No newline at end of file
package com.sibatel.solarapp.data
import androidx.lifecycle.LiveData
import com.sibatel.solarapp.data.model.mobil.Mobil
import com.sibatel.solarapp.data.model.solar.pengambilansolar.PengambilanSolar
import com.sibatel.solarapp.data.model.solar.penggunaansolar.PenggunaanSolar
import com.sibatel.solarapp.data.model.tower.Maintenance
import com.sibatel.solarapp.data.model.user.User
interface SolarDataSource {
fun getMobilList() : LiveData<ArrayList<Mobil>>
fun getUserList() : LiveData<ArrayList<User>>
fun getPengambilanSolarList(id:Int) : LiveData<ArrayList<PengambilanSolar>>
fun getPenggunaanSolarList(id: Int) : LiveData<ArrayList<PenggunaanSolar>>
fun getMaintenanceList(id: Int) : LiveData<ArrayList<Maintenance>>
}
\ No newline at end of file
package com.sibatel.solarapp.data
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.sibatel.solarapp.data.model.mobil.Mobil
import com.sibatel.solarapp.data.model.solar.pengambilansolar.PengambilanSolar
import com.sibatel.solarapp.data.model.solar.penggunaansolar.PenggunaanSolar
import com.sibatel.solarapp.data.model.tower.Maintenance
import com.sibatel.solarapp.data.model.user.User
class SolarRepository private constructor(private val remoteDataSource: RemoteDataSource): SolarDataSource{
companion object{
private var instance : SolarRepository? = null
fun getInstance(remoteDataSource: RemoteDataSource): SolarRepository =
instance ?: synchronized(this){
instance ?: SolarRepository(remoteDataSource).apply { instance = this }
}
}
override fun getMobilList(): LiveData<ArrayList<Mobil>> {
val listMobile = MutableLiveData<ArrayList<Mobil>>()
remoteDataSource.getMobilData(object : RemoteDataSource.loadDataMobilListCallback{
override fun onLoadMobil(response: ArrayList<Mobil>?) {
val mobilList = ArrayList<Mobil>()
if (response!=null){
for (mobilResponse in response){
val mobil = Mobil(
nama = mobilResponse.nama,
id = mobilResponse.id,
jenis = mobilResponse.jenis,
status = mobilResponse.status,
createdAt = mobilResponse.createdAt,
updatedAt = mobilResponse.updatedAt,
namaUser = mobilResponse.namaUser,
tujuanSite = mobilResponse.tujuanSite,
role = mobilResponse.role,
tujuanPengambilan = mobilResponse.tujuanPengambilan
)
mobilList.add(mobil)
}
listMobile.postValue(mobilList)
}
}
})
return listMobile
}
override fun getUserList(): LiveData<ArrayList<User>> {
val listUser = MutableLiveData<ArrayList<User>>()
remoteDataSource.getUserData(object : RemoteDataSource.loadDataUserListCallback{
override fun onLoadUser(response: ArrayList<User>?) {
val userList = ArrayList<User>()
if (response != null){
for (userResponse in response){
val user = User(
nama = userResponse.nama,
cluster = userResponse.cluster,
role = userResponse.role,
noHp = userResponse.noHp,
id = userResponse.id
)
userList.add(user)
}
listUser.postValue(userList)
}
}
})
return listUser
}
override fun getPengambilanSolarList(id:Int): LiveData<ArrayList<PengambilanSolar>> {
val listPengambilanSolar = MutableLiveData<ArrayList<PengambilanSolar>>()
remoteDataSource.getPengambilanSolarData(id, object : RemoteDataSource.loadDataPengambilanSolarCallback{
override fun onLoadPengambilanSolar(response: ArrayList<PengambilanSolar>?) {
val pengambilanList = ArrayList<PengambilanSolar>()
if (response != null){
for (pengambilanResponse in response){
val pengambilanaSolar = PengambilanSolar(
jlhPendonorSblm = pengambilanResponse.jlhPendonorSblm,
gbrGsSblm = pengambilanResponse.gbrGsSblm,
dariSite = pengambilanResponse.dariSite,
jlhPendonorSdh = pengambilanResponse.jlhPendonorSdh,
jlhSlrGsSblm = pengambilanResponse.jlhSlrGsSblm,
createdAt = pengambilanResponse.createdAt,
gbrSpSblm = pengambilanResponse.gbrSpSblm,
jlhSolarDiambil = pengambilanResponse.jlhSolarDiambil,
saksi = pengambilanResponse.saksi,
jenisGenset = pengambilanResponse.jenisGenset,
gbrSpSdh = pengambilanResponse.gbrSpSdh,
updatedAt = pengambilanResponse.updatedAt,
gbrGsSdh = pengambilanResponse.gbrGsSdh,
userId = pengambilanResponse.userId,
tanggal = pengambilanResponse.tanggal,
id = pengambilanResponse.id,
tujuanSite = pengambilanResponse.tujuanSite,
jlhSlrGsSdh = pengambilanResponse.jlhSlrGsSdh
)
pengambilanList.add(pengambilanaSolar)
}
listPengambilanSolar.postValue(pengambilanList)
}
}
})
return listPengambilanSolar
}
override fun getPenggunaanSolarList(id: Int): LiveData<ArrayList<PenggunaanSolar>> {
val listPenggunaanSolar = MutableLiveData<ArrayList<PenggunaanSolar>>()
remoteDataSource.getPenggunaanSolarData(id,object : RemoteDataSource.loadDataPenggunaanSolarCallback{
override fun onLoadPenggunaanSolar(response: ArrayList<PenggunaanSolar>?) {
val penggunaanSolarList = ArrayList<PenggunaanSolar>()
if (response != null){
for(penggunaanResponse in response){
val penggunaanSolar = PenggunaanSolar(
jenisGenset = penggunaanResponse.jenisGenset,
updatedAt = penggunaanResponse.updatedAt,
userId = penggunaanResponse.userId,
totalHm = penggunaanResponse.totalHm,
totalLiter = penggunaanResponse.totalLiter,
gmbrHmakhir = penggunaanResponse.gmbrHmakhir,
createdAt = penggunaanResponse.createdAt,
id = penggunaanResponse.id,
tanggal = penggunaanResponse.tanggal,
hmAwal = penggunaanResponse.hmAwal,
hmAkhir = penggunaanResponse.hmAkhir,
tujuanSite = penggunaanResponse.tujuanSite,
status = penggunaanResponse.status
)
penggunaanSolarList.add(penggunaanSolar)
}
listPenggunaanSolar.postValue(penggunaanSolarList)
}
}
})
return listPenggunaanSolar
}
override fun getMaintenanceList(id: Int): LiveData<ArrayList<Maintenance>> {
val listMaintenance = MutableLiveData<ArrayList<Maintenance>>()
remoteDataSource.getMaintenanceData(id, object : RemoteDataSource.loadDataMaintenanceCallback{
override fun onLoadMaintenance(response: ArrayList<Maintenance>?) {
val maintenanceList = ArrayList<Maintenance>()
if (response != null){
for (maintenanceResponse in response){
val maintenance = Maintenance(
tanggal = maintenanceResponse.tanggal,
tujuanSite = maintenanceResponse.tujuanSite
)
maintenanceList.add(maintenance)
}
listMaintenance.postValue(maintenanceList)
}
}
})
return listMaintenance
}
}
package com.sibatel.solarapp.data.model.genset
import com.google.gson.annotations.SerializedName
data class Genset(
@field:SerializedName("updated_at")
val updatedAt: String? = null,
@field:SerializedName("kva")
val kva: String? = null,
@field:SerializedName("created_at")
val createdAt: String? = null,
@field:SerializedName("id")
val id: Int? = null,
@field:SerializedName("cluster_genset")
val clusterGenset: String? = null,
@field:SerializedName("debit")
val debit: String? = null,
@field:SerializedName("nama_genset")
val namaGenset: String? = null,
@field:SerializedName("jenis_site")
val jenisSite: String? = null
)
package com.sibatel.solarapp.data.model.genset
import com.google.gson.annotations.SerializedName
data class GensetResponse(
@field:SerializedName("result")
val result: ArrayList<Genset>,
@field:SerializedName("success")
val success: Boolean? = null,
@field:SerializedName("message")
val message: String? = null
)
package com.sibatel.solarapp.data.model.keuangan
import com.google.gson.annotations.SerializedName
data class BiayaLapangan(
@field:SerializedName("surat_lurah")
val suratLurah: String? = null,
@field:SerializedName("nama_site")
val namaSite: String? = null,
@field:SerializedName("created_at")
val createdAt: String? = null,
@field:SerializedName("biaya_teknisi")
val biayaTeknisi: String? = null,
@field:SerializedName("nama_genset")
val namaGenset: String? = null,
@field:SerializedName("gbr_lapangan")
val gbrLapangan: String? = null,
@field:SerializedName("biaya_perbaikan_perangkat")
val biayaPerbaikanPerangkat: String? = null,
@field:SerializedName("site_donor")
val siteDonor: Any? = null,
@field:SerializedName("biaya")
val biaya: String? = null,
@field:SerializedName("updated_at")
val updatedAt: String? = null,
@field:SerializedName("ket_tagihan")
val ketTagihan: String? = null,
@field:SerializedName("id")
val id: Int? = null,
@field:SerializedName("nama_brg")
val namaBrg: String? = null,
@field:SerializedName("uang_makan")
val uangMakan: String? = null,
@field:SerializedName("site_receipter")
val siteReceipter: Any? = null,
@field:SerializedName("dana_operasional")
val danaOperasional: String? = null,
@field:SerializedName("kategori")
val kategori: String? = null,
@field:SerializedName("gbr_sblm")
val gbrSblm: String? = null,
@field:SerializedName("bbm_mobil")
val bbmMobil: String? = null,
@field:SerializedName("nama_penjaga_site")
val namaPenjagaSite: String? = null,
@field:SerializedName("biaya_lain")
val biayaLain: String? = null,
@field:SerializedName("tujuan_pengiriman")
val tujuanPengiriman: String? = null,
@field:SerializedName("user_id")
val userId: String? = null,
@field:SerializedName("gbr_bon")
val gbrBon: String? = null,
@field:SerializedName("ket_service")
val ketService: String? = null,
@field:SerializedName("jlh_liter")
val jlhLiter: String? = null,
@field:SerializedName("jlh_unit")
val jlhUnit: String? = null,
@field:SerializedName("biaya_beli_perangkat")
val biayaBeliPerangkat: String? = null,
@field:SerializedName("biaya_tukang")
val biayaTukang: String? = null,
@field:SerializedName("gbr_sdh")
val gbrSdh: String? = null
)
package com.sibatel.solarapp.data.model.keuangan
import com.google.gson.annotations.SerializedName
import com.sibatel.solarapp.data.model.mobil.Mobil
data class BiayaLapanganResponse(
@field:SerializedName("success")
val success: String? = null,
@field:SerializedName("message")
val message: String? = null,
@field:SerializedName("result")
val result: ArrayList<BiayaLapangan>
)
package com.sibatel.solarapp.data.model.mobil
import com.google.gson.annotations.SerializedName
data class Mobil(
@field:SerializedName("cluster")
val cluster: String? = null,
@field:SerializedName("nama_mobil")
val nama: String? = null,
@field:SerializedName("genset_id")
val gensetId: String? = null,
@field:SerializedName("created_at")
val createdAt: String? = null,
@field:SerializedName("jenis_mobil")
val jenis: String? = null,
@field:SerializedName("cluster_genset")
val clusterGenset: String? = null,
@field:SerializedName("nama_genset")
val namaGenset: String? = null,
@field:SerializedName("jenis_site")
val jenisSite: String? = null,
@field:SerializedName("updated_at")
val updatedAt: String? = null,
@field:SerializedName("user_id")
val userId: String? = null,
@field:SerializedName("kva")
val kva: String? = null,
@field:SerializedName("id")
val id: String? = null,
@field:SerializedName("debit")
val debit: String? = null,
@field:SerializedName("nama_user")
val namaUser: String? = null,
@field:SerializedName("status")
val status: String? = null,
@field:SerializedName("tujuan_site")
val tujuanSite: String? = null,
@field:SerializedName("role")
val role: String? = null,
@field:SerializedName("tujuan_pengambilan")
val tujuanPengambilan: String? = null,
)
package com.sibatel.solarapp.data.model.mobil
import com.google.gson.annotations.SerializedName
data class MobilResponse(
@field:SerializedName("success")
val success: String? = null,
@field:SerializedName("message")
val message: String? = null,
@field:SerializedName("results")
val results: ArrayList<Mobil>
)
package com.sibatel.solarapp.data.model.solar.pengambilansolar
import com.google.gson.annotations.SerializedName
data class PengambilanSolar(
@field:SerializedName("jlh_pendonor_sblm")
val jlhPendonorSblm: String? = null,
@field:SerializedName("gbr_gs_sblm")
val gbrGsSblm: String? = null,
@field:SerializedName("dari_site")
val dariSite: String? = null,
@field:SerializedName("jlh_pendonor_sdh")
val jlhPendonorSdh: String? = null,
@field:SerializedName("jlh_slr_gs_sblm")
val jlhSlrGsSblm: String? = null,
@field:SerializedName("created_at")
val createdAt: String? = null,
@field:SerializedName("gbr_sp_sblm")
val gbrSpSblm: String? = null,
@field:SerializedName("jlh_solar_diambil")
val jlhSolarDiambil: String? = null,
@field:SerializedName("saksi")
val saksi: String? = null,
@field:SerializedName("jenis_genset")
val jenisGenset: String? = null,
@field:SerializedName("gbr_sp_sdh")
val gbrSpSdh: String? = null,
@field:SerializedName("updated_at")
val updatedAt: String? = null,
@field:SerializedName("gbr_gs_sdh")
val gbrGsSdh: String? = null,
@field:SerializedName("user_id")
val userId: String? = null,
@field:SerializedName("tanggal")
val tanggal: String? = null,
@field:SerializedName("id")
val id: Int? = null,
@field:SerializedName("tujuan_site")
val tujuanSite: String? = null,
@field:SerializedName("jlh_slr_gs_sdh")
val jlhSlrGsSdh: String? = null
)
package com.sibatel.solarapp.data.model.solar.pengambilansolar
import com.google.gson.annotations.SerializedName
data class PengambilanSolarResponse(
val result : ArrayList<PengambilanSolar>,
@field:SerializedName("success")
val success: Boolean? = null,
@field:SerializedName("message")
val message: String? = null
)
package com.sibatel.solarapp.data.model.solar.penggunaansolar
import com.google.gson.annotations.SerializedName
data class PenggunaanSolar(
@field:SerializedName("jenis_genset")
val jenisGenset: String? = null,
@field:SerializedName("updated_at")
val updatedAt: Any? = null,
@field:SerializedName("user_id")
val userId: String? = null,
@field:SerializedName("total_hm")
val totalHm: String? = null,
@field:SerializedName("total_liter")
val totalLiter: String? = null,
@field:SerializedName("gmbr_hmakhir")
val gmbrHmakhir: String? = null,
@field:SerializedName("created_at")
val createdAt: Any? = null,
@field:SerializedName("id")
val id: Int? = null,
@field:SerializedName("tanggal")
val tanggal: String? = null,
@field:SerializedName("hm_awal")
val hmAwal: String? = null,
@field:SerializedName("hm_akhir")
val hmAkhir: String? = null,
@field:SerializedName("tujuan_site")
val tujuanSite: String? = null,
@field:
SerializedName("status")
val status: String? = null
)
package com.sibatel.solarapp.data.model.solar.penggunaansolar
data class PenggunaanSolarResponse (
val result: ArrayList<PenggunaanSolar>,
val success: Boolean? = null,
val message: String? = null
)
\ No newline at end of file
package com.sibatel.solarapp.data.model.tower
import com.google.gson.annotations.SerializedName
data class Maintenance(
@field:SerializedName("id")
val id: Int? = null,
@field:SerializedName("tanggal")
val tanggal: Any? = null,
@field:SerializedName("tujuan_site")
val tujuanSite: String? = null
)
\ No newline at end of file
package com.sibatel.solarapp.data.model.tower
import com.google.gson.annotations.SerializedName
data class MaintenanceResponse (
val result: ArrayList<Maintenance>,
@field:SerializedName("success")
val success: Boolean? = null,
@field:SerializedName("message")
val message: String? = null
)
\ No newline at end of file
package com.sibatel.solarapp.data.model.tower
import com.google.gson.annotations.SerializedName
data class Tower(
@field:SerializedName("updated_at")
val updatedAt: Any? = null,
@field:SerializedName("cluster_tower")
val clusterTower: String? = null,
@field:SerializedName("genset_id")
val gensetId: String? = null,
@field:SerializedName("created_at")
val createdAt: Any? = null,
@field:SerializedName("id")
val id: Int? = null,
@field:SerializedName("nama_tower")
val namaTower: String? = null,
@field:SerializedName("mobil_id")
val mobilId: String? = null
)
\ No newline at end of file
package com.sibatel.solarapp.data.model.tower
import com.google.gson.annotations.SerializedName
data class TowerResponse (
@field:SerializedName("result")
val result: List<Tower?>,
@field:SerializedName("success")
val success: Boolean? = null,
@field:SerializedName("message")
val message: String? = null
)
\ No newline at end of file
package com.sibatel.solarapp.data.model.user
import com.google.gson.annotations.SerializedName
data class LoginResponse(
@field:SerializedName("success")
val success: String? = null,
@field:SerializedName("message")
val message: String? = null,
@field:SerializedName("results")
val results: Results? = null
)
data class Results(
@field:SerializedName("cluster")
val cluster: String? = null,
@field:SerializedName("role")
val role: String? = null,
@field:SerializedName("nama_user")
val nama: String? = null,
@field:SerializedName("no_hp")
val noHp: String? = null,
@field:SerializedName("updated_at")
val updatedAt: String? = null,
@field:SerializedName("created_at")
val createdAt: String? = null,
@field:SerializedName("id")
val id: Int? = null
)
package com.sibatel.solarapp.data.model.user
import com.google.gson.annotations.SerializedName
data class User(
@field:SerializedName("cluster")
val cluster: String? = null,
@field:SerializedName("role")
val role: String? = null,
@field:SerializedName("nama_user")
val nama: String? = null,
@field:SerializedName("no_hp")
val noHp: String? = null,
@field:SerializedName("updated_at")
val updatedAt: String? = null,
@field:SerializedName("created_at")
val createdAt: String? = null,
@field:SerializedName("id")
val id: Int? = null
)
package com.sibatel.solarapp.data.model.user
import com.google.gson.annotations.SerializedName
data class UserResponse(
@field:SerializedName("success")
val success: String? = null,
@field:SerializedName("message")
val message: String? = null,
@field:SerializedName("result")
val result: ArrayList<User>
)
package com.sibatel.solarapp.data.viewmodel
import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import com.sibatel.solarapp.data.SolarRepository
import com.sibatel.solarapp.data.model.tower.Maintenance
class MaintenanceViewModel(private val solarRepository:SolarRepository) : ViewModel() {
fun getMaintenance(id : Int) : LiveData<ArrayList<Maintenance>> = solarRepository.getMaintenanceList(id)
}
\ No newline at end of file
package com.sibatel.solarapp.data.viewmodel
import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import com.sibatel.solarapp.data.SolarRepository
import com.sibatel.solarapp.data.model.mobil.Mobil
class MobilViewModel (private val solarRepository: SolarRepository) : ViewModel(){
fun getMobil() : LiveData<ArrayList<Mobil>> = solarRepository.getMobilList()
}
\ No newline at end of file
package com.sibatel.solarapp.data.viewmodel
import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import com.sibatel.solarapp.data.SolarRepository
import com.sibatel.solarapp.data.model.solar.pengambilansolar.PengambilanSolar
class PengambilanSolarViewModel (private val solarRepository: SolarRepository) : ViewModel(){
fun getPengambilanSolar(id:Int) : LiveData<ArrayList<PengambilanSolar>> = solarRepository.getPengambilanSolarList(id)
}
\ No newline at end of file
package com.sibatel.solarapp.data.viewmodel
import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import com.sibatel.solarapp.data.SolarRepository
import com.sibatel.solarapp.data.model.solar.penggunaansolar.PenggunaanSolar
class PenggunaanSolarViewModel (private val solarRepository: SolarRepository) : ViewModel(){
fun getPenggunaanSolar(id:Int) : LiveData<ArrayList<PenggunaanSolar>> = solarRepository.getPenggunaanSolarList(id)
}
\ No newline at end of file
package com.sibatel.solarapp.data.viewmodel
import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import com.sibatel.solarapp.data.SolarRepository
import com.sibatel.solarapp.data.model.user.User
class UserViewModel(private val solarRepository: SolarRepository): ViewModel() {
fun getUser() : LiveData<ArrayList<User>> = solarRepository.getUserList()
}
\ No newline at end of file
package com.sibatel.solarapp.network
import com.sibatel.solarapp.data.model.genset.GensetResponse
import com.sibatel.solarapp.data.model.keuangan.BiayaLapanganResponse
import com.sibatel.solarapp.data.model.mobil.MobilResponse
import com.sibatel.solarapp.data.model.solar.pengambilansolar.PengambilanSolarResponse
import com.sibatel.solarapp.data.model.solar.penggunaansolar.PenggunaanSolarResponse
import com.sibatel.solarapp.data.model.tower.MaintenanceResponse
import com.sibatel.solarapp.data.model.tower.TowerResponse
import com.sibatel.solarapp.data.model.user.LoginResponse
import com.sibatel.solarapp.data.model.user.UserResponse
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.Call
import retrofit2.http.*
interface ApiServices {
@FormUrlEncoded
@POST("postlogin")
fun login(
@Field("no_hp") noHp : String,
@Field("password") password : String
) : Call<LoginResponse>
//mobil
@GET("mobil")
fun getMobileData():Call<MobilResponse>
@FormUrlEncoded
@POST("batalkan_orderan")
fun batalkanPesanan(
@Field("userId")userId : String
):Call<MobilResponse>
@FormUrlEncoded
@POST("order")
fun orderMobil(
@Field("userId")userId : String,
@Field("tanggal") tanggal: String,
@Field("tujuan_site") tujuan_site : String,
):Call<MobilResponse>
@GET("user")
fun getAllUser():Call<UserResponse>
@Multipart
@POST("pengambilan_solar")
fun addPengambilanSolar(@Part gbr_sp_sblm : MultipartBody.Part?,
@Part gbr_sp_sdh : MultipartBody.Part?,
@Part gbr_gs_sblm : MultipartBody.Part?,
@Part gbr_gs_sdh : MultipartBody.Part?,
@PartMap text :Map<String, @JvmSuppressWildcards RequestBody>
) : Call<PengambilanSolarResponse>
@Multipart
@POST("postUpdatePengambilanSolar")
fun updatePengambilanSolar(@Part gbr_gs_sblm : MultipartBody.Part?,
@Part gbr_gs_sdh : MultipartBody.Part?,
@PartMap text :Map<String, @JvmSuppressWildcards RequestBody>
) : Call<PengambilanSolarResponse>
@GET("pengambilan_solar")
fun getAllPengambilanSolar(
@Query("id") id: Int
): Call<PengambilanSolarResponse>
@GET("penggunaan_solar")
fun getAllPenggunaanSolar(
@Query("id") id: Int
): Call<PenggunaanSolarResponse>
@Multipart
@POST("penggunaan_solar")
fun addPenggunaanSolar(@Part gbr_hmakhir: MultipartBody.Part?,
@PartMap text: Map<String, @JvmSuppressWildcards RequestBody>
) : Call<PenggunaanSolarResponse>
@GET("cekPenggunaanSolar")
fun cekPenggunaanSolar(
@Query("id") id: Int
): Call<PenggunaanSolarResponse>
@FormUrlEncoded
@POST("dafarPengambilanSolar")
fun dafarPengambilanSolar( @Field("site")site:String) : Call<PengambilanSolarResponse>
@GET("tower")
fun getAllTower(): Call<TowerResponse>
@GET("allPendonorSite")
fun getAllPendonorSite(): Call<TowerResponse>
@GET("cekPengambilanSolar")
fun cekPengambilanSolar(
@Query("id") id: Int
): Call<PengambilanSolarResponse>
@FormUrlEncoded
@POST("updatePenggunaanSolar")
fun updatePenggunaanSolar(
@Field("user_id")user_id:String,
@Field("tanggal")tanggal:String,
@Field("tujuan_site")tujuan_site:String) : Call<PenggunaanSolarResponse>
@Multipart
@POST("addBiayaLapangan")
fun addBiayaLapangan(
@Part gbr_sblm : MultipartBody.Part?,
@Part gbr_sdh : MultipartBody.Part?,
@Part gbr_bon : MultipartBody.Part?,
@Part gbr_lapangan : MultipartBody.Part?,
@PartMap text :Map<String, @JvmSuppressWildcards RequestBody>
):Call<BiayaLapanganResponse>
@GET("genset")
fun getAllGenset():Call<GensetResponse>
@GET("maintenance")
fun getAllMaintenance(
@Query("id") id: Int
):Call<MaintenanceResponse>
@FormUrlEncoded
@POST("tambahMaintenance")
fun tambahMaintenance(
@Field("id") id : String,
@Field("tanggal") tanggal : String,
@Field("tujuan_site") tujuan_site : String
) : Call<MaintenanceResponse>
}
package com.sibatel.solarapp.network
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
object RetrofitClient {
private const val BASE_URL = "http://admin.sibatel.id/api/"
private val retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build()
val apiInstance:ApiServices = retrofit.create(ApiServices::class.java)
}
\ No newline at end of file
package com.sibatel.solarapp.ui
import android.Manifest
import android.app.AlertDialog
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.content.pm.PackageManager
import android.net.ConnectivityManager
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.Button
import android.widget.EditText
import android.widget.ProgressBar
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.sibatel.solarapp.R
import com.sibatel.solarapp.data.model.user.LoginResponse
import com.sibatel.solarapp.network.RetrofitClient
import com.sibatel.solarapp.utils.SharedPref
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class LoginActivity : AppCompatActivity() {
private lateinit var button: Button
private lateinit var sharedPreferences: SharedPref
private lateinit var progressBar : ProgressBar
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)
progressBar = findViewById(R.id.progress)
showLoading(false)
sharedPreferences = SharedPref(this)
if (sharedPreferences.getStatusLogin()){
val intent = Intent(this, MainActivity::class.java)
finish()
startActivity(intent)
}
val noHp = findViewById<EditText>(R.id.textInputHp).text
val password = findViewById<EditText>(R.id.textInputPass).text
button = findViewById(R.id.cirLoginButton)
button.setOnClickListener{
showLoading(true)
login(noHp.toString(), password.toString())
}
}
fun login(noHp:String, password:String){
RetrofitClient.apiInstance.login(noHp, password)
.enqueue(object : Callback<LoginResponse>{
override fun onResponse(
call: Call<LoginResponse>,
response: Response<LoginResponse>
) {
if (isConnect()){
if (response.isSuccessful){
if (response.body()?.success=="1"){
sharedPreferences.setStatusLogin(true)
sharedPreferences.setId(response.body()?.results?.id)
sharedPreferences.setNama(response.body()?.results?.nama)
sharedPreferences.setRole(response.body()?.results?.role)
sharedPreferences.setSite(response.body()?.results?.cluster)
Toast.makeText(getApplicationContext(), response.body()?.message, Toast.LENGTH_LONG).show()
showLoading(false)
val intent = Intent(this@LoginActivity, MainActivity::class.java)
startActivity(intent)
finish()
}else{
showLoading(false)
Toast.makeText(getApplicationContext(), "No Hp / Password salah!", Toast.LENGTH_LONG).show()
}
}else{
showLoading(false)
Toast.makeText(getApplicationContext(), response.message() ,
Toast.LENGTH_LONG).show()
}
}else{
showLoading(false)
Toast.makeText(getApplicationContext(), "Device tidak terhubung ke INTERNET", Toast.LENGTH_LONG).show()
}
}
override fun onFailure(call: Call<LoginResponse>, t: Throwable) {
showLoading(false)
t.message?.let { Log.d("error Server", it)
}
}
})
}
@Suppress("DEPRECATION")
fun isConnect():Boolean{
val connect : ConnectivityManager = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
return connect.activeNetworkInfo!!.isConnected
}
private fun showLoading(state: Boolean) {
if (state)
progressBar.visibility = View.VISIBLE
else
progressBar.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.Spinner
import android.widget.Toast
import com.sibatel.solarapp.R
import com.sibatel.solarapp.data.model.solar.pengambilansolar.PengambilanSolarResponse
import com.sibatel.solarapp.data.model.tower.TowerResponse
import com.sibatel.solarapp.databinding.ActivityMainBinding
import com.sibatel.solarapp.network.RetrofitClient
import com.sibatel.solarapp.ui.keuangan.Keuangan
import com.sibatel.solarapp.ui.maintenance.MaintenanceActivity
import com.sibatel.solarapp.ui.mentoring.MentoringSolar
import com.sibatel.solarapp.ui.mobil.DataMobil
import com.sibatel.solarapp.ui.user.Profil
import com.sibatel.solarapp.utils.ProgressBarAnimation
import com.sibatel.solarapp.utils.SharedPref
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class MainActivity : AppCompatActivity() {
private lateinit var binding : ActivityMainBinding
private lateinit var sharedPref: SharedPref
private lateinit var site: Spinner
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
supportActionBar?.elevation = 0f
sharedPref = SharedPref(this)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
if(sharedPref.getRole1().equals("scd") || sharedPref.getRole1().equals("timkorektif") || sharedPref.getRole1().equals("maintenance")){
binding.btnMentoring.setOnClickListener{
val intent = Intent(this, MentoringSolar::class.java)
startActivity(intent)
}
}else{
binding.btnMentoring.setOnClickListener{
Toast.makeText(getApplicationContext(),"Maaf menuh hanya dapat diakses oleh Tim Korektif, Maintenance, dan SCD" ,
Toast.LENGTH_LONG).show()
}
}
if(sharedPref.getRole1().equals("maintenance")){
binding.btnMaintenance.visibility = View.VISIBLE
}else{
binding.btnMaintenance.visibility = View.GONE
}
binding.btnMaintenance.setOnClickListener{
val intent = Intent(this, MaintenanceActivity::class.java)
startActivity(intent)
}
binding.btnMobil.setOnClickListener{
val intent = Intent(this, DataMobil::class.java)
startActivity(intent)
}
binding.btnKeuangan.setOnClickListener{
val intent = Intent(this, Keuangan::class.java)
startActivity(intent)
}
var allTower = ArrayList<String>()
allTower.add("Pilih Site")
RetrofitClient.apiInstance.getAllPendonorSite().enqueue(object : Callback<TowerResponse> {
override fun onResponse(call: Call<TowerResponse>, response: Response<TowerResponse>) {
if (response.isSuccessful){
response.body()?.result?.forEach {
it?.namaTower?.let { it1 -> allTower.add(it1) }
}
}
}
override fun onFailure(call: Call<TowerResponse>, t: Throwable) {
}
})
site = binding.site
val adapter = ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, allTower)
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
site.adapter = adapter
site.onItemSelectedListener = object : AdapterView.OnItemSelectedListener{
override fun onItemSelected(p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long) {
if (p2 == 0){
binding.txtTotalSolar.text = "0"
binding.txtTotalSolarDiambil.text = "0"
binding.statsProgressbar.progress = 0
binding.statsProgressbar2.progress = 0
binding.numberOfCalories.text = "0"
binding.numberOfCalories2.text = "0"
}else{
RetrofitClient.apiInstance.dafarPengambilanSolar(p0?.getItemAtPosition(p2).toString())
.enqueue(object : Callback<PengambilanSolarResponse>{
override fun onResponse(
call: Call<PengambilanSolarResponse>,
response: Response<PengambilanSolarResponse>
) {
if (response.isSuccessful){
if (response.body()?.result?.isNotEmpty()!!){
var total = 0.0
var ttl = 0.0
response.body()?.result?.forEach {
total = String.format("%.0f", it?.jlhPendonorSdh.toString().toDouble()).toDouble()
ttl += String.format("%.0f", it?.jlhSolarDiambil.toString().toDouble()).toDouble()
}
binding.txtTotalSolar.text = total.toString()+"L"
binding.txtTotalSolarDiambil.text = ttl.toString()+"L"
var ttlSolar = total+ttl
var persentase = (total*100)/ttlSolar
var pers2 = (ttl*100)/ttlSolar
binding.numberOfCalories.text = String.format("%.0f", persentase).toString()+"%"
binding.numberOfCalories2.text = String.format("%.0f", pers2).toString()+"%"
var anim = ProgressBarAnimation()
anim.ProgressBarAnimation(binding.statsProgressbar, 0.0F,String.format("%.0f", persentase).toFloat())
anim.duration = 1000
binding.statsProgressbar.startAnimation(anim)
var anim2 = ProgressBarAnimation()
anim2.ProgressBarAnimation(binding.statsProgressbar2, 0.0f,String.format("%.0f", pers2).toFloat())
anim2.duration = 1000
binding.statsProgressbar2.startAnimation(anim2)
}else{
binding.txtTotalSolar.text = "0L"
binding.txtTotalSolarDiambil.text = "0L"
binding.statsProgressbar.progress = 0
binding.statsProgressbar2.progress = 0
binding.numberOfCalories.text = "0%"
binding.numberOfCalories2.text = "0%"
var anim = ProgressBarAnimation()
anim.ProgressBarAnimation(binding.statsProgressbar, 0.0F,0.0F)
anim.duration = 1000
binding.statsProgressbar.startAnimation(anim)
var anim2 = ProgressBarAnimation()
anim2.ProgressBarAnimation(binding.statsProgressbar2, 0.0f,0.0F)
anim2.duration = 1000
binding.statsProgressbar2.startAnimation(anim2)
Toast.makeText(getApplicationContext(),"Data di Site ini kosong" ,
Toast.LENGTH_LONG).show()
}
}else{
Toast.makeText(getApplicationContext(), response.message() ,
Toast.LENGTH_LONG).show()
}
}
override fun onFailure(call: Call<PengambilanSolarResponse>, t: Throwable) {
t.message?.let { Log.d("error Server", it) }
}
})
}
}
override fun onNothingSelected(p0: AdapterView<*>?) {
}
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.action_profil -> {
val intent = Intent(this, Profil::class.java)
startActivity(intent)
return true
}
R.id.action_logout ->{
sharedPref.logout()
val intent = Intent(this, LoginActivity::class.java)
startActivity(intent)
finish()
return true
}
else -> super.onOptionsItemSelected(item)
}
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui
import android.Manifest
import android.app.AlertDialog
import android.content.DialogInterface
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.view.Window
import android.view.WindowManager
import android.view.animation.AnimationUtils
import android.widget.ImageView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.sibatel.solarapp.R
import com.sibatel.solarapp.ui.MainActivity
class SplashActivity : AppCompatActivity() {
private val PERMISSION_REQUEST_CODE = 200
private val STORAGE_PERMISSION_REQUEST_CODE = 400
private val WRITE_PERMISSION_REQUEST_CODE = 201
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (checkPermissionWriteStorage()){
if (checkPermissionStorage()){
if (checkPermissionCamera()) {
setContentView(R.layout.activity_splashcreen)
val backgroundImage: ImageView = findViewById(R.id.splash)
val slideAnimation = AnimationUtils.loadAnimation(this, R.anim.hyperspace_jump)
backgroundImage.startAnimation(slideAnimation)
Handler().postDelayed({
val intent = Intent(this, LoginActivity::class.java)
startActivity(intent)
finish()
}, 3000)
} else {
requestPermissionCamera()
}
}else{
requestPermissionStorage()
}
}else{
requestPermissionWriteStorage()
}
}
private fun checkPermissionCamera(): Boolean {
return ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED
}
private fun checkPermissionStorage(): Boolean {
return ContextCompat.checkSelfPermission(
this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
}
private fun checkPermissionWriteStorage(): Boolean {
return ContextCompat.checkSelfPermission(
this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
}
private fun requestPermissionCamera() {
ActivityCompat.requestPermissions(
this, arrayOf(Manifest.permission.CAMERA),
PERMISSION_REQUEST_CODE
)
}
private fun requestPermissionStorage() {
ActivityCompat.requestPermissions(
this, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE),
STORAGE_PERMISSION_REQUEST_CODE
)
}
private fun requestPermissionWriteStorage() {
ActivityCompat.requestPermissions(
this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
WRITE_PERMISSION_REQUEST_CODE
)
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
when (requestCode) {
PERMISSION_REQUEST_CODE -> if (grantResults.size > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(applicationContext, "Permission Granted", Toast.LENGTH_SHORT).show()
setContentView(R.layout.activity_splashcreen)
val backgroundImage: ImageView = findViewById(R.id.splash)
val slideAnimation = AnimationUtils.loadAnimation(this, R.anim.hyperspace_jump)
backgroundImage.startAnimation(slideAnimation)
Handler().postDelayed({
val intent = Intent(this, LoginActivity::class.java)
startActivity(intent)
finish()
}, 3000) // 3000 is the delayed time in milliseconds.
// main logic
} else {
Toast.makeText(applicationContext, "Permission Denied", Toast.LENGTH_SHORT).show()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED
) {
showMessageOKCancel(
"You need to allow access permissions"
) { dialog, which ->
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissionCamera()
}
}
}
}
}
STORAGE_PERMISSION_REQUEST_CODE -> if (grantResults.size > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(applicationContext, "Permission Granted", Toast.LENGTH_SHORT).show()
requestPermissionCamera()
} else {
Toast.makeText(applicationContext, "Permission Denied", Toast.LENGTH_SHORT).show()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED
) {
showMessageOKCancel(
"You need to allow access permissions"
) { dialog, which ->
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissionStorage()
}
}
}
}
}
WRITE_PERMISSION_REQUEST_CODE -> if (grantResults.size > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(applicationContext, "Permission Granted", Toast.LENGTH_SHORT).show()
requestPermissionCamera()
} else {
Toast.makeText(applicationContext, "Permission Denied", Toast.LENGTH_SHORT).show()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED
) {
showMessageOKCancel(
"You need to allow access permissions"
) { dialog, which ->
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissionWriteStorage()
}
}
}
}
}
}
}
private fun showMessageOKCancel(message: String, okListener: DialogInterface.OnClickListener) {
AlertDialog.Builder(this)
.setMessage(message)
.setPositiveButton("OK", okListener)
.setNegativeButton("Cancel", null)
.create()
.show()
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.maintenance
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.ProgressBar
import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.R
import com.sibatel.solarapp.adapter.MaintenanceAdapter
import com.sibatel.solarapp.adapter.PengambilanSolarAdapter
import com.sibatel.solarapp.data.model.solar.pengambilansolar.PengambilanSolar
import com.sibatel.solarapp.data.model.tower.Maintenance
import com.sibatel.solarapp.data.viewmodel.MaintenanceViewModel
import com.sibatel.solarapp.data.viewmodel.PengambilanSolarViewModel
import com.sibatel.solarapp.databinding.ActivityMainBinding
import com.sibatel.solarapp.databinding.ActivityMaintenanceBinding
import com.sibatel.solarapp.utils.SharedPref
import com.sibatel.solarapp.utils.ViewModelFactory
class MaintenanceActivity : AppCompatActivity() {
private lateinit var binding : ActivityMaintenanceBinding
private lateinit var sharedPref : SharedPref
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_maintenance)
binding = ActivityMaintenanceBinding.inflate(layoutInflater)
setContentView(binding.root)
sharedPref = SharedPref(this)
binding.fab.setOnClickListener{
val intent = Intent(this, MaintenanceMenu::class.java)
startActivity(intent)
finish()
}
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[MaintenanceViewModel::class.java]
showLoading(true)
viewModelCatalog.getMaintenance(sharedPref.getId())
.observe(this, Observer {
if (it.isEmpty()){
Toast.makeText(this, "Data Kosong", Toast.LENGTH_LONG).show()
}else{
showDataMaintenance(it)
}
showLoading(false)
})
}
private fun showLoading(state: Boolean) {
if (state)
binding.progress.visibility = View.VISIBLE
else
binding.progress.visibility = View.GONE
}
private fun showDataMaintenance(listMaintenance : ArrayList<Maintenance>?){
binding.rvMentoringMaintenance.adapter = MaintenanceAdapter(listMaintenance)
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.maintenance
import android.app.DatePickerDialog
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.Spinner
import android.widget.Toast
import com.sibatel.solarapp.R
import com.sibatel.solarapp.data.model.tower.Maintenance
import com.sibatel.solarapp.data.model.tower.MaintenanceResponse
import com.sibatel.solarapp.data.model.tower.TowerResponse
import com.sibatel.solarapp.databinding.ActivityMaintenanceBinding
import com.sibatel.solarapp.databinding.ActivityMaintenanceMenuBinding
import com.sibatel.solarapp.network.ApiServices
import com.sibatel.solarapp.network.RetrofitClient
import com.sibatel.solarapp.utils.SharedPref
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import java.util.*
import kotlin.collections.ArrayList
class MaintenanceMenu : AppCompatActivity() {
private lateinit var site: Spinner
private lateinit var binding : ActivityMaintenanceMenuBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_maintenance_menu)
binding = ActivityMaintenanceMenuBinding.inflate(layoutInflater)
setContentView(binding.root)
var tanggal = ""
var siteMain = ""
val sharedPref = SharedPref(this)
var allTower = ArrayList<String>()
allTower.add("Pilih Site")
binding.user.text = sharedPref.getRole1()+"-"+sharedPref.getNama1()
binding.dateSolarTaken.setOnClickListener {
val cldr: Calendar = Calendar.getInstance()
val day: Int = cldr.get(Calendar.DAY_OF_MONTH)
val month: Int = cldr.get(Calendar.MONTH)
val year: Int = cldr.get(Calendar.YEAR)
var bulan = ""
var hari = ""
val picker = DatePickerDialog(
this,
{ view, year, monthOfYear, dayOfMonth ->
if(monthOfYear + 1<10){
bulan = "0"+(monthOfYear + 1)
}else{
bulan = (monthOfYear + 1).toString()
}
if(dayOfMonth<10){
hari = "0"+dayOfMonth
}else{
hari = dayOfMonth.toString()
}
binding.dateSolarTaken.setText(
year.toString() + "-" + bulan + "-" + hari
)
tanggal = binding.dateSolarTaken.text.toString()
},
year,
month,
day
)
picker.show()
}
RetrofitClient.apiInstance.getAllTower()
.enqueue(object : Callback<TowerResponse>{
override fun onResponse(
call: Call<TowerResponse>,
response: Response<TowerResponse>
) {
if (response.isSuccessful){
response.body()?.result?.forEach {
it?.namaTower?.let { it1 -> allTower.add(it1) }
}
}
}
override fun onFailure(call: Call<TowerResponse>, t: Throwable) {
}
})
site = binding.site
val adapter = ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, allTower)
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
site.adapter = adapter
site.onItemSelectedListener = object : AdapterView.OnItemSelectedListener{
override fun onItemSelected(p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long) {
if (p2 == 0 ){
siteMain = ""
}else{
val number = p0?.getItemAtPosition(p2).toString()
siteMain = number
}
}
override fun onNothingSelected(p0: AdapterView<*>?) {
}
}
val id = sharedPref.getId().toString()
binding.btnSimpan.setOnClickListener{
binding.btnSimpan.startAnimation()
tambahProses(id , tanggal, siteMain)
}
}
fun tambahProses(id:String, tanggal: String, tujuan_site: String){
RetrofitClient.apiInstance.tambahMaintenance(id, tanggal, tujuan_site)
.enqueue(object : Callback<MaintenanceResponse>{
override fun onResponse(
call: Call<MaintenanceResponse>,
response: Response<MaintenanceResponse>
) {
if (response.isSuccessful){
val intent = Intent(this@MaintenanceMenu, MaintenanceActivity::class.java)
startActivity(intent)
Toast.makeText(getApplicationContext(), "Sukses menambah data", Toast.LENGTH_LONG).show()
finish()
}else{
Toast.makeText(getApplicationContext(), response.message() ,
Toast.LENGTH_LONG).show()
}
binding.btnSimpan.revertAnimation()
}
override fun onFailure(call: Call<MaintenanceResponse>, t: Throwable) {
t.message?.let { Log.d("error Server", it)
binding.btnSimpan.revertAnimation()
}
}
})
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.mentoring
import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.view.View
import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.tabs.TabLayoutMediator
import com.sibatel.solarapp.R
import com.sibatel.solarapp.databinding.ActivityMentoringSolarBinding
import com.sibatel.solarapp.ui.LoginActivity
import com.sibatel.solarapp.ui.user.Profil
import com.sibatel.solarapp.utils.SharedPref
class MentoringSolar : AppCompatActivity() {
private lateinit var binding: ActivityMentoringSolarBinding
private lateinit var sharedPref: SharedPref
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMentoringSolarBinding.inflate(layoutInflater)
setContentView(binding.root)
supportActionBar?.elevation = 0f
supportActionBar?.setDisplayHomeAsUpEnabled(true)
sharedPref = SharedPref(this)
val sectionsPagerAdapter = SectionsPagerAdapter( this, sharedPref.getRole1())
binding.viewPager.adapter = sectionsPagerAdapter
val tabLayout = binding.tabs
TabLayoutMediator(tabLayout, binding.viewPager){tab, position ->
if (sharedPref.getRole1().equals("maintenance"))
tab.text = "Penggunaan Solar"
else
tab.text = resources.getString(TAB_TITLES[position])
}.attach()
val toolbar = binding.appLay
supportActionBar?.title = "Solar"
supportActionBar?.setDisplayShowHomeEnabled(true)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
override fun onSupportNavigateUp():Boolean{
onBackPressed()
return true
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.action_profil -> {
val intent = Intent(this, Profil::class.java)
startActivity(intent)
return true
}
R.id.action_logout ->{
sharedPref.logout()
val intent = Intent(this, LoginActivity::class.java)
startActivity(intent)
finish()
return true
}
else -> super.onOptionsItemSelected(item)
}
}
companion object{
@StringRes
private val TAB_TITLES = intArrayOf(R.string.pengambilan_solar, R.string.penggunaan_solar)
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.mentoring
import android.content.Context
import androidx.annotation.StringRes
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.sibatel.solarapp.R
import com.sibatel.solarapp.ui.mentoring.solar.pengambilan.PengambilanSolarFragment
import com.sibatel.solarapp.ui.mentoring.solar.penggunaan.PenggunaanSolarFragment
class SectionsPagerAdapter(fm: FragmentActivity, role:String) : FragmentStateAdapter(fm) {
private val role = role
override fun getItemCount(): Int {
var x =0;
if (role.equals("maintenance")){
x=1
}else if (role.equals("timkorektif")){
x=1
}else{
x=2
}
return x
}
override fun createFragment(position: Int): Fragment=
if (role.equals("maintenance")){
when(position){
0 -> PenggunaanSolarFragment()
else -> PenggunaanSolarFragment()
}
}else if(role.equals("timkorektif")){
when(position){
0 -> PengambilanSolarFragment()
else -> PengambilanSolarFragment()
}
}else{
when(position){
0 -> PengambilanSolarFragment()
1 -> PenggunaanSolarFragment()
else -> PengambilanSolarFragment()
}
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.mentoring.solar.pengambilan
import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.snackbar.Snackbar
import com.sibatel.solarapp.R
import com.sibatel.solarapp.adapter.PengambilanSolarAdapter
import com.sibatel.solarapp.data.model.solar.pengambilansolar.PengambilanSolar
import com.sibatel.solarapp.data.viewmodel.MobilViewModel
import com.sibatel.solarapp.data.viewmodel.PengambilanSolarViewModel
import com.sibatel.solarapp.databinding.FragmentPengambilanSolarBinding
import com.sibatel.solarapp.ui.LoginActivity
import com.sibatel.solarapp.ui.user.Profil
import com.sibatel.solarapp.utils.SharedPref
import com.sibatel.solarapp.utils.ViewModelFactory
class PengambilanSolarFragment : Fragment() {
private lateinit var fragmentBinding: FragmentPengambilanSolarBinding
private lateinit var sharedPref : SharedPref
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentPengambilanSolarBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
val fab: FloatingActionButton = fragmentBinding.fab
sharedPref = context?.let { SharedPref(it) }!!
fab.setOnClickListener {
val intent = Intent(context, MenuPengambilanSolar::class.java)
startActivity(intent)
requireActivity().finish()
}
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[PengambilanSolarViewModel::class.java]
showLoading(true)
viewModelCatalog.getPengambilanSolar(sharedPref.getId()).observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}else{
showDataPengambilanSolar(it)
}
showLoading(false)
})
}
}
private fun showDataPengambilanSolar(listPengambilanSolar : ArrayList<PengambilanSolar>?){
fragmentBinding.rvMentoringPengambilan.adapter = PengambilanSolarAdapter(listPengambilanSolar)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.mentoring.solar.penggunaan
import android.R
import android.app.DatePickerDialog
import android.content.Intent
import android.graphics.Bitmap
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.*
import androidx.appcompat.app.AppCompatActivity
import com.sibatel.solarapp.data.model.mobil.MobilResponse
import com.sibatel.solarapp.data.model.solar.penggunaansolar.PenggunaanSolarResponse
import com.sibatel.solarapp.data.model.tower.TowerResponse
import com.sibatel.solarapp.databinding.ActivityPenggunaanSolarBinding
import com.sibatel.solarapp.network.ApiServices
import com.sibatel.solarapp.network.RetrofitClient
import com.sibatel.solarapp.ui.mentoring.MentoringSolar
import com.sibatel.solarapp.utils.SharedPref
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import java.util.*
class MenuPenggunaanSolar : AppCompatActivity() {
private lateinit var binding : ActivityPenggunaanSolarBinding
private lateinit var site: Spinner
private lateinit var sharedPref: SharedPref
var tanggal = ""
var tujuanSite = ""
override fun onCreate(savedInstanceState: Bundle?){
super.onCreate(savedInstanceState)
binding = ActivityPenggunaanSolarBinding.inflate(layoutInflater)
supportActionBar?.elevation = 0f
supportActionBar?.setDisplayHomeAsUpEnabled(true)
setContentView(binding.root)
supportActionBar?.title = "Penggunaan Solar"
supportActionBar?.setDisplayShowHomeEnabled(true)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
sharedPref = SharedPref(this)
site = binding.site
binding.btnBatalkanOrderan.setOnClickListener{
RetrofitClient.apiInstance.batalkanPesanan(sharedPref.getId().toString())
.enqueue(object : Callback<MobilResponse>{
override fun onResponse(
call: Call<MobilResponse>,
response: Response<MobilResponse>
) {
val intent = Intent(this@MenuPenggunaanSolar, MentoringSolar::class.java)
Toast.makeText(this@MenuPenggunaanSolar, "Sukses membatalkan orderan", Toast.LENGTH_LONG).show()
startActivity(intent)
finish()
}
override fun onFailure(call: Call<MobilResponse>, t: Throwable) {
t.message?.let { Log.d("error Server", it) }
}
})
}
binding.dateSolarTaken.setOnClickListener {
val cldr: Calendar = Calendar.getInstance()
val day: Int = cldr.get(Calendar.DAY_OF_MONTH)
val month: Int = cldr.get(Calendar.MONTH)
val year: Int = cldr.get(Calendar.YEAR)
var bulan = ""
var hari = ""
val picker = DatePickerDialog(
this,
DatePickerDialog.OnDateSetListener { view, year, monthOfYear, dayOfMonth ->
if(monthOfYear + 1<10){
bulan = "0"+(monthOfYear + 1)
}else{
bulan = (monthOfYear + 1).toString()
}
if(dayOfMonth<10){
hari = "0"+dayOfMonth
}else{
hari = dayOfMonth.toString()
}
binding.dateSolarTaken.setText(
year.toString() + "-" + bulan + "-" + hari
)
tanggal = binding.dateSolarTaken.text.toString()
},
year,
month,
day
)
picker.show()
}
var allTower = ArrayList<String>()
allTower.add("Pilih Site")
RetrofitClient.apiInstance.getAllTower().enqueue(object : Callback<TowerResponse> {
override fun onResponse(call: Call<TowerResponse>, response: Response<TowerResponse>) {
if (response.isSuccessful){
response.body()?.result?.forEach {
if(it?.clusterTower.equals(sharedPref.getSite1())){
it?.namaTower?.let { it1 -> allTower.add(it1) }
}
}
}
}
override fun onFailure(call: Call<TowerResponse>, t: Throwable) {
}
})
val adapter = ArrayAdapter<String>(this, R.layout.simple_spinner_dropdown_item, allTower)
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
site.adapter = adapter
RetrofitClient.apiInstance.cekPenggunaanSolar(sharedPref.getId())
.enqueue(object : Callback<PenggunaanSolarResponse>{
override fun onResponse(
call: Call<PenggunaanSolarResponse>,
response: Response<PenggunaanSolarResponse>
) {
if (response.isSuccessful){
if (response?.body()?.result?.size!! >0){
binding.btnKrim.visibility = View.GONE
binding.layoutEdit.visibility = View.VISIBLE
binding.dateSolarTaken.setText(response?.body()?.result?.get(0)?.tanggal)
tanggal = response?.body()?.result?.get(0)?.tanggal!!
tujuanSite = response?.body()?.result?.get(0)?.tujuanSite!!
site.setSelection(allTower.indexOf(response?.body()?.result?.get(0)?.tujuanSite!!))
}else{
binding.layoutEdit.visibility = View.GONE
binding.btnKrim.visibility = View.VISIBLE
}
}
}
override fun onFailure(call: Call<PenggunaanSolarResponse>, t: Throwable) {
t.message?.let { Log.d("error Server", it) }
}
})
site.onItemSelectedListener = object : AdapterView.OnItemSelectedListener{
override fun onItemSelected(p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long) {
if (p2 == 0){
if (tujuanSite.isNotEmpty()){
(p1 as TextView).setText(tujuanSite)
}else{
tujuanSite = ""
}
}else{
val number = p0?.getItemAtPosition(p2).toString()
tujuanSite = number
}
}
override fun onNothingSelected(p0: AdapterView<*>?) {
}
}
binding.btnSimpanPerubahan.setOnClickListener{
val intent = Intent(this, LaporanPengisianSolar::class.java)
RetrofitClient.apiInstance.updatePenggunaanSolar(sharedPref.getId().toString(),tanggal, tujuanSite)
.enqueue(object : Callback<PenggunaanSolarResponse>{
override fun onResponse(
call: Call<PenggunaanSolarResponse>,
response: Response<PenggunaanSolarResponse>
) {
intent.putExtra("tanggal", tanggal)
intent.putExtra("tujuanSite", tujuanSite)
startActivity(intent)
finish()
}
override fun onFailure(call: Call<PenggunaanSolarResponse>, t: Throwable) {
t.message?.let { Log.d("error Server", it) }
}
})
}
binding.btnKrim.setOnClickListener{
if (tanggal.isEmpty()){
binding.dateSolarTaken.error = "Pilih tanggal terlebih dahulu"
}else if(tujuanSite.isEmpty()){
(site.selectedView as TextView).error = "Anda harus memilih Site terlebih dahulu"
}else{
RetrofitClient.apiInstance.orderMobil(sharedPref.getId().toString(), tanggal, tujuanSite)
.enqueue(object : Callback<MobilResponse>{
override fun onResponse(
call: Call<MobilResponse>,
response: Response<MobilResponse>
) {
Toast.makeText(this@MenuPenggunaanSolar, "Sukses menambah orderan", Toast.LENGTH_LONG).show()
val intent = Intent(this@MenuPenggunaanSolar, LaporanPengisianSolar::class.java)
intent.putExtra("tanggal", tanggal)
intent.putExtra("tujuanSite", tujuanSite)
startActivity(intent)
finish()
}
override fun onFailure(call: Call<MobilResponse>, t: Throwable) {
t.message?.let { Log.d("error Server", it) }
}
})
}
}
}
override fun onSupportNavigateUp():Boolean{
onBackPressed()
return true
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.mentoring.solar.penggunaan
import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.sibatel.solarapp.adapter.PenggunaanSolarAdapter
import com.sibatel.solarapp.data.model.solar.penggunaansolar.PenggunaanSolar
import com.sibatel.solarapp.data.viewmodel.PenggunaanSolarViewModel
import com.sibatel.solarapp.databinding.FragmentPenggunaanSolarBinding
import com.sibatel.solarapp.utils.SharedPref
import com.sibatel.solarapp.utils.ViewModelFactory
class PenggunaanSolarFragment : Fragment() {
private lateinit var fragmentBinding: FragmentPenggunaanSolarBinding
private lateinit var sharedPref: SharedPref
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentPenggunaanSolarBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
sharedPref = context?.let { SharedPref(it) }!!
val fab: FloatingActionButton = fragmentBinding.fab
fab.setOnClickListener {
if (sharedPref.getRole1().equals("maintenance")){
val intent = Intent(context, PenggunaanSolarMTC::class.java)
startActivity(intent)
}else{
val intent = Intent(context, MenuPenggunaanSolar::class.java)
startActivity(intent)
}
requireActivity().finish()
}
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[PenggunaanSolarViewModel::class.java]
showLoading(true)
viewModelCatalog.getPenggunaanSolar(sharedPref.getId()).observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}else{
showDataPenggunaanSolar(it)
}
showLoading(false)
})
}
}
private fun showDataPenggunaanSolar(listPenggunaanSolar: ArrayList<PenggunaanSolar>?){
fragmentBinding.rvMentoringPenggunaan.adapter = PenggunaanSolarAdapter(listPenggunaanSolar)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.mobil
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.adapter.MobilAdapter
import com.sibatel.solarapp.data.model.mobil.Mobil
import com.sibatel.solarapp.data.viewmodel.MobilViewModel
import com.sibatel.solarapp.databinding.FragmentMobilBinding
import com.sibatel.solarapp.utils.ViewModelFactory
class CGLFragment: Fragment() {
private lateinit var fragmentBinding: FragmentMobilBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentMobilBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[MobilViewModel::class.java]
val scdMobil = ArrayList<Mobil>()
showLoading(true)
viewModelCatalog.getMobil().observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
}else{
it.forEach {
if (it.role.equals("cgl")){
scdMobil.add(it)
}
}
if(scdMobil.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}
showDataMobil(scdMobil)
}
showLoading(false)
})
}
}
fun showDataMobil(listItemMovies : ArrayList<Mobil>?){
fragmentBinding.rvMobil.adapter = MobilAdapter(listItemMovies)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
package com.sibatel.solarapp.ui.mobil
import android.os.Bundle
import android.os.PersistableBundle
import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.tabs.TabLayoutMediator
import com.sibatel.solarapp.R
import com.sibatel.solarapp.databinding.ActivityDataMobilBinding
import com.sibatel.solarapp.ui.mentoring.MentoringSolar
class DataMobil : AppCompatActivity() {
private lateinit var binding: ActivityDataMobilBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityDataMobilBinding.inflate(layoutInflater)
setContentView(binding.root)
supportActionBar?.elevation = 0f
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.title = "Mobil"
val sectionPagerAdapter = DataMobilePagerAdapter(this)
binding.viewPager.adapter = sectionPagerAdapter
val tabLayout = binding.tabs
TabLayoutMediator(tabLayout, binding.viewPager){tab, position ->
tab.text = resources.getString(DataMobil.TAB_TITLES[position])
}.attach()
}
companion object{
@StringRes
private val TAB_TITLES = intArrayOf(R.string.SCD, R.string.Koordinator, R.string.CGL, R.string.Koerktif, R.string.Maintenance, R.string.Project)
}
override fun onSupportNavigateUp():Boolean{
onBackPressed()
return true
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.mobil
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.sibatel.solarapp.ui.mentoring.solar.pengambilan.PengambilanSolarFragment
import com.sibatel.solarapp.ui.mentoring.solar.penggunaan.PenggunaanSolarFragment
class DataMobilePagerAdapter (fm: FragmentActivity) : FragmentStateAdapter(fm) {
override fun getItemCount(): Int = 6
override fun createFragment(position: Int): Fragment =
when(position){
0 -> SCDFragment()
1 -> KoordinatorFragment()
2 -> CGLFragment()
3 -> KorektifFragment()
4 -> MaintenanceFragment()
5 -> ProjectFragment()
else -> SCDFragment()
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.mobil
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.adapter.MobilAdapter
import com.sibatel.solarapp.data.model.mobil.Mobil
import com.sibatel.solarapp.data.viewmodel.MobilViewModel
import com.sibatel.solarapp.databinding.FragmentMobilBinding
import com.sibatel.solarapp.utils.ViewModelFactory
class KoordinatorFragment : Fragment() {
private lateinit var fragmentBinding: FragmentMobilBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentMobilBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[MobilViewModel::class.java]
val koordinatorMobil = ArrayList<Mobil>()
showLoading(true)
viewModelCatalog.getMobil().observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}else{
it.forEach {
if (it.role.equals("koordinator")){
koordinatorMobil.add(it)
}
}
if(koordinatorMobil.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}
showDataMobil(koordinatorMobil)
}
showLoading(false)
})
}
}
fun showDataMobil(listItemMovies : ArrayList<Mobil>?){
fragmentBinding.rvMobil.adapter = MobilAdapter(listItemMovies)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.mobil
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.adapter.MobilAdapter
import com.sibatel.solarapp.data.model.mobil.Mobil
import com.sibatel.solarapp.data.viewmodel.MobilViewModel
import com.sibatel.solarapp.databinding.FragmentMobilBinding
import com.sibatel.solarapp.utils.ViewModelFactory
class KorektifFragment : Fragment() {
private lateinit var fragmentBinding: FragmentMobilBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentMobilBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[MobilViewModel::class.java]
val scdMobil = ArrayList<Mobil>()
showLoading(true)
viewModelCatalog.getMobil().observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
}else{
it.forEach {
if (it.role.equals("timkorektif")){
scdMobil.add(it)
}
}
if(scdMobil.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}
showDataMobil(scdMobil)
}
showLoading(false)
})
}
}
fun showDataMobil(listItemMovies : ArrayList<Mobil>?){
fragmentBinding.rvMobil.adapter = MobilAdapter(listItemMovies)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.mobil
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.adapter.MobilAdapter
import com.sibatel.solarapp.data.model.mobil.Mobil
import com.sibatel.solarapp.data.viewmodel.MobilViewModel
import com.sibatel.solarapp.databinding.FragmentMobilBinding
import com.sibatel.solarapp.utils.ViewModelFactory
class MaintenanceFragment : Fragment() {
private lateinit var fragmentBinding: FragmentMobilBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentMobilBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[MobilViewModel::class.java]
val scdMobil = ArrayList<Mobil>()
showLoading(true)
viewModelCatalog.getMobil().observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
}else{
it.forEach {
if (it.role.equals("maintenance")){
scdMobil.add(it)
}
}
if(scdMobil.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}
showDataMobil(scdMobil)
}
showLoading(false)
})
}
}
fun showDataMobil(listItemMovies : ArrayList<Mobil>?){
fragmentBinding.rvMobil.adapter = MobilAdapter(listItemMovies)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.mobil
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.adapter.MobilAdapter
import com.sibatel.solarapp.data.model.mobil.Mobil
import com.sibatel.solarapp.data.viewmodel.MobilViewModel
import com.sibatel.solarapp.databinding.FragmentMobilBinding
import com.sibatel.solarapp.utils.ViewModelFactory
class ProjectFragment : Fragment() {
private lateinit var fragmentBinding: FragmentMobilBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentMobilBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[MobilViewModel::class.java]
val scdMobil = ArrayList<Mobil>()
showLoading(true)
viewModelCatalog.getMobil().observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
}else{
it.forEach {
if (it.role.equals("timproject")){
scdMobil.add(it)
}
}
if(scdMobil.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}
showDataMobil(scdMobil)
}
showLoading(false)
})
}
}
fun showDataMobil(listItemMovies : ArrayList<Mobil>?){
fragmentBinding.rvMobil.adapter = MobilAdapter(listItemMovies)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.mobil
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.adapter.MobilAdapter
import com.sibatel.solarapp.data.model.mobil.Mobil
import com.sibatel.solarapp.data.viewmodel.MobilViewModel
import com.sibatel.solarapp.databinding.FragmentMobilBinding
import com.sibatel.solarapp.utils.ViewModelFactory
class SCDFragment : Fragment() {
private lateinit var fragmentBinding: FragmentMobilBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentMobilBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[MobilViewModel::class.java]
val scdMobil = ArrayList<Mobil>()
showLoading(true)
viewModelCatalog.getMobil().observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
}else{
it.forEach {
if (it.role.equals("scd")){
scdMobil.add(it)
}
}
if(scdMobil.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}
showDataMobil(scdMobil)
}
showLoading(false)
})
}
}
fun showDataMobil(listItemMovies : ArrayList<Mobil>?){
fragmentBinding.rvMobil.adapter = MobilAdapter(listItemMovies)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.user
import android.os.Bundle
import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.tabs.TabLayoutMediator
import com.sibatel.solarapp.R
import com.sibatel.solarapp.databinding.ActivityProfilBinding
import com.sibatel.solarapp.utils.SharedPref
class Profil : AppCompatActivity() {
private lateinit var binding: ActivityProfilBinding
private lateinit var sharedPref: SharedPref
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityProfilBinding.inflate(layoutInflater)
setContentView(binding.root)
supportActionBar?.elevation = 0f
supportActionBar?.setDisplayHomeAsUpEnabled(true)
sharedPref = SharedPref(this)
binding.scdName.text = sharedPref.getNama1()
binding.userRole.text = sharedPref.getRole1()
val sectionPagerAdapter = ProfilPagerAdapter(this)
binding.viewPager.adapter = sectionPagerAdapter
val tabLayout = binding.tabs
TabLayoutMediator(tabLayout, binding.viewPager){tab, position ->
tab.text = resources.getString(Profil.TAB_TITLES[position])
}.attach()
}
companion object{
@StringRes
private val TAB_TITLES = intArrayOf(R.string.SCD, R.string.Koordinator, R.string.CGL, R.string.Koerktif, R.string.Maintenance, R.string.Project)
}
override fun onSupportNavigateUp():Boolean{
onBackPressed()
return true
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.user
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.adapter.UserAdapter
import com.sibatel.solarapp.data.model.user.User
import com.sibatel.solarapp.data.viewmodel.UserViewModel
import com.sibatel.solarapp.databinding.FragmentProfilBinding
import com.sibatel.solarapp.utils.ViewModelFactory
class ProfilCGLFragment : Fragment(){
private lateinit var fragmentBinding : FragmentProfilBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentProfilBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[UserViewModel::class.java]
val profilSCD = ArrayList<User>()
showLoading(true)
viewModelCatalog.getUser().observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}else{
it.forEach{
if (it.role.equals("cgl")){
profilSCD.add(it)
}
}
showDataScd(profilSCD)
showLoading(false)
}
})
}
}
fun showDataScd(listSCD : ArrayList<User>){
fragmentBinding.rvProfil.adapter = UserAdapter(listSCD)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.user
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.adapter.UserAdapter
import com.sibatel.solarapp.data.model.user.User
import com.sibatel.solarapp.data.viewmodel.UserViewModel
import com.sibatel.solarapp.databinding.FragmentProfilBinding
import com.sibatel.solarapp.utils.ViewModelFactory
class ProfilKoordinatorFragmend : Fragment(){
private lateinit var fragmentBinding : FragmentProfilBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentProfilBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[UserViewModel::class.java]
val profilSCD = ArrayList<User>()
showLoading(true)
viewModelCatalog.getUser().observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}else{
it.forEach{
if (it.role.equals("koordinator")){
profilSCD.add(it)
}
}
showDataScd(profilSCD)
showLoading(false)
}
})
}
}
fun showDataScd(listSCD : ArrayList<User>){
fragmentBinding.rvProfil.adapter = UserAdapter(listSCD)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.user
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.adapter.UserAdapter
import com.sibatel.solarapp.data.model.user.User
import com.sibatel.solarapp.data.viewmodel.UserViewModel
import com.sibatel.solarapp.databinding.FragmentProfilBinding
import com.sibatel.solarapp.utils.ViewModelFactory
class ProfilKorektifFragment : Fragment(){
private lateinit var fragmentBinding : FragmentProfilBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentProfilBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[UserViewModel::class.java]
val profilSCD = ArrayList<User>()
showLoading(true)
viewModelCatalog.getUser().observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}else{
it.forEach{
if (it.role.equals("timkorektif")){
profilSCD.add(it)
}
}
showDataScd(profilSCD)
showLoading(false)
}
})
}
}
fun showDataScd(listSCD : ArrayList<User>){
fragmentBinding.rvProfil.adapter = UserAdapter(listSCD)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.user
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.adapter.UserAdapter
import com.sibatel.solarapp.data.model.user.User
import com.sibatel.solarapp.data.viewmodel.UserViewModel
import com.sibatel.solarapp.databinding.FragmentProfilBinding
import com.sibatel.solarapp.utils.ViewModelFactory
class ProfilMaintenanceFragment : Fragment() {
private lateinit var fragmentBinding : FragmentProfilBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentProfilBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[UserViewModel::class.java]
val profilSCD = ArrayList<User>()
showLoading(true)
viewModelCatalog.getUser().observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}else{
it.forEach{
if (it.role.equals("maintenance")){
profilSCD.add(it)
}
}
showDataScd(profilSCD)
showLoading(false)
}
})
}
}
fun showDataScd(listSCD : ArrayList<User>){
fragmentBinding.rvProfil.adapter = UserAdapter(listSCD)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.user
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.sibatel.solarapp.ui.mentoring.solar.pengambilan.PengambilanSolarFragment
import com.sibatel.solarapp.ui.mentoring.solar.penggunaan.PenggunaanSolarFragment
class ProfilPagerAdapter(fm: FragmentActivity) : FragmentStateAdapter(fm) {
override fun getItemCount(): Int = 6
override fun createFragment(position: Int): Fragment =
when(position){
0 -> ProfilSCDFragment()
1 -> ProfilKoordinatorFragmend()
2 -> ProfilCGLFragment()
3 -> ProfilKorektifFragment()
4 -> ProfilMaintenanceFragment()
5 -> ProfilProjectFragment()
else -> ProfilSCDFragment()
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.user
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.adapter.UserAdapter
import com.sibatel.solarapp.data.model.user.User
import com.sibatel.solarapp.data.viewmodel.UserViewModel
import com.sibatel.solarapp.databinding.FragmentProfilBinding
import com.sibatel.solarapp.utils.ViewModelFactory
class ProfilProjectFragment : Fragment(){
private lateinit var fragmentBinding : FragmentProfilBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentProfilBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[UserViewModel::class.java]
val profilSCD = ArrayList<User>()
showLoading(true)
viewModelCatalog.getUser().observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}else{
it.forEach{
if (it.role.equals("timproject")){
profilSCD.add(it)
}
}
showDataScd(profilSCD)
showLoading(false)
}
})
}
}
fun showDataScd(listSCD : ArrayList<User>){
fragmentBinding.rvProfil.adapter = UserAdapter(listSCD)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.ui.user
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.adapter.UserAdapter
import com.sibatel.solarapp.data.model.user.User
import com.sibatel.solarapp.data.viewmodel.UserViewModel
import com.sibatel.solarapp.databinding.FragmentProfilBinding
import com.sibatel.solarapp.utils.ViewModelFactory
class ProfilSCDFragment : Fragment() {
private lateinit var fragmentBinding : FragmentProfilBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
fragmentBinding = FragmentProfilBinding.inflate(inflater, container, false)
return fragmentBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity!=null){
val factory = ViewModelFactory.getInstance()
val viewModelCatalog = ViewModelProvider(
this, factory
)[UserViewModel::class.java]
val profilSCD = ArrayList<User>()
showLoading(true)
viewModelCatalog.getUser().observe(viewLifecycleOwner, Observer {
if (it.isEmpty()){
Toast.makeText(context, "Data Kosong", Toast.LENGTH_LONG).show()
}else{
it.forEach{
if (it.role.equals("scd")){
profilSCD.add(it)
}
}
showDataScd(profilSCD)
showLoading(false)
}
})
}
}
fun showDataScd(listSCD : ArrayList<User>){
fragmentBinding.rvProfil.adapter = UserAdapter(listSCD)
}
private fun showLoading(state: Boolean) {
if (state)
fragmentBinding.progress.visibility = View.VISIBLE
else
fragmentBinding.progress.visibility = View.GONE
}
}
\ No newline at end of file
package com.sibatel.solarapp.utils
object EspressoIdlingResource {
// private val RESOURCE = "GLOBAL"
// private val countingIdlingResource = CountingIdlingResource(RESOURCE)
//
// val idlingresource: IdlingResource
// get() = countingIdlingResource
//
// fun increment() {
// countingIdlingResource.increment()
// }
//
// fun decrement() {
// countingIdlingResource.decrement()
// }
}
\ No newline at end of file
package com.sibatel.solarapp.utils
import com.sibatel.solarapp.data.RemoteDataSource
import com.sibatel.solarapp.data.SolarRepository
object Injection {
fun provideRepository() : SolarRepository {
val dataSource = RemoteDataSource.getInstance()
return SolarRepository.getInstance(dataSource)
}
}
\ No newline at end of file
package com.sibatel.solarapp.utils
import android.view.animation.Animation
import android.view.animation.Transformation
import android.widget.ProgressBar
class ProgressBarAnimation() : Animation() {
private var progressBar: ProgressBar? = null
private var from = 0f
private var to = 0f
fun ProgressBarAnimation(progressBar: ProgressBar?, from: Float, to: Float) {
this.progressBar = progressBar
this.from = from
this.to = to
}
override fun applyTransformation(interpolatedTime: Float, t: Transformation?) {
super.applyTransformation(interpolatedTime, t)
val value = from + (to - from) * interpolatedTime
progressBar!!.progress = value.toInt()
}
}
\ No newline at end of file
package com.sibatel.solarapp.utils
import android.content.Context
import android.content.SharedPreferences
class SharedPref(mContext : Context) {
val login = "session_status"
val nama = "nama"
val role = "role"
val id = "id"
val mypref = "MAIN_PRF"
val sp: SharedPreferences
val tanggal = "tanggal"
val site = "site"
init {
sp = mContext.getSharedPreferences(mypref, Context.MODE_PRIVATE)
}
fun setStatusLogin(status : Boolean){
sp.edit().putBoolean(login, status).apply()
}
fun setId(idUser:Int ? = 0){
sp.edit().putInt(id,idUser!!).apply()
}
fun getId():Int{
return sp.getInt(id,0)
}
fun setSite(namaSite:String ? = null){
sp.edit().putString(site, namaSite!!).apply()
}
fun getSite1(): String{
return sp.getString(site, "").toString()
}
fun setNama(namaUser:String ? = null){
sp.edit().putString(nama, namaUser!!).apply()
}
fun getNama1(): String{
return sp.getString(nama, "").toString()
}
fun setRole(roleUser:String ? = null){
sp.edit().putString(role, roleUser!!).apply()
}
fun getRole1(): String{
return sp.getString(role, "").toString()
}
fun getStatusLogin() : Boolean{
return sp.getBoolean(login, false)
}
fun logout(){
sp.edit().putBoolean(login, false).apply()
sp.edit().putInt(id,0).apply()
sp.edit().putString(nama, "").apply()
sp.edit().putString(role, "").apply()
}
}
\ No newline at end of file
package com.sibatel.solarapp.utils
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.sibatel.solarapp.data.SolarRepository
import com.sibatel.solarapp.data.viewmodel.*
@Suppress("UNCHECKED_CAST")
class ViewModelFactory private constructor(private val solarRepository: SolarRepository) : ViewModelProvider.NewInstanceFactory() {
companion object{
@Volatile
private var instance: ViewModelFactory? = null
fun getInstance(): ViewModelFactory =
instance ?: synchronized(this){
instance ?: ViewModelFactory(Injection.provideRepository()).apply {
instance = this
}
}
}
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
return when{
modelClass.isAssignableFrom(MobilViewModel::class.java) -> {
MobilViewModel(solarRepository) as T
}
modelClass.isAssignableFrom(UserViewModel::class.java)-> {
UserViewModel(solarRepository) as T
}
modelClass.isAssignableFrom(PengambilanSolarViewModel::class.java)-> {
PengambilanSolarViewModel(solarRepository) as T
}
modelClass.isAssignableFrom(PenggunaanSolarViewModel::class.java)->{
PenggunaanSolarViewModel(solarRepository) as T
}
modelClass.isAssignableFrom(MaintenanceViewModel::class.java)->{
MaintenanceViewModel(solarRepository) as T
}
else -> throw IllegalArgumentException("Unknown ViewModel class: " + modelClass.name)
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromXScale="0.0"
android:toXScale="1.4"
android:fromYScale="0.0"
android:toYScale="1.4"
android:pivotX="50%"
android:pivotY="50%"
android:fillAfter="false"
android:duration="700" />
<set android:interpolator="@android:anim/decelerate_interpolator">
<scale
android:fromXScale="1.4"
android:toXScale="0.8"
android:fromYScale="1.4"
android:toYScale="0.8"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="700"
android:duration="400"
android:fillBefore="false" />
<!-- <rotate
android:fromDegrees="0"
android:toDegrees="360"
android:toYScale="0.0"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="700"
android:duration="400" />
-->
</set>
</set>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<solid
android:color="@color/theme_2" />
<stroke
android:width="1dp"
android:color="#222222" />
<corners
android:radius="15dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item android:state_focused="true">
<shape>
<solid
android:color="@color/teal_700" />
<stroke
android:width="1dp"
android:color="#222222" />
<corners
android:radius="15dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item>
<shape>
<solid android:color="@color/theme_3"/>
<stroke
android:width="1dp"
android:color="#4aa5d4" />
<corners
android:radius="15dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<solid
android:color="@color/theme_4" />
<stroke
android:width="1dp"
android:color="#222222" />
<corners
android:radius="15dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item android:state_focused="true">
<shape>
<solid
android:color="@color/teal_700" />
<stroke
android:width="1dp"
android:color="#222222" />
<corners
android:radius="15dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item>
<shape>
<solid android:color="@color/theme_4"/>
<stroke
android:width="1dp"
android:color="#4aa5d4" />
<corners
android:radius="15dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#80810000"/>
<stroke android:width="2dp" android:color="#4f000000" />
<corners
android:bottomRightRadius="50dp"
android:bottomLeftRadius="50dp"
android:topLeftRadius="50dp"
android:topRightRadius="50dp"/>
<solid android:color="#80810000" />
<stroke android:width="1dip" android:color="#ffffff" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#E0DEDE"/>
<stroke android:width="2dp" android:color="#E0DEDE" />
<corners
android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp"/>
<solid android:color="#FFFFFF" />
<stroke android:width="1dip" android:color="#E0DEDE" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#FFFFFF"/>
<stroke android:width="2dp" android:color="#FFFFFF" />
<corners
android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp"/>
<solid android:color="#dddddd" />
<stroke android:width="1dip" android:color="#ffffff" />
</shape>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- most important is order of layers -->
<!-- Bottom right side 2dp Shadow -->
<item >
<shape android:shape="rectangle">
<solid android:color="#000000" />
</shape>
</item>
<!-- Bottom 2dp Shadow -->
<item>
<shape android:shape="rectangle" android:padding="10dp">
<solid android:color="#000000" />
<corners
android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
</shape>
</item>
<!-- White Top color -->
<item android:bottom="3px" android:right="3px">
<shape android:shape="rectangle">
<solid android:color="#FFFFFF" />
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<padding android:left="1dp"
android:top="1dp"
android:right="1dp"
android:bottom="1dp" />
<corners android:radius="20dp" />
<gradient
android:angle="90"
android:startColor="#810000"
android:endColor="#F50002"
android:type="linear" />
</shape>
</item>
</selector>
\ No newline at end of file
<vector android:height="24dp" android:tint="#E0DEDE"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M21,19V5c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM8.5,13.5l2.5,3.01L14.5,12l4.5,6H5l3.5,-4.5z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M20,3h-1L19,1h-2v2L7,3L7,1L5,1v2L4,3c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,5c0,-1.1 -0.9,-2 -2,-2zM20,21L4,21L4,8h16v13z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96zM14,13v4h-4v-4H7l5,-5 5,5h-3z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners
android:radius="27dp"
/>
<gradient
android:angle="45"
android:centerX="35%"
android:startColor="#630000"
android:endColor="#630000"
android:type="linear"
/>
<size
android:width="250dp"
android:height="54dp"
/>
</shape>
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
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