+
+
+
+
+Icons Repository guide
+
+
+
+
+Icons Repository guide
+
+ 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.
+
+
+Opening the catalog
+
+ Tap Icons Repository 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.
+
+
+Searching icons
+
+ Type in the search field to filter the grid by icon name, for example arrow,
+ home or settings. Tap the clear button at the end of the field to
+ show every icon again.
+
+
+Importing an icon
+Tap an icon to open the import dialog. The preview at the top shows the icon with the chosen tint.
+
+ | Field | What it does |
+
+ | Icon name |
+
+ 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 ic_arrow_back. Java keywords such as class are
+ not allowed. The name starts filled in from the icon's name.
+ |
+
+
+ | Target module |
+
+ Which module receives the icon. The dialog starts on :app.
+ All modules writes a copy into every Android module the plugin finds: a folder
+ with a build file, src/main, and an Android manifest or Android plugin.
+ |
+
+
+ | Color |
+
+ The tint. None leaves the icon untinted, so it draws in black. A theme color
+ such as colorPrimary is written as ?attr/colorPrimary,
+ so the icon follows your app's theme. Custom shows a field for a hex value in
+ #RRGGBB or #AARRGGBB form.
+ |
+
+
+
+ Tap Import to write the icon. If the name or color is not valid, the field shows
+ an error and nothing is written. Cancel closes the dialog without changing
+ anything.
+
+
+What gets written
+
+ Each import writes one file, res/drawable/<name>.xml, 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 @drawable/ic_arrow_back in a layout or
+ R.drawable.ic_arrow_back in code.
+
+
+ An existing drawable is never replaced. A module whose res/drawable
+ already has a drawable with that name, in any format (for example ic_home.png),
+ is skipped, and the dialog lists the skipped files. Pick a new name to import it there.
+
+
+Getting help
+
+ 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.
+
+
+
+
diff --git a/plugins/Icons-Repository/src/main/java/dev/omar/plugin/iconsrepo/BasePlugin.java b/plugins/Icons-Repository/src/main/java/dev/omar/plugin/iconsrepo/BasePlugin.java
index 55fc072bf..087793c09 100644
--- a/plugins/Icons-Repository/src/main/java/dev/omar/plugin/iconsrepo/BasePlugin.java
+++ b/plugins/Icons-Repository/src/main/java/dev/omar/plugin/iconsrepo/BasePlugin.java
@@ -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;
@@ -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;
@@ -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);
@@ -88,11 +89,13 @@ public void dispose() {
context = null;
}
+ @Nullable
@Override
public List getMainEditorTabs() {
return null;
}
+ @Nullable
@Override
public List getSideMenuItems() {
return null;
@@ -100,41 +103,47 @@ public List getSideMenuItems() {
@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