Fix Androud glide issue, GlideApp errors in android studio - android-glide

I have a java class in my app PostViewHolder and I am trying to load an image using Glide but I get error, I am not the original developer of the code, it appears it was developed 3 years ago and so i don't know how best to explain.
I have this code line in my PostViewHolder
Imageutil.loadImageCenterCrop(GlideApp.with(baseActivity), imageUrl, postImageView, width, height);
For this line, GlideApp.with(baseActivity) is underlined red with error saying Required type: GlideRequests, provided:.........
I tried to change it to Glide.with and it shows cannot resolve symbol 'Glide'
On my project Glide is extending a class to load image with GlideApp
#GlideModule
public class MyAppGlideModule extends AppGlideModule {
#Override
public void registerComponents(Context context, Glide glide, Registry registry)
{ registry.prepend(String.class ByteBuffer.class, new Base64ModelLoadeeFactory();}
}
I will appreciate any help to get rid of the error Required type:GlideRequests
How to make this code work Imageutil.loadImageCenterCrop(GlideApp.with(baseActivity), imageUrl, postImageView, width, height);

Short and simple way would be Glide.with(context).load(imgUrl).into(imgView)

Related

Support content effect (highlight, lift and hover) for mouse and trackpad on iPadOS 13.4

I have implemented UIButton as custom renderer in Xamarin.Forms project. Is there a sample project to demonstrate how to implement content effects like highlight using UIPointerInteraction class? Specifically, is there an equivalent for this sample code in Xamarin? Integrating Pointer Interactions into Your iPad App
After doing some research and I did not find a sample project about UIPointerInteraction.
While I think you can use it in the latest Xamarin.iOS 13.6.0 as those classes has been added to Xamarin.iOS in this version:
new-type-uikituipointerregion
new-type-uikituipointerregionrequest
I wrote a simple example about how to initialize UIPointerInteraction :
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Perform any additional setup after loading the view
pointerDelegate myDelegate = new pointerDelegate();
UIPointerInteraction interPointer = new UIPointerInteraction(myDelegate);
}
public class pointerDelegate : UIPointerInteractionDelegate {
public override void WillEnterRegion(UIPointerInteraction interaction, UIPointerRegion region, IUIPointerInteractionAnimating animator)
{
base.WillEnterRegion(interaction, region, animator);
}
public override void WillExitRegion(UIPointerInteraction interaction, UIPointerRegion region, IUIPointerInteractionAnimating animator)
{
base.WillExitRegion(interaction, region, animator);
}
}
Feel free to ask me if you have any difficulty when transferring swift/OC code from native iOS to C# in Xamarin.iOS.

Manually Open custom inspector for serializable object

I have a window editor that holds nodes. I would like to open a custom inspector when one of these nodes is selected. The node class is a custom serializable class. Is this possible?.
It seems that custom inspectors can be created manually through the Editor.CreateEditor method but can't see how to let it appear docked like an usual inspector in the unity inspector window.
I would like to achieve the same behaviour that we have when we select a gameobject in sceneview that inmediately show properties for the object (Components, etc...) in the unity inspector.
Cheers
As I'm not sure what you're asking, here are multiple different solutions;
Selection
If you just want your nodes to become the focus of the hierarchy, then in your custom window's OnGUI method, use the code below;
[CustomEditor(typeof(NodeManager))]
public class NodeManager : EditorWindow
{
private static NodeManager window;
private Node[] m_nodes;
[MenuItem("Custom Windows/Node Inspector")]
public static void Init()
{
if(window == null)
window = GetWindow<NodeManager>("Node Manager", true, typeof(SceneView));
}
public void OnGUI()
{
m_nodes = GameObject.FindObjectsOfType<Node>();
foreach(Node node in m_nodes)
{
GUILayout.BeginHorizontal();
{
GUILayout.Label(node.name);
if (GUILayout.Button("Select"))
Selection.objects = new Object[] { node.gameObject };
}
GUILayout.EndHorizontal();
}
}
}
This adds a Button for each object in your custom window view, that will then select that object in the hierarchy.
Auto-Docking
I originally found the second response to this question, which goes into the details of parameters of the GetWindow method, and with this you can clearly see how to dock the window (I've converted it from JS to C# below).
(I looked fairly extensively in UnityEditor and UnityEditorInternal namespaces but couldn't find the Hierarchy or the Inspector).
GetWindow<T>(string title, bool focus, params System.Type[] desiredDockNextTo)
Which we can write for this example as;
EditorWindow.GetWindow<NodeInspector>("Node Test", true, typeof(SceneView));
This example docks the windows next to the SceneView window. This functionality can be combined with a custom inspector's OnInspectorGUI method, to automatically launch the custom node window, if it's not already open.
[CustomEditor(typeof(Node))]
public class NodeInspector : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
NodeManager.Init();
}
}
Sorry if this isn't what you are looking for, if it's not then please give more details and I will amend my answer to better suit the question.
Hope this helped.
Has a possibility, you can make a custom ScriptableObject and Custom Editor for It, and when open the node inspector, just find a instance of the scriptable object and use Selection.selectedObject = scriptableObject, and in the custom editor, make a static field called 'editor' to draw inside.
It will work.

