use of com.codename1.ui.plaf.DefaultLookAndFeel in project CodenameOne by codenameone.
the class BlackBerryImplementation method installNativeTheme.
/**
* Installs the native theme, this is only applicable if hasNativeTheme() returned true. Notice that this method
* might replace the DefaultLookAndFeel instance and the default transitions.
*/
public void installNativeTheme() {
if (nativeThemeAvailable) {
try {
InputStream is = getResourceAsStream(getClass(), "/blackberry_theme.res");
Resources r = Resources.open(is);
UIManager.getInstance().setThemeProps(r.getTheme(r.getThemeResourceNames()[0]));
is.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
use of com.codename1.ui.plaf.DefaultLookAndFeel in project CodenameOne by codenameone.
the class IOSImplementation method installNativeTheme.
/**
* Installs the native theme, this is only applicable if hasNativeTheme() returned true. Notice that this method
* might replace the DefaultLookAndFeel instance and the default transitions.
*/
public void installNativeTheme() {
try {
Resources r;
if (iosMode.equals("modern")) {
r = Resources.open("/iOS7Theme.res");
Hashtable tp = r.getTheme(r.getThemeResourceNames()[0]);
if (!nativeInstance.isIOS7()) {
tp.put("TitleArea.padding", "0,0,0,0");
}
UIManager.getInstance().setThemeProps(tp);
return;
}
if (iosMode.equals("auto")) {
if (nativeInstance.isIOS7()) {
r = Resources.open("/iOS7Theme.res");
} else {
r = Resources.open("/iPhoneTheme.res");
}
UIManager.getInstance().setThemeProps(r.getTheme(r.getThemeResourceNames()[0]));
return;
}
r = Resources.open("/iPhoneTheme.res");
UIManager.getInstance().setThemeProps(r.getTheme(r.getThemeResourceNames()[0]));
} catch (IOException ex) {
ex.printStackTrace();
}
}
use of com.codename1.ui.plaf.DefaultLookAndFeel in project CodenameOne by codenameone.
the class Label method initComponentImpl.
/**
* {@inheritDoc}
*/
void initComponentImpl() {
super.initComponentImpl();
UIManager manager = getUIManager();
LookAndFeel lf = manager.getLookAndFeel();
if (hasFocus()) {
if (lf instanceof DefaultLookAndFeel) {
((DefaultLookAndFeel) lf).focusGained(this);
}
}
// into the container
if (isTickerEnabled() && isTickerRunning() && !isCellRenderer()) {
getComponentForm().registerAnimatedInternal(this);
}
checkAnimation();
if (maskName != null && mask == null) {
setMask(UIManager.getInstance().getThemeMaskConstant(maskName));
}
if (getIcon() != null) {
getIcon().lock();
}
}
use of com.codename1.ui.plaf.DefaultLookAndFeel in project CodenameOne by codenameone.
the class AndroidImplementation method installNativeTheme.
/**
* Installs the native theme, this is only applicable if hasNativeTheme()
* returned true. Notice that this method might replace the
* DefaultLookAndFeel instance and the default transitions.
*/
public void installNativeTheme() {
hasNativeTheme();
if (nativeThemeAvailable) {
try {
InputStream is;
if (android.os.Build.VERSION.SDK_INT < 14 && !isTablet() || Display.getInstance().getProperty("and.hololight", "false").equals("true")) {
is = getResourceAsStream(getClass(), "/androidTheme.res");
} else {
is = getResourceAsStream(getClass(), "/android_holo_light.res");
}
Resources r = Resources.open(is);
Hashtable h = r.getTheme(r.getThemeResourceNames()[0]);
h.put("@commandBehavior", "Native");
UIManager.getInstance().setThemeProps(h);
is.close();
Display.getInstance().setCommandBehavior(Display.COMMAND_BEHAVIOR_NATIVE);
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
Aggregations