Make custom item in UIActivityViewController icon colorful? - ios6

I follow the steps in How can I create a custom UIActivity in iOS? It works as expected. It looks like iOS force a metallic look&feel for all custom icons as well as its own "Bookmark", "Print", etc. Anyway to make my icon colorful?

As of iOS 6, it is not possible to do this.
All color data for the UIImage that is returned by UIActivity's activityImage method will be ignored.

In iOS 10, set the activityCategory class property to .share. This will cause the activity icon to appear in color in the top row of the UIActivityViewController.
In your UIActivity subclass:
In iOS 10, set the activityCategory class property to .share. This will cause the activity icon to appear in color in the top row of the UIActivityViewController.
In your UIActivity subclass:
class MyCustomActivity: UIActivity
{
...
override open class var activityCategory: UIActivityCategory
{
get
{
return UIActivityCategory.share;
}
}
...
}

Related

codename one how to add a badge to the sideMenu Icon in toolbar

how can I add a budge to that SideMenu Icon
mainToolbar.addComponentToSideMenu(avatarBox);
mainToolbar.addMaterialCommandToSideMenu(" Home", FontImage.MATERIAL_HOME, e -> {
ManagementDashboard mdas = new ManagementDashboard(this);
mdas.Home();
});
The questions is a bit vague and I am not sure that i understand what you are asking, but in my experience, the only way to customize the toolbar to do anything beyond what the out-of-the-box toolbars methods offer is to use setTitleComponent and add your own custom container to your toolbar. The downside of this is that you will have to redesing a lot of your toolbars as you will be basically creating them again from scratch. You can center a new container with setTitleComponent, override its calcPreferredSize to stretch it across the entire toolbar horizontally, and stick stuff in it as you would in any Container (use any Layout, etc)
Another way of achieving your goal would be to extend the Toolbar class and manually change things within it. But the Toolbar class is quite heavy and you might spend much more time trying to figure out what to change than by using the first method
Method #1 sample code:
//stick stuff in this container to create your own toolbar
Container titleContainer = new Container(new BorderLayout()) {
#Override
protected Dimension calcPreferredSize() {
Dimension original = super.calcPreferredSize();
return new Dimension(Display.getInstance().getDisplayWidth(), original.getHeight());
}
};
form.getToolbar().setTitleComponent(titleContainer);
Here is an example of what could be achieved if you go this route (pretty much anything):

Change CodenameOne Accordion Icon UIID

How do you change the UIID for the openIcon and closeIcon on a CodenameOne Accordion? It does not appear that there is any method available to do this.
What I am ultimately trying to do is to change the color of the material icon being used for the openIcon/closeIcon in one instance of an Accordion component. I have tried to do this a dozen different ways with no luck. I have been able to change the UIID of the accordion container itself, the header, and the content, but not the > icon.
I realize that I could create a > icon of the desired color and then use setCloseIcon/setOpenIcon to assign it. However, I would prefer to use the material icon, and those get their color from the UIID.
I see in the CN1 source that arrow.setUIID("AccordionArrow"); appears to be used in the AccordionContent class. However defining an AccordionArrow UIID in the theme builder does not appear to make a difference either.
You can customize the material icons programmatically. Create below method and reuse it where necessary.
public static FontImage materialIcon(char charCode, float size, int color) {
Font fnt = Font.createTrueTypeFont("native:MainLight", "native:MainLight").derive(CN.convertToPixels(size), Font.STYLE_PLAIN);
Style s = new Style(color, 0, fnt, (byte) 0);
FontImage fm = FontImage.createMaterial(charCode, s);
return fm;
}
//Change material icon, size and color as appropriate
accordion.setOpenIcon(materialIcon(FontImage.MATERIAL_ARROW_DROP_DOWN, 4, 0x4D5052));
accordion.setCloseIcon(materialIcon(FontImage.MATERIAL_ARROW_DROP_UP, 4, 0x4D5052));

Back button in statusbar

