Renamed inflater module and package name

This commit is contained in:
Akash Yadav
2022-01-01 11:49:03 +05:30
parent 06850acadc
commit 5cf99ed2e0
71 changed files with 1608 additions and 1641 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ dependencies {
implementation project(':emulatorview')
implementation project(':javapoet')
implementation project(':lsp')
implementation project(':layout-inflater')
implementation project(':xml-inflater')
implementation project(':lexers')
implementation project(':common')
@@ -38,7 +38,6 @@ import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.ThemedSpinnerAdapter;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
@@ -51,12 +50,10 @@ import androidx.transition.TransitionManager;
import androidx.transition.TransitionSet;
import com.blankj.utilcode.util.DeviceUtils;
import com.blankj.utilcode.util.ThreadUtils;
import com.blankj.utilcode.util.ThrowableUtils;
import com.itsaky.androidide.adapters.WidgetGroupItemAdapter;
import com.itsaky.androidide.adapters.WidgetItemAdapter;
import com.itsaky.androidide.app.StudioActivity;
import com.itsaky.androidide.app.StudioApp;
import com.itsaky.androidide.databinding.ActivityDesignerBinding;
import com.itsaky.androidide.fragments.sheets.AttrEditorSheet;
import com.itsaky.androidide.fragments.sheets.ProgressSheet;
@@ -68,12 +65,11 @@ import com.itsaky.androidide.ui.WidgetDragShadowBuilder;
import com.itsaky.androidide.ui.WidgetTouchListener;
import com.itsaky.androidide.utils.DialogUtils;
import com.itsaky.androidide.utils.Logger;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IInflateListener;
import com.itsaky.layoutinflater.ILayoutInflater;
import com.itsaky.layoutinflater.IView;
import com.itsaky.layoutinflater.IViewGroup;
import com.itsaky.toaster.Toaster;
import com.itsaky.inflater.IAttribute;
import com.itsaky.inflater.IInflateListener;
import com.itsaky.inflater.ILayoutInflater;
import com.itsaky.inflater.IView;
import com.itsaky.inflater.IViewGroup;
import org.eclipse.lsp4j.jsonrpc.CompletableFutures;
import org.jetbrains.annotations.Contract;
@@ -81,8 +77,6 @@ import org.jetbrains.annotations.Contract;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
public class DesignerActivity extends StudioActivity implements WidgetItemAdapter.OnDragStartListener {
@@ -37,7 +37,6 @@ import android.widget.LinearLayout;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -97,7 +96,7 @@ import com.itsaky.androidide.shell.ShellServer;
import com.itsaky.androidide.syntax.colorschemes.SchemeAndroidIDE;
import com.itsaky.androidide.tasks.TaskExecutor;
import com.itsaky.androidide.utils.DialogUtils;
import com.itsaky.layoutinflater.ILayoutInflater;
import com.itsaky.inflater.ILayoutInflater;
import com.itsaky.androidide.utils.LSPUtils;
import com.itsaky.androidide.utils.Logger;
import com.itsaky.androidide.utils.RecursiveFileSearcher;
@@ -21,9 +21,9 @@ import com.google.firebase.messaging.FirebaseMessaging;
import com.itsaky.androidide.language.xml.completion.XMLCompletionService;
import com.itsaky.androidide.project.ProjectResourceFinder;
import com.itsaky.androidide.services.MessagingService;
import com.itsaky.layoutinflater.ILayoutInflater;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.layoutinflater.LayoutInflaterConfiguration;
import com.itsaky.inflater.ILayoutInflater;
import com.itsaky.inflater.IResourceFinder;
import com.itsaky.inflater.LayoutInflaterConfiguration;
import com.itsaky.androidide.utils.FileUtil;
import com.itsaky.androidide.utils.Logger;
import com.itsaky.apiinfo.ApiInfo;
@@ -51,7 +51,7 @@ import com.itsaky.androidide.models.XMLAttribute;
import com.itsaky.androidide.utils.AttributeDialogs;
import com.itsaky.androidide.utils.DialogUtils;
import com.itsaky.androidide.utils.Logger;
import com.itsaky.layoutinflater.IView;
import com.itsaky.inflater.IView;
import com.itsaky.toaster.Toaster;
import java.util.ArrayList;
@@ -21,12 +21,11 @@ import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.itsaky.androidide.app.StudioApp;
import com.itsaky.attrinfo.models.Attr;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.impl.UiAttribute;
import com.itsaky.inflater.IAttribute;
import com.itsaky.inflater.impl.UiAttribute;
import org.jetbrains.annotations.Contract;
@@ -20,7 +20,7 @@ package com.itsaky.androidide.project;
import androidx.annotation.NonNull;
import com.itsaky.androidide.utils.Logger;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.inflater.IResourceFinder;
import java.io.File;
import java.io.FileFilter;
@@ -18,7 +18,7 @@
package com.itsaky.androidide.ui;
import com.itsaky.androidide.models.UIWidget;
import com.itsaky.layoutinflater.IView;
import com.itsaky.inflater.IView;
/**
* Store data about a draggable widget. Used in UI Designer.
@@ -30,12 +30,12 @@ import com.itsaky.androidide.DesignerActivity;
import com.itsaky.androidide.R;
import com.itsaky.androidide.models.UIWidget;
import com.itsaky.androidide.utils.Logger;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IView;
import com.itsaky.layoutinflater.IViewGroup;
import com.itsaky.layoutinflater.impl.UiAttribute;
import com.itsaky.layoutinflater.impl.UiView;
import com.itsaky.layoutinflater.impl.UiViewGroup;
import com.itsaky.inflater.IAttribute;
import com.itsaky.inflater.IView;
import com.itsaky.inflater.IViewGroup;
import com.itsaky.inflater.impl.UiAttribute;
import com.itsaky.inflater.impl.UiView;
import com.itsaky.inflater.impl.UiViewGroup;
import org.jetbrains.annotations.Contract;
@@ -26,7 +26,7 @@ import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.itsaky.layoutinflater.IView;
import com.itsaky.inflater.IView;
/**
* A touch listener for handling touch events of a view in the
@@ -1 +0,0 @@
<manifest package="com.itsaky.layoutinflater"/>
+1 -1
View File
@@ -4,7 +4,7 @@ include ':emulatorview'
include ':javapoet'
include ':lsp'
include ':sdk-info'
include ':layout-inflater'
include ':xml-inflater'
include ':lexers'
include ':common'
View File
View File
View File
@@ -0,0 +1 @@
<manifest package="com.itsaky.inflater"/>
@@ -17,7 +17,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
package com.itsaky.inflater;
/**
* Value type of {@link IAttribute}
@@ -15,12 +15,10 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
package com.itsaky.inflater;
import com.itsaky.layoutinflater.IView;
import java.util.HashSet;
import java.util.Set;
import com.itsaky.layoutinflater.IAttribute;
public abstract class BaseLayoutInflater extends ILayoutInflater {
@@ -1,113 +1,111 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.Comparator;
import java.util.Set;
/**
* Attribute that can be applied to a {@link IView}
*
* @author Akash Yadav
*/
public interface IAttribute {
/**
* The android namespace
*/
public static final String NS_ANDROID = "android";
@NonNull
String getNamespace ();
@NonNull
String getAttributeName ();
@NonNull
String getValue ();
/**
* Set the given string as a value to this attribute.
* This will set {@link #isApplied()} to return {@code true}.
*
* @param value The value to set.
*/
void apply (String value);
public static final Comparator <IAttribute> COMPARATOR = (first, second) -> {
var result = compareNull(first, second);
if (result != IAttribute.DO_COMPARE) {
return result;
}
result = compareNull(first.getNamespace(), second.getNamespace());
if (result != IAttribute.DO_COMPARE) {
return result;
}
// If we reach here, then it means that the attributes and their namespaces are not null
// First, the attributes must be compared by their namespaces
final var firstNs = first.getNamespace();
final var secondNs = second.getNamespace();
if (firstNs.equals(secondNs)) {
// Compare by attribute names if the namespaces are same
return first.getAttributeName().compareTo(second.getAttributeName());
}
// xmlns declarations must be on top
if (firstNs.equals("xmlns") && !secondNs.equals("xmlns")) {
return -1;
}
if (!firstNs.equals("xmlns") && secondNs.equals("xmlns")) {
return 1;
}
return 0;
};
/**
* Returned by {@link #compareNull(Object, Object)} to indicate
* that the comparison must be done further.
*/
static final int DO_COMPARE = 2;
private static int compareNull (Object first, Object second) {
if (first == null && second == null) {
return 0;
}
if (first != null && second == null) {
return -1;
}
if (first == null && second != null) {
return 1;
}
return DO_COMPARE;
}
}
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.inflater;
import androidx.annotation.NonNull;
import java.util.Comparator;
/**
* Attribute that can be applied to a {@link IView}
*
* @author Akash Yadav
*/
public interface IAttribute {
/**
* The android namespace
*/
public static final String NS_ANDROID = "android";
@NonNull
String getNamespace ();
@NonNull
String getAttributeName ();
@NonNull
String getValue ();
/**
* Set the given string as a value to this attribute.
* This will set {@link #isApplied()} to return {@code true}.
*
* @param value The value to set.
*/
void apply (String value);
public static final Comparator <IAttribute> COMPARATOR = (first, second) -> {
var result = compareNull(first, second);
if (result != IAttribute.DO_COMPARE) {
return result;
}
result = compareNull(first.getNamespace(), second.getNamespace());
if (result != IAttribute.DO_COMPARE) {
return result;
}
// If we reach here, then it means that the attributes and their namespaces are not null
// First, the attributes must be compared by their namespaces
final var firstNs = first.getNamespace();
final var secondNs = second.getNamespace();
if (firstNs.equals(secondNs)) {
// Compare by attribute names if the namespaces are same
return first.getAttributeName().compareTo(second.getAttributeName());
}
// xmlns declarations must be on top
if (firstNs.equals("xmlns") && !secondNs.equals("xmlns")) {
return -1;
}
if (!firstNs.equals("xmlns") && secondNs.equals("xmlns")) {
return 1;
}
return 0;
};
/**
* Returned by {@link #compareNull(Object, Object)} to indicate
* that the comparison must be done further.
*/
static final int DO_COMPARE = 2;
private static int compareNull (Object first, Object second) {
if (first == null && second == null) {
return 0;
}
if (first != null && second == null) {
return -1;
}
if (first == null && second != null) {
return 1;
}
return DO_COMPARE;
}
}
@@ -17,10 +17,9 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
package com.itsaky.inflater;
import android.view.View;
import com.itsaky.layoutinflater.IResourceFinder;
/**
* An adapter that handles attributes of a specific type of view
@@ -15,7 +15,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
package com.itsaky.inflater;
import android.view.View;
import java.util.HashMap;
@@ -17,7 +17,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
package com.itsaky.inflater;
/**
* A fixed value which represents an enum of a flag
@@ -15,10 +15,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
import com.itsaky.layoutinflater.IView;
import com.itsaky.layoutinflater.IViewGroup;
import com.itsaky.layoutinflater.IAttribute;
package com.itsaky.inflater;
/**
* A listener which is invoked to notify about events in {@link ILayoutInflater}
@@ -15,7 +15,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
package com.itsaky.inflater;
import android.content.Context;
import android.view.ViewGroup;
@@ -1,86 +1,86 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
import androidx.annotation.NonNull;
import java.io.File;
/**
* Finds values in resources of a project
*/
public interface IResourceFinder {
/**
* Find the path of the drawable with the provided name
* <p>
* This method will be called if the value of attribute starts with '@drawable/'
*
* @param name The name of the drawable
* @return The drawable resource.
*/
File findDrawable (@NonNull String name);
/**
* Find the layout file with the specified name.
*
* @param name The name of the layout file
* @return The found layout resource file
*/
File inflateLayout (@NonNull String name);
/**
* Find a string resource. Must be a valid string or {@code null}
*
* @param name The name of the resource
* @return Value of the resource
*/
String findString (@NonNull String name);
/**
* Find a color resource. The returned value must be a valid color value or {@code -1}
*
* @param name The name of the resource
* @return Value of the resource
*/
String findColor (@NonNull String name);
/**
* Find an array resource. Must be a valid array or {@code null}
*
* @param name The name of the resource
* @return Value of the resource
*/
String[] findArray (@NonNull String name);
/**
* Find the dimension value with the given name.
*
* @param name The name of the dimension resource
* @return The String representation of the dimension. It could one of the following format :
* 1dp, 12sp, 123px, etc.
*/
String findDimension (@NonNull String name);
/**
* Set the file which is currently being inflated.
*
* @param file The file.
*/
void setInflatingFile (@NonNull File file);
}
/************************************************************************************
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.inflater;
import androidx.annotation.NonNull;
import java.io.File;
/**
* Finds values in resources of a project
*/
public interface IResourceFinder {
/**
* Find the path of the drawable with the provided name
* <p>
* This method will be called if the value of attribute starts with '@drawable/'
*
* @param name The name of the drawable
* @return The drawable resource.
*/
File findDrawable (@NonNull String name);
/**
* Find the layout file with the specified name.
*
* @param name The name of the layout file
* @return The found layout resource file
*/
File inflateLayout (@NonNull String name);
/**
* Find a string resource. Must be a valid string or {@code null}
*
* @param name The name of the resource
* @return Value of the resource
*/
String findString (@NonNull String name);
/**
* Find a color resource. The returned value must be a valid color value or {@code -1}
*
* @param name The name of the resource
* @return Value of the resource
*/
String findColor (@NonNull String name);
/**
* Find an array resource. Must be a valid array or {@code null}
*
* @param name The name of the resource
* @return Value of the resource
*/
String[] findArray (@NonNull String name);
/**
* Find the dimension value with the given name.
*
* @param name The name of the dimension resource
* @return The String representation of the dimension. It could one of the following format :
* 1dp, 12sp, 123px, etc.
*/
String findDimension (@NonNull String name);
/**
* Set the file which is currently being inflated.
*
* @param file The file.
*/
void setInflatingFile (@NonNull File file);
}
@@ -15,7 +15,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
package com.itsaky.inflater;
import android.view.View;
@@ -23,7 +23,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.List;
import java.util.Set;
/**
* Represents a view in the UI Designer
@@ -15,7 +15,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
package com.itsaky.inflater;
import android.view.View;
@@ -17,7 +17,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
package com.itsaky.inflater;
/**
* Thrown when there was an error inflating the layout
@@ -15,7 +15,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
package com.itsaky.inflater;
import java.io.File;
import java.util.Set;
@@ -15,7 +15,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater;
package com.itsaky.inflater;
import android.content.Context;
import android.view.View;
@@ -28,12 +28,12 @@ import com.itsaky.androidide.app.BaseApplication;
import com.itsaky.androidide.ui.util.Preconditions;
import com.itsaky.androidide.utils.Logger;
import com.itsaky.attrinfo.AttrInfo;
import com.itsaky.layoutinflater.adapters.android.view.ViewAttrAdapter;
import com.itsaky.layoutinflater.adapters.android.view.ViewGroupAttrAdapter;
import com.itsaky.layoutinflater.impl.BaseView;
import com.itsaky.layoutinflater.impl.UiAttribute;
import com.itsaky.layoutinflater.impl.UiView;
import com.itsaky.layoutinflater.impl.UiViewGroup;
import com.itsaky.inflater.adapters.android.view.ViewAttrAdapter;
import com.itsaky.inflater.adapters.android.view.ViewGroupAttrAdapter;
import com.itsaky.inflater.impl.BaseView;
import com.itsaky.inflater.impl.UiAttribute;
import com.itsaky.inflater.impl.UiView;
import com.itsaky.inflater.impl.UiViewGroup;
import com.itsaky.widgets.WidgetInfo;
import com.itsaky.widgets.models.Widget;
import java.io.File;
@@ -201,7 +201,7 @@ class XMLLayoutInflater extends BaseLayoutInflater {
protected IAttributeAdapter onCreateAttributeAdapter(View view) {
try {
final String adapterName = view.getClass().getName().concat(ATTR_ADAPTER_SUFFIX);
final String name = "com.itsaky.layoutinflater.adapters.".concat(adapterName);
final String name = "com.itsaky.inflater.adapters.".concat(adapterName);
final Class <? extends IAttributeAdapter> adapterClass = getClass()
.getClassLoader()
.loadClass(name)
@@ -210,7 +210,7 @@ class XMLLayoutInflater extends BaseLayoutInflater {
adapter.setResourceFinder (resFinder);
return adapter;
} catch (Throwable th) {
LOG.error (BaseApplication.getBaseInstance().getString(com.itsaky.layoutinflater.R.string.err_no_attr_adapter, view.getClass().getName()), th);
LOG.error (BaseApplication.getBaseInstance().getString(com.itsaky.inflater.R.string.err_no_attr_adapter, view.getClass().getName()), th);
}
// If we cannot find a suitable adapter, fall back to using common adapters
@@ -260,7 +260,7 @@ class XMLLayoutInflater extends BaseLayoutInflater {
final Widget widget = widgetInfo.getWidgetBySimpleName(name);
if (widget == null) {
LOG.error("Unable to inflate view. widget == null");
return onCreateErrorView(name, getString(com.itsaky.layoutinflater.R.string.msg_cannot_create_view, name));
return onCreateErrorView(name, getString(com.itsaky.inflater.R.string.msg_cannot_create_view, name));
}
return createFromQualifiedName(widget.name, parent, style);
@@ -15,7 +15,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater.adapters.android.view;
package com.itsaky.inflater.adapters.android.view;
import android.content.Context;
import android.content.res.Resources;
@@ -42,10 +42,10 @@ import androidx.core.view.GravityCompat;
import com.blankj.utilcode.util.ImageUtils;
import com.itsaky.androidide.utils.Logger;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IAttributeAdapter;
import com.itsaky.layoutinflater.IDTable;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.inflater.IAttribute;
import com.itsaky.inflater.IAttributeAdapter;
import com.itsaky.inflater.IDTable;
import com.itsaky.inflater.IResourceFinder;
import com.sdsmdg.harjot.vectormaster.VectorMasterDrawable;
import org.xmlpull.v1.XmlPullParserException;
@@ -607,8 +607,7 @@ public class ViewAttrAdapter implements IAttributeAdapter {
if (drawable.getName ().endsWith (".xml")) {
// TODO This might not always be a vector drawable
// Implement a drawable parser that can parse shape drawables, layer lists
// or even a color state list
// Implement a drawable parser that can parse everything listed here: https://developer.android.com/guide/topics/resources/drawable-resource
try {
return VectorMasterDrawable.fromXMLFile (drawable);
} catch (XmlPullParserException e) {
@@ -15,7 +15,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater.adapters.android.view;
package com.itsaky.inflater.adapters.android.view;
import android.animation.LayoutTransition;
import android.view.View;
@@ -23,7 +23,7 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.inflater.IAttribute;
import org.jetbrains.annotations.Contract;
@@ -1,76 +1,75 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.view.View;
import android.widget.AbsSeekBar;
import androidx.annotation.NonNull;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IResourceFinder;
/**
* Attribute adapter for handling attributes related to
* AbsSeekBar.
*
* @author Akash Yadav
*/
public abstract class AbsSeekBarAttrAdapter extends ProgressBarAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof AbsSeekBar;
}
@Override
public boolean apply(@NonNull IAttribute attribute, View view) {
final var seek = (AbsSeekBar) view;
final var namespace = attribute.getNamespace();
final var name = attribute.getAttributeName();
final var value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "thumbTint" :
// TODO Parse color state list
break;
case "thumbTintMode" :
seek.setThumbTintMode(parsePorterDuffMode(value));
break;
case "tickMarkTint" :
// TODO Parse color state list
break;
case "tickMarkTintMode":
seek.setTickMarkTintMode(parsePorterDuffMode(value));
break;
default:
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.view.View;
import android.widget.AbsSeekBar;
import androidx.annotation.NonNull;
import com.itsaky.inflater.IAttribute;
/**
* Attribute adapter for handling attributes related to
* AbsSeekBar.
*
* @author Akash Yadav
*/
public abstract class AbsSeekBarAttrAdapter extends ProgressBarAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof AbsSeekBar;
}
@Override
public boolean apply(@NonNull IAttribute attribute, View view) {
final var seek = (AbsSeekBar) view;
final var namespace = attribute.getNamespace();
final var name = attribute.getAttributeName();
final var value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "thumbTint" :
// TODO Parse color state list
break;
case "thumbTintMode" :
seek.setThumbTintMode(parsePorterDuffMode(value));
break;
case "tickMarkTint" :
// TODO Parse color state list
break;
case "tickMarkTintMode":
seek.setTickMarkTintMode(parsePorterDuffMode(value));
break;
default:
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
}
@@ -1,66 +1,63 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.view.View;
import android.widget.AbsSpinner;
import android.widget.ArrayAdapter;
import android.widget.SimpleAdapter;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IResourceFinder;
public class AbsSpinnerAttrAdapter extends AdapterViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof AbsSpinner;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final var spinner = (AbsSpinner) view;
final var context = spinner.getContext();
final var namespace = attribute.getNamespace();
final var name = attribute.getAttributeName();
final var value = attribute.getValue();
boolean handled = true;
if (!canHandleNamespace(namespace)) {
return false;
}
switch (name) {
case "entries" :
final var adapter = newSimpleAdapter(context, resFinder.findArray(value));
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
break;
default:
handled = false;
break;
}
if (!handled){
handled = super.apply(attribute, view);
}
return handled;
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.view.View;
import android.widget.AbsSpinner;
import com.itsaky.inflater.IAttribute;
public class AbsSpinnerAttrAdapter extends AdapterViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof AbsSpinner;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final var spinner = (AbsSpinner) view;
final var context = spinner.getContext();
final var namespace = attribute.getNamespace();
final var name = attribute.getAttributeName();
final var value = attribute.getValue();
boolean handled = true;
if (!canHandleNamespace(namespace)) {
return false;
}
switch (name) {
case "entries" :
final var adapter = newSimpleAdapter(context, resFinder.findArray(value));
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
break;
default:
handled = false;
break;
}
if (!handled){
handled = super.apply(attribute, view);
}
return handled;
}
}
@@ -1,63 +1,62 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.content.Context;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.layoutinflater.adapters.android.view.ViewGroupAttrAdapter;
/**
* Adapter for handling attributes related to
* AdapterView.
*
* @author Akash Yadav
*/
public abstract class AdapterViewAttrAdapter extends ViewGroupAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof AdapterView;
}
@Override
public boolean apply(IAttribute attribute, View view) {
// No special attributes for AdapterView
return super.apply(attribute, view);
}
protected ArrayAdapter <String> newSimpleAdapter (Context ctx) {
return newSimpleAdapter(ctx, newAdapterItems(4));
}
protected ArrayAdapter <String> newSimpleAdapter (Context ctx, String[] items) {
return new ArrayAdapter<String>(ctx, android.R.layout.simple_list_item_1, items);
}
protected String[] newAdapterItems (int size) {
final var items = new String [size];
for (var i = 0;i<size;i++) {
items[i] = "Item " + i;
}
return items;
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.content.Context;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import com.itsaky.inflater.IAttribute;
import com.itsaky.inflater.adapters.android.view.ViewGroupAttrAdapter;
/**
* Adapter for handling attributes related to
* AdapterView.
*
* @author Akash Yadav
*/
public abstract class AdapterViewAttrAdapter extends ViewGroupAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof AdapterView;
}
@Override
public boolean apply(IAttribute attribute, View view) {
// No special attributes for AdapterView
return super.apply(attribute, view);
}
protected ArrayAdapter <String> newSimpleAdapter (Context ctx) {
return newSimpleAdapter(ctx, newAdapterItems(4));
}
protected ArrayAdapter <String> newSimpleAdapter (Context ctx, String[] items) {
return new ArrayAdapter<String>(ctx, android.R.layout.simple_list_item_1, items);
}
protected String[] newAdapterItems (int size) {
final var items = new String [size];
for (var i = 0;i<size;i++) {
items[i] = "Item " + i;
}
return items;
}
}
@@ -1,45 +1,45 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.view.View;
import android.widget.Button;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.layoutinflater.IAttribute;
/**
* Adapter for handling attributes related to Button.
*
* However, {@code android.widget.Button} has no special attributes.
* This adpater simply inherits from {@link TextViewAttrAdapter}.
*
* @author Akash Yadav
*/
public class ButtonAttrAdapter extends TextViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof Button;
}
@Override
public boolean apply(IAttribute attribute, View view) {
// No special attributes for Button
return super.apply(attribute, view);
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.view.View;
import android.widget.Button;
import com.itsaky.inflater.IAttribute;
/**
* Adapter for handling attributes related to Button.
*
* However, {@code android.widget.Button} has no special attributes.
* This adpater simply inherits from {@link TextViewAttrAdapter}.
*
* @author Akash Yadav
*/
public class ButtonAttrAdapter extends TextViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof Button;
}
@Override
public boolean apply(IAttribute attribute, View view) {
// No special attributes for Button
return super.apply(attribute, view);
}
}
@@ -1,40 +1,40 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.view.View;
import android.widget.CheckBox;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.layoutinflater.IAttribute;
/**
* Attribute handler for handling attributes related to CheckBox
*/
public class CheckBoxAttrAdapter extends CompondButtonAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof CheckBox;
}
@Override
public boolean apply(IAttribute attribute, View view) {
// No special attributes for CheckBox
return super.apply(attribute, view);
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.view.View;
import android.widget.CheckBox;
import com.itsaky.inflater.IAttribute;
/**
* Attribute handler for handling attributes related to CheckBox
*/
public class CheckBoxAttrAdapter extends CompondButtonAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof CheckBox;
}
@Override
public boolean apply(IAttribute attribute, View view) {
// No special attributes for CheckBox
return super.apply(attribute, view);
}
}
@@ -1,72 +1,72 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.view.View;
import android.widget.CheckedTextView;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.layoutinflater.IAttribute;
/**
* Attribute handler for handling attributes related to
* CheckedTextView.
*
* @author Akash Yadav
*/
public class CheckedTextViewAttrAdapter extends TextViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof CheckedTextView;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final CheckedTextView text = (CheckedTextView) view;
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "checkMarkTintMode" :
text.setCheckMarkTintMode(parsePorterDuffMode(value));
break;
case "checkMarkTint" :
// TODO Parse color state list
break;
case "checkMark" :
// Ignored...
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.view.View;
import android.widget.CheckedTextView;
import com.itsaky.inflater.IAttribute;
/**
* Attribute handler for handling attributes related to
* CheckedTextView.
*
* @author Akash Yadav
*/
public class CheckedTextViewAttrAdapter extends TextViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof CheckedTextView;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final CheckedTextView text = (CheckedTextView) view;
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "checkMarkTintMode" :
text.setCheckMarkTintMode(parsePorterDuffMode(value));
break;
case "checkMarkTint" :
// TODO Parse color state list
break;
case "checkMark" :
// Ignored...
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
}
@@ -1,56 +1,56 @@
package com.itsaky.layoutinflater.adapters.android.widget;
import android.content.Context;
import android.view.View;
import android.widget.CompoundButton;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.layoutinflater.IAttribute;
/**
* Attribute handler for handling attibutes to CompoundButton
*
* @author Akash Yadav
*/
public class CompondButtonAttrAdapter extends ButtonAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof CompoundButton;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final CompoundButton button = (CompoundButton) view;
final Context context = button.getContext();
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "buttonTint" :
// TODO Parse color state list
break;
case "button" :
button.setButtonDrawable(parseDrawable(value, context));
break;
case "buttonTintMode" :
button.setButtonTintMode(parsePorterDuffMode(value));
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
}
package com.itsaky.inflater.adapters.android.widget;
import android.content.Context;
import android.view.View;
import android.widget.CompoundButton;
import com.itsaky.inflater.IAttribute;
/**
* Attribute handler for handling attibutes to CompoundButton
*
* @author Akash Yadav
*/
public class CompondButtonAttrAdapter extends ButtonAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof CompoundButton;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final CompoundButton button = (CompoundButton) view;
final Context context = button.getContext();
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "buttonTint" :
// TODO Parse color state list
break;
case "button" :
button.setButtonDrawable(parseDrawable(value, context));
break;
case "buttonTintMode" :
button.setButtonTintMode(parsePorterDuffMode(value));
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
}
@@ -1,38 +1,38 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.view.View;
import android.widget.EditText;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.layoutinflater.IAttribute;
public class EditTextAttrAdapter extends TextViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof EditText;
}
@Override
public boolean apply(IAttribute attribute, View view) {
// No special attributes for EditText
return super.apply(attribute, view);
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.view.View;
import android.widget.EditText;
import com.itsaky.inflater.IAttribute;
public class EditTextAttrAdapter extends TextViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof EditText;
}
@Override
public boolean apply(IAttribute attribute, View view) {
// No special attributes for EditText
return super.apply(attribute, view);
}
}
@@ -1,42 +1,42 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.view.View;
import android.widget.ImageButton;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.layoutinflater.IAttribute;
/**
* Attribute handler for handling attributes related to
* ImageButton.
*
* @author Akash Yadav
*/
public class ImageButtonAttrAdapter extends ImageViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof ImageButton;
}
@Override
public boolean apply(IAttribute attribute, View view) {
// No special attributes for ImageButton
return super.apply(attribute, view);
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.view.View;
import android.widget.ImageButton;
import com.itsaky.inflater.IAttribute;
/**
* Attribute handler for handling attributes related to
* ImageButton.
*
* @author Akash Yadav
*/
public class ImageButtonAttrAdapter extends ImageViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof ImageButton;
}
@Override
public boolean apply(IAttribute attribute, View view) {
// No special attributes for ImageButton
return super.apply(attribute, view);
}
}
@@ -1,129 +1,128 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.ImageView;
import androidx.core.content.ContextCompat;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.layoutinflater.adapters.android.view.ViewAttrAdapter;
/**
* Attribute handler for handling attributes related to
* ImageButton.
*
* @author Akash Yadav
*/
public class ImageViewAttrAdapter extends ViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof ImageView;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final ImageView image = (ImageView) view;
final Context context = image.getContext();
final DisplayMetrics dm = context.getResources().getDisplayMetrics();
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "adjustViewBounds" :
image.setAdjustViewBounds(parseBoolean(value));
break;
case "baseline" :
image.setBaseline(parseDimension(value, 0, dm));
break;
case "baselineAlignBottom" :
image.setBaselineAlignBottom(parseBoolean(value));
break;
case "cropToPadding" :
image.setCropToPadding(parseBoolean(value));
break;
case "maxHeight" :
image.setMaxHeight(parseDimension(value, 0, dm));
break;
case "maxWidth" :
image.setMaxWidth(parseDimension(value, 0, dm));
break;
case "scaleType" :
image.setScaleType(parseScaleType(value));
break;
case "src" :
image.setImageDrawable(parseImageResource(value, context));
break;
case "tint" :
// TODO Parse color state list
break;
case "tintMode" :
image.setImageTintMode(parsePorterDuffMode(value));
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
private Drawable parseImageResource(String value, Context context) {
if (value.startsWith("@drawable/") || value.startsWith("@mipmap/")) {
return parseDrawable(value, context);
}
return ContextCompat.getDrawable(context, android.R.drawable.ic_delete);
}
private ImageView.ScaleType parseScaleType(String value) {
switch (value) {
case "center" :
return ImageView.ScaleType.CENTER;
case "centerCrop" :
return ImageView.ScaleType.CENTER_CROP;
case "centerInside" :
return ImageView.ScaleType.CENTER_INSIDE;
case "fitEnd" :
return ImageView.ScaleType.FIT_END;
case "fitStart" :
return ImageView.ScaleType.FIT_START;
case "fitXY" :
return ImageView.ScaleType.FIT_XY;
case "matrix" :
return ImageView.ScaleType.MATRIX;
case "fitCenter" :
default :
return ImageView.ScaleType.FIT_CENTER;
}
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.ImageView;
import androidx.core.content.ContextCompat;
import com.itsaky.inflater.IAttribute;
import com.itsaky.inflater.adapters.android.view.ViewAttrAdapter;
/**
* Attribute handler for handling attributes related to
* ImageButton.
*
* @author Akash Yadav
*/
public class ImageViewAttrAdapter extends ViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof ImageView;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final ImageView image = (ImageView) view;
final Context context = image.getContext();
final DisplayMetrics dm = context.getResources().getDisplayMetrics();
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "adjustViewBounds" :
image.setAdjustViewBounds(parseBoolean(value));
break;
case "baseline" :
image.setBaseline(parseDimension(value, 0, dm));
break;
case "baselineAlignBottom" :
image.setBaselineAlignBottom(parseBoolean(value));
break;
case "cropToPadding" :
image.setCropToPadding(parseBoolean(value));
break;
case "maxHeight" :
image.setMaxHeight(parseDimension(value, 0, dm));
break;
case "maxWidth" :
image.setMaxWidth(parseDimension(value, 0, dm));
break;
case "scaleType" :
image.setScaleType(parseScaleType(value));
break;
case "src" :
image.setImageDrawable(parseImageResource(value, context));
break;
case "tint" :
// TODO Parse color state list
break;
case "tintMode" :
image.setImageTintMode(parsePorterDuffMode(value));
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
private Drawable parseImageResource(String value, Context context) {
if (value.startsWith("@drawable/") || value.startsWith("@mipmap/")) {
return parseDrawable(value, context);
}
return ContextCompat.getDrawable(context, android.R.drawable.ic_delete);
}
private ImageView.ScaleType parseScaleType(String value) {
switch (value) {
case "center" :
return ImageView.ScaleType.CENTER;
case "centerCrop" :
return ImageView.ScaleType.CENTER_CROP;
case "centerInside" :
return ImageView.ScaleType.CENTER_INSIDE;
case "fitEnd" :
return ImageView.ScaleType.FIT_END;
case "fitStart" :
return ImageView.ScaleType.FIT_START;
case "fitXY" :
return ImageView.ScaleType.FIT_XY;
case "matrix" :
return ImageView.ScaleType.MATRIX;
case "fitCenter" :
default :
return ImageView.ScaleType.FIT_CENTER;
}
}
}
@@ -1,93 +1,92 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.view.View;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.layoutinflater.adapters.android.view.ViewGroupAttrAdapter;
/**
* Adapter for handling attributes related to LinearLayout.
*
* @author Akash Yadav
*/
public class LinearLayoutAttrAdapter extends ViewGroupAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof LinearLayout;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final LinearLayout linear = (LinearLayout) view;
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "baselineAligned" :
linear.setBaselineAligned(parseBoolean(value));
break;
case "baselineAlignedChildIndex" :
linear.setBaselineAlignedChildIndex(parseInteger(value, linear.getChildCount()));
break;
case "gravity" :
linear.setGravity(parseGravity(value));
break;
case "measureWithLargestChild" :
linear.setMeasureWithLargestChildEnabled(parseBoolean(value));
break;
case "orientation" :
linear.setOrientation(parseOrientation(value));
break;
case "weightSum" :
linear.setWeightSum(parseFloat(value));
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
protected int parseOrientation(@NonNull String value) {
switch (value) {
case "vertical" :
return LinearLayout.VERTICAL;
case "horizontal" :
default :
return LinearLayout.HORIZONTAL;
}
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.view.View;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import com.itsaky.inflater.IAttribute;
import com.itsaky.inflater.adapters.android.view.ViewGroupAttrAdapter;
/**
* Adapter for handling attributes related to LinearLayout.
*
* @author Akash Yadav
*/
public class LinearLayoutAttrAdapter extends ViewGroupAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof LinearLayout;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final LinearLayout linear = (LinearLayout) view;
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "baselineAligned" :
linear.setBaselineAligned(parseBoolean(value));
break;
case "baselineAlignedChildIndex" :
linear.setBaselineAlignedChildIndex(parseInteger(value, linear.getChildCount()));
break;
case "gravity" :
linear.setGravity(parseGravity(value));
break;
case "measureWithLargestChild" :
linear.setMeasureWithLargestChildEnabled(parseBoolean(value));
break;
case "orientation" :
linear.setOrientation(parseOrientation(value));
break;
case "weightSum" :
linear.setWeightSum(parseFloat(value));
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
protected int parseOrientation(@NonNull String value) {
switch (value) {
case "vertical" :
return LinearLayout.VERTICAL;
case "horizontal" :
default :
return LinearLayout.HORIZONTAL;
}
}
}
@@ -1,135 +1,134 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.content.Context;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.ProgressBar;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.layoutinflater.adapters.android.view.ViewAttrAdapter;
/**
* Attribute adapter for handling attributes related to
* ProgressBar.
*
* @author Akash Yadav
*/
public class ProgressBarAttrAdapter extends ViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof ProgressBar;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final ProgressBar pb = (ProgressBar) view;
final Context context = pb.getContext();
final DisplayMetrics dm = context.getResources().getDisplayMetrics();
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "indeterminate" :
pb.setIndeterminate(parseBoolean(value));
break;
case "indeterminateDrawable" :
pb.setIndeterminateDrawable(parseDrawable(value, context));
break;
case "indeterminateTint" :
// TODO Parse color state list
break;
case "indeterminateTintMode" :
pb.setIndeterminateTintMode(parsePorterDuffMode(value));
break;
case "max" :
pb.setMax(parseInteger(value, 100));
break;
case "maxHeight" :
if (isApi29 ()) {
pb.setMaxHeight(parseDimension(value, Integer.MAX_VALUE, dm));
}
break;
case "maxWidth" :
if (isApi29 ()) {
pb.setMaxWidth(parseDimension(value, Integer.MAX_VALUE, dm));
}
break;
case "min" :
if (isApi26()) {
pb.setMin(parseInteger(value, 0));
}
break;
case "minHeight" :
if (isApi29()) {
pb.setMinHeight(parseDimension(value, 0, dm));
}
break;
case "minWidth" :
if (isApi29()) {
pb.setMinWidth(parseDimension(value, 0, dm));
}
break;
case "progress" :
pb.setProgress(parseInteger(value, 50));
break;
case "progressBackgroundTint" :
// TODO Parse color state list
break;
case "progressBackgroundTintMode" :
pb.setProgressBackgroundTintMode(parsePorterDuffMode(value));
break;
case "progressDrawable" :
pb.setProgressDrawable(parseDrawable(value, context));
break;
case "progressTint" :
// TODO Parse color state list
break;
case "progressTintMode" :
pb.setProgressTintMode(parsePorterDuffMode(value));
break;
case "secondaryProgress" :
pb.setSecondaryProgress(parseInteger(value, 0));
break;
case "secondaryProgressTint" :
// TODO Parse color state list
break;
case "secondaryProgressTintMode" :
pb.setSecondaryProgressTintMode(parsePorterDuffMode(value));
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.content.Context;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.ProgressBar;
import com.itsaky.inflater.IAttribute;
import com.itsaky.inflater.adapters.android.view.ViewAttrAdapter;
/**
* Attribute adapter for handling attributes related to
* ProgressBar.
*
* @author Akash Yadav
*/
public class ProgressBarAttrAdapter extends ViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof ProgressBar;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final ProgressBar pb = (ProgressBar) view;
final Context context = pb.getContext();
final DisplayMetrics dm = context.getResources().getDisplayMetrics();
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "indeterminate" :
pb.setIndeterminate(parseBoolean(value));
break;
case "indeterminateDrawable" :
pb.setIndeterminateDrawable(parseDrawable(value, context));
break;
case "indeterminateTint" :
// TODO Parse color state list
break;
case "indeterminateTintMode" :
pb.setIndeterminateTintMode(parsePorterDuffMode(value));
break;
case "max" :
pb.setMax(parseInteger(value, 100));
break;
case "maxHeight" :
if (isApi29 ()) {
pb.setMaxHeight(parseDimension(value, Integer.MAX_VALUE, dm));
}
break;
case "maxWidth" :
if (isApi29 ()) {
pb.setMaxWidth(parseDimension(value, Integer.MAX_VALUE, dm));
}
break;
case "min" :
if (isApi26()) {
pb.setMin(parseInteger(value, 0));
}
break;
case "minHeight" :
if (isApi29()) {
pb.setMinHeight(parseDimension(value, 0, dm));
}
break;
case "minWidth" :
if (isApi29()) {
pb.setMinWidth(parseDimension(value, 0, dm));
}
break;
case "progress" :
pb.setProgress(parseInteger(value, 50));
break;
case "progressBackgroundTint" :
// TODO Parse color state list
break;
case "progressBackgroundTintMode" :
pb.setProgressBackgroundTintMode(parsePorterDuffMode(value));
break;
case "progressDrawable" :
pb.setProgressDrawable(parseDrawable(value, context));
break;
case "progressTint" :
// TODO Parse color state list
break;
case "progressTintMode" :
pb.setProgressTintMode(parsePorterDuffMode(value));
break;
case "secondaryProgress" :
pb.setSecondaryProgress(parseInteger(value, 0));
break;
case "secondaryProgressTint" :
// TODO Parse color state list
break;
case "secondaryProgressTintMode" :
pb.setSecondaryProgressTintMode(parsePorterDuffMode(value));
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
}
@@ -1,44 +1,43 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.view.View;
import android.widget.RadioButton;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IResourceFinder;
/**
* Attribute adapter for handling attributes related to
* RadioButton.
*
* @author Akash Yadav
*/
public class RadioButtonAttrAdapter extends CompondButtonAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof RadioButton;
}
@Override
public boolean apply(IAttribute attribute, View view) {
// No special attributes for RadioButton
return super.apply(attribute, view);
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.view.View;
import android.widget.RadioButton;
import com.itsaky.inflater.IAttribute;
/**
* Attribute adapter for handling attributes related to
* RadioButton.
*
* @author Akash Yadav
*/
public class RadioButtonAttrAdapter extends CompondButtonAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof RadioButton;
}
@Override
public boolean apply(IAttribute attribute, View view) {
// No special attributes for RadioButton
return super.apply(attribute, view);
}
}
@@ -1,70 +1,69 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.view.View;
import android.widget.RelativeLayout;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.layoutinflater.adapters.android.view.ViewGroupAttrAdapter;
/**
* Attribute adapter for handling attributes related to
* RelativeLayout.
*
* @author Akash Yadav
*/
public class RelativeLayoutAttrAdapter extends ViewGroupAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof RelativeLayout;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final RelativeLayout relative = (RelativeLayout) view;
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "gravity" :
relative.setGravity(parseGravity(value));
break;
case "ignoreGravity" :
relative.setIgnoreGravity(parseId(value));
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.view.View;
import android.widget.RelativeLayout;
import com.itsaky.inflater.IAttribute;
import com.itsaky.inflater.adapters.android.view.ViewGroupAttrAdapter;
/**
* Attribute adapter for handling attributes related to
* RelativeLayout.
*
* @author Akash Yadav
*/
public class RelativeLayoutAttrAdapter extends ViewGroupAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof RelativeLayout;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final RelativeLayout relative = (RelativeLayout) view;
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "gravity" :
relative.setGravity(parseGravity(value));
break;
case "ignoreGravity" :
relative.setIgnoreGravity(parseId(value));
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
}
@@ -1,66 +1,65 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.view.View;
import android.widget.SeekBar;
import androidx.annotation.NonNull;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IResourceFinder;
/**
* Attribute adapter for handling attributes related to
* SeekBar.
*
* @author Akash Yadav
*/
public class SeekBarAttrAdapter extends AbsSeekBarAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof SeekBar;
}
@Override
public boolean apply(@NonNull IAttribute attribute, View view) {
final var seek = (SeekBar) view;
final var context = seek.getContext();
final var namespace = attribute.getNamespace();
final var name = attribute.getAttributeName();
final var value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "thumb":
seek.setThumb(parseDrawable(value, context));
break;
default:
handled = false;
break;
}
return handled;
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.view.View;
import android.widget.SeekBar;
import androidx.annotation.NonNull;
import com.itsaky.inflater.IAttribute;
/**
* Attribute adapter for handling attributes related to
* SeekBar.
*
* @author Akash Yadav
*/
public class SeekBarAttrAdapter extends AbsSeekBarAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof SeekBar;
}
@Override
public boolean apply(@NonNull IAttribute attribute, View view) {
final var seek = (SeekBar) view;
final var context = seek.getContext();
final var namespace = attribute.getNamespace();
final var name = attribute.getAttributeName();
final var value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "thumb":
seek.setThumb(parseDrawable(value, context));
break;
default:
handled = false;
break;
}
return handled;
}
}
@@ -1,83 +1,82 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.view.View;
import android.widget.Spinner;
import androidx.annotation.NonNull;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IResourceFinder;
/**
* Attribute adapter for handling attributes related to
* Spinner.
*
* @author Akash Yadav
*/
public class SpinnerAttrAdapter extends AbsSpinnerAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof Spinner;
}
@Override
public boolean apply(@NonNull IAttribute attribute, View view) {
final var spinner = (Spinner) view;
final var context = spinner.getContext();
final var dm = context.getResources().getDisplayMetrics();
final var namespace = attribute.getNamespace();
final var name = attribute.getAttributeName();
final var value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "dropDownHorizontalOffset":
spinner.setDropDownHorizontalOffset(parseDimension(value, 0, dm));
break;
case "dropDownVerticalOffset":
spinner.setDropDownVerticalOffset(parseDimension(value, 0, dm));
break;
case "dropDownWidth":
spinner.setDropDownWidth(parseDimension(value, 0, dm));
break;
case "gravity" :
spinner.setGravity(parseGravity(value));
break;
case "popupBackground" :
spinner.setPopupBackgroundDrawable(parseDrawable(value, context));
break;
default:
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.view.View;
import android.widget.Spinner;
import androidx.annotation.NonNull;
import com.itsaky.inflater.IAttribute;
/**
* Attribute adapter for handling attributes related to
* Spinner.
*
* @author Akash Yadav
*/
public class SpinnerAttrAdapter extends AbsSpinnerAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof Spinner;
}
@Override
public boolean apply(@NonNull IAttribute attribute, View view) {
final var spinner = (Spinner) view;
final var context = spinner.getContext();
final var dm = context.getResources().getDisplayMetrics();
final var namespace = attribute.getNamespace();
final var name = attribute.getAttributeName();
final var value = attribute.getValue();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "dropDownHorizontalOffset":
spinner.setDropDownHorizontalOffset(parseDimension(value, 0, dm));
break;
case "dropDownVerticalOffset":
spinner.setDropDownVerticalOffset(parseDimension(value, 0, dm));
break;
case "dropDownWidth":
spinner.setDropDownWidth(parseDimension(value, 0, dm));
break;
case "gravity" :
spinner.setGravity(parseGravity(value));
break;
case "popupBackground" :
spinner.setPopupBackgroundDrawable(parseDrawable(value, context));
break;
default:
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
}
@@ -1,235 +1,234 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.layoutinflater.adapters.android.widget;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.text.util.Linkify;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.blankj.utilcode.util.SizeUtils;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IResourceFinder;
import com.itsaky.layoutinflater.adapters.android.view.ViewAttrAdapter;
import java.util.regex.Pattern;
/**
* Adapter for handling attributes related to TextView.
*
* @author Akash Yadav
*/
public class TextViewAttrAdapter extends ViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof TextView;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final TextView text = (TextView) view;
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
final ViewGroup.LayoutParams params = view.getLayoutParams();
final Resources res = view.getResources();
final DisplayMetrics dm = res.getDisplayMetrics();
final Context ctx = view.getContext();
final Drawable[] drawables = text.getCompoundDrawables();
final Drawable[] drawablesRelative = text.getCompoundDrawablesRelative();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "autoLink" :
text.setAutoLinkMask(parseAutoLinkMask(value));
break;
case "drawableLeft" :
text.setCompoundDrawables(parseDrawable(value, ctx), drawables[1], drawables[2], drawables[3]);
break;
case "drawableTop" :
text.setCompoundDrawables(drawables[0], parseDrawable(value, ctx), drawables[2], drawables[3]);
break;
case "drawableRight" :
text.setCompoundDrawables(drawables[0], drawables[1], parseDrawable(value, ctx), drawables[3]);
break;
case "drawableBottom" :
text.setCompoundDrawables(drawables[0], drawables[1], drawables[2], parseDrawable(value, ctx));
break;
case "drawableStart" :
text.setCompoundDrawables(parseDrawable(value, ctx), drawablesRelative[1], drawablesRelative[2], drawablesRelative[3]);
break;
case "drawableEnd" :
text.setCompoundDrawables(drawablesRelative[0], drawablesRelative[1], parseDrawable(value, ctx), drawablesRelative[3]);
break;
case "drawablePadding" :
text.setCompoundDrawablePadding(parseDimension(value, 0, dm));
break;
case "ellipsize" :
text.setEllipsize(parseEllipsize(value));
break;
case "gravity" :
text.setGravity(parseGravity(value));
break;
case "hint" :
text.setHint(parseString(value));
break;
case "letterSpacing" :
text.setLetterSpacing(parseFloat(value));
break;
case "lineHeight" :
text.setLines(parseInteger(value, Integer.MAX_VALUE));
break;
case "linksClickable" :
text.setLinksClickable(parseBoolean(value));
break;
case "marqueeRepeatLimit" :
text.setMarqueeRepeatLimit(parseInteger(value, Integer.MAX_VALUE));
break;
case "maxLines" :
text.setMaxLines(parseInteger(value, Integer.MAX_VALUE));
break;
case "minLines" :
text.setMinLines(parseInteger(value, 1));
break;
case "singleLine" :
text.setSingleLine(parseBoolean(value));
break;
case "text" :
text.setText(parseString(value));
break;
case "textAllCaps" :
text.setAllCaps(parseBoolean(value));
break;
case "textColor" :
text.setTextColor(parseColor(value, ctx));
break;
case "textColorHint" :
text.setHintTextColor(parseColor(value, ctx));
break;
case "textSize" :
text.setTextSize(TypedValue.COMPLEX_UNIT_PX, parseDimension(value, SizeUtils.sp2px(14), dm));
break;
case "textStyle" :
text.setTypeface(text.getTypeface(), parseTextStyle(value));
break;
case "typeface" :
text.setTypeface(parseTypeface(value));
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
protected int parseTextStyle(@NonNull String value) {
final String[] splits = value.split(Pattern.quote("|"));
int mask = 0;
for (String split : splits) {
mask |= textStyleFor(split);
}
return mask;
}
protected int textStyleFor(@NonNull String split) {
switch (split) {
case "bold" :
return Typeface.BOLD;
case "italic" :
return Typeface.ITALIC;
case "normal" :
default :
return Typeface.NORMAL;
}
}
protected Typeface parseTypeface(@NonNull String value) {
switch (value) {
case "sans" :
return Typeface.SANS_SERIF;
case "serif" :
return Typeface.SERIF;
case "monospace" :
return Typeface.MONOSPACE;
case "normal" :
default :
return Typeface.DEFAULT;
}
}
protected TextUtils.TruncateAt parseEllipsize(@NonNull String value) {
switch (value) {
case "end" :
return TextUtils.TruncateAt.END;
case "start" :
return TextUtils.TruncateAt.START;
case "marquee" :
return TextUtils.TruncateAt.MARQUEE;
case "middle" :
return TextUtils.TruncateAt.MIDDLE;
case "none" :
default :
return null;
}
}
protected int parseAutoLinkMask(@NonNull String value) {
final String[] splits = value.split(Pattern.quote("|"));
int mask = 0;
for (String split : splits) {
mask |= autoLinkMaskFor (split);
}
return mask;
}
protected int autoLinkMaskFor(@NonNull String mask) {
switch (mask) {
case "all" :
return Linkify.ALL;
case "web" :
return Linkify.WEB_URLS;
case "phone" :
return Linkify.PHONE_NUMBERS;
case "map" :
return Linkify.MAP_ADDRESSES;
case "email" :
return Linkify.EMAIL_ADDRESSES;
case "none" :
default :
return 0;
}
}
}
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.inflater.adapters.android.widget;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.text.util.Linkify;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.blankj.utilcode.util.SizeUtils;
import com.itsaky.inflater.IAttribute;
import com.itsaky.inflater.adapters.android.view.ViewAttrAdapter;
import java.util.regex.Pattern;
/**
* Adapter for handling attributes related to TextView.
*
* @author Akash Yadav
*/
public class TextViewAttrAdapter extends ViewAttrAdapter {
@Override
public boolean isApplicableTo(View view) {
return view instanceof TextView;
}
@Override
public boolean apply(IAttribute attribute, View view) {
final TextView text = (TextView) view;
final String namespace = attribute.getNamespace();
final String name = attribute.getAttributeName();
final String value = attribute.getValue();
final ViewGroup.LayoutParams params = view.getLayoutParams();
final Resources res = view.getResources();
final DisplayMetrics dm = res.getDisplayMetrics();
final Context ctx = view.getContext();
final Drawable[] drawables = text.getCompoundDrawables();
final Drawable[] drawablesRelative = text.getCompoundDrawablesRelative();
if (!canHandleNamespace(namespace)) {
return false;
}
boolean handled = true;
switch (name) {
case "autoLink" :
text.setAutoLinkMask(parseAutoLinkMask(value));
break;
case "drawableLeft" :
text.setCompoundDrawables(parseDrawable(value, ctx), drawables[1], drawables[2], drawables[3]);
break;
case "drawableTop" :
text.setCompoundDrawables(drawables[0], parseDrawable(value, ctx), drawables[2], drawables[3]);
break;
case "drawableRight" :
text.setCompoundDrawables(drawables[0], drawables[1], parseDrawable(value, ctx), drawables[3]);
break;
case "drawableBottom" :
text.setCompoundDrawables(drawables[0], drawables[1], drawables[2], parseDrawable(value, ctx));
break;
case "drawableStart" :
text.setCompoundDrawables(parseDrawable(value, ctx), drawablesRelative[1], drawablesRelative[2], drawablesRelative[3]);
break;
case "drawableEnd" :
text.setCompoundDrawables(drawablesRelative[0], drawablesRelative[1], parseDrawable(value, ctx), drawablesRelative[3]);
break;
case "drawablePadding" :
text.setCompoundDrawablePadding(parseDimension(value, 0, dm));
break;
case "ellipsize" :
text.setEllipsize(parseEllipsize(value));
break;
case "gravity" :
text.setGravity(parseGravity(value));
break;
case "hint" :
text.setHint(parseString(value));
break;
case "letterSpacing" :
text.setLetterSpacing(parseFloat(value));
break;
case "lineHeight" :
text.setLines(parseInteger(value, Integer.MAX_VALUE));
break;
case "linksClickable" :
text.setLinksClickable(parseBoolean(value));
break;
case "marqueeRepeatLimit" :
text.setMarqueeRepeatLimit(parseInteger(value, Integer.MAX_VALUE));
break;
case "maxLines" :
text.setMaxLines(parseInteger(value, Integer.MAX_VALUE));
break;
case "minLines" :
text.setMinLines(parseInteger(value, 1));
break;
case "singleLine" :
text.setSingleLine(parseBoolean(value));
break;
case "text" :
text.setText(parseString(value));
break;
case "textAllCaps" :
text.setAllCaps(parseBoolean(value));
break;
case "textColor" :
text.setTextColor(parseColor(value, ctx));
break;
case "textColorHint" :
text.setHintTextColor(parseColor(value, ctx));
break;
case "textSize" :
text.setTextSize(TypedValue.COMPLEX_UNIT_PX, parseDimension(value, SizeUtils.sp2px(14), dm));
break;
case "textStyle" :
text.setTypeface(text.getTypeface(), parseTextStyle(value));
break;
case "typeface" :
text.setTypeface(parseTypeface(value));
break;
default :
handled = false;
break;
}
if (!handled) {
handled = super.apply(attribute, view);
}
return handled;
}
protected int parseTextStyle(@NonNull String value) {
final String[] splits = value.split(Pattern.quote("|"));
int mask = 0;
for (String split : splits) {
mask |= textStyleFor(split);
}
return mask;
}
protected int textStyleFor(@NonNull String split) {
switch (split) {
case "bold" :
return Typeface.BOLD;
case "italic" :
return Typeface.ITALIC;
case "normal" :
default :
return Typeface.NORMAL;
}
}
protected Typeface parseTypeface(@NonNull String value) {
switch (value) {
case "sans" :
return Typeface.SANS_SERIF;
case "serif" :
return Typeface.SERIF;
case "monospace" :
return Typeface.MONOSPACE;
case "normal" :
default :
return Typeface.DEFAULT;
}
}
protected TextUtils.TruncateAt parseEllipsize(@NonNull String value) {
switch (value) {
case "end" :
return TextUtils.TruncateAt.END;
case "start" :
return TextUtils.TruncateAt.START;
case "marquee" :
return TextUtils.TruncateAt.MARQUEE;
case "middle" :
return TextUtils.TruncateAt.MIDDLE;
case "none" :
default :
return null;
}
}
protected int parseAutoLinkMask(@NonNull String value) {
final String[] splits = value.split(Pattern.quote("|"));
int mask = 0;
for (String split : splits) {
mask |= autoLinkMaskFor (split);
}
return mask;
}
protected int autoLinkMaskFor(@NonNull String mask) {
switch (mask) {
case "all" :
return Linkify.ALL;
case "web" :
return Linkify.WEB_URLS;
case "phone" :
return Linkify.PHONE_NUMBERS;
case "map" :
return Linkify.MAP_ADDRESSES;
case "email" :
return Linkify.EMAIL_ADDRESSES;
case "none" :
default :
return 0;
}
}
}
@@ -15,7 +15,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater.impl;
package com.itsaky.inflater.impl;
import android.view.View;
@@ -23,10 +23,10 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.itsaky.androidide.utils.Logger;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.layoutinflater.IAttributeAdapter;
import com.itsaky.layoutinflater.IView;
import com.itsaky.layoutinflater.IViewGroup;
import com.itsaky.inflater.IAttribute;
import com.itsaky.inflater.IAttributeAdapter;
import com.itsaky.inflater.IView;
import com.itsaky.inflater.IViewGroup;
import java.util.ArrayList;
import java.util.HashSet;
@@ -15,16 +15,16 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater.impl;
package com.itsaky.inflater.impl;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import com.itsaky.layoutinflater.IAttributeAdapter;
import com.itsaky.layoutinflater.IView;
import com.itsaky.layoutinflater.IViewGroup;
import com.itsaky.inflater.IAttributeAdapter;
import com.itsaky.inflater.IView;
import com.itsaky.inflater.IViewGroup;
import java.util.ArrayList;
import java.util.List;
@@ -15,9 +15,9 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater.impl;
package com.itsaky.inflater.impl;
import com.itsaky.layoutinflater.IAttribute;
import com.itsaky.inflater.IAttribute;
import java.util.Objects;
@@ -15,10 +15,9 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater.impl;
package com.itsaky.inflater.impl;
import android.view.View;
import com.itsaky.layoutinflater.IViewGroup;
public class UiView extends BaseView {
@@ -15,14 +15,13 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater.impl;
package com.itsaky.inflater.impl;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.itsaky.layoutinflater.IView;
import com.itsaky.inflater.IView;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
@@ -17,7 +17,7 @@
**************************************************************************************/
package com.itsaky.androidide.ui.util;
import com.itsaky.layoutinflater.InflateException;
import com.itsaky.inflater.InflateException;
public class Preconditions {
@@ -15,7 +15,7 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.layoutinflater.util;
package com.itsaky.inflater.util;
import com.blankj.utilcode.util.FileIOUtils;
import com.blankj.utilcode.util.FileUtils;
@@ -71,7 +71,7 @@ public class ValuesTable {
read.whenComplete((__, th) -> {
if (th != null) {
LOG.error(BaseApplication.getBaseInstance().getString(com.itsaky.layoutinflater.R.string.err_cannot_read_values), th);
LOG.error(BaseApplication.getBaseInstance().getString(com.itsaky.inflater.R.string.err_cannot_read_values), th);
} else {
initialized = true;
}
@@ -9,7 +9,7 @@ import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;
import com.itsaky.layoutinflater.R;
import com.itsaky.inflater.R;
import com.sdsmdg.harjot.vectormaster.models.ClipPathModel;
import com.sdsmdg.harjot.vectormaster.models.GroupModel;
import com.sdsmdg.harjot.vectormaster.models.PathModel;