initial
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,47 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.example.resbuilder"
|
||||
compileSdk {
|
||||
version = release(36) {
|
||||
minorApiLevel = 1
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.example.resbuilder"
|
||||
minSdk = 29
|
||||
targetSdk = 36
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
optimization {
|
||||
enable = false
|
||||
}
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.androidx.appcompat)
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.material)
|
||||
implementation(libs.okhttp)
|
||||
implementation(libs.gson)
|
||||
implementation(libs.browser)
|
||||
implementation(libs.google.play.services.auth)
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.androidx.espresso.core)
|
||||
androidTestImplementation(libs.androidx.junit)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.example.resbuilder
|
||||
|
||||
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.example.resbuilder", appContext.packageName)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.ResBuilder"
|
||||
android:usesCleartextTraffic="false">
|
||||
|
||||
<activity
|
||||
android:name=".ui.LoginActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".ui.MainActivity"
|
||||
android:exported="false" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.AdminActivity"
|
||||
android:exported="false" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.example.resbuilder.data.model
|
||||
|
||||
data class User(
|
||||
val authenticated: Boolean = false,
|
||||
val email: String? = null,
|
||||
val name: String? = null,
|
||||
val picture: String? = null,
|
||||
val is_admin: Boolean = false,
|
||||
val usage_count: Int = 0,
|
||||
val free_limit: Int = 2,
|
||||
val can_submit: Boolean = false
|
||||
)
|
||||
|
||||
data class BuildRequest(
|
||||
val job_title: String,
|
||||
val job_text: String,
|
||||
val resume_text: String? = null,
|
||||
val cover_letter_text: String? = null
|
||||
)
|
||||
|
||||
data class BuildResponse(
|
||||
val job_id: String
|
||||
)
|
||||
|
||||
data class Job(
|
||||
val job_id: String? = null,
|
||||
val type: String? = null,
|
||||
val status: String = "queued",
|
||||
val created_at: String? = null,
|
||||
val updated_at: String? = null,
|
||||
val html_content: String? = null,
|
||||
val raw_content: String? = null,
|
||||
val error: String? = null
|
||||
)
|
||||
|
||||
data class UploadResponse(
|
||||
val text: String,
|
||||
val filename: String,
|
||||
val size: Int
|
||||
)
|
||||
|
||||
data class ScrapeResponse(
|
||||
val text: String,
|
||||
val url: String,
|
||||
val length: Int
|
||||
)
|
||||
|
||||
data class HealthResponse(
|
||||
val status: String,
|
||||
val timestamp: String,
|
||||
val dependencies: Map<String, String>? = null
|
||||
)
|
||||
|
||||
data class AdminUser(
|
||||
val email: String,
|
||||
val name: String? = null,
|
||||
val usage_count: Int = 0,
|
||||
val blocked: Boolean = false,
|
||||
val is_admin: Boolean = false
|
||||
)
|
||||
|
||||
data class AdminUsersResponse(
|
||||
val users: List<AdminUser>
|
||||
)
|
||||
@@ -0,0 +1,294 @@
|
||||
package com.example.resbuilder.data.remote
|
||||
|
||||
import com.example.resbuilder.data.model.AdminUsersResponse
|
||||
import com.example.resbuilder.data.model.BuildRequest
|
||||
import com.example.resbuilder.data.model.BuildResponse
|
||||
import com.example.resbuilder.data.model.HealthResponse
|
||||
import com.example.resbuilder.data.model.Job
|
||||
import com.example.resbuilder.data.model.ScrapeResponse
|
||||
import com.example.resbuilder.data.model.UploadResponse
|
||||
import com.example.resbuilder.data.model.User
|
||||
import com.google.gson.Gson
|
||||
import okhttp3.Cookie
|
||||
import okhttp3.CookieJar
|
||||
import okhttp3.FormBody
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||
import okhttp3.MediaType.Companion.toMediaType
|
||||
import okhttp3.MultipartBody
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.RequestBody.Companion.asRequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
object ApiClient {
|
||||
|
||||
internal const val API_BASE = "https://resume.aridgwayweb.com"
|
||||
|
||||
private val gson = Gson()
|
||||
private val cookieStore = mutableListOf<Cookie>()
|
||||
private var bearerToken: String? = null
|
||||
|
||||
private val client = OkHttpClient.Builder()
|
||||
.cookieJar(object : CookieJar {
|
||||
override fun saveFromResponse(url: HttpUrl, cookies: List<Cookie>) {
|
||||
cookieStore.removeAll { existing ->
|
||||
cookies.any { it.name == existing.name && it.domain == existing.domain }
|
||||
}
|
||||
cookieStore.addAll(cookies)
|
||||
}
|
||||
|
||||
override fun loadForRequest(url: HttpUrl): List<Cookie> {
|
||||
return cookieStore.filter { it.matches(url) }
|
||||
}
|
||||
})
|
||||
.addInterceptor { chain ->
|
||||
val req = chain.request()
|
||||
val builder = req.newBuilder()
|
||||
bearerToken?.let { builder.header("Authorization", "Bearer $it") }
|
||||
chain.proceed(builder.build())
|
||||
}
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
.writeTimeout(60, TimeUnit.SECONDS)
|
||||
.build()
|
||||
|
||||
fun setToken(token: String) {
|
||||
bearerToken = token
|
||||
}
|
||||
|
||||
fun setCookies(cookies: List<Cookie>) {
|
||||
cookieStore.clear()
|
||||
cookieStore.addAll(cookies)
|
||||
}
|
||||
|
||||
fun clearAuth() {
|
||||
bearerToken = null
|
||||
cookieStore.clear()
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun exchangeGoogleToken(idToken: String): String {
|
||||
val json = gson.toJson(mapOf("id_token" to idToken))
|
||||
val req = Request.Builder()
|
||||
.url("$API_BASE/auth/google-token")
|
||||
.post(json.toRequestBody("application/json".toMediaType()))
|
||||
.build()
|
||||
client.newCall(req).execute().use { res ->
|
||||
if (!res.isSuccessful) {
|
||||
val errBody = res.body?.string()
|
||||
val detail = try {
|
||||
gson.fromJson(errBody, Map::class.java)["detail"] as? String
|
||||
} catch (_: Exception) { null }
|
||||
throw IOException(detail ?: "Google token exchange failed")
|
||||
}
|
||||
val body = res.body?.string() ?: throw IOException("Empty response")
|
||||
val resp = gson.fromJson(body, Map::class.java)
|
||||
return resp["token"] as? String ?: throw IOException("No token in response")
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun healthCheck(): HealthResponse? {
|
||||
val req = Request.Builder()
|
||||
.url("$API_BASE/health")
|
||||
.build()
|
||||
client.newCall(req).execute().use { res ->
|
||||
if (!res.isSuccessful) return null
|
||||
val body = res.body?.string() ?: return null
|
||||
return gson.fromJson(body, HealthResponse::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun getMe(): User {
|
||||
val req = Request.Builder()
|
||||
.url("$API_BASE/auth/me")
|
||||
.build()
|
||||
client.newCall(req).execute().use { res ->
|
||||
if (!res.isSuccessful) return User(authenticated = false)
|
||||
val body = res.body?.string() ?: return User(authenticated = false)
|
||||
return gson.fromJson(body, User::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
fun getLoginUrl(): String = "$API_BASE/auth/login"
|
||||
fun getLogoutUrl(): String = "$API_BASE/auth/logout"
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun buildResume(jobTitle: String, jobText: String, resumeText: String): BuildResponse {
|
||||
val payload = BuildRequest(
|
||||
job_title = jobTitle,
|
||||
job_text = jobText,
|
||||
resume_text = resumeText
|
||||
)
|
||||
val json = gson.toJson(payload)
|
||||
val req = Request.Builder()
|
||||
.url("$API_BASE/build_resume")
|
||||
.post(json.toRequestBody("application/json".toMediaType()))
|
||||
.build()
|
||||
client.newCall(req).execute().use { res ->
|
||||
if (!res.isSuccessful) {
|
||||
val errBody = res.body?.string()
|
||||
val detail = try {
|
||||
gson.fromJson(errBody, Map::class.java)["detail"] as? String
|
||||
} catch (_: Exception) { null }
|
||||
when (res.code) {
|
||||
401 -> throw IOException("Please log in first")
|
||||
403 -> throw IOException(detail ?: "You have reached your free limit")
|
||||
else -> throw IOException(detail ?: "Failed to submit resume job")
|
||||
}
|
||||
}
|
||||
val body = res.body?.string() ?: throw IOException("Empty response")
|
||||
return gson.fromJson(body, BuildResponse::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun buildCoverLetter(jobTitle: String, jobText: String, coverLetterText: String): BuildResponse {
|
||||
val payload = BuildRequest(
|
||||
job_title = jobTitle,
|
||||
job_text = jobText,
|
||||
cover_letter_text = coverLetterText
|
||||
)
|
||||
val json = gson.toJson(payload)
|
||||
val req = Request.Builder()
|
||||
.url("$API_BASE/build_cover_letter")
|
||||
.post(json.toRequestBody("application/json".toMediaType()))
|
||||
.build()
|
||||
client.newCall(req).execute().use { res ->
|
||||
if (!res.isSuccessful) {
|
||||
val errBody = res.body?.string()
|
||||
val detail = try {
|
||||
gson.fromJson(errBody, Map::class.java)["detail"] as? String
|
||||
} catch (_: Exception) { null }
|
||||
when (res.code) {
|
||||
401 -> throw IOException("Please log in first")
|
||||
403 -> throw IOException(detail ?: "You have reached your free limit")
|
||||
else -> throw IOException(detail ?: "Failed to submit cover letter job")
|
||||
}
|
||||
}
|
||||
val body = res.body?.string() ?: throw IOException("Empty response")
|
||||
return gson.fromJson(body, BuildResponse::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun getJob(jobId: String): Job? {
|
||||
val req = Request.Builder()
|
||||
.url("$API_BASE/job/$jobId")
|
||||
.build()
|
||||
client.newCall(req).execute().use { res ->
|
||||
if (res.code == 404) return null
|
||||
if (!res.isSuccessful) throw IOException("Failed to fetch job status")
|
||||
val body = res.body?.string() ?: return null
|
||||
return gson.fromJson(body, Job::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun uploadResume(file: File): UploadResponse {
|
||||
val body = MultipartBody.Builder()
|
||||
.setType(MultipartBody.FORM)
|
||||
.addFormDataPart("file", file.name, file.asRequestBody("application/octet-stream".toMediaType()))
|
||||
.build()
|
||||
val req = Request.Builder()
|
||||
.url("$API_BASE/upload/resume")
|
||||
.post(body)
|
||||
.build()
|
||||
client.newCall(req).execute().use { res ->
|
||||
if (!res.isSuccessful) {
|
||||
val errBody = res.body?.string()
|
||||
val detail = try {
|
||||
gson.fromJson(errBody, Map::class.java)["detail"] as? String
|
||||
} catch (_: Exception) { null }
|
||||
throw IOException(detail ?: "Upload failed")
|
||||
}
|
||||
val respBody = res.body?.string() ?: throw IOException("Empty response")
|
||||
return gson.fromJson(respBody, UploadResponse::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun uploadCoverLetter(file: File): UploadResponse {
|
||||
val body = MultipartBody.Builder()
|
||||
.setType(MultipartBody.FORM)
|
||||
.addFormDataPart("file", file.name, file.asRequestBody("application/octet-stream".toMediaType()))
|
||||
.build()
|
||||
val req = Request.Builder()
|
||||
.url("$API_BASE/upload/cover_letter")
|
||||
.post(body)
|
||||
.build()
|
||||
client.newCall(req).execute().use { res ->
|
||||
if (!res.isSuccessful) {
|
||||
val errBody = res.body?.string()
|
||||
val detail = try {
|
||||
gson.fromJson(errBody, Map::class.java)["detail"] as? String
|
||||
} catch (_: Exception) { null }
|
||||
throw IOException(detail ?: "Upload failed")
|
||||
}
|
||||
val respBody = res.body?.string() ?: throw IOException("Empty response")
|
||||
return gson.fromJson(respBody, UploadResponse::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun scrapeJobUrl(url: String): ScrapeResponse {
|
||||
val json = gson.toJson(mapOf("url" to url))
|
||||
val req = Request.Builder()
|
||||
.url("$API_BASE/scrape-job")
|
||||
.post(json.toRequestBody("application/json".toMediaType()))
|
||||
.build()
|
||||
client.newCall(req).execute().use { res ->
|
||||
if (!res.isSuccessful) {
|
||||
val errBody = res.body?.string()
|
||||
val detail = try {
|
||||
gson.fromJson(errBody, Map::class.java)["detail"] as? String
|
||||
} catch (_: Exception) { null }
|
||||
throw IOException(detail ?: "Failed to scrape URL")
|
||||
}
|
||||
val body = res.body?.string() ?: throw IOException("Empty response")
|
||||
return gson.fromJson(body, ScrapeResponse::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun adminGetUsers(): AdminUsersResponse {
|
||||
val req = Request.Builder()
|
||||
.url("$API_BASE/admin/users")
|
||||
.build()
|
||||
client.newCall(req).execute().use { res ->
|
||||
if (!res.isSuccessful) throw IOException("Failed to fetch users")
|
||||
val body = res.body?.string() ?: throw IOException("Empty response")
|
||||
return gson.fromJson(body, AdminUsersResponse::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun adminReleaseUser(email: String): Boolean {
|
||||
val req = Request.Builder()
|
||||
.url("$API_BASE/admin/users/${java.net.URLEncoder.encode(email, "UTF-8")}/release")
|
||||
.post(FormBody.Builder().build())
|
||||
.build()
|
||||
client.newCall(req).execute().use { res ->
|
||||
return res.isSuccessful
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun adminBlockUser(email: String): Boolean {
|
||||
val req = Request.Builder()
|
||||
.url("$API_BASE/admin/users/${java.net.URLEncoder.encode(email, "UTF-8")}/block")
|
||||
.post(FormBody.Builder().build())
|
||||
.build()
|
||||
client.newCall(req).execute().use { res ->
|
||||
return res.isSuccessful
|
||||
}
|
||||
}
|
||||
|
||||
fun getExportPdfUrl(jobId: String): String = "$API_BASE/export/$jobId/pdf"
|
||||
fun getExportDocxUrl(jobId: String): String = "$API_BASE/export/$jobId/docx"
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.example.resbuilder.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.example.resbuilder.R
|
||||
import com.example.resbuilder.data.model.AdminUser
|
||||
import com.example.resbuilder.data.remote.ApiClient
|
||||
import com.google.android.material.appbar.MaterialToolbar
|
||||
|
||||
class AdminActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var toolbar: MaterialToolbar
|
||||
private lateinit var recyclerView: RecyclerView
|
||||
private lateinit var adapter: AdminUserAdapter
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_admin)
|
||||
|
||||
toolbar = findViewById(R.id.adminToolbar)
|
||||
recyclerView = findViewById(R.id.adminRecyclerView)
|
||||
|
||||
setSupportActionBar(toolbar)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
adapter = AdminUserAdapter { user, block ->
|
||||
onUserAction(user, block)
|
||||
}
|
||||
recyclerView.layoutManager = LinearLayoutManager(this)
|
||||
recyclerView.adapter = adapter
|
||||
|
||||
loadUsers()
|
||||
}
|
||||
|
||||
private fun loadUsers() {
|
||||
Thread {
|
||||
try {
|
||||
val response = ApiClient.adminGetUsers()
|
||||
handler.post {
|
||||
adapter.submitList(response.users)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
handler.post {
|
||||
Toast.makeText(this, e.message ?: "Failed to load users", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
private fun onUserAction(user: AdminUser, block: Boolean) {
|
||||
Thread {
|
||||
val success = try {
|
||||
if (block) ApiClient.adminBlockUser(user.email) else ApiClient.adminReleaseUser(user.email)
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
}
|
||||
handler.post {
|
||||
Toast.makeText(
|
||||
this,
|
||||
if (success) R.string.admin_action_success else R.string.admin_action_failed,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
if (success) loadUsers()
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
android.R.id.home -> {
|
||||
finish()
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.example.resbuilder.ui
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.example.resbuilder.R
|
||||
import com.example.resbuilder.data.model.AdminUser
|
||||
import com.google.android.material.button.MaterialButton
|
||||
|
||||
class AdminUserAdapter(
|
||||
private val onAction: (AdminUser, Boolean) -> Unit
|
||||
) : RecyclerView.Adapter<AdminUserAdapter.ViewHolder>() {
|
||||
|
||||
private val users = mutableListOf<AdminUser>()
|
||||
|
||||
fun submitList(list: List<AdminUser>) {
|
||||
users.clear()
|
||||
users.addAll(list)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_admin_user, parent, false)
|
||||
return ViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
holder.bind(users[position])
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = users.size
|
||||
|
||||
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
private val email: TextView = itemView.findViewById(R.id.userEmail)
|
||||
private val name: TextView = itemView.findViewById(R.id.userName)
|
||||
private val usage: TextView = itemView.findViewById(R.id.userUsage)
|
||||
private val actionButton: MaterialButton = itemView.findViewById(R.id.actionButton)
|
||||
|
||||
fun bind(user: AdminUser) {
|
||||
email.text = user.email
|
||||
name.text = user.name ?: ""
|
||||
name.visibility = if (user.name.isNullOrEmpty()) View.GONE else View.VISIBLE
|
||||
usage.text = itemView.context.getString(R.string.usage_format, user.usage_count, 0)
|
||||
|
||||
if (user.is_admin) {
|
||||
actionButton.visibility = View.GONE
|
||||
} else {
|
||||
actionButton.visibility = View.VISIBLE
|
||||
if (user.blocked) {
|
||||
actionButton.text = itemView.context.getString(R.string.release_user)
|
||||
actionButton.setOnClickListener { onAction(user, false) }
|
||||
} else {
|
||||
actionButton.text = itemView.context.getString(R.string.block_user)
|
||||
actionButton.setOnClickListener { onAction(user, true) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
package com.example.resbuilder.ui
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.provider.OpenableColumns
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.widget.doAfterTextChanged
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.example.resbuilder.R
|
||||
import com.example.resbuilder.data.model.UploadResponse
|
||||
import com.example.resbuilder.data.model.User
|
||||
import com.example.resbuilder.data.remote.ApiClient
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
|
||||
class JobFormFragment : Fragment() {
|
||||
|
||||
companion object {
|
||||
const val TYPE_RESUME = "resume"
|
||||
const val TYPE_COVER_LETTER = "cover_letter"
|
||||
private const val ARG_TYPE = "type"
|
||||
|
||||
fun newInstance(type: String): JobFormFragment {
|
||||
return JobFormFragment().apply {
|
||||
arguments = Bundle().apply { putString(ARG_TYPE, type) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface JobFormListener {
|
||||
fun onJobSubmitted(jobId: String, type: String)
|
||||
}
|
||||
|
||||
private var listener: JobFormListener? = null
|
||||
private val type: String by lazy { arguments?.getString(ARG_TYPE) ?: TYPE_RESUME }
|
||||
|
||||
private lateinit var jobTitleInput: TextInputEditText
|
||||
private lateinit var seekUrlInput: TextInputEditText
|
||||
private lateinit var scrapeButton: MaterialButton
|
||||
private lateinit var jobDescriptionInput: TextInputEditText
|
||||
private lateinit var uploadButton: MaterialButton
|
||||
private lateinit var docInputLayout: TextInputLayout
|
||||
private lateinit var docInput: TextInputEditText
|
||||
private lateinit var submitButton: MaterialButton
|
||||
private lateinit var progressBar: ProgressBar
|
||||
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private var user: User = User()
|
||||
|
||||
private lateinit var filePickerLauncher: ActivityResultLauncher<Intent>
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
listener = context as? JobFormListener
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
filePickerLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
|
||||
if (result.resultCode == Activity.RESULT_OK) {
|
||||
result.data?.data?.let { uri ->
|
||||
uploadFile(uri)
|
||||
}
|
||||
}
|
||||
}
|
||||
loadUser()
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.fragment_job_form, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
jobTitleInput = view.findViewById(R.id.jobTitleInput)
|
||||
seekUrlInput = view.findViewById(R.id.seekUrlInput)
|
||||
scrapeButton = view.findViewById(R.id.scrapeButton)
|
||||
jobDescriptionInput = view.findViewById(R.id.jobDescriptionInput)
|
||||
uploadButton = view.findViewById(R.id.uploadButton)
|
||||
docInputLayout = view.findViewById(R.id.docInputLayout)
|
||||
docInput = view.findViewById(R.id.docInput)
|
||||
submitButton = view.findViewById(R.id.submitButton)
|
||||
progressBar = view.findViewById(R.id.progressBar)
|
||||
|
||||
docInputLayout.hint = getString(if (type == TYPE_COVER_LETTER) R.string.hint_your_cover_letter else R.string.hint_your_resume)
|
||||
submitButton.text = getString(if (type == TYPE_COVER_LETTER) R.string.generate_cover_letter else R.string.generate_resume)
|
||||
|
||||
scrapeButton.setOnClickListener { scrapeUrl() }
|
||||
uploadButton.setOnClickListener { pickFile() }
|
||||
submitButton.setOnClickListener { submitJob() }
|
||||
|
||||
jobTitleInput.doAfterTextChanged { validateForm() }
|
||||
jobDescriptionInput.doAfterTextChanged { validateForm() }
|
||||
docInput.doAfterTextChanged { validateForm() }
|
||||
}
|
||||
|
||||
private fun loadUser() {
|
||||
Thread {
|
||||
try {
|
||||
user = ApiClient.getMe()
|
||||
handler.post { validateForm() }
|
||||
} catch (e: Exception) {
|
||||
user = User(authenticated = false)
|
||||
handler.post { validateForm() }
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
private fun showLoading(loading: Boolean) {
|
||||
progressBar.visibility = if (loading) View.VISIBLE else View.GONE
|
||||
scrapeButton.isEnabled = !loading
|
||||
uploadButton.isEnabled = !loading
|
||||
submitButton.isEnabled = !loading
|
||||
}
|
||||
|
||||
private fun validateForm() {
|
||||
val authenticated = user.authenticated
|
||||
val overLimit = !user.is_admin && !user.can_submit
|
||||
val hasTitle = jobTitleInput.text?.toString()?.isNotBlank() == true
|
||||
val hasJob = jobDescriptionInput.text?.toString()?.isNotBlank() == true
|
||||
val hasDoc = docInput.text?.toString()?.isNotBlank() == true
|
||||
|
||||
submitButton.isEnabled = authenticated && !overLimit && hasTitle && hasJob && hasDoc
|
||||
submitButton.text = when {
|
||||
!authenticated -> getString(R.string.please_log_in)
|
||||
overLimit -> getString(R.string.usage_limit_banner)
|
||||
type == TYPE_COVER_LETTER -> getString(R.string.generate_cover_letter)
|
||||
else -> getString(R.string.generate_resume)
|
||||
}
|
||||
}
|
||||
|
||||
private fun scrapeUrl() {
|
||||
val url = seekUrlInput.text?.toString()?.trim() ?: ""
|
||||
if (url.isEmpty()) {
|
||||
seekUrlInput.error = "Enter a URL"
|
||||
return
|
||||
}
|
||||
showLoading(true)
|
||||
Thread {
|
||||
try {
|
||||
val resp = ApiClient.scrapeJobUrl(url)
|
||||
handler.post {
|
||||
showLoading(false)
|
||||
jobDescriptionInput.setText(resp.text)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
handler.post {
|
||||
showLoading(false)
|
||||
Toast.makeText(context, e.message ?: "Scrape failed", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
private fun pickFile() {
|
||||
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
|
||||
addCategory(Intent.CATEGORY_OPENABLE)
|
||||
type = "*/*"
|
||||
putExtra(Intent.EXTRA_MIME_TYPES, arrayOf("application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/msword"))
|
||||
}
|
||||
filePickerLauncher.launch(intent)
|
||||
}
|
||||
|
||||
private fun uploadFile(uri: Uri) {
|
||||
val context = requireContext()
|
||||
showLoading(true)
|
||||
Thread {
|
||||
try {
|
||||
val file = uriToFile(context, uri)
|
||||
val resp: UploadResponse = if (type == TYPE_COVER_LETTER) ApiClient.uploadCoverLetter(file) else ApiClient.uploadResume(file)
|
||||
file.delete()
|
||||
handler.post {
|
||||
showLoading(false)
|
||||
docInput.setText(resp.text)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
handler.post {
|
||||
showLoading(false)
|
||||
Toast.makeText(context, e.message ?: "Upload failed", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
private fun uriToFile(context: Context, uri: Uri): File {
|
||||
val fileName = getFileName(context, uri) ?: "document.pdf"
|
||||
val tempFile = File(context.cacheDir, fileName)
|
||||
context.contentResolver.openInputStream(uri)?.use { input ->
|
||||
FileOutputStream(tempFile).use { output ->
|
||||
input.copyTo(output)
|
||||
}
|
||||
}
|
||||
return tempFile
|
||||
}
|
||||
|
||||
private fun getFileName(context: Context, uri: Uri): String? {
|
||||
if (uri.scheme == "content") {
|
||||
context.contentResolver.query(uri, null, null, null, null)?.use { cursor ->
|
||||
if (cursor.moveToFirst()) {
|
||||
val idx = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)
|
||||
if (idx >= 0) return cursor.getString(idx)
|
||||
}
|
||||
}
|
||||
}
|
||||
return uri.lastPathSegment
|
||||
}
|
||||
|
||||
private fun submitJob() {
|
||||
val title = jobTitleInput.text?.toString()?.trim() ?: ""
|
||||
val jobText = jobDescriptionInput.text?.toString()?.trim() ?: ""
|
||||
val docText = docInput.text?.toString()?.trim() ?: ""
|
||||
if (title.isEmpty() || jobText.isEmpty() || docText.isEmpty()) {
|
||||
Toast.makeText(context, R.string.fields_required, Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
showLoading(true)
|
||||
Thread {
|
||||
try {
|
||||
val resp = if (type == TYPE_COVER_LETTER) {
|
||||
ApiClient.buildCoverLetter(title, jobText, docText)
|
||||
} else {
|
||||
ApiClient.buildResume(title, jobText, docText)
|
||||
}
|
||||
handler.post {
|
||||
showLoading(false)
|
||||
listener?.onJobSubmitted(resp.job_id, type)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
handler.post {
|
||||
showLoading(false)
|
||||
Toast.makeText(context, e.message ?: "Submit failed", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
handler.removeCallbacksAndMessages(null)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.example.resbuilder.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.example.resbuilder.R
|
||||
import com.example.resbuilder.data.model.Job
|
||||
import com.example.resbuilder.data.remote.ApiClient
|
||||
import com.google.android.material.button.MaterialButton
|
||||
|
||||
class JobStatusFragment : Fragment() {
|
||||
|
||||
companion object {
|
||||
private const val ARG_JOB_ID = "job_id"
|
||||
private const val ARG_TYPE = "type"
|
||||
private const val POLL_INTERVAL_MS = 2000L
|
||||
private const val TIMEOUT_MS = 600000L
|
||||
|
||||
fun newInstance(jobId: String, type: String): JobStatusFragment {
|
||||
return JobStatusFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(ARG_JOB_ID, jobId)
|
||||
putString(ARG_TYPE, type)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private lateinit var statusBadge: TextView
|
||||
private lateinit var statusProgress: ProgressBar
|
||||
private lateinit var statusMessage: TextView
|
||||
private lateinit var statusDetail: TextView
|
||||
private lateinit var tryAgainButton: MaterialButton
|
||||
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private var pollRunnable: Runnable? = null
|
||||
private var startTime = 0L
|
||||
private var stopped = false
|
||||
|
||||
private val jobId: String by lazy { arguments?.getString(ARG_JOB_ID) ?: "" }
|
||||
private val type: String by lazy { arguments?.getString(ARG_TYPE) ?: JobFormFragment.TYPE_RESUME }
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.fragment_job_status, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
statusBadge = view.findViewById(R.id.statusBadge)
|
||||
statusProgress = view.findViewById(R.id.statusProgress)
|
||||
statusMessage = view.findViewById(R.id.statusMessage)
|
||||
statusDetail = view.findViewById(R.id.statusDetail)
|
||||
tryAgainButton = view.findViewById(R.id.tryAgainButton)
|
||||
|
||||
tryAgainButton.setOnClickListener {
|
||||
requireActivity().supportFragmentManager.popBackStackImmediate()
|
||||
}
|
||||
|
||||
startPolling()
|
||||
}
|
||||
|
||||
private fun startPolling() {
|
||||
startTime = System.currentTimeMillis()
|
||||
val r = object : Runnable {
|
||||
override fun run() {
|
||||
if (stopped) return
|
||||
pollJob()
|
||||
}
|
||||
}
|
||||
pollRunnable = r
|
||||
handler.post(r)
|
||||
}
|
||||
|
||||
private fun pollJob() {
|
||||
Thread {
|
||||
try {
|
||||
val job = ApiClient.getJob(jobId)
|
||||
handler.post {
|
||||
if (stopped) return@post
|
||||
if (job == null) {
|
||||
onFailed(getString(R.string.job_failed_message))
|
||||
return@post
|
||||
}
|
||||
updateUI(job)
|
||||
when (job.status.uppercase()) {
|
||||
"COMPLETED" -> onCompleted(job)
|
||||
"FAILED" -> onFailed(job.error ?: getString(R.string.job_failed_message))
|
||||
else -> scheduleNextPoll()
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
handler.post {
|
||||
if (stopped) return@post
|
||||
scheduleNextPoll()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
private fun scheduleNextPoll() {
|
||||
if (System.currentTimeMillis() - startTime > TIMEOUT_MS) {
|
||||
onFailed(getString(R.string.job_timeout_message))
|
||||
return
|
||||
}
|
||||
pollRunnable?.let { handler.postDelayed(it, POLL_INTERVAL_MS) }
|
||||
}
|
||||
|
||||
private fun updateUI(job: Job) {
|
||||
val status = job.status.uppercase()
|
||||
statusBadge.text = status
|
||||
val (bgColor, textColor) = when (status) {
|
||||
"QUEUED" -> Pair(R.color.status_badge_queued, R.color.white)
|
||||
"RUNNING" -> Pair(R.color.status_badge_running, R.color.white)
|
||||
"COMPLETED" -> Pair(R.color.status_badge_completed, R.color.white)
|
||||
"FAILED" -> Pair(R.color.status_badge_failed, R.color.white)
|
||||
else -> Pair(R.color.status_badge_queued, R.color.black)
|
||||
}
|
||||
statusBadge.setBackgroundColor(ContextCompat.getColor(requireContext(), bgColor))
|
||||
statusBadge.setTextColor(ContextCompat.getColor(requireContext(), textColor))
|
||||
if (!job.error.isNullOrEmpty()) {
|
||||
statusDetail.text = job.error
|
||||
statusDetail.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
private fun onCompleted(job: Job) {
|
||||
statusProgress.visibility = View.GONE
|
||||
statusMessage.text = getString(R.string.status_completed)
|
||||
tryAgainButton.visibility = View.GONE
|
||||
|
||||
val resultFragment = ResultFragment.newInstance(job, type)
|
||||
requireActivity().supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.fragmentContainer, resultFragment)
|
||||
.addToBackStack(null)
|
||||
.commitAllowingStateLoss()
|
||||
}
|
||||
|
||||
private fun onFailed(message: String) {
|
||||
statusProgress.visibility = View.GONE
|
||||
statusMessage.text = message
|
||||
statusBadge.text = getString(R.string.status_failed)
|
||||
statusBadge.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.status_badge_failed))
|
||||
statusBadge.setTextColor(ContextCompat.getColor(requireContext(), R.color.white))
|
||||
tryAgainButton.visibility = View.VISIBLE
|
||||
statusDetail.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
stopped = true
|
||||
pollRunnable?.let { handler.removeCallbacks(it) }
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
stopped = false
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
stopped = true
|
||||
pollRunnable?.let { handler.removeCallbacks(it) }
|
||||
handler.removeCallbacksAndMessages(null)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package com.example.resbuilder.ui
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.View
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.example.resbuilder.R
|
||||
import com.example.resbuilder.data.remote.ApiClient
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignIn
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInOptions
|
||||
import com.google.android.gms.common.SignInButton
|
||||
import com.google.android.gms.common.api.ApiException
|
||||
import com.google.android.gms.tasks.Task
|
||||
|
||||
class LoginActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var googleSignInButton: SignInButton
|
||||
private lateinit var progress: ProgressBar
|
||||
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
|
||||
private lateinit var googleSignInLauncher: ActivityResultLauncher<Intent>
|
||||
|
||||
// Same client ID registered in Google Cloud Console for the backend OAuth
|
||||
private val webClientId = "416332591622-godddvcplbobkhv6uvabg94pvtukp61u.apps.googleusercontent.com"
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_login)
|
||||
|
||||
googleSignInButton = findViewById(R.id.googleSignInButton)
|
||||
progress = findViewById(R.id.loginProgress)
|
||||
|
||||
googleSignInButton.setOnClickListener { launchGoogleSignIn() }
|
||||
|
||||
googleSignInLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.StartActivityForResult()
|
||||
) { result ->
|
||||
if (result.resultCode == RESULT_OK && result.data != null) {
|
||||
val task = GoogleSignIn.getSignedInAccountFromIntent(result.data)
|
||||
handleSignInResult(task)
|
||||
} else {
|
||||
showLoading(false)
|
||||
Toast.makeText(this, "Sign in cancelled", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
showLoading(true)
|
||||
checkExistingAuth()
|
||||
}
|
||||
|
||||
private fun showLoading(loading: Boolean) {
|
||||
progress.visibility = if (loading) View.VISIBLE else View.GONE
|
||||
googleSignInButton.isEnabled = !loading
|
||||
}
|
||||
|
||||
private fun checkExistingAuth() {
|
||||
Thread {
|
||||
try {
|
||||
val user = ApiClient.getMe()
|
||||
handler.post {
|
||||
showLoading(false)
|
||||
if (user.authenticated) {
|
||||
launchMain()
|
||||
}
|
||||
}
|
||||
} catch (_: Exception) {
|
||||
handler.post { showLoading(false) }
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
private fun launchGoogleSignIn() {
|
||||
showLoading(true)
|
||||
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
|
||||
.requestIdToken(webClientId)
|
||||
.requestEmail()
|
||||
.build()
|
||||
val client = GoogleSignIn.getClient(this, gso)
|
||||
// Clear any previous sign-in to force account picker
|
||||
client.signOut().addOnCompleteListener {
|
||||
val signInIntent = client.signInIntent
|
||||
googleSignInLauncher.launch(signInIntent)
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleSignInResult(task: Task<GoogleSignInAccount>) {
|
||||
try {
|
||||
val account = task.getResult(ApiException::class.java)
|
||||
val idToken = account?.idToken
|
||||
if (idToken.isNullOrEmpty()) {
|
||||
showLoading(false)
|
||||
Toast.makeText(this, "No ID token from Google", Toast.LENGTH_LONG).show()
|
||||
return
|
||||
}
|
||||
exchangeToken(idToken)
|
||||
} catch (e: ApiException) {
|
||||
showLoading(false)
|
||||
Toast.makeText(this, "Sign in failed: ${e.message}", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun exchangeToken(idToken: String) {
|
||||
Thread {
|
||||
try {
|
||||
val token = ApiClient.exchangeGoogleToken(idToken)
|
||||
ApiClient.setToken(token)
|
||||
val user = ApiClient.getMe()
|
||||
handler.post {
|
||||
showLoading(false)
|
||||
if (user.authenticated) {
|
||||
Toast.makeText(
|
||||
this,
|
||||
"Welcome ${user.name ?: user.email}",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
launchMain()
|
||||
} else {
|
||||
Toast.makeText(
|
||||
this,
|
||||
"Server rejected the token",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
handler.post {
|
||||
showLoading(false)
|
||||
Toast.makeText(
|
||||
this,
|
||||
e.message ?: "Token exchange failed",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
private fun launchMain() {
|
||||
startActivity(Intent(this, MainActivity::class.java))
|
||||
finish()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
handler.removeCallbacksAndMessages(null)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
package com.example.resbuilder.ui
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.PorterDuff
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.example.resbuilder.R
|
||||
import com.example.resbuilder.data.model.User
|
||||
import com.example.resbuilder.data.remote.ApiClient
|
||||
import com.google.android.material.appbar.MaterialToolbar
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
|
||||
class MainActivity : AppCompatActivity(), JobFormFragment.JobFormListener, ResultFragment.OnNewListener {
|
||||
|
||||
private lateinit var toolbar: MaterialToolbar
|
||||
private lateinit var tabLayout: TabLayout
|
||||
private lateinit var healthIndicator: ImageView
|
||||
private lateinit var userName: TextView
|
||||
private lateinit var usageBanner: TextView
|
||||
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private var user: User = User()
|
||||
private var healthRunnable: Runnable? = null
|
||||
|
||||
companion object {
|
||||
private const val TAB_RESUME = 0
|
||||
private const val TAB_COVER = 1
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
toolbar = findViewById(R.id.toolbar)
|
||||
tabLayout = findViewById(R.id.tabLayout)
|
||||
healthIndicator = findViewById(R.id.healthIndicator)
|
||||
userName = findViewById(R.id.userName)
|
||||
usageBanner = findViewById(R.id.usageBanner)
|
||||
|
||||
setSupportActionBar(toolbar)
|
||||
|
||||
tabLayout.addTab(tabLayout.newTab().setText(R.string.tab_build_resume))
|
||||
tabLayout.addTab(tabLayout.newTab().setText(R.string.tab_build_cover_letter))
|
||||
|
||||
tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
||||
override fun onTabSelected(tab: TabLayout.Tab?) {
|
||||
switchFormTab(tab?.position ?: TAB_RESUME)
|
||||
}
|
||||
|
||||
override fun onTabUnselected(tab: TabLayout.Tab?) {}
|
||||
override fun onTabReselected(tab: TabLayout.Tab?) {
|
||||
switchFormTab(tab?.position ?: TAB_RESUME)
|
||||
}
|
||||
})
|
||||
|
||||
loadUser()
|
||||
startHealthPolling()
|
||||
if (savedInstanceState == null) {
|
||||
switchFormTab(TAB_RESUME)
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadUser() {
|
||||
Thread {
|
||||
try {
|
||||
user = ApiClient.getMe()
|
||||
runOnUiThread { updateUserUI() }
|
||||
} catch (e: Exception) {
|
||||
runOnUiThread {
|
||||
user = User(authenticated = false)
|
||||
updateUserUI()
|
||||
Toast.makeText(this, e.message ?: "Failed to load user", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
private fun updateUserUI() {
|
||||
userName.text = user.name ?: user.email ?: getString(R.string.unknown_user)
|
||||
if (!user.authenticated || (!user.is_admin && !user.can_submit)) {
|
||||
usageBanner.visibility = View.VISIBLE
|
||||
} else {
|
||||
usageBanner.visibility = View.GONE
|
||||
}
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
private fun switchFormTab(position: Int) {
|
||||
val type = if (position == TAB_COVER) JobFormFragment.TYPE_COVER_LETTER else JobFormFragment.TYPE_RESUME
|
||||
val fragment = JobFormFragment.newInstance(type)
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.fragmentContainer, fragment)
|
||||
.commitAllowingStateLoss()
|
||||
}
|
||||
|
||||
private fun startHealthPolling() {
|
||||
val r = object : Runnable {
|
||||
override fun run() {
|
||||
checkHealth()
|
||||
handler.postDelayed(this, 30000)
|
||||
}
|
||||
}
|
||||
healthRunnable = r
|
||||
handler.post(r)
|
||||
}
|
||||
|
||||
private fun checkHealth() {
|
||||
Thread {
|
||||
val colorRes = try {
|
||||
val health = ApiClient.healthCheck()
|
||||
when (health?.status?.lowercase()) {
|
||||
"ok", "healthy", "up" -> R.color.status_healthy
|
||||
else -> R.color.status_degraded
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
R.color.status_unhealthy
|
||||
}
|
||||
runOnUiThread {
|
||||
healthIndicator.setColorFilter(ContextCompat.getColor(this, colorRes), PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
menuInflater.inflate(R.menu.menu_main, menu)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu?): Boolean {
|
||||
menu?.findItem(R.id.menuAdminPanel)?.isVisible = user.is_admin
|
||||
return super.onPrepareOptionsMenu(menu)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
R.id.menuSignOut -> {
|
||||
signOut()
|
||||
true
|
||||
}
|
||||
R.id.menuAdminPanel -> {
|
||||
startActivity(Intent(this, AdminActivity::class.java))
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
|
||||
private fun signOut() {
|
||||
Thread {
|
||||
try {
|
||||
ApiClient.clearAuth()
|
||||
} catch (_: Exception) {}
|
||||
runOnUiThread {
|
||||
startActivity(Intent(this, LoginActivity::class.java))
|
||||
finish()
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
override fun onJobSubmitted(jobId: String, type: String) {
|
||||
val statusFragment = JobStatusFragment.newInstance(jobId, type)
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.fragmentContainer, statusFragment)
|
||||
.addToBackStack(null)
|
||||
.commitAllowingStateLoss()
|
||||
}
|
||||
|
||||
fun onResultNewJob() {
|
||||
supportFragmentManager.popBackStackImmediate()
|
||||
tabLayout.getTabAt(TAB_RESUME)?.select()
|
||||
switchFormTab(TAB_RESUME)
|
||||
}
|
||||
|
||||
override fun onNewJob() {
|
||||
onResultNewJob()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
healthRunnable?.let { handler.removeCallbacks(it) }
|
||||
handler.removeCallbacksAndMessages(null)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.example.resbuilder.ui
|
||||
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.WebView
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.example.resbuilder.R
|
||||
import com.example.resbuilder.data.model.Job
|
||||
import com.example.resbuilder.data.remote.ApiClient
|
||||
import com.google.android.material.button.MaterialButton
|
||||
|
||||
class ResultFragment : Fragment() {
|
||||
|
||||
companion object {
|
||||
private const val ARG_JOB_ID = "job_id"
|
||||
private const val ARG_HTML = "html_content"
|
||||
private const val ARG_RAW = "raw_content"
|
||||
private const val ARG_TYPE = "type"
|
||||
|
||||
fun newInstance(job: Job, type: String): ResultFragment {
|
||||
return ResultFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(ARG_JOB_ID, job.job_id)
|
||||
putString(ARG_HTML, job.html_content)
|
||||
putString(ARG_RAW, job.raw_content)
|
||||
putString(ARG_TYPE, type)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface OnNewListener {
|
||||
fun onNewJob()
|
||||
}
|
||||
|
||||
private var listener: OnNewListener? = null
|
||||
|
||||
private lateinit var resultBadge: TextView
|
||||
private lateinit var resultWebView: WebView
|
||||
private lateinit var copyButton: MaterialButton
|
||||
private lateinit var newButton: MaterialButton
|
||||
private lateinit var pdfButton: MaterialButton
|
||||
private lateinit var docxButton: MaterialButton
|
||||
|
||||
private val jobId: String? by lazy { arguments?.getString(ARG_JOB_ID) }
|
||||
private val htmlContent: String? by lazy { arguments?.getString(ARG_HTML) }
|
||||
private val rawContent: String? by lazy { arguments?.getString(ARG_RAW) }
|
||||
private val type: String by lazy { arguments?.getString(ARG_TYPE) ?: JobFormFragment.TYPE_RESUME }
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
listener = (parentFragment as? OnNewListener) ?: (context as? OnNewListener)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.fragment_result, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
resultBadge = view.findViewById(R.id.resultBadge)
|
||||
resultWebView = view.findViewById(R.id.resultWebView)
|
||||
copyButton = view.findViewById(R.id.copyButton)
|
||||
newButton = view.findViewById(R.id.newButton)
|
||||
pdfButton = view.findViewById(R.id.pdfButton)
|
||||
docxButton = view.findViewById(R.id.docxButton)
|
||||
|
||||
resultBadge.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.status_badge_completed))
|
||||
resultBadge.setTextColor(ContextCompat.getColor(requireContext(), R.color.white))
|
||||
|
||||
resultWebView.settings.javaScriptEnabled = false
|
||||
val html = htmlContent ?: "<html><body><p>No content available.</p></body></html>"
|
||||
resultWebView.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null)
|
||||
|
||||
copyButton.setOnClickListener { copyText() }
|
||||
newButton.setOnClickListener { listener?.onNewJob() }
|
||||
|
||||
jobId?.let { id ->
|
||||
pdfButton.setOnClickListener { openUrl(ApiClient.getExportPdfUrl(id)) }
|
||||
docxButton.setOnClickListener { openUrl(ApiClient.getExportDocxUrl(id)) }
|
||||
} ?: run {
|
||||
pdfButton.isEnabled = false
|
||||
docxButton.isEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
private fun copyText() {
|
||||
val raw = rawContent
|
||||
if (raw.isNullOrEmpty()) {
|
||||
Toast.makeText(context, R.string.nothing_to_copy, Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
clipboard.setPrimaryClip(ClipData.newPlainText("Generated document", raw))
|
||||
Toast.makeText(context, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
private fun openUrl(url: String) {
|
||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
fun setOnNewListener(l: OnNewListener) {
|
||||
listener = l
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
# Add project specific R8 rules here.
|
||||
# AGP will combine all keep rule files in src/main/keepRules to pass to R8
|
||||
#
|
||||
# For more details, see
|
||||
# https://d.android.com/r/tools/r8/keep-rules
|
||||
|
||||
# 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 *;
|
||||
#}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/banner_warning" />
|
||||
<corners android:radius="8dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/status_healthy" />
|
||||
<size
|
||||
android:width="12dp"
|
||||
android:height="12dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="12dp"
|
||||
android:height="12dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,12m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0" />
|
||||
</vector>
|
||||
@@ -0,0 +1,170 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,30 @@
|
||||
<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>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/adminToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
|
||||
app:title="@string/admin_title"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto" />
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/adminRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/colorBackground">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loginProgress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@id/loginTitle"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loginTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="@string/app_title"
|
||||
android:textAppearance="?attr/textAppearanceHeadline3"
|
||||
android:textColor="?attr/colorPrimary"
|
||||
app:layout_constraintBottom_toTopOf="@id/googleSignInButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed" />
|
||||
|
||||
<com.google.android.gms.common.SignInButton
|
||||
android:id="@+id/googleSignInButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/loginTitle" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.MainActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Dark"
|
||||
app:title="@string/app_title"
|
||||
app:titleTextColor="@color/white">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/healthContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/healthIndicator"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:contentDescription="@string/app_name"
|
||||
android:src="@drawable/ic_circle_status" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="@string/unknown_user"
|
||||
android:textAppearance="?attr/textAppearanceBody2"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.material.appbar.MaterialToolbar>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/usageBanner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:background="@drawable/bg_banner_warning"
|
||||
android:padding="12dp"
|
||||
android:text="@string/usage_limit_banner"
|
||||
android:textColor="@color/banner_warning_text"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragmentContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/hint_job_title"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/jobTitleInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="text" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/hint_seek_url"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/seekUrlInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textUri" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/scrapeButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="@string/button_scrape" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:hint="@string/hint_job_description"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/jobDescriptionInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="top"
|
||||
android:inputType="textMultiLine"
|
||||
android:minLines="4" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/uploadButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/button_upload" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/docInputLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:hint="@string/hint_your_resume"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/docInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="top"
|
||||
android:inputType="textMultiLine"
|
||||
android:minLines="6" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/submitButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/generate_resume" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="16dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/statusBadge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@drawable/bg_banner_warning"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:text="@string/status_queued"
|
||||
android:textAppearance="?attr/textAppearanceBody2"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/statusProgress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/statusMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/job_wait_message"
|
||||
android:textAppearance="?attr/textAppearanceBody1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/statusDetail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textAppearance="?attr/textAppearanceCaption"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/tryAgainButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/try_again"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="2dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/resultBadge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_banner_warning"
|
||||
android:paddingHorizontal="12dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:text="@string/status_completed"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/copyButton"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/copy_text" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/newButton"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/new_job" />
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/resultWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginHorizontal="12dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/pdfButton"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/export_pdf" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/docxButton"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/export_docx" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="2dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userEmail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?attr/textAppearanceBody1"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?attr/textAppearanceBody2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userUsage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?attr/textAppearanceCaption" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/actionButton"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/block_user" />
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/menuAdminPanel"
|
||||
android:title="@string/menu_admin_panel"
|
||||
android:visible="false" />
|
||||
<item
|
||||
android:id="@+id/menuSignOut"
|
||||
android:title="@string/menu_sign_out" />
|
||||
</menu>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 982 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
@@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.ResBuilder" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
|
||||
<color name="status_healthy">#FF4CAF50</color>
|
||||
<color name="status_degraded">#FFFFC107</color>
|
||||
<color name="status_unhealthy">#FFF44336</color>
|
||||
<color name="banner_warning">#FFFFF3E0</color>
|
||||
<color name="banner_warning_text">#FFE65100</color>
|
||||
<color name="status_badge_queued">#FF9E9E9E</color>
|
||||
<color name="status_badge_running">#FF2196F3</color>
|
||||
<color name="status_badge_completed">#FF4CAF50</color>
|
||||
<color name="status_badge_failed">#FFF44336</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,55 @@
|
||||
<resources>
|
||||
<string name="app_name">resBuilder</string>
|
||||
|
||||
<!-- Login -->
|
||||
<string name="sign_in_with_google">Sign in with Google</string>
|
||||
<string name="checking_auth">Checking authentication…</string>
|
||||
|
||||
<!-- Main -->
|
||||
<string name="app_title">resBuilder</string>
|
||||
<string name="tab_build_resume">Build Resume</string>
|
||||
<string name="tab_build_cover_letter">Build Cover Letter</string>
|
||||
<string name="menu_sign_out">Sign Out</string>
|
||||
<string name="menu_admin_panel">Admin Panel</string>
|
||||
<string name="usage_limit_banner">You have reached your free limit. Please contact support to upgrade.</string>
|
||||
<string name="unknown_user">Unknown user</string>
|
||||
|
||||
<!-- Job form -->
|
||||
<string name="hint_job_title">Job Title</string>
|
||||
<string name="hint_seek_url">SEEK job URL</string>
|
||||
<string name="button_scrape">Scrape</string>
|
||||
<string name="hint_job_description">Job Description</string>
|
||||
<string name="button_upload">Upload</string>
|
||||
<string name="hint_your_resume">Your Resume</string>
|
||||
<string name="hint_your_cover_letter">Your Cover Letter</string>
|
||||
<string name="generate_resume">Generate Resume</string>
|
||||
<string name="generate_cover_letter">Generate Cover Letter</string>
|
||||
<string name="please_log_in">Please log in to continue</string>
|
||||
<string name="fields_required">Please fill in all fields</string>
|
||||
|
||||
<!-- Status -->
|
||||
<string name="status_queued">Queued</string>
|
||||
<string name="status_running">Running</string>
|
||||
<string name="status_completed">Completed</string>
|
||||
<string name="status_failed">Failed</string>
|
||||
<string name="job_wait_message">This usually takes 1–5 minutes.</string>
|
||||
<string name="job_failed_message">Job failed</string>
|
||||
<string name="job_timeout_message">Job timed out. Please try again.</string>
|
||||
<string name="try_again">Try again</string>
|
||||
|
||||
<!-- Result -->
|
||||
<string name="copy_text">Copy Text</string>
|
||||
<string name="new_job">New</string>
|
||||
<string name="export_pdf">PDF</string>
|
||||
<string name="export_docx">DOCX</string>
|
||||
<string name="copied_to_clipboard">Copied to clipboard</string>
|
||||
<string name="nothing_to_copy">Nothing to copy</string>
|
||||
|
||||
<!-- Admin -->
|
||||
<string name="admin_title">Admin Panel</string>
|
||||
<string name="block_user">Block</string>
|
||||
<string name="release_user">Release</string>
|
||||
<string name="admin_action_success">Action completed</string>
|
||||
<string name="admin_action_failed">Action failed</string>
|
||||
<string name="usage_format">%1$d / %2$d</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.ResBuilder" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older than API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.example.resbuilder
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||