I don't need toolbar, title and all that. But I need back button (back button icon with a string back to Home). There is a status bar in iOS. Can I put back btn with icon and text in statusbar? I have seen it in fb. If I go to messenger from fb, back to facebook is in the status bar with time battery icons etc. Can we do that in codenameone?
Back button in status bar (not in title bar) in iOS
What I have done so far. I think this is similar to what have been suggested in the answer. It works in android but in iOS I want to keep the back btn in the status bar with time, battery icons etc.
t = new Toolbar();
t.setUIID("TitleAreaa");
f.setToolBar(t);
Style s = UIManager.getInstance().getComponentStyle("Button");
s.setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM));
Image backtoRTN = FontImage.createMaterial(FontImage.MATERIAL_ARROW_BACK, s);
back = new Command("Back to RTN", backtoRTN) {
#Override
public void actionPerformed(ActionEvent evt) {
showForm("Main", this);
}
};
back.putClientProperty("uiid", "BacktoRTN");
f.setBackCommand(back);
t.addCommandToLeftBar(back);
The right thing to do here is something similar to what we do in this demo
Notice that the smiley is part of the UI and not part of the title...
The trick for doing this is simple override this method in your Form:
#Override
protected void initGlobalToolbar() {
Toolbar tb = new Toolbar(true);
tb.setUIID("Container");
setToolbar(tb);
getTitleArea().setUIID("Container");
}
That creates a toolbar that is layered (floats on top of the UI). Setting it to Container UIID makes it invisible.

Extjs.form.field.Trigger with a help icon

Is there a built-in icon and class for making a trigger with a help icon (like there is a class 'x-form-clear-trigger' for a trigger with a delete icon)?
More general: is somewhere in the extjs documentation a list of predefined styles for the trigger field type?
Native ExtJS have this four possible trigger class (list you can find in the first comment on triggerCls documentation):
x-form-clear-trigger // the X icon
x-form-search-trigger // the magnifying glass icon
x-form-trigger // the down arrow (default for combobox) icon
x-form-date-trigger // the calendar icon (just in case)
Native class for help icon does not exists, but you can define your own css class and use it as triggerCls

Present Modal View in iOS 6

I want to display a modal view but I have two problems:
There is no presentModalViewController in iOS 6 and I have to use presentViewController which is just display my second ViewController like a modal segue not a modal window without full screen option,
My second problem is how can I show the modal window from UICollectionViewController. I tried to use presentViewController but it just works with ViewController not CollectionViewController.
The best example of what I want to do is this (Instagram). How they made this modal window? Is it because it's still working with older iOS versions and it's not iOS 6 yet? Or there is another way to display modal window like this from UICollectionViewController?
Thanks
If I understood you correctly what you are trying to achieve is to present one of your ViewControllers over the parent and still see the parent ViewController in the background.
First solution:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"MainStoryboard" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:#"SecondViewController"];
vc.view.backgroundColor = [UIColor clearColor];
self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext; //self.modalPresentationStyle might do a better job here
[self presentViewController:vc animated:NO completion:nil];
Make sure your SecondViewController content is smaller than your current ``ViewController` and that you can see the background color of it in StoryBoard \ xib. The background color will be clear and will create the transparency effect.
Second Solution:
Create a Container (iOS 6 and up if you are planning to use the Storyboard IB, lower than that will let you create Containers but only progrematicly).
Set the container size 3/4 of the parent size and connect the second viewcontroller to it. Instead of segueing \ pushing to your second viewcontroller you can just
myContainer.alpha = 1;
to show it on screen.
I would take a look at the docs for UIContainerView which is used for displaying a view controller as a child of another view controller in a similar way to a non-fullscreen modal presentation.
As you are saying that presentViewController is only works with UIViewController not UICollectionViewController.
Then simply import UIViewController class in header file of CollectionViewController as displayed below:
#import <UIKit/UIKit.h>
#class UIViewController;
#interface MyCVController : UICollectionViewController
#end

Resources