Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Little Fix and Android "hasHardwareButton", "IMEI", "MACAdress"

  • Loading branch information...
commit 2808f62c038f414617533aeb4efd7c6629521449 1 parent 8dff626
@mateuszmackowiak authored
Showing with 92 additions and 45 deletions.
  1. +77 −28 AS/NativeAlert/src/pl/mateuszmackowiak/nativeANE/dialogs/NativeListDialog.as
  2. +3 −0  AS/NativeAlert/src/pl/mateuszmackowiak/nativeANE/dialogs/NativeTextInputDialog.as
  3. BIN  Android/NativeAlert/bin/classes/pl/mateuszmackowiak/nativeANE/NativeDialog/listDialog/showListDialog.class
  4. BIN  ...d/NativeAlert/bin/classes/pl/mateuszmackowiak/nativeANE/NativeDialog/progressDialog/showProgressPopup.class
  5. BIN  ...NativeAlert/bin/classes/pl/mateuszmackowiak/nativeANE/NativeDialog/systemProperties$getSystemProperty.class
  6. BIN  Android/NativeAlert/bin/classes/pl/mateuszmackowiak/nativeANE/NativeDialog/systemProperties.class
  7. +1 −1  Android/NativeAlert/project.properties
  8. +0 −4 Android/NativeAlert/src/pl/mateuszmackowiak/nativeANE/NativeDialog/NativeExtension.java
  9. +1 −1  Android/NativeAlert/src/pl/mateuszmackowiak/nativeANE/NativeDialog/alert/showAlertFunction.java
  10. +1 −1  Android/NativeAlert/src/pl/mateuszmackowiak/nativeANE/NativeDialog/listDialog/showListDialog.java
  11. +1 −1  Android/NativeAlert/src/pl/mateuszmackowiak/nativeANE/NativeDialog/progressDialog/showProgressPopup.java
  12. +3 −5 Android/NativeAlert/src/pl/mateuszmackowiak/nativeANE/NativeDialog/systemProperties.java
  13. BIN  ...NativeAlert.xcodeproj/project.xcworkspace/xcuserdata/mmmackowiak.xcuserdatad/UserInterfaceState.xcuserstate
  14. BIN  build/NativeAlert.swc
  15. BIN  build/nativealert.jar
  16. BIN  build/release/NativeAlert.ane
  17. BIN  build/release/NativeAlert.swc
  18. +1 −1  example/NativeAlertMobile/.actionScriptProperties
  19. BIN  example/NativeAlertMobile/NativeAlertMobile.apk
  20. +1 −0  example/NativeAlertMobile/src/NativeAlertMobile-app.xml
  21. +3 −3 example/NativeAlertMobile/src/views/NativeAlertUsageHomeView.mxml
View
105 AS/NativeAlert/src/pl/mateuszmackowiak/nativeANE/dialogs/NativeListDialog.as
@@ -88,6 +88,7 @@ package pl.mateuszmackowiak.nativeANE.dialogs
private var _list:Vector.<Object> = null;
private var _selectedIndex:int = -1;
private var _isShowing:Boolean=false;
+ private var _isSingleChoice:Boolean = false;
//---------------------------------------------------------------------
//
// Public Methods.
@@ -99,6 +100,8 @@ package pl.mateuszmackowiak.nativeANE.dialogs
*
* <br> flash.events.ErrorEvent
* <br> pl.mateuszmackowiak.nativeANE.NativeDialogEvent
+ *
+ * @param the theme of the dialog - defined by the version of software
* @author Mateusz Maćkowiak
* @see http://www.mateuszmackowiak.art.pl/blog
* @since 2012
@@ -106,7 +109,7 @@ package pl.mateuszmackowiak.nativeANE.dialogs
* @see pl.mateuszmackowiak.nativeANE.NativeDialogListEvent
* @see flash.events.ErrorEvent
*/
- public function NativeListDialog(theme:uint=NaN)
+ public function NativeListDialog(theme:int=-1)
{
if(Capabilities.os.toLowerCase().indexOf("linux")>-1)
isAndroid = true;
@@ -143,6 +146,7 @@ package pl.mateuszmackowiak.nativeANE.dialogs
*/
public function showSingleChoice(labels:Vector.<String>,checkedLabel:int=-1,buttons:Vector.<String>=null,cancleble:Object=null):Boolean
{
+ _isSingleChoice = true;
if(_theme ==-1)
_theme = defaultTheme;
if(buttons!=null)
@@ -187,6 +191,7 @@ package pl.mateuszmackowiak.nativeANE.dialogs
*/
public function showMultiChoice(labels:Vector.<String>,checkedLabels:Vector.<Boolean>,buttons:Vector.<String>=null,cancelable:Object=null):Boolean
{
+ _isSingleChoice = false;
if(_theme ==-1)
_theme = defaultTheme;
if(buttons!=null)
@@ -212,7 +217,7 @@ package pl.mateuszmackowiak.nativeANE.dialogs
_selectedIndex = -1;
try{
if(isAndroid)
- context.call("showListDialog","create",_title,_buttons,labels,checkedLabels,_cancelable,_theme);
+ context.call("showListDialog","show",_title,_buttons,labels,checkedLabels,_cancelable,_theme);
else
context.call("show",_title,_message,_buttons,labels,checkedLabels);
return true;
@@ -240,63 +245,107 @@ package pl.mateuszmackowiak.nativeANE.dialogs
/**
- * list of selected labels
+ * list of selected labels. If <code>type</code> =="SingleChoice" returns a list with one selected label else empty
+ * @see #type
*/
public function get selectedLabels():Vector.<String>{
var labels:Vector.<String> = new Vector.<String>();
if(_list!==null && _list.length>0){
- for each (var obj:Object in _list)
- {
- if(obj.selected == true)
- labels.push(obj.label);
+ if(_isSingleChoice){
+ if(_selectedIndex>-1 && _selectedIndex<_list.length){
+ labels.push(_list[_selectedIndex].label);
+ }
+ }else{
+ for each (var obj:Object in _list)
+ {
+ if(obj.selected == true)
+ labels.push(obj.label);
+ }
}
- if(labels.length>0 && _selectedIndex>-1)
- labels.push(_list[_selectedIndex].label);
}
return labels;
}
/**
- * list of selected indexes
+ * list of selected indexes. If <code>type</code> =="SingleChoice" returns a list with selected index else empty
+ * @see #type
*/
public function get selectedIndexes():Vector.<int>{
var indexes:Vector.<int> = new Vector.<int>();
if(_list!==null && _list.length>0){
- for (var i:int = 0; i < _list.length; i++)
- {
- if(_list[i].selected == true)
- indexes.push(i);
- }
- if(indexes.length>0 && _selectedIndex>-1)
- indexes.push(_selectedIndex);
+ if(_isSingleChoice){
+ if(_selectedIndex>-1 && _selectedIndex<_list.length){
+ indexes.push(_selectedIndex);
+ }
+ }else{
+ for (var i:int = 0; i < _list.length; i++)
+ {
+ if(_list[i].selected == true)
+ indexes.push(i);
+ }
+ }
}
return indexes;
}
+ /**
+ * returns the type of dialog
+ * "MultipleChoice" or "SingleChoice"
+ */
+ public function get type():String
+ {
+ if(_isSingleChoice)
+ return "SingleChoice";
+ else
+ return "MultipleChoice";
+ }
/**
- * selected index. If multichoice -1
+ * selected index. If is multiple choice return the first slected index
+ * @see #type
*/
public function get selectedIndex():int{
- return _selectedIndex;
+ if(_isSingleChoice)
+ return _selectedIndex;
+ else if(_list!==null && _list.length>0){
+ for (var i:int = 0; i < _list.length; i++)
+ {
+ if(_list[i].selected == true)
+ return i;
+ }
+ }
+
+ return -1;
}
/**
- * selected label. If multichoice null
+ * selected label. If is multiple choice return the first slected label or null if non selected
+ * @see type
*/
public function get selectedLabel():String{
- if(_selectedIndex>-1 && _list!=null && _list.length>0)
- return _list[_selectedIndex].label;
- else
+ if(_isSingleChoice){
+ if(_selectedIndex>-1 && _list!=null && _list.length>0 && _selectedIndex<_list.length)
+ return _list[_selectedIndex].label;
+ else
+ return null;
+ }else{
+ if(_list!=null && _list.length>0){
+ for (var i:int = 0; i < _list.length; i++)
+ {
+ if(_list[i].selected == true)
+ return _list[i].label;
+ }
+ }
return null;
+ }
}
/**
- * if the dialog is showing (only Android)
+ * if the dialog is showing
*/
public function isShowing():Boolean{
if(context){
@@ -304,11 +353,11 @@ package pl.mateuszmackowiak.nativeANE.dialogs
const b:Boolean = context.call("showListDialog","isShowing");
_isShowing = b;
return b;
- }/*else if(isIOS){
+ }else if(isIOS){
const b2:Boolean = context.call("isShowing");
_isShowing = b2;
return b2;
- }*/
+ }
}
return false;
@@ -330,10 +379,10 @@ package pl.mateuszmackowiak.nativeANE.dialogs
context.call("showListDialog","setTitle",value);
return true;
}
- /*if(isIOS){
+ if(isIOS){
context.call("setTitle",value);
return true;
- }*/
+ }
return false;
}catch(e:Error){
showError("Error setting title "+e.message,e.errorID);
View
3  AS/NativeAlert/src/pl/mateuszmackowiak/nativeANE/dialogs/NativeTextInputDialog.as
@@ -91,6 +91,9 @@ package pl.mateuszmackowiak.nativeANE.dialogs
*
* <br> flash.events.ErrorEvent
* <br> pl.mateuszmackowiak.nativeANE.NativeDialogEvent
+ *
+ * @param the theme of the dialog - defined by the version of software
+ *
* @author Mateusz Maćkowiak
* @see http://www.mateuszmackowiak.art.pl/blog
* @since 2012
View
BIN  Android/NativeAlert/bin/classes/pl/mateuszmackowiak/nativeANE/NativeDialog/listDialog/showListDialog.class
Binary file not shown
View
BIN  ...ativeAlert/bin/classes/pl/mateuszmackowiak/nativeANE/NativeDialog/progressDialog/showProgressPopup.class
Binary file not shown
View
BIN  ...iveAlert/bin/classes/pl/mateuszmackowiak/nativeANE/NativeDialog/systemProperties$getSystemProperty.class
Binary file not shown
View
BIN  Android/NativeAlert/bin/classes/pl/mateuszmackowiak/nativeANE/NativeDialog/systemProperties.class
Binary file not shown
View
2  Android/NativeAlert/project.properties
@@ -8,4 +8,4 @@
# project structure.
# Project target.
-target=android-12
+target=android-15
View
4 Android/NativeAlert/src/pl/mateuszmackowiak/nativeANE/NativeDialog/NativeExtension.java
@@ -55,8 +55,4 @@ public void initialize()
{
Log.i("NativeAlert", "initialize");
}
-
-
-
-
}
View
2  Android/NativeAlert/src/pl/mateuszmackowiak/nativeANE/NativeDialog/alert/showAlertFunction.java
@@ -12,7 +12,7 @@
import android.app.AlertDialog;
/**
*
-* @author Mateusz Maækowiak
+* @author Mateusz Makowiak
*/
public class showAlertFunction implements FREFunction{
View
2  Android/NativeAlert/src/pl/mateuszmackowiak/nativeANE/NativeDialog/listDialog/showListDialog.java
@@ -99,7 +99,7 @@ else if(args[4]!=null)
public AlertDialog createPopup(FREContext context, String title, String buttons[], CharSequence choices[],boolean checkedItems[],Integer checkedItem, boolean cancelable, int theme) {
- AlertDialog.Builder builder = (Integer.parseInt(android.os.Build.VERSION.SDK)<11)?new AlertDialog.Builder(context.getActivity()):new AlertDialog.Builder(context.getActivity(),theme);
+ AlertDialog.Builder builder = (android.os.Build.VERSION.SDK_INT<11)?new AlertDialog.Builder(context.getActivity()):new AlertDialog.Builder(context.getActivity(),theme);
try{
if(title!=null && !title.isEmpty())
builder.setTitle(Html.fromHtml(title));
View
2  Android/NativeAlert/src/pl/mateuszmackowiak/nativeANE/NativeDialog/progressDialog/showProgressPopup.java
@@ -119,7 +119,7 @@ public FREObject call(FREContext context, FREObject[] args) {
public ProgressDialog createProgressDialog(FREContext context,int style,Integer progress,Integer secondaryProgress,String title,String message,int theme,boolean cancleble,boolean indeterminate) {
- ProgressDialog mDialog = (Integer.parseInt(android.os.Build.VERSION.SDK)<11)?new ProgressDialog(context.getActivity()):new ProgressDialog(context.getActivity(),theme);
+ ProgressDialog mDialog = (android.os.Build.VERSION.SDK_INT<11)?new ProgressDialog(context.getActivity()):new ProgressDialog(context.getActivity(),theme);
try{
if(title!=null && !title.isEmpty())
mDialog.setTitle(Html.fromHtml(title));
View
8 Android/NativeAlert/src/pl/mateuszmackowiak/nativeANE/NativeDialog/systemProperties.java
@@ -1,6 +1,5 @@
package pl.mateuszmackowiak.nativeANE.NativeDialog;
-import java.lang.reflect.Method;
import java.security.MessageDigest;
import java.util.HashMap;
import java.util.Map;
@@ -20,7 +19,7 @@
import com.adobe.fre.FREObject;
/**
*
-* @author Mateusz Maækowiak
+* @author Mateusz Makowiak
*/
public class systemProperties extends FREContext{
public static final String KEY = "SystemProperites";
@@ -110,9 +109,8 @@ public FREObject call(FREContext context, FREObject[] args)
dictionary.setProperty("AppUid",FREObject.newObject(String.valueOf(pInfo.applicationInfo.uid)));
Boolean hasHardwareMenuButton = true;
- if((Integer.parseInt(android.os.Build.VERSION.SDK)>14))
- hasHardwareMenuButton = false;
- //hasHardwareMenuButton = ViewConfiguration.get(activity.getBaseContext()).hasPermanentMenuKey();
+ if((android.os.Build.VERSION.SDK_INT>14))
+ hasHardwareMenuButton = ViewConfiguration.get(activity.getBaseContext()).hasPermanentMenuKey();
dictionary.setProperty("hasHardwareMenuButton", FREObject.newObject(hasHardwareMenuButton));
View
BIN  ...iveAlert.xcodeproj/project.xcworkspace/xcuserdata/mmmackowiak.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown
View
BIN  build/NativeAlert.swc
Binary file not shown
View
BIN  build/nativealert.jar
Binary file not shown
View
BIN  build/release/NativeAlert.ane
Binary file not shown
View
BIN  build/release/NativeAlert.swc
Binary file not shown
View
2  example/NativeAlertMobile/.actionScriptProperties
@@ -69,13 +69,13 @@
<actionScriptSettings version="1"/>
</buildTarget>
<buildTarget airDownloadURL="https://market.android.com/details?id=com.adobe.air" androidSettingsVersion="1" buildTargetName="com.adobe.flexide.multiplatform.android.platform">
+ <multiPlatformSettings enabled="true" includePlatformLibs="false" platformID="com.adobe.flexide.multiplatform.android.platform" version="2"/>
<airSettings airCertificatePath="/Users/mmmackowiak/Documents/Adobe Flash Builder 4.6/CERTYFIKATY/android.p12" airTimestamp="true" anePathSet="true" version="1">
<airExcludes/>
<anePaths>
<anePathEntry path="/Users/mmmackowiak/Documents/git/NativeDialog/build/release/NativeAlert.ane"/>
</anePaths>
</airSettings>
- <multiPlatformSettings enabled="true" includePlatformLibs="false" platformID="com.adobe.flexide.multiplatform.android.platform" version="2"/>
<actionScriptSettings version="1"/>
</buildTarget>
</buildTargets>
View
BIN  example/NativeAlertMobile/NativeAlertMobile.apk
Binary file not shown
View
1  example/NativeAlertMobile/src/NativeAlertMobile-app.xml
@@ -235,6 +235,7 @@
<manifestAdditions><![CDATA[
<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<!--See the Adobe AIR documentation for more information about setting Google Android permissions-->
<!--Removing the permission android.permission.INTERNET will have the side effect
View
6 example/NativeAlertMobile/src/views/NativeAlertUsageHomeView.mxml
@@ -405,10 +405,10 @@
var dialog:NativeListDialog = (event.target as NativeListDialog)
returnText.appendText("NativeDialogListEvent "+ event.index+" "+event.selected+"\n");
- if(dialog.selectedIndex>-1){
+ /*if(dialog.selectedIndex>-1){
selectedIndex = dialog.selectedIndex;
returnText.appendText("selectedLabel "+dialog.selectedLabel+"\n");
- }else{
+ }else{*/
const a:Vector.<String> = dialog.selectedLabels;
returnText.appendText("selectedLabels : \n");
if(a.length>0){
@@ -417,7 +417,7 @@
returnText.appendText(" "+a[i]+"\n");
}
}
- }
+ //}
}
public function closeNativeDialogHandler(event:NativeDialogEvent):void

1 comment on commit 2808f62

@katopz

i think we need to fix some typo there?

public static const MAC_ADRESS:String = 'MACAdress';

should be

public static const MAC_ADDRESS:String = 'MACAddress';

via pl.mateuszmackowiak.nativeANE.properties.SystemProperties

Please sign in to comment.
Something went wrong with that request. Please try again.