Is it possible to customize the XDA's today screen (i.e. by using XML) as you can do with the Orange's SPV ?
Download Microsoft's Theme Generator...
http://www.microsoft.com/mobile/pocketpc/downloads/powertoys.asp
There are some other goodies on that page aswell.
Good luck!
Powertoy is not what I am looking for: the idea is not only changing the background image but to organize all the datas on the screen as and where you wish (date, time, numbers of emails received, fonts, etc.) as you can do on smarphone 2002 changing the today screen's script in XML.
For examples what you can do with Smartphone 2002:
http://www.smartphony.org/stories.php?topic=32
It's a bit more complicated with PPC 2002. Unlike smartphone, it is an API to change the contents of 'Today'. Each line is loaded as a type of 'snap in' dll.
Do you I could find some examples of that kind of work ?
It is really a pain in the ass
But this works fine... 8)
#include "stdafx.h"
#include <todaycmn.h>
#define IDI_ICON1 101
HINSTANCE Instance;
BOOL Refresh;
HICON hIcon;
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
PAINTSTRUCT ps;
RECT rect;
switch (msg) {
case WM_TODAYCUSTOM_CLEARCACHE:
break;
case WM_TODAYCUSTOM_QUERYREFRESHCACHE:
if (Refresh) {
Refresh = FALSE;
((TODAYLISTITEM *)(wparam))->cyp = 20;
return TRUE;
} else {
return FALSE;
}
case WM_ERASEBKGND:
{
TODAYDRAWWATERMARKINFO dwi;
dwi.hwnd = hwnd;
dwi.hdc = (HDC)wparam;
GetClientRect(hwnd, &(dwi.rc));
SendMessage(GetParent(hwnd), TODAYM_DRAWWATERMARK, 0, (LPARAM)&dwi);
return 1;
}
case WM_PAINT:
BeginPaint(hwnd, &ps);
GetWindowRect(hwnd, &rect);
SetBkMode(ps.hdc, TRANSPARENT);
hIcon = (HICON)LoadImage(Instance,MAKEINTRESOURCE(IDI_ICON1),IMAGE_ICON,16,16,LR_DEFAULTCOLOR );
DrawIcon(ps.hdc, 2, 0, hIcon);
DestroyIcon(hIcon);
LOGFONT lf;
HFONT hSysFont;
HFONT hFont, hFontOld;
hSysFont = (HFONT) GetStockObject(SYSTEM_FONT);
GetObject(hSysFont, sizeof(LOGFONT), &lf);
lf.lfWeight = FW_BOLD;
lf.lfHeight = (long) -((8.0 * (double)GetDeviceCaps(ps.hdc, LOGPIXELSY) / 72.0)+.5);
hFont = CreateFontIndirect(&lf);
hFontOld = (HFONT) SelectObject(ps.hdc, hFont);
SetTextColor(ps.hdc, SendMessage(GetParent(hwnd), TODAYM_GETCOLOR, (WPARAM)TODAYCOLOR_TEXT, NULL));
GetClientRect(hwnd, &rect);
DrawText(ps.hdc, TEXT("Text you want to enter"), -1, &rect, DT_LEFT | DT_TOP | DT_NOCLIP);
SelectObject(ps.hdc, hFontOld);
DeleteObject(hFont);
EndPaint(hwnd, &ps);
break;
case WM_LBUTTONUP:
// Whatever you want to occur when the button is pressed //
CreateProcess(TEXT("iexplore.exe"), NULL, NULL, NULL, FALSE, 0, NULL, NULL, NULL, NULL);
break;
default:
return DefWindowProc(hwnd, msg, wparam, lparam);
}
return 0;
}
HWND APIENTRY InitializeCustomItem(TODAYLISTITEM *tli, HWND parent)
{
if (!tli->fEnabled) {
return NULL;
}
Instance = tli->hinstDLL;
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = Instance;
wc.hIcon = 0;
wc.hCursor = 0;
wc.hbrBackground = (HBRUSH)COLOR_BACKGROUND + 1;
wc.lpszMenuName = NULL;
wc.lpszClassName = TEXT("RegisterClassName");
UnregisterClass(TEXT("RegisterClassName"), Instance);
RegisterClass(&wc);
Refresh = TRUE;
return CreateWindow(TEXT("RegisterClassName"), TEXT("RegisterClassName"), WS_VISIBLE | WS_CHILD, CW_DEFAULT, CW_DEFAULT, 0, 0, parent, NULL, Instance, NULL);
}
Thank's !
Is there somewhere a technical documentation about that ?
Not sure why it crash while looping the array:
Code:
final String tname[] = getResources().getStringArray(R.array.tname);
final int tid[] = getResources().getIntArray(R.array.tid);
final int tlv[] = getResources().getIntArray(R.array.tlv);
int tlength = tname.length;
String pname[] = new String[tlength];
int pid[] = new int[tlength];
for(int i = 0; i < tlength; i++) {
if(tlv[i] <= 0) {
pname[i] = tname[i];
pid[i] = tid[i];
}
}
setListAdapter(new ArrayAdapter<String>(this, R.layout.pMenu, pname));
Thanks in advance!
I looked all over the net and I couldn't find something that works.
First there is this:
Code:
File wave1 = new File(wavFile1);
if(!wave1.exists())
throw new Exception(wave1.getPath() + " - File Not Found");
AudioInputStream clip1 = AudioSystem.getAudioInputStream(wave1);
AudioInputStream clip2 = AudioSystem.getAudioInputStream(new File(wavFile2));
AudioInputStream emptyClip =
AudioSystem.getAudioInputStream(new File(emptyWavPath));
AudioInputStream appendedFiles =
new AudioInputStream(
new SequenceInputStream(clip1, emptyClip),
clip1.getFormat(),
clip1.getFrameLength() + 100
);
clip1 = appendedFiles;
appendedFiles =
new AudioInputStream(
new SequenceInputStream(clip1, clip2),
clip1.getFormat(),
clip1.getFrameLength() + clip2.getFrameLength()
);
but android dosen't support java.sound.sampled
there is also this:
Code:
private void merge2WavFiles(String wavFile1, String wavFile2, String newWavFilePath) {
long RECORDER_SAMPLERATE = 44100;
long RECORDER_BPP = 16;
FileInputStream in1 = null, in2 = null;
FileOutputStream out = null;
long totalAudioLen = 0;
long totalDataLen = totalAudioLen + 36;
long longSampleRate = RECORDER_SAMPLERATE;
int channels = 2;
long byteRate = RECORDER_BPP * RECORDER_SAMPLERATE * channels / 8;
byte[] data = new byte[100];
try {
in1 = new FileInputStream(wavFile1);
in2 = new FileInputStream(wavFile2);
out = new FileOutputStream(newWavFilePath);
totalAudioLen = in1.getChannel().size() + in2.getChannel().size();
totalDataLen = totalAudioLen + 36;
WriteWaveFileHeader(out, totalAudioLen, totalDataLen, longSampleRate, channels, byteRate);
while (in1.read(data) != -1) {
out.write(data);
}
while (in2.read(data) != -1) {
out.write(data);
}
out.close();
in1.close();
in2.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
private void WriteWaveFileHeader(FileOutputStream out, long totalAudioLen,
long totalDataLen, long longSampleRate, int channels, long byteRate)
throws IOException {
byte[] header = new byte[44];
header[0] = 'R';
header[1] = 'I';
header[2] = 'F';
header[3] = 'F';
header[4] = (byte)(totalDataLen & 0xff);
header[5] = (byte)((totalDataLen >> 8) & 0xff);
header[6] = (byte)((totalDataLen >> 16) & 0xff);
header[7] = (byte)((totalDataLen >> 24) & 0xff);
header[8] = 'W';
header[9] = 'A';
header[10] = 'V';
header[11] = 'E';
header[12] = 'f';
header[13] = 'm';
header[14] = 't';
header[15] = ' ';
header[16] = 16;
header[17] = 0;
header[18] = 0;
header[19] = 0;
header[20] = 1;
header[21] = 0;
header[22] = (byte) channels;
header[23] = 0;
header[24] = (byte)(longSampleRate & 0xff);
header[25] = (byte)((longSampleRate >> 8) & 0xff);
header[26] = (byte)((longSampleRate >> 16) & 0xff);
header[27] = (byte)((longSampleRate >> 24) & 0xff);
header[28] = (byte)(byteRate & 0xff);
header[29] = (byte)((byteRate >> 8) & 0xff);
header[30] = (byte)((byteRate >> 16) & 0xff);
header[31] = (byte)((byteRate >> 24) & 0xff);
header[32] = (byte)(2 * 16 / 8);
header[33] = 0;
header[34] = 16;
header[35] = 0;
header[36] = 'd';
header[37] = 'a';
header[38] = 't';
header[39] = 'a';
header[40] = (byte)(totalAudioLen & 0xff);
header[41] = (byte)((totalAudioLen >> 8) & 0xff);
header[42] = (byte)((totalAudioLen >> 16) & 0xff);
header[43] = (byte)((totalAudioLen >> 24) & 0xff);
out.write(header, 0, 44);
}
but is also dosen't work.
In all cases the result sound file is empty without sound.
How can I merge two *.wav files?
I m also searching for months like MP3 EDITOR LIKE software..which can combine two or more sound file and make one..
But all apps i found is just mp3 cutter..
There is one app in symbian os my friend have in his c6
Which do editing i forgot the name but for sure in android i have not found one since six months
we all should be polite enough to press thanks for anyone who helped US.
I need to do some image processing in real time on mobile. I am using camera2 library. I managed to put camera preview directly on surfaceView but when i redirect it to ImageReader to do something with frames before i preview them it goes really slow, and there is not even processing just taking Y value from YUV_420_888 and converting it to gray picture in ARGB_8888 format. Code is below. For that one for loop i need about 600ms. And for image processing i will need to go trough that image at least one more time. In Bits array i form ARGB_8888 format out of Y array which is Y value of YUV_420_888 format. I test it on phone with Quad Core 1ghz processor and 1gb ram. Is there any way to speed this code up so i can go lets say 2-3 times trough picture and have at least 7-10 fps? If i delete for loop and just measure fps its 8-12fps. Why is it so slow compering to 25fps when i put it directly on surfaceView?
Code:
private final CameraDevice.StateCallback mStateCallback = new CameraDevice.StateCallback() {
@Override
public void onOpened(@NonNull CameraDevice cameraDevice) {
// This method is called when the camera is opened. We start camera preview here.
mCameraOpenCloseLock.release();
mCameraDevice = cameraDevice;
createCameraPreviewSession();
mImageReader.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() {
@Override
public void onImageAvailable(ImageReader reader) {
Image image = reader.acquireLatestImage();
if(image != null) {
ByteBuffer buffer0 = image.getPlanes()[0].getBuffer();
byte[] Y = new byte[buffer0.remaining()];
buffer0.get(Y);
byte[] Bits = new byte[Y.length*4]; //That's where the RGBA array goes.
int Ylength = Y.length;
for (int i = 0; i < Ylength; i++) {
int i1 = i*4;
Bits[i1] =Y[i];
Bits[i1 + 1] =Y[i];
Bits[i1 + 2] = Y[i];
Bits[i1 + 3] = -1;//0xff, that's the alpha.
}
Bitmap bm = Bitmap.createBitmap(image.getWidth(), image.getHeight(), Bitmap.Config.ARGB_8888);
bm.copyPixelsFromBuffer(ByteBuffer.wrap(Bits));
Bitmap scaled = Bitmap.createScaledBitmap(bm, surfaceView.getWidth(), surfaceView.getHeight(), true);
Canvas c;
c = surfaceHolder.lockCanvas();
c.drawBitmap(scaled, 0, 0, null);
surfaceHolder.unlockCanvasAndPost(c);
image.close();
time2 = System.nanoTime();
Log.d("Vreme",Double.toString(1000000000/(time2-time1))+"fps");
time1 = System.nanoTime();
}
}
},mBackgroundHandler);
}
@Override
public void onDisconnected(@NonNull CameraDevice cameraDevice) {
mCameraOpenCloseLock.release();
cameraDevice.close();
mCameraDevice = null;
}
@Override
public void onError(@NonNull CameraDevice cameraDevice, int error) {
mCameraOpenCloseLock.release();
cameraDevice.close();
mCameraDevice = null;
}
};
Hi, community,
I was trying to resize a video to be played on Google Pixel 5 to fit the screen. I am able to achieve the required but I need to dig a bit deeper to understand the functioning under the hood. I want to understand if the resizing is happening on hardware or software? Also, what is the algorithm used in the resizing operation whether it is bilinear or bicubic or Lanczos or anything else?
Java:
public void setVideo(String id)
{
System.out.println("Starting video");
System.out.println(id);
String videoPath = Environment.getExternalStorageDirectory().getPath()+"/"+ id;
videoView.setVideoPath(videoPath);
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int screenWidth = metrics.widthPixels;
int screenHeight = metrics.heightPixels;
float screenProportion = (float) screenWidth / (float) screenHeight;
android.view.ViewGroup.LayoutParams lp = videoView.getLayoutParams();
int VideoWidth = mp.getVideoWidth();
int VideoHeight = mp.getVideoHeight();
float videoProportion = (float) VideoWidth / (float) VideoHeight;
if (videoProportion > screenProportion) {
lp.width = screenWidth;
lp.height = (int) ((float) screenWidth / videoProportion);
} else {
lp.width = (int) (videoProportion * (float) screenHeight);
lp.height = screenHeight;
}
videoView.setLayoutParams(lp);
}
});
videoView.start();