Skip to content

Commit

Permalink
Refactor: Update colors and remove unused resources
Browse files Browse the repository at this point in the history
This commit updates the colors used in the app and removes some unused resources.

Specific changes include:

-
 Updating the fill color of several icons to use `?colorOnSurfaceVariant`.
- Removing the `splash_background` color from `colors.xml`.
- Updating the status bar and navigation bar colors to use `?colorSurfaceContainerLow`.
- Adding an icon to the Git settings screen.
- Updating the background color of several layouts to use `?colorSurfaceContainerLow`.
- Updating the text appearance of several text views.
- Adding a drag handle to the new plugin item layout.

These changes improve the overall look and feel of the app and make it more consistent with Material Design 3.

Signed-off-by: Pranav Purwar <[email protected]>
  • Loading branch information
PranavPurwar committed Aug 15, 2024
1 parent 70af75b commit 5c6002e
Show file tree
Hide file tree
Showing 204 changed files with 216 additions and 14,993 deletions.
1 change: 0 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
27 changes: 13 additions & 14 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ plugins {

android {
namespace = "org.cosmicide"
compileSdk = 34
compileSdk = 35

defaultConfig {
val commit = getGitCommit()
val GEMINI_API_KEY = "AIzaSyDR-8pmVxLaZHsQM0M5aw4gmyjxnU7ljNo"

applicationId = "org.cosmicide"
minSdk = 26
targetSdk = 34
targetSdk = 35
versionCode = 24
versionName = "2.0.4"
buildConfigField("String", "GIT_COMMIT", "\"$commit\"")
Expand Down Expand Up @@ -170,6 +170,7 @@ materialThemeBuilder {
}

generatePaletteAttributes = true
packageName = "org.cosmicide"
}

configurations.all {
Expand All @@ -178,7 +179,7 @@ configurations.all {
}

dependencies {
implementation("com.android.tools:r8:8.3.37")
implementation("com.android.tools:r8:8.5.35")
implementation("com.android.tools.smali:smali-dexlib2:3.0.7")

//noinspection GradleDependency
Expand All @@ -189,25 +190,24 @@ dependencies {
implementation("com.github.haroldadmin:WhatTheStack:1.0.0-alpha04")

implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.constraintlayout:constraintlayout:2.2.0-alpha13")
implementation("androidx.constraintlayout:constraintlayout:2.2.0-alpha14")
implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.core:core-splashscreen:1.1.0-rc01")
implementation("androidx.documentfile:documentfile:1.1.0-alpha01")
implementation("androidx.fragment:fragment-ktx:1.8.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.2")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.2")
implementation("androidx.fragment:fragment-ktx:1.8.2")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.4")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01")
implementation("androidx.viewpager2:viewpager2:1.1.0")
implementation("androidx.activity:activity-ktx:1.9.0")
implementation("androidx.activity:activity-ktx:1.9.1")
implementation("androidx.startup:startup-runtime:1.2.0-alpha02")

val editorVersion = "0.23.4-cac2770-SNAPSHOT"
val editorVersion = "0.23.4-96c0abc-SNAPSHOT"
//noinspection GradleDependency
implementation("io.github.Rosemoe.sora-editor:editor:$editorVersion")
//noinspection GradleDependency
implementation("io.github.Rosemoe.sora-editor:language-treesitter:$editorVersion") {
isTransitive = false
}
implementation("io.github.Rosemoe.sora-editor:language-treesitter:$editorVersion")
implementation("io.github.Rosemoe.sora-editor:language-textmate:$editorVersion")
implementation("com.itsaky.androidide.treesitter:android-tree-sitter:4.3.1")
implementation("com.itsaky.androidide.treesitter:tree-sitter-java:4.3.1")
implementation("com.itsaky.androidide.treesitter:tree-sitter-kotlin:4.3.1")
Expand All @@ -231,7 +231,7 @@ dependencies {
implementation("org.lsposed.hiddenapibypass:hiddenapibypass:4.3")
implementation("org.slf4j:slf4j-simple:2.1.0-alpha1")

implementation("com.google.ai.client.generativeai:generativeai:0.8.0")
implementation("com.google.ai.client.generativeai:generativeai:0.9.0")

val shizukuVersion = "13.1.5"
implementation("dev.rikka.shizuku:api:$shizukuVersion")
Expand All @@ -253,7 +253,6 @@ dependencies {
implementation(projects.util)
implementation(projects.jgit)
implementation(projects.feature.treeView)
implementation(projects.feature.editorTextmate)

// jgit uses some methods like `transferTo` are only available from Android 13 onwards
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.CosmicIde.Start"
android:theme="@style/Theme.CosmicIde.Flamingo.Light"
tools:targetApi="34">

<provider
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/kotlin/org/cosmicide/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ class App : Application() {
override fun onActivityDestroyed(p0: Activity) {}
})

//TermuxApplication.init(this)

Analytics.setAnalyticsCollectionEnabled(Prefs.analyticsEnabled)
}

Expand Down
18 changes: 9 additions & 9 deletions app/src/main/kotlin/org/cosmicide/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import android.content.pm.PackageManager
import android.os.Bundle
import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updateLayoutParams
import androidx.fragment.app.commit
import androidx.lifecycle.lifecycleScope
import com.google.android.material.color.DynamicColors
Expand Down Expand Up @@ -64,19 +63,20 @@ class MainActivity : AppCompatActivity() {

binding = ActivityMainBinding.inflate(layoutInflater)

enableEdgeToEdge()

ViewCompat.setOnApplyWindowInsetsListener(binding.root) { view, windowInsets ->
val imeInset =
ViewCompat.getRootWindowInsets(view)!!.getInsets(WindowInsetsCompat.Type.ime())

val systemBarInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())

view.updateLayoutParams<ViewGroup.MarginLayoutParams> {
leftMargin = systemBarInsets.left
rightMargin = systemBarInsets.right
topMargin = systemBarInsets.top
bottomMargin = if (imeInset.bottom > 0) 0 else systemBarInsets.bottom
}

view.setPadding(
systemBarInsets.left,
systemBarInsets.top,
systemBarInsets.right,
if (imeInset.bottom > 0) 0 else systemBarInsets.bottom
)

WindowInsetsCompat.CONSUMED
}
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/kotlin/org/cosmicide/fragment/ProjectFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.EditText
import android.widget.LinearLayout
import android.widget.TextView
import android.widget.Toast
import androidx.activity.result.ActivityResult
Expand Down Expand Up @@ -133,6 +134,7 @@ class ProjectFragment : BaseBindingFragment<FragmentProjectBinding>(),
}
true
}

else -> false
}
}
Expand Down Expand Up @@ -343,8 +345,14 @@ class ProjectFragment : BaseBindingFragment<FragmentProjectBinding>(),
hint = "Enter your name"
}