JavaFX - Extends Stage, but inherited method is undefined

I'm working with JavaFX using Java 8 and I have a class where Stage is extended. I got this code from another student and it works fine for everyone else, but for me I get an error on setAlwaysOnTop. It says the method is undefined, but it is inherited from Stage. It seems to be only that method which is giving this error.
It would be easier with an image, but I can't post images yet so I had to just copy-paste the relevant code:
public class NotificationWindow extends Stage {
public void showNotification(){
Rectangle2D screenBounds=Screen.getPrimary().getVisualBounds();
this.setAlwaysOnTop(true); //Error here
this.setX(screenBounds.getMaxX()-scene.getWidth());
this.setY(screenBounds.getMaxY()-scene.getHeight());
this.show();
}
}
The alwaysOnTop property was introduced in JavaFX 8 update 20. So you are probably using an earlier version. Update to the latest JavaFX version and it should recognize the method.

Make JavaFx application Fullscreen OnClick

Hello i am making a web browser in javafx and i want to make it fullscreen when user clicks on Fullscreen button. I tried the below given code but unfortunately it is giving error.
Fullscreen.setOnAction(new EventHandler<ActionEvent>() {
#Override
public void handle(ActionEvent event) {
primaryStage.setFullScreen(true); // here it gives error "cannot find variable primaryStage"
}
});
**I know that this doesn't follow the basics of java but i didn't find another way of implementing it.
Kindly help :)
Assuming Fullscreen is a button, just get the stage it's in with
((Stage)Fullscreen.getScene().getWindow()).setFullScreen(true);

Flex PlotChart zoom error in findDataPoints()

I came across this great tutorial on how to zoom into a chart by drawing a rectangle in a LineChart to zoom into it (http://blog.ninjacaptain.com/2010/03/flex-chart-zoom-window/) but i'm trying to apply it to a PlotChart instead and i'm having issues trying to get the DataTips showing with the following error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.charts.series::PlotSeries/findDataPoints()[E:\dev\4.5.1\frameworks\projects\charts\src\mx\charts\series\PlotSeries.as:961]
at mx.charts.chartClasses::ChartBase/findDataPoints()[E:\dev\4.5.1\frameworks\projects\charts\src\mx\charts\chartClasses\ChartBase.as:2069]
at mx.charts.chartClasses::ChartBase/mouseClickHandler()[E:\dev\4.5.1\frameworks\projects\charts\src\mx\charts\chartClasses\ChartBase.as:4823]
The link mentioned about extending the LineChartSeries and override the findDataPoints() function, but after trying to doing the same for extending PlotSeries.as, sortOnXField seems to be undefined and I don't have access to the PlotSeries.as since it is in a swc.
Has anyone tried applying the following to a PlotChart instead and got the DataTips to show? What was the override function in the findDataPoints()?
Thanks
Some days ago I had the same problem with PieSeries.
I have not found yet why '_renderData.filteredCache' is null in 'filterDataPoints' function, but meanwhile I have resolved the problem extending PieSeries Class this way:
package com.eque.report.model {
import mx.charts.series.PieSeries;
public class MyPieSeries extends PieSeries {
public function MyPieSeries () {
super();
}
/**
* 'findDataPoints' function has been overriden in order to prevent
* '_renderData.filteredCache' is null.
*/
override public function findDataPoints(x:Number, y:Number, sensitivity:Number):Array {
if (renderData.filteredCache == null) {
renderData.filteredCache = [];
}
return super.findDataPoints(x, y, sensitivity);
}
}
}
I hope it could help you
If you're asking about how to solve the "filterDataPoints" issue in accessing chart points, you just have to create you own Series class, copy-paste the code from PlotSeries in it and change whatever fails on runtime. What kind of error do you get ?

Resources