I am using Coolreader as an epubviewer, and it is working fine till kitkat, but when i installed the same in Lollypop, chinese characters are showing as '?'. I went through the Sourcecode of the coolreader application and got this page
I cannot post that link here but i will post the code here
private boolean applyDefaultFont(Properties props, String propName, String defFontFace) {
String currentValue = props.getProperty(propName);
boolean changed = false;
if (currentValue == null) {
currentValue = defFontFace;
changed = true;
}
if (!isValidFontFace(currentValue)) {
if (isValidFontFace("Droid Sans"))
currentValue = "Droid Sans";
else if (isValidFontFace("Roboto"))
currentValue = "Roboto";
else if (isValidFontFace("Droid Serif"))
currentValue = "Droid Serif";
else if (isValidFontFace("Arial"))
currentValue = "Arial";
else if (isValidFontFace("Times New Roman"))
currentValue = "Times New Roman";
else if (isValidFontFace("Droid Sans Fallback"))
currentValue = "Droid Sans Fallback";
else {
String[] fontFaces = Engine.getFontFaceList();
if (fontFaces != null)
currentValue = fontFaces[0];
}
changed = true;
}
if (changed)
props.setProperty(propName, currentValue);
return changed;
}
public boolean fixFontSettings(Properties props) {
boolean res = false;
res = applyDefaultFont(props, ReaderView.PROP_FONT_FACE, DeviceInfo.DEF_FONT_FACE) || res;
res = applyDefaultFont(props, ReaderView.PROP_STATUS_FONT_FACE, DeviceInfo.DEF_FONT_FACE) || res;
res = applyDefaultFont(props, ReaderView.PROP_FALLBACK_FONT_FACE, "Droid Sans Fallback") || res;
return res;
}
in line 1403 to 1444' I found something related to fonts, they have hard coded 5 fonts and below they have set '"Droid Sans Fallback " as default fallback font. I inspected /system/fonts in my emulator working in 5.1 and found out even if there is "Droid Sans Fallback" and other fonts are there only these fonts are coming in the applications font selector
fonts in /systems/fonts in 5.1
cosmic gothic SC
comming soon
cutive mono
Dancing script
Droid sans mono
motoyalmaru
nanumgothic
noto sans myanmar
noto sans myanmar UI
noto serif
roboto
Roboto condensed
fonts 4.4.4 in systems/fonts
Droid Naskh Shift Alt
Droid Sans Fallback
Droid sans mono
droid serif
Motoyalmaru
NamumGothic
Padauk book
Roboto
Roboto Condensed
Now see my observations, in 4.4.4, I tried all the fonts and in all the fonts the chinese characters are loading correctly
In 5.1.0 I tried all the available fonts but chinese characters are not loading in any of it, always ?
Then i took a copy of Droid Sans Fallback from 4.4.4 and pasted it in system/fonts in 5.1 then the droid sans fallback font appeard in font list of Coolreader, before , even though it exixted in system/fonts of 5.1, it was not appearing in the fonts list of coolreader. Then i selected it and i could see chinese characters.
My question is in 4.4.4 all the fonts are loading chinese, but in 5.1.0, even though there are more fonts in the list none are loading chinese, So it must be something else which is causing the problem.
I tired another reader called fb reader and it is showing chinese the funny part is that it has got ont 3 fonts in its fontslist, Droid sans, droid serif and droid mono.
I almost created an app using cool reader and the same thing is haunting me please help
Is lollypop no compactable with chinese in epub reader
:crying::crying:
mukundzg said:
I am using Coolreader as an epubviewer, and it is working fine till kitkat, but when i installed the same in Lollypop, chinese characters are showing as '?'. I went through the Sourcecode of the coolreader application and got this page
I cannot post that link here but i will post the code here
private boolean applyDefaultFont(Properties props, String propName, String defFontFace) {
String currentValue = props.getProperty(propName);
boolean changed = false;
if (currentValue == null) {
currentValue = defFontFace;
changed = true;
}
if (!isValidFontFace(currentValue)) {
if (isValidFontFace("Droid Sans"))
currentValue = "Droid Sans";
else if (isValidFontFace("Roboto"))
currentValue = "Roboto";
else if (isValidFontFace("Droid Serif"))
currentValue = "Droid Serif";
else if (isValidFontFace("Arial"))
currentValue = "Arial";
else if (isValidFontFace("Times New Roman"))
currentValue = "Times New Roman";
else if (isValidFontFace("Droid Sans Fallback"))
currentValue = "Droid Sans Fallback";
else {
String[] fontFaces = Engine.getFontFaceList();
if (fontFaces != null)
currentValue = fontFaces[0];
}
changed = true;
}
if (changed)
props.setProperty(propName, currentValue);
return changed;
}
public boolean fixFontSettings(Properties props) {
boolean res = false;
res = applyDefaultFont(props, ReaderView.PROP_FONT_FACE, DeviceInfo.DEF_FONT_FACE) || res;
res = applyDefaultFont(props, ReaderView.PROP_STATUS_FONT_FACE, DeviceInfo.DEF_FONT_FACE) || res;
res = applyDefaultFont(props, ReaderView.PROP_FALLBACK_FONT_FACE, "Droid Sans Fallback") || res;
return res;
}
in line 1403 to 1444' I found something related to fonts, they have hard coded 5 fonts and below they have set '"Droid Sans Fallback " as default fallback font. I inspected /system/fonts in my emulator working in 5.1 and found out even if there is "Droid Sans Fallback" and other fonts are there only these fonts are coming in the applications font selector
fonts in /systems/fonts in 5.1
cosmic gothic SC
comming soon
cutive mono
Dancing script
Droid sans mono
motoyalmaru
nanumgothic
noto sans myanmar
noto sans myanmar UI
noto serif
roboto
Roboto condensed
fonts 4.4.4 in systems/fonts
Droid Naskh Shift Alt
Droid Sans Fallback
Droid sans mono
droid serif
Motoyalmaru
NamumGothic
Padauk book
Roboto
Roboto Condensed
Now see my observations, in 4.4.4, I tried all the fonts and in all the fonts the chinese characters are loading correctly
In 5.1.0 I tried all the available fonts but chinese characters are not loading in any of it, always ?
Then i took a copy of Droid Sans Fallback from 4.4.4 and pasted it in system/fonts in 5.1 then the droid sans fallback font appeard in font list of Coolreader, before , even though it exixted in system/fonts of 5.1, it was not appearing in the fonts list of coolreader. Then i selected it and i could see chinese characters.
My question is in 4.4.4 all the fonts are loading chinese, but in 5.1.0, even though there are more fonts in the list none are loading chinese, So it must be something else which is causing the problem.
I tired another reader called fb reader and it is showing chinese the funny part is that it has got ont 3 fonts in its fontslist, Droid sans, droid serif and droid mono.
I almost created an app using cool reader and the same thing is haunting me please help
Is lollypop no compactable with chinese in epub reader
:crying::crying:
Click to expand...
Click to collapse
It seems someone here: http://forum.xda-developers.com/google-nexus-5/help/japanese-fonts-android-5-0-lollipop-t2939463
had a similar problem and solved it. See if this helps
But it needs root privilages right?
GokulNC said:
It seems someone here: http://forum.xda-developers.com/google-nexus-5/help/japanese-fonts-android-5-0-lollipop-t2939463
had a similar problem and solved it. See if this helps
Click to expand...
Click to collapse
I need to fix the problem without rooting the device. Is there any way?
mukundzg said:
I need to fix the problem without rooting the device. Is there any way?
Click to expand...
Click to collapse
I guess there's no other way for the moment without rooting.
Why do you hesitate to root your phone?
Nothing wrong will happen until you do it right
I already did that
GokulNC said:
I guess there's no other way for the moment without rooting.
Why do you hesitate to root your phone?
Nothing wrong will happen until you do it right
Click to expand...
Click to collapse
Hi, I already did rooting, and what i did was I copied Droid Sans Fallback font in 4.4.4 to 5.1.0 to the /system/fonts folder after moving the original file in that folder. and problem got solved, I was looking for a solution other than this, perhaps in source code of the application
Related
Hi All,
I am using DirectShow API for fetching camera contents on T-Mobile Shadow phone (manufacturer is HTC). I am having problem with the default Camera Zoom factor on this phone (when opened using DirectShow). I am trying to control the Zoom factor using IAMCameraControl interface. But I don't get any valid pointer for IAMCameraControl Inteface by using following code =>
$$$$$$$$$$$$$$$$$$$$$$$$$$$
long camera_flags = 0;
long zoom_val = 0;
IAMCameraControl* pCameraControl = NULL;
pVideoCaptureFilter->QueryInterface(IID_IAMCameraControl,(void**)&pCameraControl);
if(NULL == pCameraControl)
{
result = E_NOTIMPL;
goto error_handler;
}
$$$$$$$$$$$$$$$$$$$$$$$$$$$
Looks like IAMCameraControl has not been implemented on this particular phone. Is there any other way to change default Camera Zoom factor on HTC phones?
I came to know about HTC Camera DLL using this forum. How should I go about getting the Camera DLL and the documentation?
Thanks,
Shashi
was just thinking... once we get cracking on nexus development.. are ppl going to be able to design there own live wallpapers? would be sort of aweSOME!!!!
Depend what type of file they are.
Its obviously more than a picture or animated file.
My buddies first reply was "how very ..java scriptish"
I can't wait to see people create their own. I know it will be out of my current range of knowledge to do it myself. My friend suggested someone needs to make a Matrix like live wallpaper.
Bouncing boobies ftw!?
Carloswithac said:
Bouncing boobies ftw!?
Click to expand...
Click to collapse
And as you swipe to the next screen they jiggle to the way you swiped lol.
stewart1988 said:
and as you swipe to the next screen they jiggle to the way you swiped lol.
Click to expand...
Click to collapse
i would pay for this!!!
velazcod said:
i would pay for this!!!
Click to expand...
Click to collapse
http://www.youtube.com/watch?v=zKO-tZGuFDg
Aint these live wallpapers .GIF files?
Going thru the LiveWallpapers.apk right now. Interesting.... This is not something you can just replace. They are not GIF images. They are actually regular png/jpg with combo of some other code. I have not been programing for a while. I have to sit and figure out the actual logic behind them etc. I can tell you this came out of galaxy live wallpaper:
*/
void createParticle(struct Stars_s *star, struct Particles_s *part, float scale) {
float d = fabsf(randomGauss()) * State->galaxyRadius * 0.5f + randf(64.0f);
float id = d / State->galaxyRadius;
float z = randomGauss() * 0.4f * (1.0f - id);
float p = -d * ELLIPSE_TWIST;
Click to expand...
Click to collapse
/**
* Initialize all the stars. Called from Java.
*/
void initParticles() {
if (State->isPreview == 1) {
angle = 0.0f;
}
struct Stars_s *star = Stars;
struct Particles_s *part = Particles;
int particlesCount = State->particlesCount;
float scale = State->galaxyRadius / (State->width * 0.5f);
int i;
for (i = 0; i < particlesCount; i ++) {
createParticle(star, part, scale);
star++;
part++;
}
}
void drawSpace(float xOffset, int width, int height) {
bindTexture(NAMED_PFBackground, 0, NAMED_TSpace);
drawQuadTexCoords(
0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
width, 0.0f, 0.0f, 2.0f, 1.0f,
width, height, 0.0f, 2.0f, 0.0f,
0.0f, height, 0.0f, 0.0f, 0.0f);
}
Click to expand...
Click to collapse
The live wallpapers are evidently built using Processing(processing.org).
Source: http://www.curious-creature.org/2010/01/07/nexus-one-live-wallpapers/
shawncplus said:
The live wallpapers are evidently built using Processing(processing.org).
Source: http://www.curious-creature.org/2010/01/07/nexus-one-live-wallpapers/
Click to expand...
Click to collapse
nice find.. hope some ppl start developing these
There is already a bounty started for the first person to make Live Wallpapers for the community
http://alldroid.org/viewtopic.php?f=247&t=1283
From the Android IRC, think SDK for Live Wallpapers will be released very soon... likely with 2.1 SDK.
Processing
Processing is an artistically-inclined language built on Java that's relatively easy to use, and reminds me of coding flash animation. If this is written using Processing, the language is already available at http://www.processing.org.
ccunningham83 said:
I can't wait to see people create their own. I know it will be out of my current range of knowledge to do it myself. My friend suggested someone needs to make a Matrix like live wallpaper.
Click to expand...
Click to collapse
+1 to a Matrix wallpaper, and pressing it would have a ripple effect lighting up letters
http://androidandme.com/2010/01/news/google-to-offer-sdk-for-android-live-wallpapers/
just wait for the confirmed new sdk...kinda pointless making a bounty for this with the sdk release confirmed
DarkLord7854 said:
+1 to a Matrix wallpaper, and pressing it would have a ripple effect lighting up letters
Click to expand...
Click to collapse
+1 for both those ideas. If that wallpaper existed, I would be downloading it this moment and would love it forever.
Anyone know the location of the live wallpapers? I'd like to remove the ones I don't use. . . but, I guess, if they're part of the app, that might be a problem.
Pulled the apk. Think I just answered my own question. :-\
think /system/app/livewallpaper.apk .odex..
dont think you can just delete one but not sure
http://droidninja.com/?p=5341
"There are currently 10 live wallpapers to choose from and that number will be greatly expanding soon. Google will be releasing a SDK that will allow developers to code their own wallpapers, according to Android Engineer Romain Guy."
Would anyone be able to modify the Camera apk so when you click on the image in the lower right corner of the last taken photo to open it in the gallery?
Right now a workaround to get to the gallery from the camera app is to hit Menu, Gallery.
Wondering if anyone can get the button working?
+1 I would like to see this too.
Tried myself a little. I believe the command for launching the review of the phone is
Code:
com.cooliris.media.action.REVIEW
The problem is that only the 3D Gallery is called, com.cooliris.media
The 2D Gallery is known has, com.android.camera.Camera
I tried swapping them out, but it just results in the camera app now showing up.
Maybe the 2D Gallery doesn't have a review command and this isn't even possible.
OK so a little more digging and trying and no success.
It appears that the 2D Gallery and 3D Gallery seem to appear to handle the "Reviewing of images differently"
2D:
Code:
com.android.camera.ReviewImage
and that seems to be it's own separate activity
whereas
3D:
Code:
com.cooliris.media.action.REVIEW
and is a action inside of the Gallery activity
It appears that there is no equivalent review action with the 2D Gallery, so it can easily be swapped out in the Camera.apk via a hex editor or the like. I would assume a change in the source code for the Camera.apk would be needed.
Would be nice to have it coded so it looks for 3D gallery 1st and if that fails falls back on 2D.
More digging found me this:
http://ip208-100-42-21.static.xda-developers.com/showthread.php?t=731659&page=96
Seems to exactly what you are looking for Jedis.
To get the Camera thumbnail to stop calling Gallery3D, I made the following change in the Camera source.
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java
index 44d5681..52a6639 100644
--- a/src/com/android/camera/Util.java
+++ b/src/com/android/camera/Util.java
@@ -42,7 +42,7 @@ public class Util {
public static final int DIRECTION_UP = 2;
public static final int DIRECTION_DOWN = 3;
- public static final String REVIEW_ACTION = "com.cooliris.media.action.REVIEW";
+ public static final String REVIEW_ACTION = "android.intent.action.VIEW";
private Util() {
}
There may be a better way, but this is working for me.
I am working on a project on Augmented Reality with Android. The code captures the camera video, finds the marker and displays a cube on top of it. After this a motion vector (in the form of pixels moved in the x and y direction) is found. What I need to do is read the pixels from the GL layer and draw them again after moving them by the distance specified by the motion vector.
The GL layer is specified using the GLSurfaceView class which is a transparent layer. The problem I am facing is that when I use glReadPixels() to read the pixels and convert it into a 480x800 array (nexus one screen resolution), I get 3 different portions of the cube instead of one.
I intend to move the pixels by the motion vector after this and use glDrawPixels() to put the pixels back into the frame buffer
Please help me with the interpretation of the same. Is there something I am missing while using glReadPixels and also if there is some other function that will help me achieve the same. I was thinking of using glBlitFrameBuffer() but this is not supported by the android GL10 class.
I have attached the part of the code where I am reading the pixels and changing them to a 2D matrix along with the image of the pixels I reconstructed using MatLab.
Any help will be greatly appreciated.
Code:
gl.glPixelStorei(GL10.GL_PACK_ALIGNMENT, 1);
IntBuffer pixels = IntBuffer.allocate(384000);
gl.glReadPixels(0, 0, 800, 480, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE ,pixels);
File f = new File ("./mnt/sdcard/Sahiba_PixelData_" + flag + ".txt");
if(!f.exists())
f.createNewFile();
FileWriter fw = new FileWriter(f);
int pixelsArr [][] = new int [480][800];
//int temp[] = pixels.array();
int n=0;
for(int i=0; i<480; i++){
for(int j=0; j<800; j++){
pixelsArr[i][j] = pixels.get(n);
//temp[n + pixels.arrayOffset()];
fw.write(pixelsArr[i][j] + " ");
//fw.write(pixels.get(n) + " ");
n++;
}
//fw.write("\n");
}
Log.i("GLLayer", "Pixels reading and storing finished !!!");
}catch(Exception e){
Log.i("GLLayer","Exception = " +e);
}
The following code, is a simple example of programmatically "WITHOUT XML" translate animation, that works perfect on all versión bellow Android 4.4.2, but does nothing on Android 4.4.2. It's really making me crazy!
Any ideas why?
Tested and working OK on: EMULATOR AVD with 4.1.2 (API 16), EMULATOR AVD with 4.2.2 (API 17), EMULATOR AVD with 4.3.1 (API 18), Galaxy Tab 3 (4.1.2), Surprice, surprice.....works on my Galaxy NOTE with Omnirom 4.4.4
Not Working on: EMULATOR AVD with 4.4.2 (API 19), Galaxy S4 (4.4.2), Galaxy Note 3 (4.4.2)
Code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int myWidth = 1280;
int myHeight = 800;
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
boolean isPortrait = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
int frameBufferWidth = isPortrait ? myHeight : myWidth;
int frameBufferHeight = isPortrait ? myWidth : myHeight;
Bitmap frameBuffer = Bitmap.createBitmap(frameBufferWidth, frameBufferHeight, Config.RGB_565);
graphics = new AndroidGraphics(getAssets(), frameBuffer);
fl = new FrameLayout(this);
ImageView mons= new ImageView(this);
mons.setImageBitmap(graphics.newImage("mons/mons01.png", ImageFormat.ARGB8888).getBitmap());
mons.setX(400);
mons.setY(200);
TranslateAnimation aniTrans = new TranslateAnimation(0, 0, 0, -200);
aniTrans.setDuration(5000);
mons.setAnimation(aniTrans);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
fl.addView(mons, params);
FrameLayout.LayoutParams flp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
this.setContentView(fl, flp);
mons.startAnimation(aniTrans);
aniTrans.startNow();
}
Issue Found!
HAVE FOUND THE PROBLEM, but NEED HELP TO SOLVED IT!
(NOTE: This only occurs in full java code. It doesn’t happened using XML file, what is not the case)
Now I should call this topic like:
ANDROID 4.4.2 CREATES A BLACK MASK OUTSIDE VIEW OBJECT BOUNDARY, ONLY DURING FULL JAVA CODE ANIMATIONS?
Why?:
Take a look to this new example code:
Code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
common = new Common(this, this);
FrameLayout.LayoutParams framelayoutparameter = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
/* I think that this is the line code (imageviewparamenter) were Android 4.4.2 FAILS during animation.*/
LayoutParams imageviewparamenter = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
/* No matter the size of the screen, Android 4.4.2 creates a black hole outside the image size,
* just during animation (see attached picture). Thats why animation dont show up, if the
* initial position (setX or setY) of the image, is outside the image boundary.*/
fl = new FrameLayout(this);
ImageView iv = new ImageView(this);
/* Image is located in the ASSET and is 100x100 pixels (non dpi dependable)
* "common" method use AssetManager to read the image file */
iv.setImageBitmap(common.newImage("iv_image.png", ImageFormat.RGB565).getBitmap());
iv.setX(50); // position show in the example
iv.setY(0);
fl.addView(iv, imageviewparamenter);
this.setContentView(fl, framelayoutparameter);
AlphaAnimation animation = new AlphaAnimation(0,1);
animation.setDuration(5000);
animation.setAnimationListener(this);
/* Also, "setAnimation(animation)" must be present, in order that
* Android 4.4.2 animates without skipping frames*/
iv.setAnimation(animation);
iv.startAnimation(animation);
}
Create a frame layout with a ImageView and alpha animation using pure java code. During animation, Android 4.4.2 (API19) is creating a black mask outside the ImageView size boundary, starting at x/y coordinates (0 + imageWidth / 0 + imageHeight), so if you initially place the image outside that coordinate, you don’t see any animation, just the original image at the end of the animation....
To recreate the issue, i have place the image in x = 50 . You would see that the half right side of the image is BLACK during Android 4.4.2 animation. You can recreate using emulator with any size of screen setup that you prefer. Using API 16,17,18, have no problem, but using API19, the black mask will make you crazy!
NOW, ANY IDEAS? or is a big bug on Android 4.4.2? or I just don’t see it?
Anyone?
SOLVED
! SOLVED !
For some reason, API19 programmatically pure java animations doesnt play very well with absolut settings, like setX() or setY(). Experts may take a look on this. API19 preffers to work with margins on the layout parameter side.
The following procedure, apply's to android 4.4.2. Of cource, it works on the others versions down and up, but you must change your way of thinking. You must place a imagen programmatically using layout parameters, so change:
Code:
iv.setX(50);
iv.setY(0);
to
Code:
lparam.setMargins(50, 0, 0, 0);
iv.setLayoutParams(lparam);
iv.requestLayout();
You must call "requestLayout()" to ensure that the new changes on the layout, will be commited when adding the view to the parent (fl).
Finnally, by mistake, I use "LayoutParams" instead of "FrameLayout.LayoutParams". This nothing have to do with the issue and was not affecting it, but is the correct way to define it, so change:
Code:
LayoutParams lparam = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
to
Code:
FrameLayout.LayoutParams lparam = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
The complete working code for any API is:
Code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Common common = new Common(this, this);
FrameLayout fl = new FrameLayout(this);
ImageView iv = new ImageView(this);
FrameLayout.LayoutParams flparam = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
FrameLayout.LayoutParams lparam = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
iv.setImageBitmap(common.newImage("100x100.png", ImageFormat.RGB565).getBitmap());
lparam.setMargins(50, 0, 0, 0);
iv.setLayoutParams(lparam);
iv.requestLayout();
fl.addView(iv);
this.setContentView(fl, flparam);
AlphaAnimation animation = new AlphaAnimation(0, 1);
animation.setDuration(3000);
iv.setAnimation(animation);
iv.startAnimation(animation);
}