Development team V2 - GT540 Optimus Android Development

Hello everyone,
I want to start again with a development team. After miroslav decided to finish the project on his own, I want to try it again. But this time with a real team Only with people who want to participate, and not just type make. Who wants to join?

miroslav_mm said:
So, I opened your eyes and showed real face our "superstar"!?
Ok! Let's stop this stupid discussion and continuous develop ROM.
At this moment I have main part:
Torchscreen +
BT (BT-calling) +
WiFi (need to test) +
Sensor +
GSM (Waiting call) +
Mobile Data +
Audio +
Vibrate +
HW + 3D ??? (need new kernel or port new 3D kernel driver (kgsl) (in progress))
usb storage ??? (only with special app (native in progress))
Camera ??? (in progress)
Video codec ??? (in progress)
Anyone doing something? Maybe fix some stuff?
Click to expand...
Click to collapse
He just want to clean his topic. Send him a PM.

I understand that but there is still no team. He just made his project open for patches. And I think, personally, a team could help the speed on development of a ROM So please join
Sent from my GT540 using Tapatalk

So join his team , and start patching?

wwenigma said:
So join his team , and start patching?
Click to expand...
Click to collapse
Since when does he have a team? What I know about it, is that he just made some kind of open-source project where you can add your own updates and where he gets no credit.
Sent from my GT540 using Tapatalk

I can help you with Java stuff!

I think miroslav_mm wants to release ICS under name of SWIFT-TEAM, with developer names in credits.... may you ask him about it?
Do not split guys...

Miroslav said that it's only him on the team...so i don't see any team there..if we are more than 1 guy in a team we can get faster a daily ROM for our Phones

rexes13 said:
Miroslav said that it's only him on the team
Click to expand...
Click to collapse
Jep, because PCF+MGP join then leave and jasper580 cant make neccessary steps... ask him. All two, ask him about it.

wwenigma said:
Jep, because PCF+MGP join then leave and jasper580 cant make neccessary steps... ask him. All two, ask him about it.
Click to expand...
Click to collapse
I can make nesseccary steps if I want, but I don't want to. I want to start cleaned up. That's why I created this topic. So:
If you want to join: welcome.
If you don't want to: stop spamming
@rexes13 Welcome to the team!
Sent from my GT540 using Tapatalk

Good news.
Yesterday I successfully ported 3d kernel driver (kgsl) from 35, so now we have full functionality kernel with OpenGL ES-CM 1.1.
So HW, 3D and other stuff with support OpenGL working, not excellent but working, need improve source code Surfaceflinger and HardwareDisplay.
Maybe next weak I will make new thread and publish first public test version, but all development moments we can discus here.
Before I need redownload all sources CM9 again. Yesterday I had the same error like in wwenigma and aaa801
Code:
target thumb C: libhardware_legacy <= hardware/libhardware_legacy/power/power.c
arm-linux-androideabi-gcc: ": No such file or directory
<command-line>: warning: missing terminating " character
and I dont know WTF, so delete all source tree. Maybe today will try download again and build again.

hell yeah! im just another non-dev member LOL sry

Need help!
Look on code:
Code:
//static int32_t msm_tscal_scaler = 65536;
static int32_t msm_tscal_xscale = 70046;
static int32_t msm_tscal_xoffset = -4191987;
static int32_t msm_tscal_yscale = 71735;
static int32_t msm_tscal_yoffset = -3004437;
this pointers for torch 320*240. So when I using that I need tap on 2mm high on icon for open something. This pointer need for screen calibration. Need find right pointer.
I can't find a logic in this numbers.

miroslav_mm said:
Need help!
Look on code:
Code:
//static int32_t msm_tscal_scaler = 65536;
static int32_t msm_tscal_xscale = 70046;
static int32_t msm_tscal_xoffset = -4191987;
static int32_t msm_tscal_yscale = 71735;
static int32_t msm_tscal_yoffset = -3004437;
this pointers for torch 320*240. So when I using that I need tap on 2mm high on icon for open something. This pointer need for screen calibration. Need find right pointer.
I can't find a logic in this numbers.
Click to expand...
Click to collapse
The offsets appear to have a ~4:3 ratio. It doesn't make sense though why it's x:y=4:3, and not the other way around, since the screen is usually 3:4(e.g. 320x480 or 240x320). Also, considering our screen is 320x480, which is a ratio of 1,5 and not 1,(3), I think those would be totally wrong for our phone. Maybe try to modify one of the two to match 1,5 ratio. E.g. make xoffset=-4506655. I don't know. :/

