How to create a watchface for Quick Circle
General info
The app that is responsible for the watchface is LGAlarmClock.apk from /system/priv-apps .
This guide will learn you how to create an xposed module to switch those files.
Requirements
To know how to compile source to apk
Android Stuio / gradle project / To know how to reference a jar on a regular project on eclipse
Tutorial:
Create the new watchfaces.
Since we doesn't edit the functionallity of the clock, your image should be compatible with the layout of the original watchface.
The original watchfaces are stored on raw-xxxhdpi folder on the apk. You can decompoile the apk by yourself, or take a look at this.
save the edited image in the same name as the original
Create new android project in your IDE.
add the edited file to raw-xxxhdpi folder inside res folder.
Download the xposed-bridge jar from here.
Reference the jar to your project. In a gradle project you need to add to the dependencies:
Code:
provided files('path to jar')
Note: you don't need to add to jar to the classpath, only reference since it already exists on the firmware.
Create a module class that implements IXposedHookZygoteInit and IXposedHookInitPackageResources. It should look like:
Java:
package com.yoavst.quickcirclemod;
import android.content.res.XModuleResources;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.callbacks.XC_InitPackageResources;
public class Module implements IXposedHookZygoteInit, IXposedHookInitPackageResources {
// Required for resources
private static String MODULE_PATH = null;
[user=439709]@override[/user]
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
[user=439709]@override[/user]
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resParam) throws Throwable {
// Only if it is the clock package, continue.
if (!resParam.packageName.equals("com.lge.clock")) return;
// Here we will put or modifications.
}
}
Now you need to replace the resources. for example, let's say you edited those files: b2_quickcircle_digital_bg and b2_quickcircle_analog_style01_hour.
Java:
[user=439709]@override[/user]
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resParam) throws Throwable {
// Only if it is the clock package, continue.
if (!resParam.packageName.equals("com.lge.clock")) return;
// Create a reference to our resources
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resParam.res);
// Replace the raw resources with hour resources
resParam.res.setReplacement("com.lge.clock", "raw", "b2_quickcircle_analog_style01_hour", modRes.fwd(R.raw.b2_quickcircle_analog_style01_hour));
resParam.res.setReplacement("com.lge.clock", "raw", "b2_quickcircle_digital_bg", modRes.fwd(R.raw.b2_quickcircle_digital_bg));
}
add an assets folder (in gradle, it is under the "main" folder). add an xposed_init file, this file contain the full classname for your module class. in the example it is: com.yoavst.quickcirclemod.Module
Compile it and see it works (need to be applied in xposed and reboot)
You can check for the source here - https://github.com/yoavst/rolexquickcircle
Awesome thanks!
Nobody is going to take advantage with that?
Gabbyh28 said:
Nobody is going to take advantage with that?
Click to expand...
Click to collapse
http://forum.xda-developers.com/lg-g3/themes-apps/xposed-rolex-watchface-quick-circle-t2862715
Here are the 3 available watchfaces for now (the last one which is a paid one, have more then 1 watchface)
Related
I received a CAB file from my friend, and when I tried to install it, I found that it has a popup message from my friend telling me a joke...
how he do that?
and how can I change that message?
Still No Comment...!
Please Help!
I asume you know how to make a cab to start with????
As you know there are exported functions in the dll that the cab uses (you make the dll). For example this is the normal look of whats exportd. Bellow is whats in the def file.
--------------------------------------------------------------------------
; TestSetup.def : Declares the module parameters for the DLL.
LIBRARY "TESTSETUP"
;DESCRIPTION 'TESTSETUP Windows CE Dynamic Link Library'
EXPORTS
Install_Init
Install_Exit
Uninstall_Init
Uninstall_Exit
now in the code for one of those you just make a dialog like normal.
The code below is cut out of one of my working cabs. Because its in Install_Init it is the first thing to happen. Changing the method to Install_Exit would give the message after the instalation.
#include "stdafx.h"
#include "TestSetup.h"
#include "ce_setup.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "MyAboutDialog.h"
BOOL CALLBACK gAboutDialogProc(HWND h_dlg, UINT my_message, WPARAM wpAram, LPARAM lpAram);
static CMyAboutDialog* myAbout= new CMyAboutDialog();
BOOL CALLBACK gAboutDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
return myAbout->AboutProc(hWnd,uMsg,wParam,lParam);
}
/////////////////////////////////////////////////////////////////////////////
// CTestSetupApp
BEGIN_MESSAGE_MAP(CTestSetupApp, CWinApp)
//{{AFX_MSG_MAP(CTestSetupApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestSetupApp construction
CTestSetupApp::CTestSetupApp()
{
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CTestSetupApp object
CTestSetupApp theApp;
/////////////////////////////////////////////////////////////////////
codeINSTALL_INIT
Install_Init( HWND hwndParent,
BOOL fFirstCall,
BOOL fPreviouslyInstalled,
LPCTSTR pszInstallDir )
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DialogBox:AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDD_AboutDIALOG),
hwndParent,
(DLGPROC)gAboutDialogProc);
return codeINSTALL_INIT_CONTINUE;
}
//------------------------------------------------------------------
Of course the detail of the dialog is in the MyAboutDialog. You just make your own to do what you want.
You can do just about anything from the code you put in the cab's dll, but a lot of the instalation should be left up to cabwiz to generate. What ever you do put in the dll will permanently reside in the windows folder until the user removes the program, so don't make it too big.
Thanks Dear OdeeanRDeathshead...
your reply is more than an informative article.
however, I hope if you can answer my second part of the question...
how can I remove the message from a CAB file that i have?
I you want to remove the message on an existing cab then that is more complicated. If you know everything that the cab dose when it gets tapped (eg registry changes etc) then you could gather all the file that the cab installs and use them to re-write them into a new cab that has no messages. This is more trouble than its worth. Unless your friend is willing to give you detailed info on what his cab dose you would be bound to miss something.
Also many messages are as a result of the os, and these vary depending on the version of os. You can't stop some of those (on every platform).
Most people would not want their instalation packages tampered with.
Try to extract the .cab file with Win CE Cab manager. Remove the Setup.dll, hopefully it does not do anything else then showing the joke Then build your own version of it.
for any complex instalation I doubt that doing that would leave you with a working instalation. Still its worth a go if it saves time. What I would like to know (not having vis studio 2005 yet) is why dose the wm2005 device always ask where you want to put the software even when you have turned this feature off? When one's coding gets a bit lazy it can all fall appart when put in a location other than that you expect.
OdeeanRDeathshead, I assume you are referring to whether to install to main memory or to SD question (this dialog pups up on WM5 device with SD inserted or built in storage).
To avoid it remove the InstDir string from your inf file (or change the string name to something else). This will force the software installation to the directory you specify in the cab.
I did not want to hard code the directory, so I used
InstallDir="%CE2%"
That should get the location of the windows folder for the install. Are you saying that if I just put
InstallDir="\windows\"
it will force it there. Dose this mean that there is a new table of Windows CE Directory Identifiers or that installs just always ask if you use them?
No, what I meant was you don’t want a string call 'InstallDir' in your inf file.
The 'InstallDir' is just a string definition you may or may not use later in the inf (like #define in C).
What determines where the files are installed is what's in the [DestinationDirs] section.
For example:
Files.Windows = 0,%CE2%
You should delete the line InstallDir = completely from your inf file, or if this string appears else where (except [CEStrings] section) just change it to something like MyDir= (be sure to change it every ware it appears in the file)
Hey everybody, hope you can help me ;-)
my app creates a playlist of type m3u in the folder /sdcard/playlists/filename.m3u.
I'm trying to add the playlist to the MediaStore using MediaScannerConnection, so the playlist is listed in Android's Stock Music App, but it doesn't work: the playlist doesn't show up in the Music App's Category "Playlists".
Here's my code:
Code:
void rescanSD(final File playlistFile) {
msc = new MediaScannerConnection(TracklistActivity.this, new MediaScannerConnectionClient() {
@Override
public void onScanCompleted(String arg0, Uri arg1) {
if (arg0.equals(playlistFile.getAbsolutePath())) {
Log.d("Activity", "File scanned");
msc.disconnect();
}
}
@Override
public void onMediaScannerConnected() {
msc.scanFile(playlistFile.getAbsolutePath(), null);
}
});
msc.connect();
}
The Fileobject File playlistFile is my created m3u-File.
playlistFile.getAbsolutePath() gives: /mnt/sdcard/Music/playlists/filename.m3u
Logcat shows "File scanned", when app has finished, but the playlist doesn't show up in my Music App.
If I initiate a SD-rescan using Tasker the playlist appears in the desired list, so Tasker must be using an other code for realizing that.
Can please anybody tell me where the bug in my code is and give me a suggestion how I can achieve what I want?
Thanks in advance ;-)
Regards ChemDroid
I was task to allocate only 1GB of space to store my videos in a particular file directory where it is going to auto-delete the oldest video file in that directory once its about to reach/hit 1GB?
And i eventually found these code but i was left with a problem on how to incorporate these example 1/2 codes into my current existing mainActivity.java file because of the differences in names like "dirlist,tempFile" compared with other examples 1/2 given to perform the task of size checking and deleting.
Sorry i'm kinna new in android/java therefore i don't really know what "fields" to change to suit my current coding needs? Can someone help on how am i going to complie these set of codes into a single set of code which perform the above mention functions??
My Current existing mainActivity.java
Code:
File dirlist = new File(Environment.getExternalStorageDirectory() + "/VideoList");
if(!(dirlist.exists()))
dirlist.mkdir();
File TempFile = new File(Environment.getExternalStorageDirectory()
+ "/VideoList", dateFormat.format(date) + fileFormat);
mediaRecorder.setOutputFile(TempFile.getPath());
(Example 1) code for summing up directory file size in a given folder..
Code:
private static long dirSize(File dir) {
long result = 0;
Stack<File> dirlist= new Stack<File>();
dirlist.clear();
dirlist.push(dir);
while(!dirlist.isEmpty())
{
File dirCurrent = dirlist.pop();
File[] fileList = dirCurrent.listFiles();
for (int i = 0; i < fileList.length; i++) {
if(fileList[i].isDirectory())
dirlist.push(fileList[i]);
else
result += fileList[i].length();
}
}
return result;
}
(Example 2) set of code for getting all the files in an array, and sorts them depending on their modified/created date. Then the first file in your array is your oldest file and delete it.
Code:
// no idea what are the parameters i should enter
// here for my case in mainActivity??
File directory = new File((**String for absolute path to directory**);
File[] files = directory.listFiles();
Arrays.sort(files, new Comparator<File>() {
@Override
public int compare(File f1, File f2)
{
return Long.valueOf(f1.lastModified()).compareTo(f2.lastModified());
}});
file[0].delete();
imso said:
And i eventually found these code but i was left with a problem on how to incorporate these example 1/2 codes into my current existing mainActivity.java file because of the differences in names like "dirlist,tempFile" compared with other examples 1/2 given to perform the task of size checking and deleting.
Click to expand...
Click to collapse
if its a matter of variable names and discrepancies from the sample code to your code then i would recommend an ide with really good refactoring built in. it will let you in a couple clicks rename all the new vars to vars that are already in your code. i use IntelliJ (i know alot of people use Eclipse, but i cant stand it. IntelliJ is really way better to code on)
beyond that id have to sit down and look at what this code is doing to try and help. ill give it a look over but its hard to know whats going on when you havent written the code.
DBXDroidSimple ORM Library for Android SQLite Database
Description
This is android library to simplify Android SQlite Database
It become very tedious to write large Android SQLite Open helper for simple database usage. So I developed this library to create android databases very easily using straight forward functions.
Github Project Link - DBXDroid-Github
Direct Download Link - DBXDroid-Sourceforge
Features
Create Android SQLite Database
Add Tables to database
Insert new entry to tables
Fetch entries from tables
Ability to interact with database directly using getDatabase() function.
Compatibility
DBXDroid library is compatible for Android 2.3+
Installation
To use DBXDroid ,
Download Library
Extract it to DBXDroid directory
Copy it to your Android Project Workspace
Add it as a project to your Android ADT
Edit properties of your project -> Android -> Library -> Add DBXDroid as Library
Library is now ready to use
Use
1. Define Database
Code:
DBXDatabase studentDatabase;
studentDatabase = new DBXDatabase("college.db", this);
2. Create ColumnList
Code:
DBXColumnList studentColumns = new DBXColumnList();
studentColumns.addColumn(new DBXColumn("student_id",DBXFieldType.INTEGER));
studentColumns.addColumn(new DBXColumn("student_name",DBXFieldType.TEXT));
studentColumns.addColumn(new DBXColumn("student_dept",DBXFieldType.VARCHAR));
3. Add new Table to Database
Code:
studentDatabase.addTable(new DBXTable("students", studentColumns));
4. Create Database
Code:
try {
studentDatabase.createDatabase();
} catch (Exception e) {
e.printStackTrace();
}
5. Open Database
Code:
try {
studentDatabase.openDatabase();
} catch (Exception e) {
e.printStackTrace();
}
6. Inserting new Entry to table
Code:
DBXFieldValuePairList studentFieldsList = new DBXFieldValuePairList();
studentFieldsList.addFieldValuePair(new DBXFieldValuePair("student_id", Integer.parseInt(studentID)));
studentFieldsList.addFieldValuePair(new DBXFieldValuePair("student_name", studentName));
studentFieldsList.addFieldValuePair(new DBXFieldValuePair("student_dept", studentDept));
try {
if (studentDatabase.insertEntry("students", studentFieldsList) != -1) {
Toast.makeText(this, "Added", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
e.printStackTrace();
}
7. Fetching Entries
Code:
DBXResult dbxResult = studentDatabase.getEntries("students");
String[][] result = dbxResult.getResults();
8. Access Database Directly
Code:
public SQLiteDatabase getDatabase();
This method returns SQLiteDatabase object reference for your database, So you can interact normally and directly to database
9. Closing Database
Code:
try {
studentDatabase.closeDatabase();
} catch (Exception e) {
e.printStackTrace();
}
Refer DBXDroidDemo for Full Demo
License
DBXDroid is under the GNU General Public License v3.0 License.
sdk? or jdk
s.o.s so this is a java script object oriented based sql form relational database that has a sdk acting like the LRAD filtering data through normal forms?
If you decide to further inspect the contents of the p32m x 360f512 l.h file (it is a simple
text file that you can open with the MPLAB editor), you will see that it contains an
incredibly long list of definitions for all the names of the internal special-function
registers (often referred to in the documentation as the SFRs ) of the chosen PIC32 model.
If the include file is accurate, those names reflect exactly those being used in the device
datasheet and the PIC32 reference manual.
Here is a segment of the p32m x 360f512 l.h file in which the special-function register that
controls the watchdog module ( WDTCON ) and each of its individual bits are assigned their
conventional names:
...
extern volatile unsigned int WDTCON__attribute__
((section( " sfrs " )));
typedef union {
struct {
unsigned WDTCLR:1;
The Adventure Begins 7
unsigned WDTWEN:1;
unsigned SWDTPS0:1;
unsigned SWDTPS1:1;
unsigned SWDTPS2:1;
unsigned SWDTPS3:1;
unsigned SWDTPS4:1;
unsigned :7;
unsigned FRZ:1;
unsigned ON:1;
};
...
Back to our Hello.c source file; let ’ s add a couple more lines that will introduce you to
the main() function:
main()
{
}
What we have now is already a complete, although still empty and pretty useless, C
language program. In between those two curly brackets is where we will soon put the first
few instructions of our embedded-control application.
Independently of this function position in the file, whether in the first lines on top or
the last few lines in a million-lines file, the main() function is the place where the
microcontroller will go first at power-up or after each subsequent reset. This is actually an
oversimplification. After a reset or at power-up, but before entering the main() function,
the microcontroller will execute a short initialization code segment automatically
inserted by the MPLAB C32 linker. This is known as the Startup code or crt0 code (or
simply c0 in the traditional C language literature). The Startup code will perform basic
housekeeping chores, including the all important initialization of the stack, among many
other things.
aditya.kamble said:
DBXDroidSimple ORM Library for Android SQLite Database
Description
...
Click to expand...
Click to collapse
This is no ORM library. There is no mapping from or to objects in this code. Have a look at http://en.wikipedia.org/wiki/Object-relational_mapping for the differences. As examples for real ORM libraries for android, OrmLite or GreenDAO come to mind.
Furthermore, there are a lot of problems with this code.
Its ORM Like Library
onlyolli said:
This is no ORM library. There is no mapping from or to objects in this code. Have a look at http://en.wikipedia.org/wiki/Object-relational_mapping for the differences. As examples for real ORM libraries for android, OrmLite or GreenDAO come to mind.
Furthermore, there are a lot of problems with this code.
Click to expand...
Click to collapse
Yeah it is not fully ORM library but it is ORM like library which provides easier functions can be adopted fast by developer when they dont have time to learn proper ORM library
Nope, sorry, it is really not. All it is is a few functions to create a database schema programmatically and a few functions to do some conversion from and to strings. This is nothing anyone should touch if he/she wants to do proper android software development. If you dont have the time to learn some real ORM tool, then you're better of not developing at all. It takes just a few minutes to get started with something like SugarORM (have a look at http://satyan.github.io/sugar/getting-started.html to see what i mean) which provides a real benefit to your application.
JDXA ORM for Android
You may want to check out JDXA, a simple yet powerful, and flexible ORM solution for Android. JDXA easily supports inheritance, one-to-one, one-to-many, and many-to-many relationships and offers a POJO (Plain Old Java Objects) friendly non-intrusive programming model, which does not require you to change your Java classes in any way:
No need to subclass your domain classes from any base class
No need to clutter your source code with annotations
No need for DAO classes
No source code generation or pre-processing of your code
Automatic creation of database schema
Get more information including code snippets and a FREE trial download at softwaretree.com
Hello everyone!
I need help in making a really simple app that can copy a zip i provide in the apk to a folder on the sd card. Im using Android Studio and most of the github repos ive been trying to study and replicate have so far proven unhelpful because of one reason or another. So i would like a small step by step tutorial or just the codes to make that happen.
PS ive got Android Sudio all setup and ready.
I'll be very thankful if someone helps me out :3
Cheers
alicarbovader said:
Hello everyone!
I need help in making a really simple app that can copy a zip i provide in the apk to a folder on the sd card. Im using Android Studio and most of the github repos ive been trying to study and replicate have so far proven unhelpful because of one reason or another. So i would like a small step by step tutorial or just the codes to make that happen.
PS ive got Android Sudio all setup and ready.
I'll be very thankful if someone helps me out :3
Cheers
Click to expand...
Click to collapse
Hi,
you have to be aware that the user needs to open your app before you can start any services to do the copying. And I'm not sure whether extracting files from an apk (even if it's your own) is possible without root (maybe with an expansion file?). I would provide those files over the internet instead. Other than that, where exactly is your problem? If you have no clue of Android development I'd suggest you start reading the developer tutorials.
SimplicityApks said:
Hi,
you have to be aware that the user needs to open your app before you can start any services to do the copying. And I'm not sure whether extracting files from an apk (even if it's your own) is possible without root (maybe with an expansion file?). I would provide those files over the internet instead. Other than that, where exactly is your problem? If you have no clue of Android development I'd suggest you start reading the developer tutorials.
Click to expand...
Click to collapse
Okay about the part of not opening the app, zooper skins are able tp do just exactly that ie getting installed from playstore and bam all the files within the apk get copied to sd card. Im looking for exactly the same thing, but instead of zooper, i intend to have my own zip file being copied to the sdcard.
alicarbovader said:
Okay about the part of not opening the app, zooper skins are able tp do just exactly that ie getting installed from playstore and bam all the files within the apk get copied to sd card. Im looking for exactly the same thing, but instead of zooper, i intend to have my own zip file being copied to the sdcard.
Click to expand...
Click to collapse
Well the zooper apps I tried just now weren't copying something to my storage without me opening them, and I am sure this isn't possible since Android 3.1 (see here). However, something similar might be possible with the app extension files though I am not familiar with how that would work. Is not explicitly starting the app really such an issue?
SimplicityApks said:
Well the zooper apps I tried just now weren't copying something to my storage without me opening them, and I am sure this isn't possible since Android 3.1 (see here). However, something similar might be possible with the app extension files though I am not familiar with how that would work. Is not explicitly starting the app really such an issue?
Click to expand...
Click to collapse
Okay i decided to create a UI for the app, where i can show the screenshot and added a button which you can press to install the theme.
my question now is about this piece of code:
Code:
private void copyAssets() {
AssetManager assetManager = getAssets();
String[] files = null;
try {
files = assetManager.list("");
} catch (IOException e) {
Log.e("tag", "Failed to get asset file list.", e);
}
for(String filename : files) {
InputStream in = null;
OutputStream out = null;
try {
in = assetManager.open(filename);
File outFile = new File(getExternalFilesDir(null), filename);
out = new FileOutputStream(outFile);
copyFile(in, out);
} catch(IOException e) {
Log.e("tag", "Failed to copy asset file: " + filename, e);
}
finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
// NOOP
}
}
if (out != null) {
try {
out.close();
} catch (IOException e) {
// NOOP
}
}
}
}
}
private void copyFile(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
int read;
while((read = in.read(buffer)) != -1){
out.write(buffer, 0, read);
}
}
i found it on stackoverflow, and i wanna understand how to use it to copy stuff from my assets folder to /storage/MycolorSCreen/Theme/exported/zip folder