-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d84db04
commit 3988c06
Showing
9 changed files
with
211 additions
and
16 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
app/src/main/java/com/seogaemo/hackseoul_android/data/CreatedAt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.seogaemo.hackseoul_android.data | ||
|
||
class CreatedAt |
8 changes: 8 additions & 0 deletions
8
app/src/main/java/com/seogaemo/hackseoul_android/data/PipLineBody.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.seogaemo.hackseoul_android.data | ||
|
||
data class PipLineBody( | ||
val companyId: String, | ||
val description: String, | ||
val productItemId: String, | ||
val title: String | ||
) |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/seogaemo/hackseoul_android/data/ProditemResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.seogaemo.hackseoul_android.data | ||
|
||
data class ProditemResponse( | ||
val createdAt: CreatedAt, | ||
val modelNumber: String, | ||
val productId: String, | ||
val title: String, | ||
val uid: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 12 additions & 6 deletions
18
app/src/main/java/com/seogaemo/hackseoul_android/view/HomeActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
package com.seogaemo.hackseoul_android.view | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.activity.enableEdgeToEdge | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.core.view.ViewCompat | ||
import androidx.core.view.WindowInsetsCompat | ||
import com.seogaemo.hackseoul_android.R | ||
import com.seogaemo.hackseoul_android.databinding.ActivityHomeBinding | ||
|
||
class HomeActivity : AppCompatActivity() { | ||
private lateinit var binding: ActivityHomeBinding | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
enableEdgeToEdge() | ||
setContentView(R.layout.activity_home) | ||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> | ||
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) | ||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) | ||
insets | ||
binding = ActivityHomeBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
binding.loginButton.setOnClickListener { | ||
startActivity(Intent(this@HomeActivity, LoginActivity::class.java)) | ||
} | ||
|
||
binding.qrButton.setOnClickListener { | ||
startActivity(Intent(this@HomeActivity, MainActivity::class.java)) | ||
} | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
app/src/main/java/com/seogaemo/hackseoul_android/view/JobHistoryActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,85 @@ | ||
package com.seogaemo.hackseoul_android.view | ||
|
||
import android.content.Context | ||
import android.os.Bundle | ||
import android.widget.Toast | ||
import androidx.lifecycle.lifecycleScope | ||
import com.bumptech.glide.Glide | ||
import com.seogaemo.hackseoul_android.data.PipLineBody | ||
import com.seogaemo.hackseoul_android.data.ProductResponse | ||
import com.seogaemo.hackseoul_android.database.SharedPreference | ||
import com.seogaemo.hackseoul_android.databinding.ActivityJobHistoryBinding | ||
import com.seogaemo.hackseoul_android.network.RetrofitAPI | ||
import com.seogaemo.hackseoul_android.network.RetrofitClient | ||
import com.seogaemo.hackseoul_android.util.BaseActivity | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.launch | ||
import kotlinx.coroutines.withContext | ||
|
||
class JobHistoryActivity : BaseActivity() { | ||
private lateinit var binding: ActivityJobHistoryBinding | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityJobHistoryBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
val id = intent.getStringExtra("id").toString() | ||
|
||
lifecycleScope.launch { | ||
getProduct(this@JobHistoryActivity, id)?.let { | ||
binding.titleText.text = it.title | ||
Glide.with(this@JobHistoryActivity) | ||
.load(it.imageUrl) | ||
.centerCrop() | ||
.into(binding.itemImageView) | ||
} | ||
|
||
binding.backButton.setOnClickListener { | ||
finish() | ||
} | ||
|
||
binding.submitButton.setOnClickListener { | ||
} | ||
} | ||
} | ||
|
||
private suspend fun postPipeline(body: PipLineBody): Void? { | ||
return try { | ||
withContext(Dispatchers.IO) { | ||
val retrofitAPI = RetrofitClient.getInstance().create(RetrofitAPI::class.java) | ||
val response = retrofitAPI.postPipeline(body) | ||
if (response.isSuccessful) { | ||
response.body() | ||
} else { | ||
withContext(Dispatchers.Main) { | ||
} | ||
null | ||
} | ||
} | ||
} catch (e: Exception) { | ||
withContext(Dispatchers.Main) { | ||
} | ||
null | ||
} | ||
} | ||
|
||
|
||
private suspend fun getProduct(context: Context, id: String): ProductResponse? { | ||
return try { | ||
withContext(Dispatchers.IO) { | ||
val retrofitAPI = RetrofitClient.getInstance().create(RetrofitAPI::class.java) | ||
val response = retrofitAPI.getProduct("bearer ${SharedPreference.token}", id) | ||
if (response.isSuccessful) { | ||
response.body() | ||
} else { | ||
|
||
null | ||
} | ||
} | ||
} catch (e: Exception) { | ||
|
||
null | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters