Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:appcelerator/titanium_mobile into…
… AUTO_LAYOUT
- Loading branch information
Showing
353 changed files
with
4,349 additions
and
1,386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
<project name="android" default="build"> | ||
<import file="../../build/build-module.xml"/> | ||
</project> | ||
|
||
<path id="dependencies"> | ||
<path path="${dist.classes.dir}/filesystem"/> | ||
</path> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
...ndroid/src/java/ti/modules/titanium/android/notificationmanager/BigPictureStyleProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/** | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2009-2014 by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
package ti.modules.titanium.android.notificationmanager; | ||
|
||
import org.appcelerator.kroll.KrollDict; | ||
import org.appcelerator.kroll.annotations.Kroll; | ||
import org.appcelerator.kroll.common.Log; | ||
import org.appcelerator.titanium.TiApplication; | ||
import org.appcelerator.titanium.TiC; | ||
import org.appcelerator.titanium.util.TiConvert; | ||
import org.appcelerator.titanium.util.TiUIHelper; | ||
import org.appcelerator.titanium.view.TiDrawableReference; | ||
|
||
import ti.modules.titanium.android.AndroidModule; | ||
import ti.modules.titanium.filesystem.FileProxy; | ||
import android.graphics.Bitmap; | ||
import android.graphics.BitmapFactory; | ||
import android.support.v4.app.NotificationCompat.BigPictureStyle; | ||
|
||
@Kroll.proxy(creatableInModule = AndroidModule.class, propertyAccessors = { | ||
TiC.PROPERTY_DECODE_RETRIES | ||
}) | ||
public class BigPictureStyleProxy extends StyleProxy { | ||
|
||
private static final String TAG = "TiNotificationBigPictureStyle"; | ||
|
||
public BigPictureStyleProxy() { | ||
super(); | ||
style = new BigPictureStyle(); | ||
} | ||
|
||
@Override | ||
public void handleCreationDict(KrollDict d) | ||
{ | ||
super.handleCreationDict(d); | ||
|
||
if (d == null) { | ||
return; | ||
} | ||
|
||
if (d.containsKey(TiC.PROPERTY_BIG_LARGE_ICON)) { | ||
setBigLargeIcon(d.get(TiC.PROPERTY_BIG_LARGE_ICON)); | ||
} | ||
|
||
if (d.containsKey(TiC.PROPERTY_BIG_PICTURE)) { | ||
setBigPicture(d.get(TiC.PROPERTY_BIG_PICTURE)); | ||
} | ||
|
||
if (d.containsKey(TiC.PROPERTY_BIG_CONTENT_TITLE)) { | ||
setBigContentTitle(TiConvert.toString(d.get(TiC.PROPERTY_BIG_CONTENT_TITLE))); | ||
} | ||
|
||
if (d.containsKey(TiC.PROPERTY_SUMMARY_TEXT)) { | ||
setSummaryText(TiConvert.toString(d.get(TiC.PROPERTY_SUMMARY_TEXT))); | ||
} | ||
} | ||
|
||
private TiDrawableReference makeImageSource(Object object) | ||
{ | ||
if (object instanceof FileProxy) { | ||
return TiDrawableReference.fromFile(this.getActivity(), ((FileProxy) object).getBaseFile()); | ||
} else if (object instanceof String) { | ||
return TiDrawableReference.fromUrl(this, (String) object); | ||
} else { | ||
return TiDrawableReference.fromObject(this.getActivity(), object); | ||
} | ||
} | ||
|
||
@Kroll.method @Kroll.setProperty | ||
public void setBigLargeIcon(Object icon) | ||
{ | ||
if(icon instanceof Number) { | ||
Bitmap bigLargeIcon = BitmapFactory.decodeResource(TiApplication.getInstance().getResources(), ((Number)icon).intValue()); | ||
((BigPictureStyle)style).bigLargeIcon(bigLargeIcon); | ||
} else { | ||
String iconUrl = TiConvert.toString(icon); | ||
if (iconUrl == null) { | ||
Log.e(TAG, "Url is null"); | ||
return; | ||
} | ||
String iconFullUrl = resolveUrl(null, iconUrl); | ||
Bitmap bigLargeIcon = BitmapFactory.decodeResource(TiApplication.getInstance().getResources(), TiUIHelper.getResourceId(iconFullUrl)); | ||
((BigPictureStyle)style).bigLargeIcon(bigLargeIcon); | ||
} | ||
|
||
setProperty(TiC.PROPERTY_BIG_LARGE_ICON, icon); | ||
} | ||
|
||
@Kroll.method @Kroll.setProperty | ||
public void setBigPicture(Object picture) | ||
{ | ||
TiDrawableReference source = makeImageSource(picture); | ||
|
||
// Check for decodeRetries | ||
if (hasProperty(TiC.PROPERTY_DECODE_RETRIES)) { | ||
source.setDecodeRetries(TiConvert.toInt(getProperty(TiC.PROPERTY_DECODE_RETRIES), TiDrawableReference.DEFAULT_DECODE_RETRIES)); | ||
} | ||
|
||
((BigPictureStyle)style).bigPicture(source.getBitmap()); | ||
|
||
setProperty(TiC.PROPERTY_BIG_PICTURE, picture); | ||
} | ||
|
||
@Kroll.method @Kroll.setProperty | ||
public void setBigContentTitle(String title) { | ||
((BigPictureStyle)style).setBigContentTitle(title); | ||
setProperty(TiC.PROPERTY_BIG_CONTENT_TITLE, title); | ||
} | ||
|
||
@Kroll.method @Kroll.setProperty | ||
public void setSummaryText(String text) { | ||
((BigPictureStyle)style).setSummaryText(text); | ||
setProperty(TiC.PROPERTY_SUMMARY_TEXT, text); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
...s/android/src/java/ti/modules/titanium/android/notificationmanager/BigTextStyleProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2009-2014 by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
package ti.modules.titanium.android.notificationmanager; | ||
|
||
import ti.modules.titanium.android.AndroidModule; | ||
import org.appcelerator.kroll.KrollDict; | ||
import org.appcelerator.kroll.annotations.Kroll; | ||
import org.appcelerator.titanium.TiC; | ||
import org.appcelerator.titanium.util.TiConvert; | ||
|
||
import android.support.v4.app.NotificationCompat.BigTextStyle; | ||
|
||
@Kroll.proxy(creatableInModule = AndroidModule.class) | ||
public class BigTextStyleProxy extends StyleProxy { | ||
|
||
public BigTextStyleProxy() { | ||
super(); | ||
style = new BigTextStyle(); | ||
} | ||
|
||
@Override | ||
public void handleCreationDict(KrollDict d) | ||
{ | ||
super.handleCreationDict(d); | ||
|
||
if (d == null) { | ||
return; | ||
} | ||
|
||
if (d.containsKey(TiC.PROPERTY_BIG_TEXT)) { | ||
setBigText(TiConvert.toString(d.get(TiC.PROPERTY_BIG_TEXT))); | ||
} | ||
|
||
if (d.containsKey(TiC.PROPERTY_BIG_CONTENT_TITLE)) { | ||
setBigContentTitle(TiConvert.toString(d.get(TiC.PROPERTY_BIG_CONTENT_TITLE))); | ||
} | ||
|
||
if (d.containsKey(TiC.PROPERTY_SUMMARY_TEXT)) { | ||
setSummaryText(TiConvert.toString(d.get(TiC.PROPERTY_SUMMARY_TEXT))); | ||
} | ||
} | ||
|
||
@Kroll.method @Kroll.setProperty | ||
public void setBigText(String text) { | ||
((BigTextStyle)style).bigText(text); | ||
setProperty(TiC.PROPERTY_BIG_TEXT, text); | ||
} | ||
|
||
@Kroll.method @Kroll.setProperty | ||
public void setBigContentTitle(String title) { | ||
((BigTextStyle)style).setBigContentTitle(title); | ||
setProperty(TiC.PROPERTY_BIG_CONTENT_TITLE, title); | ||
} | ||
|
||
@Kroll.method @Kroll.setProperty | ||
public void setSummaryText(String text) { | ||
((BigTextStyle)style).setSummaryText(text); | ||
setProperty(TiC.PROPERTY_SUMMARY_TEXT, text); | ||
} | ||
} |
Oops, something went wrong.