val linear = LinearLayout(requireContext()).apply {
orientation = LinearLayout.VERTICAL
setPadding(32, 16, 32, 8)
addView(editText)
}

MaterialAlertDialogBuilder(requireContext()).apply {
setView(editText)
setView(linear)
setTitle("Enter your name")
setPositiveButton("Okay") { _, _ ->
val name = editText.text.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import de.Maxr1998.modernpreferences.helpers.screen
import de.Maxr1998.modernpreferences.helpers.subScreen
import org.cosmicide.MainActivity
import org.cosmicide.chat.ChatProvider
import org.cosmicide.common.BaseBindingFragment
import org.cosmicide.databinding.FragmentSettingsBinding
import org.cosmicide.fragment.settings.AboutSettings
import org.cosmicide.fragment.settings.AppearanceSettings
Expand All @@ -28,7 +29,6 @@ import org.cosmicide.fragment.settings.FormatterSettings
import org.cosmicide.fragment.settings.GeminiSettings
import org.cosmicide.fragment.settings.GitSettings
import org.cosmicide.fragment.settings.PluginSettingsProvider
import org.cosmicide.common.BaseBindingFragment

/**
* Fragment for displaying settings screen.
Expand All @@ -52,7 +52,7 @@ class SettingsFragment : BaseBindingFragment<FragmentSettingsBinding>() {
val formatterSettings = FormatterSettings(requireActivity())
val compilerSettings = CompilerSettings(requireActivity())
val pluginsSettings = PluginSettingsProvider(requireActivity())
val gitSettings = GitSettings()
val gitSettings = GitSettings(requireActivity())
val aboutSettings = AboutSettings(requireActivity())
val geminiSettings = GeminiSettings(requireActivity())

Expand Down
13 changes: 11 additions & 2 deletions app/src/main/kotlin/org/cosmicide/fragment/settings/GitSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,23 @@

package org.cosmicide.fragment.settings

import androidx.core.content.res.ResourcesCompat
import androidx.fragment.app.FragmentActivity
import de.Maxr1998.modernpreferences.PreferenceScreen
import de.Maxr1998.modernpreferences.helpers.editText
import org.cosmicide.R
import org.cosmicide.util.PreferenceKeys

class GitSettings : SettingsProvider {
class GitSettings(private val activity: FragmentActivity) : SettingsProvider {

override fun provideSettings(builder: PreferenceScreen.Builder) {
builder.apply {
icon = ResourcesCompat.getDrawable(
activity.resources,
R.drawable.github,
activity.theme
)

editText(PreferenceKeys.GIT_USERNAME) {
title = "Username"
defaultValue = ""
Expand All @@ -32,4 +41,4 @@ class GitSettings : SettingsProvider {
}
}
}
}
}
7 changes: 3 additions & 4 deletions app/src/main/res/drawable/baseline_arrow_back_24.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:fillColor="?colorOnSurfaceVariant"
android:pathData="M313,520L509,716Q521,728 521,744Q520,760 508,772Q496,783 480,784Q464,784 452,772L188,508Q182,502 180,495Q177,488 177,480Q177,472 180,465Q182,458 188,452L452,188Q463,177 480,177Q496,177 508,188Q520,200 520,217Q520,233 508,245L313,440L760,440Q777,440 789,452Q800,463 800,480Q800,497 789,509Q777,520 760,520L313,520Z" />
</vector>
</vector>
3 changes: 1 addition & 2 deletions app/src/main/res/drawable/baseline_close_24.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?colorControlNormal"
android:fillColor="?colorOnSurfaceVariant"
android:pathData="M19,6.4L17.6,5 12,10.6 6.4,5 5,6.4 10.6,12 5,17.6 6.4,19 12,13.4 17.6,19 19,17.6 13.4,12z" />
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/baseline_color_lens_24.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?colorControlNormal"
android:fillColor="?colorOnSurfaceVariant"
android:pathData="M12,3c-5,0 -9,4 -9,9s4,9 9,9c0.8,0 1.5,-0.7 1.5,-1.5 0,-0.4 -0.2,-0.7 -0.4,-1 -0.2,-0.3 -0.4,-0.6 -0.4,-1 0,-0.8 0.7,-1.5 1.5,-1.5L16,16c2.8,0 5,-2.2 5,-5 0,-4.4 -4,-8 -9,-8zM6.5,12c-0.8,0 -1.5,-0.7 -1.5,-1.5S5.7,9 6.5,9 8,9.7 8,10.5 7.3,12 6.5,12zM9.5,8C8.7,8 8,7.3 8,6.5S8.7,5 9.5,5s1.5,0.7 1.5,1.5S10.3,8 9.5,8zM14.5,8c-0.8,0 -1.5,-0.7 -1.5,-1.5S13.7,5 14.5,5s1.5,0.7 1.5,1.5S15.3,8 14.5,8zM17.5,12c-0.8,0 -1.5,-0.7 -1.5,-1.5S16.7,9 17.5,9s1.5,0.7 1.5,1.5 -0.7,1.5 -1.5,1.5z" />
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/baseline_mode_edit_24.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?colorControlNormal"
android:fillColor="?colorOnSurfaceVariant"
android:pathData="M3,17.3V21h3.8L17.8,9.9l-3.8,-3.8L3,17.3zM20.7,7c0.4,-0.4 0.4,-1 0,-1.4l-2.3,-2.3c-0.4,-0.4 -1,-0.4 -1.4,0l-1.8,1.8 3.8,3.8 1.8,-1.8z" />
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/baseline_redo_24.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?colorControlNormal"
android:fillColor="?colorOnSurfaceVariant"
android:pathData="M18.4,10.6C16.55,8.99 14.15,8 11.5,8c-4.65,0 -8.58,3.03 -9.96,7.22L3.9,16c1.05,-3.19 4.05,-5.5 7.6,-5.5 1.95,0 3.73,0.72 5.12,1.88L13,16h9V7l-3.6,3.6z" />
</vector>
3 changes: 1 addition & 2 deletions app/src/main/res/drawable/baseline_undo_24.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
android:width="24dp"
android:height="24dp"
android:autoMirrored="true"
android:tint="?colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:fillColor="?colorOnSurfaceVariant"
android:pathData="M12.5,8c-2.7,0 -5.1,1 -6.9,2.6L2,7v9h9l-3.6,-3.6c1.4,-1.2 3.2,-1.9 5.1,-1.9 3.5,0 6.6,2.3 7.6,5.5l2.4,-0.8C21.1,11 17.2,8 12.5,8z" />
</vector>
7 changes: 3 additions & 4 deletions app/src/main/res/drawable/github.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
<path
android:pathData="M15 22v-4a4.8 4.8 0 0 0 -1 -3.5c3 0 6 -2 6 -5.5 0.1 -1.3 -0.3 -2.5 -1 -3.5 0.3 -1.2 0.3 -2.4 0 -3.5 0 0 -1 0 -3 1.5 -2.6 -0.5 -5.4 -0.5 -8 0C6 2 5 2 5 2c-0.3 1.2 -0.3 2.4 0 3.5A5.4 5.4 0 0 0 4 9c0 3.5 3 5.5 6 5.5 -0.4 0.5 -0.7 1.1 -0.9 1.7 -0.2 0.6 -0.2 1.2 -0.2 1.9v4"
android:strokeWidth="2"
android:strokeColor="?colorControlNormal"
android:strokeColor="?colorOnSurfaceVariant"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M9 18c-4.5 2 -5 -2 -7 -2"
android:strokeWidth="2"
android:strokeColor="?colorControlNormal"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
android:strokeColor="?colorOnSurfaceVariant"
android:strokeLineCap="round" />
</vector>
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/ic_baseline_send_24.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
android:viewportHeight="960"
android:autoMirrored="true">
<path
android:fillColor="?attr/colorControlNormal"
android:fillColor="?colorOnSurfaceVariant"
android:pathData="M792,517L176,777Q156,785 138,773.5Q120,762 120,740L120,220Q120,198 138,186.5Q156,175 176,183L792,443Q817,454 817,480Q817,506 792,517ZM200,680L674,480L200,280L200,420L440,480L200,540L200,680ZM200,680L200,480L200,280L200,420L200,420L200,540L200,540L200,680Z" />
</vector>
</vector>
9 changes: 4 additions & 5 deletions app/src/main/res/drawable/ic_download.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:fillColor="?colorOnSurfaceVariant"
android:pathData="M480,617Q473,617 467,614Q460,612 455,606L330,482Q321,473 322,461Q322,449 330,440Q340,430 352,430Q364,430 373,439L450,516L450,210Q450,197 459,189Q467,180 480,180Q493,180 501,189Q510,197 510,210L510,516L587,439Q596,430 608,430Q620,430 630,440Q638,449 639,461Q639,473 630,482L505,606Q500,612 494,614Q487,617 480,617Z" />
<path
android:fillColor="@android:color/white"
android:fillColor="?colorOnSurfaceVariant"
android:pathData="M252,780Q222,780 201,759Q180,738 180,708L180,629Q180,617 189,608Q197,599 210,599Q223,599 231,608Q240,617 240,629L240,708Q240,712 244,716Q248,720 252,720L708,720Q712,720 716,716Q720,712 720,708L720,629Q720,617 729,608Q737,599 750,599Q763,599 771,608Q780,617 780,629L780,708Q780,738 759,759Q738,780 708,780L252,780Z" />
</vector>
</vector>
5 changes: 2 additions & 3 deletions app/src/main/res/drawable/ic_import.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?colorControlNormal"
android:fillColor="?colorOnSurfaceVariant"
android:pathData="M19,9h-4L15,3L9,3v6L5,9l7,7 7,-7zM11,11L11,5h2v6h1.2L12,13.2 9.8,11L11,11zM5,18h14v2L5,20z" />
</vector>
</vector>
7 changes: 3 additions & 4 deletions app/src/main/res/drawable/ic_launcher_background.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
android:viewportWidth="108"
android:viewportHeight="108">
<path android:name="path"
android:pathData="M -14.204 130.914 L -14.204 -20.449 L 123.817 -20.449 L 123.817 130.914 Z"
android:fillColor="@color/logo_background"
android:strokeWidth="0"/>
</vector>
android:pathData="M -14.2 130.9 L -14.2 -20.5 L 123.8 -20.5 L 123.8 130.9 Z"
android:fillColor="@color/logo_background" />
</vector>
5 changes: 2 additions & 3 deletions app/src/main/res/drawable/ic_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?colorControlNormal"
android:fillColor="?colorOnSurfaceVariant"
android:pathData="M3,18V16H21V18ZM3,13V11H21V13ZM3,8V6H21V8Z" />
</vector>
</vector>
Loading

0 comments on commit 5c6002e

Please sign in to comment.