Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/contacts/Contact.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public Hashtable getAddresses() {
/// #### Parameters
///
/// - `addresses`: @param addresses the Hashtable contains key/value pairs where
/// the key is a String which represents the type of the Address, types can
/// the key is a String that represents the type of the Address, types can
/// be: "home", "work", "other" the value is an Address Object.
public void setAddresses(Hashtable addresses) {
this.addresses = addresses;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public static void appendNotification(String type, String body, String image, St
msg += "&category="+java.net.URLEncoder.encode(category, "UTF-8");
}
if (image != null) {
image += "&image="+java.net.URLEncoder.encode(image, "UTF-8");
msg += "&image="+java.net.URLEncoder.encode(image, "UTF-8");
}
os.writeUTF(msg);

Expand Down Expand Up @@ -1591,9 +1591,6 @@ public boolean isNativeInputImmediate() {
}

public void editString(final Component cmp, int maxSize, final int constraint, String text, int keyCode) {
if (keyCode > 0 && getKeyboardType() == Display.KEYBOARD_TYPE_QWERTY) {
text += (char) keyCode;
}
InPlaceEditView.edit(this, cmp, constraint);
}

Expand Down Expand Up @@ -3933,7 +3930,6 @@ public void run() {
);

final com.codename1.media.AudioBuffer audioBuffer = com.codename1.media.MediaManager.getAudioBuffer(path, true, 64);
final boolean[] stop = new boolean[1];

record[0] = new AbstractMedia() {
private int lastTime;
Expand Down Expand Up @@ -8122,11 +8118,7 @@ private void removeCompletionHandler(Runnable onCompletion) {


private String getImageFilePath(Uri uri) {

File file = new File(uri.getPath());
String scheme = uri.getScheme();
//String[] filePaths = file.getPath().split(":");
//String image_id = filePath[filePath.length - 1];
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = getContext().getContentResolver().query(
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
Expand All @@ -8151,8 +8143,10 @@ private String getImageFilePath(Uri uri) {
if (filePath == null || "content".equals(scheme)) {
//if the file is not on the filesystem download it and save it
//locally
InputStream inputStream = null;
OutputStream tmp = null;
try {
InputStream inputStream = getContext().getContentResolver().openInputStream(uri);
inputStream = getContext().getContentResolver().openInputStream(uri);
if (inputStream != null) {
String name = new File(uri.toString()).getName();//getContentName(getContext().getContentResolver(), uri);
if (name != null) {
Expand All @@ -8163,27 +8157,20 @@ private String getImageFilePath(Uri uri) {
filePath = homePath
+ getFileSystemSeparator() + name;
File f = new File(removeFilePrefix(filePath));
OutputStream tmp = createFileOuputStream(f);
byte[] buffer = new byte[1024];
int read = -1;
while ((read = inputStream.read(buffer)) > -1) {
tmp.write(buffer, 0, read);
}
tmp.close();
inputStream.close();
tmp = createFileOuputStream(f);
Util.copy(inputStream, tmp);
}
}
} catch (Exception e) {
e.printStackTrace();
com.codename1.io.Log.e(e);
} finally {
Util.cleanup(tmp);
Util.cleanup(inputStream);
}
}
//long len = new com.codename1.io.File(filePath).length();
return filePath;
}





@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,16 +303,13 @@ public void handleSizeChange(int w, int h) {
if (InPlaceEditView.isEditing()) {
final Form f = this.implementation.getCurrentForm();
ActionListener sizeChanged = new ActionListener() {

@Override
public void actionPerformed(ActionEvent evt) {
CodenameOneView.this.implementation.getActivity().runOnUiThread(new Runnable() {

@Override
public void run() {
InPlaceEditView.reLayoutEdit();
InPlaceEditView.scrollActiveTextfieldToVisible();

}
});
f.removeSizeChangedListener(this);
Expand Down
25 changes: 0 additions & 25 deletions Ports/Android/src/com/codename1/impl/android/InPlaceEditView.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,31 +104,6 @@ public class InPlaceEditView extends FrameLayout{
public static final int REASON_TOUCH_OUTSIDE = 2;
public static final int REASON_SYSTEM_KEY = 3;

static void scrollActiveTextfieldToVisible() {
if (isEditing() && sInstance != null) {
Runnable r = new Runnable() {

@Override
public void run() {
if (sInstance != null && sInstance.mEditText != null && sInstance.mEditText.mTextArea != null) {
TextArea ta = sInstance.mEditText.mTextArea;
if (isScrollableParent(ta)) {
ta.scrollRectToVisible(0, 0, ta.getWidth(), ta.getHeight(), ta);
ta.getComponentForm().getAnimationManager().flushAnimation(new Runnable() {

@Override
public void run() {
reLayoutEdit();
}

});
}
}
}

};
}
}
// The native Android edit-box to place over Codename One's edit-component
private EditView mEditText = null;
private EditView mLastEditText = null;
Expand Down
54 changes: 9 additions & 45 deletions Ports/iOSPort/src/com/codename1/impl/ios/IOSImplementation.java
Original file line number Diff line number Diff line change
Expand Up @@ -6655,7 +6655,15 @@ public Contact getContactById(String id, boolean includesFullName, boolean inclu
if (includeAddress) {
// This is a hack to make sure that
// Address and its methods aren't stripped out by the BytecodeCompiler
Address tmp = new Address();
if (System.currentTimeMillis() == 0) {
Address tmp = new Address();
tmp.setCountry("");
tmp.setLocality("");
tmp.setRegion("");
tmp.setPostalCode("");
tmp.setStreetAddress("");
c.getAddresses().put("", tmp);
}
}

c.setEmails(new Hashtable());
Expand All @@ -6670,50 +6678,6 @@ public Contact getContactById(String id) {
throw new RuntimeException("Please add the ios.NSContactsUsageDescription build hint");
}
return getContactById(id, true, true, true, true, true);

/*c.setId("" + id);
long person = nativeInstance.getPersonWithRecordID(recId);
String fname = nativeInstance.getPersonFirstName(person);
c.setFirstName(fname);
String sname = nativeInstance.getPersonSurnameName(person);
c.setFamilyName(sname);
if(c.getFirstName() != null) {
StringBuilder s = new StringBuilder();
if(fname != null && fname.length() > 0) {
if(sname != null && sname.length() > 0) {
c.setDisplayName(fname + " " + sname);
} else {
c.setDisplayName(fname);
}
} else {
if(sname != null && sname.length() > 0) {
c.setDisplayName(sname);
}
}
}
c.setPrimaryEmail(nativeInstance.getPersonEmail(person));

int phones = nativeInstance.getPersonPhoneCount(person);
Hashtable h = new Hashtable();
for(int iter = 0 ; iter < phones ; iter++) {
String t = nativeInstance.getPersonPhoneType(person, iter);
if(t == null) {
t = "work";
}
String phone = nativeInstance.getPersonPhone(person, iter);
if(phone != null) {
h.put(t, phone);
}
}
c.setPhoneNumbers(h);

c.setPrimaryPhoneNumber(nativeInstance.getPersonPrimaryPhone(person));

//h = new Hashtable();
//h.put("Work", h);
c.setAddresses(h);
nativeInstance.releasePeer(person);
return c;*/
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,6 @@ public boolean build(File sourceZip, final BuildRequest request) throws BuildExc
}

File androidToolsDir = new File(androidSDKDir, "tools");
File androidCommand = new File(androidToolsDir, "android" + bat);
File projectDir = new File(tmpFile, request.getMainClass());
gradleProjectDirectory = projectDir;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,9 @@ private void processString(String contents, File projectDir) throws MojoExecutio
}

private File generateBaseArchetype(String string, File templateFile) throws TemplateParseException, IOException {
Dependency out = new Dependency();
String archetype = extractSectionFrom(string, "archetype");
Properties props = new Properties();


props.load(new StringReader(archetype));
String[] requiredProperties = new String[]{
"artifactId", "groupId", "version"
Expand All @@ -343,7 +341,6 @@ private File generateBaseArchetype(String string, File templateFile) throws Temp
}
}


File dest = new File(outputDir, props.getProperty("artifactId"));
if (dest.exists()) {
if (overwrite) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,6 @@ protected void processBuffer(ByteArrayOutputStream buffer) {
private Path prepareClasspath(Java java) {
Log log = getLog();
log.debug("Preparing classpath for Simulator");
List<String> paths = new ArrayList<>();
//StringBuilder classpath = new StringBuilder();
Path classpath = java.createClasspath();
if (System.getProperty("cef.dir") != null) {
Variable v = new Variable();
Expand Down Expand Up @@ -242,15 +240,7 @@ private Path prepareClasspath(Java java) {
if (getProjectInternalTmpJar() != null && getProjectInternalTmpJar().exists()) {
classpath.add(new Path(antProject, getProjectInternalTmpJar().getAbsolutePath()));
}

//classpath.append(file.getPath());
//paths.add(file.getAbsolutePath());
}
//if (classpath.length() > 0) {
// classpath.append(':');
//}
//classpath.append(classFiles.getPath());
//paths.add(classFiles.getAbsolutePath());
classpath.add(new Path(antProject, project.getBuild().getOutputDirectory()));
log.debug("Using the following classpath for Stubber: " + classpath);
return classpath;
Expand Down
Loading
Loading