Giter VIP home page Giter VIP logo

Comments (19)

manumaticx avatar manumaticx commented on June 7, 2024

Hi @IvoPereira

Are you using Titanium 4.0.X ?

Maybe it's a bug. Your code looks good. I wonder if providing a density-independent image resource would solve this because the same thing is working in the example. I'd need to change how to resolve the image then. Could be worth a try.

from actionbarextras.

IvoPereira avatar IvoPereira commented on June 7, 2024

Hello @manumaticx,

I'm using Titanium Studio v. 3.4.1.201410281727 and Titanium SDK 3.5.1.GA.

I'm testing on a 4.2.2 device.

That snippet is working in the example, however the example does not use MVC and its folder structure (controllers, models, views), and is only based in an app.js file at root. Possibly may be that related to the problem locating the files?

As soon as I get office I will try with some density-independent image resources, and I'll let you know the result.

Thanks.

from actionbarextras.

manumaticx avatar manumaticx commented on June 7, 2024

There shouldn't be a difference when using Alloy because Alloy creates a classic project with the same folder structure.

I've just tested an fixed-density image and I do get the same error:
ActionbarextrasModule: (main) [2,3204] Couldn't resolve /images/icon_menu.png

I recommend you using res-mdpi, res-hdpi, res-xhdpi, res-xxhdpi resources for icons. This will solve your issue.

But I also will try to resolve resources within the /images/ directory.

from actionbarextras.

IvoPereira avatar IvoPereira commented on June 7, 2024

Hey @manumaticx,

Thanks for the feedback. I was trying to follow your suggestion, so I've put the image inside all of the folders you mentioned, using the path:
/PROJECT_NAME/app/assets/images/res-hdpi
/PROJECT_NAME/app/assets/images/res-mdpi
/PROJECT_NAME/app/assets/images/res-xhdpi
/PROJECT_NAME/app/assets/images/res-xxhdpi

However, it seemed to change something in the location where it was looking for the file, but it was still not able to find it (and the files were moved to Resources folder as expected).

Couldn't resolve

from actionbarextras.

manumaticx avatar manumaticx commented on June 7, 2024

Hm, I'm not sure what's going on here!

I've just created a fresh new Alloy app with Titanium 3.5.1.GA and ABX 1.6.3 to test this. But I am not able to reproduce this error.

The resource path in your log is also very strange. It should actually log the path that was passed to setHomeAsUpIcon, not the resolved path. I will have to do some more testing in order to fix this. Hopefully I can come up with a solution here.

If you find anything that could help me to find the reason for this, please let me know.

from actionbarextras.

IvoPereira avatar IvoPereira commented on June 7, 2024

I'll be happy to assist you debugging the problem @manumaticx.

I've tried with a live device LG-G2 using Ti-Shadow (and without it - through TitaniumStudio directly).

The image I'm using is this one: http://i.imgur.com/AR7zIc8.png

Let me know if you need anything else.

from actionbarextras.

ndastur avatar ndastur commented on June 7, 2024

@manumaticx strange but I get a similar error

[ERROR] ActionbarextrasModule: (main) [1441,2453] Couldn't resolve ic_menu_black_24dp.png

and the ic_menu_black_24dp.png is in app/assets/android. Also tried with a / prefix and still not found

from actionbarextras.

manumaticx avatar manumaticx commented on June 7, 2024

@ndastur as stated in the above comment I'd recommend using res-mdpi, res-hdpi, res-xhdpi, res-xxhdpi - this probably solves the error

from actionbarextras.

ndastur avatar ndastur commented on June 7, 2024

@manumaticx thanks. I have been looking into the code and I think it is because you are using the getResourceId helper function. Looking deeper into the Appc source this seems to be a deeper level function.

Looking at how Appc resolve the setIcon in their actionbar implementation
https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/proxy/ActionBarProxy.java
I think some higher level SDK helper function is required.

from actionbarextras.

ndastur avatar ndastur commented on June 7, 2024

Specific bit of code that might help is

private Drawable getDrawableFromUrl(String url)
    {
        TiUrl imageUrl = new TiUrl((String) url);
        TiFileHelper tfh = new TiFileHelper(TiApplication.getInstance());
        return tfh.loadDrawable(imageUrl.resolve(), false);
    }

from actionbarextras.

manumaticx avatar manumaticx commented on June 7, 2024

@ndastur Thank you for this. Do you think there is a chance that you could build the module and test this?

from actionbarextras.

ChanakyaSrinivas avatar ChanakyaSrinivas commented on June 7, 2024

Unable to setHomeAsUpIcon with titanium 4.0.X

Can any one help me out.

from actionbarextras.

manumaticx avatar manumaticx commented on June 7, 2024

@ChanakyaSrinivas Hi there, I need some more info! This is not considered as a bug until you instruct me how to reproduce the issue.

from actionbarextras.

ChanakyaSrinivas avatar ChanakyaSrinivas commented on June 7, 2024

Environments:
Tiatanium sdk 4.1.0
MVC Alloy 1.6.2

code:
mytest

output:

output

Not getting any error related to setHomeAsUpIcon.
But Icon is not visible left side corner.

from actionbarextras.

manumaticx avatar manumaticx commented on June 7, 2024

@ChanakyaSrinivas try adding actionBar.displayHomeAsUp = true; before the line where you set the icon

if (actionBar){
  actionBar.displayHomeAsUp = true;
  abx.setTitle("Example");
  abx.setHomeAsUpIcon("/images/drawericon.png");
}

from actionbarextras.

ChanakyaSrinivas avatar ChanakyaSrinivas commented on June 7, 2024

As per your suggestion changed my code.
It's working fine.

from actionbarextras.

manumaticx avatar manumaticx commented on June 7, 2024

Great. Nice to hear.

So I think I can close this issue here since setHomeAsUpIcon works as expected and the behavior described in the original question is not reproducible.

Please feel free to reopen if you can provide test code to reproduce this issue.

from actionbarextras.

ChanakyaSrinivas avatar ChanakyaSrinivas commented on June 7, 2024

Hi All,

Module is not working for Titanium SDK 5.3.1GA and Alloy 1.8.7

Environments:
Npm Version = 2.11.3
Titanium CLI Version = 5.0.8
Titanium SDK Version = 5.3.1.GA
Alloy Version = 1.8.7

Error:

[ERROR] : TiApplication: java.lang.ClassCastException: org.appcelerator.titanium.TiActivity cannot be cast to android.support.v7.app.ActionBarActivity [ERROR] : TiApplication: at com.alcoapps.actionbarextras.ActionbarextrasModule.getActionBar(ActionbarextrasModule.java:117) [ERROR] : TiApplication: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetHomeAsUpIcon(ActionbarextrasModule.java:523) [ERROR] : TiApplication: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:175) [ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:98) [ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:148) [ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5417) [ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Native Method) [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

from actionbarextras.

manumaticx avatar manumaticx commented on June 7, 2024

@ChanakyaSrinivas Try updating the Module

from actionbarextras.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.