Please discuss development on your page. I want to make a dev team here
Sent from my GT540 using Tapatalk

deleted
10 character

This numbers working with this java code together:
]
Code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Read current values
final int xoffset = (readValue("xoffset")*240+480)/960;
final int yoffset = (readValue("yoffset")*320+460)/920;
final int xscale = readValue("xscale");
final int yscale = readValue("yscale");
view = new View(this) {
private int step = 1;
private int rawx1;
private int rawy1;
private int rawx2;
private int rawy2;
private void writeValue(String parameter, int value) {
try {
FileOutputStream fos = new FileOutputStream(new File("/sys/module/msm_touch/parameters/tscal_" + parameter));
fos.write(String.valueOf(value).getBytes());
fos.flush();
fos.getFD().sync();
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (ev.getAction() != MotionEvent.ACTION_UP)
return true;
if(step==1) {
rawx1 = ((int)ev.getRawX()*65536-xoffset+32768)/xscale;
rawy1 = ((int)ev.getRawY()*65536-yoffset+32768)/yscale;
if(rawx1<100 && rawy1<100)
step = 2;
} else if(step==2) {
rawx2 = ((int)ev.getRawX()*65536-xoffset+32768)/xscale;
rawy2 = ((int)ev.getRawY()*65536-yoffset+32768)/yscale;
if(rawx2>140 && rawy2>220)
step = 3;
} else {
int distx = rawx2 - rawx1;
int new_xscale = (140*65536 + distx/2)/distx;
int disty = rawy2 - rawy1;
int new_yscale = (220*65536 + disty/2)/disty;
int new_xoffset = 1;
new_xoffset += 50*65536-rawx1*new_xscale;
new_xoffset += 190*65536-rawx2*new_xscale;
new_xoffset /= 2;
new_xoffset = (new_xoffset*960+120)/240;
int new_yoffset = 1;
new_yoffset += 50*65536-rawy1*new_yscale;
new_yoffset += 270*65536-rawy2*new_yscale;
new_yoffset /= 2;
new_yoffset = (new_yoffset*920+160)/320;
// Pass new calibration to kernel
writeValue("xoffset", new_xoffset);
writeValue("yoffset", new_yoffset);
writeValue("xscale", new_xscale);
writeValue("yscale", new_yscale);
// Save calibraiton data to /data/system/pointercal
StringBuilder sb = new StringBuilder();
sb.append(new_xscale);
sb.append(" ");
sb.append(0);
sb.append(" ");
sb.append(new_xoffset);
sb.append(" ");
sb.append(0);
sb.append(" ");
sb.append(new_yscale);
sb.append(" ");
sb.append(new_yoffset);
sb.append(" ");
sb.append(65536);
App + ui input framework + kernel working together.
App - creation poinercal
ui input framework - reading pointercal send correct info to kernel
kernel touch driver - doing move.

Öhm, the touchscreen driver use a virtual square (320*320) to detect touch, stretched to a rectangle(320*480)?
mod: about calibration, http://code.google.com/p/openeve/issues/detail?id=91

jasper580 said:
Please discuss development on your page. I want to make a dev team here
Click to expand...
Click to collapse
I cant understand you! What do you mean? Do you wanna make new dev team? Working on my sources but without me?

I exactly want to ask that. Maybe he start from scratch, his github is near empty.

Related

Android Code: Downloading from within an app

I've searched the android website but I cannot find any sample code that will allow you to download something from a webpage/website. I'm trying to create a simple application that will allow you to download a podcast from a website straight onto the phone's sdcard. Any help is appreciated. Thanks!
[Edit]: I've found http://developer.android.com/reference/android/webkit/DownloadListener.html it seems right but I'm still a beginner and not sure how to apply the code / modify it and where to place it.
Networking is a big series of tests. Just about everything needs to be within a try/catch block, and you need to think of and test every possible contingency. Without doing that, you WILL get crashes and ugliness.
It is not the simplest thing for a newb to implement.
The SECOND thing you need to note is that WEBKIT is not what you want to mess with for *pure downloads*. If you just want to pull a file and do something manual with it, you do NOT want to be messing with an html rendering engine (that's what webkit is...).
Third, network requests should be done in a SEPARATE THREAD from the UI, otherwise it will result in a terrible user experience, ANR's, and general appearance of FREEZUPS.
You can try some of this:
Code:
public class HTTPGetData {
private byte[] data;
public HTTPGetData(){
}
public byte[] toByteArray(){
return data;
}
public void getViaHttpConnection(String url) throws IOException{
HttpClient httpClient = new DefaultHttpClient();
Log.d("***HTTPGetData",url);
HttpGet request = new HttpGet(url);
request.addHeader("Accept-Encoding", "gzip");
HttpResponse response;
try {
response = httpClient.execute(request);
boolean gzip = false;
if (response.containsHeader("Content-Encoding")){
Header[] headers = response.getHeaders("Content-Encoding");
for (int i=0; i<headers.length; i++){
if (headers[i].getValue().compareToIgnoreCase("gzip")==0) gzip = true;
}
}
int status = response.getStatusLine().getStatusCode();
// we assume that the response body contains the error message
if (status != HttpStatus.SC_OK) {
ByteArrayOutputStream ostream = new ByteArrayOutputStream();
response.getEntity().writeTo(ostream);
Log.e("HTTP_CLIENT", ostream.toString());
throw new IOException("HTTP response code: " + status);
} else {
int len = (int)response.getEntity().getContentLength();
InputStream content;
if (gzip) content = new GZIPInputStream(response.getEntity().getContent());
else content = response.getEntity().getContent();
if (len>0 && !gzip){
byte[] theData = new byte[len];
int rec = 0;
int cread = 0;
boolean fail=false;
while (rec < len){
if ((cread=content.read(theData, rec, len-rec))==0){
Log.e("HTTP_CLIENT","Short");
fail=true;
break;
}
rec+=cread;
}
if (!fail) data=theData;
} else {
int ch;
ByteVector bv = new ByteVector(1000);
while ((ch = content.read()) != -1){
bv.add((byte)ch);
}
data = bv.toByteArray();
}
content.close(); // this will also close the connection
}
} catch (ClientProtocolException e) {
Log.e("HTTP_CLIENT","ClientProtocolException");
throw new IOException("ClientProtocolException caught in HTTPGetData.getViaHttpConnection(String url)");
} catch (IOException e) {
Log.e("HTTP_CLIENT","IOException");
throw new IOException("IOException caught in HTTPGetData.getViaHttpConnection(String url)");
}
}
}
What you can do with that is something like this;
try{
HTTPGetData hgd = new HTTPGetData();
hgd.getViaHttpConnection("http://someurl");
//open file and dump in hgd.toByteArray();
catch(IOException e){
//do something with e
}
... and of course, put that in some new thread and while its running, make something spin to give the user the impression of progress.
Thanks lb. I don't really understand perfectly but I will look up the stuff I do not understand. Thanks for the help

[Java]Programming Help

So I'm learning Java right now, starting off with simple programs. I need to make a program that displays "1-10" when the user inputs one of the numbers and ""11-20" if it's one of those. I have no idea what lines I'm missing, and I'm sure someone here can help me.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package coinflip2;
/**
*
* @author Class
*/
import java.util.Scanner;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.print("Input a Number from 1-20: ");
int num = scan.nextInt();
while (num < 1 || num > 20)
{
System.out.print ("Not in range. Please enter a number from 1 to 20. ");
{
if (num >= 1 || num <=10)
System.out.print("1-10");
else
System.out.print("11-20");
}
}
}
}
Click to expand...
Click to collapse
im also really new to java im kinda self teaching. when u tried to compile what were ur error messages
Wait, I messed something up. before I posted it I was able to actually input a number. Let me take a look at it and I'll edit the first post.
Ok so I edited the first post.
I get no errors. It prompts me to input a number, and after I do it just says "Build Successful" and if I put in a number less than 1 or greater than 20 it prompts me to input a different number. So the first part I got right, I just need to get the print functions to work in the if/else statements.
EDIT!!! Ok I got it to work. This is now the final version if you want to know, even though it's very simple.
Just an update on what I have so far. Everything works but no matter what number between 1 and 20 I put I still get the same answer.
Also sorry for spamming like that, but I'm sure someone can actually learn from my mistakes .
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package coinflip2;
/**
*
* @author Class
*/
import java.util.Scanner;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.print("Input a Number from 1-20: ");
int num = scan.nextInt();
while (num < 1 || num > 20)
{
System.out.print ("Not in range. Please enter a number from 1 to 20. ");
num = scan.nextInt();
}
{
if (num >= 1 && num <=10)
System.out.println("1-10");
else
System.out.println("11-20");
}
}
}
Click to expand...
Click to collapse

[Q] XSharedPreferences - never loaded

Hi guys,
I'm currently a little bit confused because i try to create my first XPosed module for Xposed 2.6.1 on a Android 4.0.3 unit but i have trouble with my preferences. I tried multiple things but it was never working.
Here is the preferences code of my Settings activity. That one works and it creates a the preference file with rw-rw-r permissions and the preferences are correctly saved.
Code:
getPreferenceManager().setSharedPreferencesMode(MODE_WORLD_READABLE | MODE_MULTI_PROCESS);
getPreferenceManager().setSharedPreferencesName(Const.PACKAGE + "_preferences");
addPreferencesFromResource(R.xml.preferences);
That one is the xposed side snippet:
Code:
preferences = new XSharedPreferences(Const.PACKAGE, Const.PACKAGE+"_preferences");
if (preferences.getAll().size()==0)
{
debug("Preferences seems not to be initialized!");
}
It never loads any of my preferences. I tried the constructor XSharedPreferences(Const.PACKAGE) instead, but without any luck...
I checked the directory permissions of the settings directory, and that one seems to be correct (rwxrwxr-x).
Thanks for every help!
Bye
Have you checked what Const.PACKAGE actually is set to?
It is set to the hardcoded package Name. No class.getPackage... I added a file.isreadable and it returns false. I dont know, im just out oft any ideas.
TheLexus said:
It is set to the hardcoded package Name. No class.getPackage... I added a file.isreadable and it returns false. I dont know, im just out oft any ideas.
Click to expand...
Click to collapse
Is there any reason why you set MODE_MULTI_PROCESS? Can you please try removing it, delete your preference file and try again?
In my UI I open SharedPreferences from <packagename>_preferences.xml
getSharedPreferences(Common.PREFERENCES_NAME, Context.MODE_WORLD_READABLE)
Click to expand...
Click to collapse
and in the module I open the settings via
new XSharedPreferences(Common.PACKAGE_NAME);
Click to expand...
Click to collapse
Please remove your current preferences file and the MODE_MULTI_PROCESS and try the code from above.
So you found any way to make it work??
I ran into the same problem, I set the preferences by the code:
SharedPreferences.Editor editor = LogExtras.getAppContext().getSharedPreferences(Commons.PACKAGE_NAME, Context.MODE_WORLD_READABLE).edit();
editor.putString("package_to_look", _packageToLook);
And when I try to get it from the module it always returns size 0
private static final XSharedPreferences preferences = new XSharedPreferences(Commons.PACKAGE_NAME, Commons.PACKAGE_NAME+"_preferences");
public static void refreshPreferences() {
Log.d("Utils", "reading prefs");
preferences.reload();
Log.d("Utils", Integer.toString(preferences.getAll().size()));
Commons.PACKAGE_TO_LOOK = preferences.getString("package_to_look", Commons.PACKAGE_TO_LOOK);
log("Package to Look: " + Commons.PACKAGE_TO_LOOK);
}
---------- Post added at 04:30 PM ---------- Previous post was at 03:34 PM ----------
I tested the prefs in the context, and it works, only in xposed it dont load.
So I got the app saving the pref and reading the pref working, but when I try to read the pref with XSharedPreference, the size is always 0.
Already tried everything, but nothing works.
caioketo said:
So you found any way to make it work??
I ran into the same problem, I set the preferences by the code:
SharedPreferences.Editor editor = LogExtras.getAppContext().getSharedPreferences(Commons.PACKAGE_NAME, Context.MODE_WORLD_READABLE).edit();
editor.putString("package_to_look", _packageToLook);
And when I try to get it from the module it always returns size 0
private static final XSharedPreferences preferences = new XSharedPreferences(Commons.PACKAGE_NAME, Commons.PACKAGE_NAME+"_preferences");
public static void refreshPreferences() {
Log.d("Utils", "reading prefs");
preferences.reload();
Log.d("Utils", Integer.toString(preferences.getAll().size()));
Commons.PACKAGE_TO_LOOK = preferences.getString("package_to_look", Commons.PACKAGE_TO_LOOK);
log("Package to Look: " + Commons.PACKAGE_TO_LOOK);
}
---------- Post added at 04:30 PM ---------- Previous post was at 03:34 PM ----------
I tested the prefs in the context, and it works, only in xposed it dont load.
So I got the app saving the pref and reading the pref working, but when I try to read the pref with XSharedPreference, the size is always 0.
Already tried everything, but nothing works.
Click to expand...
Click to collapse
I have a similar problem, but only for one preference:
Code:
public class Main implements IXposedHookZygoteInit, IXposedHookLoadPackage {
public static final String MY_PACKAGE_NAME = Main.class.getPackage().getName();
private static XSharedPreferences pref, packagePref;
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
pref = new XSharedPreferences(MY_PACKAGE_NAME, Common.PREF);
packagePref = new XSharedPreferences(MY_PACKAGE_NAME, Common.PREF_PACKAGE);
}
@Override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
pref.reload();
packagePref.reload();
final String packageName = lpparam.packageName;
boolean masterSwitchOn = pref.getBoolean(Common.MASTER_SWITCH, true);
XposedBridge.log("Master Switch " + (masterSwitchOn ? "on" : "off"));
if (!masterSwitchOn) {
return;
}
if (!packagePref.getBoolean(packageName, false)) {
return;
}
Long timestamp = System.currentTimeMillis();
Long permitTimestamp = packagePref.getLong(packageName + "_tmp", 0);
if (permitTimestamp != 0 && timestamp - permitTimestamp <= 4000) {
return;
}
.
.
.
}
So, the package boolean works, the master switch doesn't…
It only seems to work after opening and closing the app multiple times.
caioketo said:
So you found any way to make it work??
I ran into the same problem, I set the preferences by the code:
Click to expand...
Click to collapse
Are you sure that your app saves the file to shared_prefs/<packagename>_preferences.xml? Better verify it using a file explorer. It's the default for preference activities, but it might not be for the methods you use.
Maxr1998 said:
I have a similar problem, but only for one preference:
Click to expand...
Click to collapse
Similar stuff here. Does your application really save the preferences in two different files, named shared_prefs/<Value of Common.PREF>.xml and shared_prefs/<Value of Common.PREF_PACKAGE>.xml? If yes, are both of these files world-readable?
You just saved my day. Making the preference files world readable solves it , preferences.makeWorldReadable() is the way to go. And yes, I'm using two preference files.
Thank you thank you thank you

Changes applied only after reboot

Hey.
I have a little problem with my module. I can't dynamicly change settings, changes are applied only after reboot
Here code (in this case is code responding to cahnge color )
ColorPickerSample.java
Code:
String mColor = ([COLOR=#008000][B]"#" [/B][/COLOR]+ [COLOR=#660e7a][B]editText[/B][/COLOR].getText().toString());
[COLOR=#808000]@SuppressWarnings[/COLOR]([COLOR=#008000][B]"deprecation"[/B][/COLOR])
SharedPreferences pref = getSharedPreferences([COLOR=#008000][B]"pref"[/B][/COLOR], Context.[COLOR=#660e7a][B][I]MODE_WORLD_READABLE[/I][/B][/COLOR]);
Editor editor = pref.edit();
[COLOR=#808080][I]//write prefs
[/I][/COLOR]editor.putString(PrefKeys.UI_COLOR, mColor);
[COLOR=#808080][I]//apply
[/I][/COLOR]editor.commit();
Module.java
Code:
XSharedPreferences [COLOR=#660e7a][B]pref [/B][/COLOR]= [COLOR=#000080][B]new [/B][/COLOR]XSharedPreferences(ModuleTest.[COLOR=#000080][B]class[/B][/COLOR].getPackage().getName(), [COLOR=#008000][B]"pref"[/B][/COLOR]);
[COLOR=#000080][B]final [/B][/COLOR]String [COLOR=#660e7a][B]uicolor [/B][/COLOR]= [COLOR=#660e7a][B]pref[/B][/COLOR].getString(PrefKeys.[COLOR=#660e7a][I]UI_COLOR[/I][/COLOR], [COLOR=#008000][B]"#ff008080"[/B][/COLOR]);
[COLOR=#000080][B]final int [/B][/COLOR][COLOR=#660e7a][B]colorint [/B][/COLOR]= Color.[I]parseColor[/I]([COLOR=#660e7a][B]uicolor[/B][/COLOR]);
[COLOR=#808000]@Override
[/COLOR][COLOR=#000080][B]public void [/B][/COLOR]initZygote(StartupParam startupParam) [COLOR=#000080][B]throws [/B][/COLOR]Throwable {
XResources.[I]setSystemWideReplacement[/I]([COLOR=#008000][B]"android"[/B][/COLOR], [COLOR=#008000][B]"color"[/B][/COLOR], [COLOR=#008000][B]"holo_blue_light"[/B][/COLOR], Color.[I]parseColor[/I](uicolor));
}
Thank you so much for any help!
KuaQ said:
Hey.
I have a little problem with my module. I can't dynamicly change settings, changes are applied only after reboot
Here code (in this case is code responding to cahnge color )
ColorPickerSample.java
Code:
String mColor = ([COLOR=#008000][B]"#" [/B][/COLOR]+ [COLOR=#660e7a][B]editText[/B][/COLOR].getText().toString());
[COLOR=#808000]@SuppressWarnings[/COLOR]([COLOR=#008000][B]"deprecation"[/B][/COLOR])
SharedPreferences pref = getSharedPreferences([COLOR=#008000][B]"pref"[/B][/COLOR], Context.[COLOR=#660e7a][B][I]MODE_WORLD_READABLE[/I][/B][/COLOR]);
Editor editor = pref.edit();
[COLOR=#808080][I]//write prefs
[/I][/COLOR]editor.putString(PrefKeys.UI_COLOR, mColor);
[COLOR=#808080][I]//apply
[/I][/COLOR]editor.commit();
Module.java
Code:
XSharedPreferences [COLOR=#660e7a][B]pref [/B][/COLOR]= [COLOR=#000080][B]new [/B][/COLOR]XSharedPreferences(ModuleTest.[COLOR=#000080][B]class[/B][/COLOR].getPackage().getName(), [COLOR=#008000][B]"pref"[/B][/COLOR]);
[COLOR=#000080][B]final [/B][/COLOR]String [COLOR=#660e7a][B]uicolor [/B][/COLOR]= [COLOR=#660e7a][B]pref[/B][/COLOR].getString(PrefKeys.[COLOR=#660e7a][I]UI_COLOR[/I][/COLOR], [COLOR=#008000][B]"#ff008080"[/B][/COLOR]);
[COLOR=#000080][B]final int [/B][/COLOR][COLOR=#660e7a][B]colorint [/B][/COLOR]= Color.[I]parseColor[/I]([COLOR=#660e7a][B]uicolor[/B][/COLOR]);
[COLOR=#808000]@Override
[/COLOR][COLOR=#000080][B]public void [/B][/COLOR]initZygote(StartupParam startupParam) [COLOR=#000080][B]throws [/B][/COLOR]Throwable {
XResources.[I]setSystemWideReplacement[/I]([COLOR=#008000][B]"android"[/B][/COLOR], [COLOR=#008000][B]"color"[/B][/COLOR], [COLOR=#008000][B]"holo_blue_light"[/B][/COLOR], Color.[I]parseColor[/I](uicolor));
}
Thank you so much for any help!
Click to expand...
Click to collapse
Could you make broadcast receiver to get the color and set it
Sent from my SM-G530H using XDA Free mobile app
Problem solved. Thank you
initZygote's code runs only once, when system boots. So even if you change pref, nothing will happen.

Json body with retrofit issues with format

As simple as this json looks I cannot get it formatted correctly to post in body.
Code:
{
"requests": [
{
"action": "reject",
"justification": "admin reason",
"requestId": "23423423refsdsdgdg"
}
],
"justification": "admin reason"
}
Here is what I have so far in Android studio using retrofit2
Code:
Gson gson = new GsonBuilder()
.setLenient()
.create();
Retrofit.Builder builder = new Retrofit.Builder()
.baseUrl("https://myurl.com/")
.addConverterFactory(GsonConverterFactory.create(gson));
JsonObject jsonObject = new JsonObject();
JsonObject jsonObjectN = new JsonObject();
jsonObject.addProperty("action", action);
jsonObject.addProperty("request_id", request_id);
jsonObject.addProperty("justification", "blablabla");
jsonObjectN.add("requests", jsonObject);
jsonObjectN.addProperty("justification", justification);
Retrofit retrofit = builder.build();
Client client = retrofit.create(Client.class);
Call<PostRequest> user = client.postRequests(
jsonObjectN
);
in client class I have
Code:
@Headers("Content-Type: application/json")
@POST("/requests")
Call<PostRequest> postRequests(@Body JsonObject body
);
So the request is like this
Code:
Request{method=POST, url=https://myurl.com/requests, tags={class retrofit2.Invocation=com.login.Client.postRequests() [{"requests":{"action":"reject","request_id":"23423423refsdsdgdg","justification":"blablabla"},"justification":"Action done by Admin"}]}}
Very close but I cant quite figure out how to make it in the exact array/json format as its expecting??
Hopefully someone knows Android and jsonObject well enough to help.

Categories

Resources