Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions plugins/Icons-Repository/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### **Icons Repository**

**Version:** 1.0.1
**Version:** 2.0.3

**License:** (e.g., MIT, Apache 2.0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR: The licence is still unclear, and this PR brings in a new block of upstream code under it.

This line is still the template placeholder. addon.json says AGPL-3.0-or-later, upstream's README shows an MIT badge, and upstream has no LICENSE file. material_icon.zip ships no licence or notice either.

Get an explicit licence from the upstream author, make addon.json and this README agree with it, and ship the icon set's licence or NOTICE with the assets.


Expand All @@ -14,7 +14,7 @@ A plugin to help add drawable icons to your Android project on the Code on the G

### **Requirements and dependencies**

* **Supported Code on the Go versions:** 26.17 – 26.22
* **Supported Code on the Go versions:** 26.42 – 26.99

### **Installation**

Expand All @@ -25,7 +25,7 @@ Install using the Plugin Manager in Code on the Go.
Requires:

* JDK 17
* Android SDK with build-tools 37.0.0 and platform 35 (the Gradle build will fetch these automatically if missing)
* Android SDK platform 36 (the Gradle build will fetch these automatically if missing)
* `local.properties` at the repo root with `sdk.dir=<path-to-android-sdk>`

Build command:
Expand Down
8 changes: 5 additions & 3 deletions plugins/Icons-Repository/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {

pluginBuilder {
pluginName = "icons-repository"
pluginVersion = "2.0.3"
}

android {
Expand All @@ -17,7 +18,7 @@ android {
minSdk = 26
targetSdk = 36
versionCode = 1
versionName = "1.0.0"
versionName = "2.0.3"
}

buildTypes {
Expand Down Expand Up @@ -61,13 +62,14 @@ dependencies {

implementation("com.github.megatronking:svg-generator:1.3.2")
implementation("com.github.megatronking:svg-support:1.3.2")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.appcompat:appcompat:1.7.1")
implementation("com.google.android.material:material:1.12.0") // the host's version: plugins run against the host's copy
implementation("androidx.fragment:fragment-ktx:1.8.8")
implementation("androidx.fragment:fragment:1.8.8")
implementation("org.jetbrains.kotlin:kotlin-stdlib:2.3.21")
implementation("com.google.code.gson:gson:2.10.1")
implementation("com.caverock:androidsvg:1.4")
implementation("androidx.recyclerview:recyclerview:1.4.0")
}
tasks.wrapper {
gradleVersion = "9.6.1"
Expand Down
11 changes: 7 additions & 4 deletions plugins/Icons-Repository/icons-repository.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h2 id="executive-overview">Executive overview</h2>
Icons Repository is a sidebar extension for the Code on the Go IDE that lets developers browse a bundled library of Material-style icons and import any of them into the current Android project as a Vector Drawable XML. The plugin replaces the manual "find an SVG, convert it, copy it into <code>res/drawable</code>, fix the colors" loop with a single dialog: pick an icon, optionally pick a tint, hit Import. The result is committed-ready XML in the project's <code>res/drawable</code> directory with no external network calls and no SDK changes required.
</p>
<p>
The plugin targets Code on the Go versions <strong>26.17 through 26.22</strong> and runs on Android API 26 and above.
The plugin targets Code on the Go versions <strong>26.42 through 26.99</strong> and runs on Android API 26 and above.
</p>
<p>
Originally created by <a href="https://github.com/omar-haidar">OMAR HAIDAR</a> (<a href="https://github.com/omar-haidar/IconsRepository-Plugin">upstream repository</a>) and included in this collection with attribution.
Expand All @@ -83,11 +83,14 @@ <h3>Module layout</h3>
<ul>
<li><code>Main</code> — implements <code>IPlugin</code> via <code>BasePlugin</code>; registers one sidebar item and one editor tab; owns the singleton <code>IconRepository</code>.</li>
<li><code>BasePlugin</code> — common lifecycle plumbing on top of the <code>plugin-api</code>; exposes <code>PluginContext</code>, <code>ServiceRegistry</code>, and a logger to subclasses, and clears references in <code>dispose()</code>.</li>
<li><code>repository.IconRepository</code> — loads icons from the bundled <code>material_icon.zip</code> asset on a background thread, caches them in memory, and exposes an asynchronous load API. Provides <code>shutdown()</code> to terminate the executor on plugin disposal.</li>
<li><code>ui.fragments.MainFragment</code> — the catalog UI: a grid <code>RecyclerView</code> driven by <code>IconsAdapter</code>, with a debounced search input and an import dialog.</li>
<li><code>data.repository.IconRepository</code> — loads icons from the bundled <code>material_icon.zip</code> asset on a background thread, caches them in memory, and exposes an asynchronous load API. Provides <code>shutdown()</code> to terminate the executor on plugin disposal.</li>
<li><code>ui.fragments.MainFragment</code> — the catalog UI: a grid <code>RecyclerView</code> driven by <code>IconsAdapter</code>, with a debounced search input. It observes <code>ui.viewmodel.MainViewModel</code>, which loads the catalog through <code>IconRepository</code> and publishes a <code>MainUiState</code> (loading, loaded, empty or error).</li>
<li><code>ui.dialog.IconImportDialogManager</code> — the import dialog (icon name, tint color, and a target module or all modules); hands the result to <code>domain.IconImportUseCase</code>, which runs the importer.</li>
<li><code>ui.adapter.IconsAdapter</code> — owns the search index, the SVG render executor pool, the main-thread handler, and the bitmap <code>LruCache</code>. All resources are released in <code>onDetachedFromRecyclerView</code>.</li>
<li><code>data.importer.SvgToVectorImporter</code> — extracts SVG <code>d</code> path data, builds a Vector Drawable document with <code>XmlPullParser</code>, and writes it to the project's resource directory.</li>
<li><code>data.importer.AppPathResolver</code> — resolves the active project's <code>app/src/main/res/drawable</code> through the IDE's <code>IProject</code>/<code>IModule</code> APIs (with a Gradle-plugin-project fallback).</li>
<li><code>data.importer.AppPathResolver</code> — resolves each target module's <code>src/main/res/drawable</code> folder from the modules <code>ModuleDiscoveryEngine</code> finds, for one module or all of them. The dialog defaults to <code>:app</code>; if no module resolves, it falls back to <code>app/src/main/res/drawable</code>.</li>
<li><code>data.importer.ModuleDiscoveryEngine</code> — lists the project's Android modules from the IDE's module list, the <code>include</code> lines in <code>settings.gradle</code>, and a bounded scan of the project tree, so the import dialog can target any module.</li>
<li><code>help.IconsRepositoryHelp</code> — the in-app help: tooltip entries for the side-menu item, the search field, the icon grid and each import-dialog control, and the offline guide in <code>assets/docs/index.html</code>. <code>Main</code> serves them through <code>DocumentationExtension</code>.</li>
<li><code>data.validation</code> — small validation framework (<code>Validator</code>, <code>ValidationRule</code>, <code>IconNameRule</code>, <code>HexColorRule</code>, <code>RequiredRule</code>) used by the import dialog.</li>
</ul>

Expand Down
16 changes: 9 additions & 7 deletions plugins/Icons-Repository/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:label="Icons Repository"
android:theme="@style/PluginTheme">
android:theme="@style/PluginTheme"
tools:ignore="MissingApplicationIcon">

<!-- Plugin metadata -->
<meta-data
Expand All @@ -13,7 +15,7 @@
<meta-data
android:name="plugin.name"
android:value="Icons Repository" />

<meta-data
android:name="plugin.icon_day"
android:value="assets/icon_day.png" />
Expand All @@ -23,23 +25,23 @@
android:value="assets/icon_night.png" />
<meta-data
android:name="plugin.version"
android:value="1.0.1" />
android:value="${pluginVersion}" />

<meta-data
android:name="plugin.description"
android:value="A Code on the Go plugin" />
android:value="A plugin to help add drawable icons to your Android project on the `CodeOnTheGo` IDE." />

<meta-data
android:name="plugin.author"
android:value="OMAR HAIDAR" />

<meta-data
android:name="plugin.min_ide_version"
android:value="26.17" />
android:value="26.42" />

<meta-data
android:name="plugin.max_ide_version"
android:value="26.22" />
android:value="26.99" />

<!-- Available permissions (comma-separated): - filesystem.read : Read files from the filesystem - filesystem.write : Write files to the filesystem - network.access : Access the network - system.commands : Execute system commands - ide.settings : Access IDE settings - project.structure : Access project structure -->
<meta-data
Expand Down
105 changes: 105 additions & 0 deletions plugins/Icons-Repository/src/main/assets/docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Icons Repository guide</title>
<style>
body {
background: #ffffff;
color: #000000;
font-family: sans-serif;
line-height: 1.5;
margin: 0 auto;
max-width: 760px;
padding: 16px;
}
h1, h2, p, li, td, th { color: #000000; }
code {
background: #f2f2f2;
color: #000000;
padding: 0 3px;
}
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #999999; padding: 6px; text-align: left; vertical-align: top; }
</style>
</head>
<body>

<h1>Icons Repository guide</h1>
<p>
Icons Repository adds Material icons to your project as vector drawables, from inside
Code on the Go. The whole catalog is bundled with the plugin, so it works offline.
</p>

<h2 id="open">Opening the catalog</h2>
<p>
Tap <b>Icons Repository</b> in the side menu. The catalog opens as an editor tab with a
grid of icons. The first time it opens, the icons take a moment to load.
</p>

<h2 id="search">Searching icons</h2>
<p>
Type in the search field to filter the grid by icon name, for example <code>arrow</code>,
<code>home</code> or <code>settings</code>. Tap the clear button at the end of the field to
show every icon again.
</p>

<h2 id="import">Importing an icon</h2>
<p>Tap an icon to open the import dialog. The preview at the top shows the icon with the chosen tint.</p>
<table>
<tr><th>Field</th><th>What it does</th></tr>
<tr id="name">
<td>Icon name</td>
<td>
The drawable's resource name and file name. Use lowercase letters, digits and
single underscores, starting with a letter and not ending with an underscore, for
example <code>ic_arrow_back</code>. Java keywords such as <code>class</code> are
not allowed. The name starts filled in from the icon's name.
</td>
</tr>
<tr id="module">
<td>Target module</td>
<td>
Which module receives the icon. The dialog starts on <code>:app</code>.
<b>All modules</b> writes a copy into every Android module the plugin finds: a folder
with a build file, <code>src/main</code>, and an Android manifest or Android plugin.
</td>
</tr>
<tr id="color">
<td>Color</td>
<td>
The tint. <b>None</b> leaves the icon untinted, so it draws in black. A theme color
such as <code>colorPrimary</code> is written as <code>?attr/colorPrimary</code>,
so the icon follows your app's theme. <b>Custom</b> shows a field for a hex value in
<code>#RRGGBB</code> or <code>#AARRGGBB</code> form.
</td>
</tr>
</table>
<p>
Tap <b>Import</b> to write the icon. If the name or color is not valid, the field shows
an error and nothing is written. <b>Cancel</b> closes the dialog without changing
anything.
</p>

<h2 id="result">What gets written</h2>
<p>
Each import writes one file, <code>res/drawable/&lt;name&gt;.xml</code>, in the main source
set of each target module. It is a 24dp vector drawable, and you use it like any other
drawable, for example <code>@drawable/ic_arrow_back</code> in a layout or
<code>R.drawable.ic_arrow_back</code> in code.
</p>
<p>
<b>An existing drawable is never replaced.</b> A module whose <code>res/drawable</code>
already has a drawable with that name, in any format (for example <code>ic_home.png</code>),
is skipped, and the dialog lists the skipped files. Pick a new name to import it there.
</p>

<h2 id="help">Getting help</h2>
<p>
Long-press the search icons, an icon in the grid, a button or list in the import dialog, or a
field's icon, to see a short explanation of it. Long-pressing the text of a field selects it.
</p>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package dev.omar.plugin.iconsrepo;

import android.content.Context;
import android.view.LayoutInflater;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.itsaky.androidide.plugins.IPlugin;
Expand All @@ -16,12 +17,12 @@
import com.itsaky.androidide.plugins.extensions.FabAction;
import com.itsaky.androidide.plugins.extensions.MenuItem;
import com.itsaky.androidide.plugins.extensions.NavigationItem;
import com.itsaky.androidide.plugins.extensions.ProjectType;
import com.itsaky.androidide.plugins.extensions.TabItem;
import com.itsaky.androidide.plugins.extensions.ToolbarAction;
import com.itsaky.androidide.plugins.extensions.UIExtension;

import com.itsaky.androidide.plugins.services.IdeProjectService;

import java.util.Collections;
import java.util.List;
import java.util.Set;
Expand All @@ -33,7 +34,7 @@ public abstract class BasePlugin implements IPlugin, UIExtension, EditorTabExten


@Override
public boolean initialize(PluginContext context) {
public boolean initialize(@NonNull PluginContext context) {
try {
this.context = context;
this.projectService = getServices().get(IdeProjectService.class);
Expand Down Expand Up @@ -88,53 +89,61 @@ public void dispose() {
context = null;
}

@Nullable
@Override
public List<EditorTabItem> getMainEditorTabs() {
return null;
}

@Nullable
@Override
public List<NavigationItem> getSideMenuItems() {
return null;
}


@Override
public void onEditorTabSelected(String tabId, Fragment fragment) {}
public void onEditorTabSelected(@NonNull String tabId, @NonNull Fragment fragment) {}

@Override
public void onEditorTabClosed(String tabId) {}
public void onEditorTabClosed(@NonNull String tabId) {}

@Override
public boolean canCloseEditorTab(String tabId) {
public boolean canCloseEditorTab(@NonNull String tabId) {
return true;
}

@Nullable
@Override
public List<MenuItem> getMainMenuItems() {
return null;
}

@Nullable
@Override
public List<MenuItem> getContextMenuItems(ContextMenuContext _context) {
public List<MenuItem> getContextMenuItems(@NonNull ContextMenuContext _context) {
return null;
}

@Nullable
@Override
public List<TabItem> getEditorTabs() {
return null;
}

@Nullable
@Override
public List<ToolbarAction> getToolbarActions() {
return null;
}

@Nullable
@Override
public List<FabAction> getFabActions() {
return null;
}

@NonNull
@Override
public Set<String> getHiddenToolbarActionIds() {
return Collections.emptySet();
}
Expand Down
Loading
Loading