package SHARK2.keymon.com.mx;


import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.B4AClass;
import anywheresoftware.b4a.BALayout;
import anywheresoftware.b4a.debug.*;

public class filehandler extends B4AClass.ImplB4AClass implements BA.SubDelegator{
    private static java.util.HashMap<String, java.lang.reflect.Method> htSubs;
    private void innerInitialize(BA _ba) throws Exception {
        if (ba == null) {
            ba = new anywheresoftware.b4a.ShellBA(_ba, this, htSubs, "SHARK2.keymon.com.mx.filehandler");
            if (htSubs == null) {
                ba.loadHtSubs(this.getClass());
                htSubs = ba.htSubs;
            }
            
        }
        if (BA.isShellModeRuntimeCheck(ba)) 
			   this.getClass().getMethod("_class_globals", SHARK2.keymon.com.mx.filehandler.class).invoke(this, new Object[] {null});
        else
            ba.raiseEvent2(null, true, "class_globals", false);
    }

 
    public void  innerInitializeHelper(anywheresoftware.b4a.BA _ba) throws Exception{
        innerInitialize(_ba);
    }
    public Object callSub(String sub, Object sender, Object[] args) throws Exception {
        return BA.SubDelegator.SubNotFound;
    }
public static class _loadresult{
public boolean IsInitialized;
public boolean Success;
public String Dir;
public String FileName;
public String RealName;
public long Size;
public long Modified;
public String MimeType;
public void Initialize() {
IsInitialized = true;
Success = false;
Dir = "";
FileName = "";
RealName = "";
Size = 0L;
Modified = 0L;
MimeType = "";
}
@Override
		public String toString() {
			return BA.TypeToString(this, false);
		}}
public anywheresoftware.b4a.keywords.Common __c = null;
public Object _ion = null;
public anywheresoftware.b4a.objects.IntentWrapper _oldintent = null;
public b4a.example.dateutils _dateutils = null;
public SHARK2.keymon.com.mx.main _main = null;
public SHARK2.keymon.com.mx.appupdater _appupdater = null;
public SHARK2.keymon.com.mx.mapa_cliente _mapa_cliente = null;
public SHARK2.keymon.com.mx.mapa_rutas _mapa_rutas = null;
public SHARK2.keymon.com.mx.notificationservice _notificationservice = null;
public SHARK2.keymon.com.mx.pendientes _pendientes = null;
public SHARK2.keymon.com.mx.starter _starter = null;
public SHARK2.keymon.com.mx.subs _subs = null;
public SHARK2.keymon.com.mx.tracker _tracker = null;
public SHARK2.keymon.com.mx.newinst2 _newinst2 = null;
public SHARK2.keymon.com.mx.b4xpages _b4xpages = null;
public SHARK2.keymon.com.mx.b4xcollections _b4xcollections = null;
public SHARK2.keymon.com.mx.httputils2service _httputils2service = null;
public SHARK2.keymon.com.mx.xuiviewsutils _xuiviewsutils = null;
public String  _initialize(SHARK2.keymon.com.mx.filehandler __ref,anywheresoftware.b4a.BA _ba) throws Exception{
__ref = this;
innerInitialize(_ba);
RDebugUtils.currentModule="filehandler";
if (Debug.shouldDelegate(ba, "initialize", false))
	 {return ((String) Debug.delegate(ba, "initialize", new Object[] {_ba}));}
RDebugUtils.currentLine=31981568;
 //BA.debugLineNum = 31981568;BA.debugLine="Public Sub Initialize";
RDebugUtils.currentLine=31981570;
 //BA.debugLineNum = 31981570;BA.debugLine="End Sub";
return "";
}
public anywheresoftware.b4a.keywords.Common.ResumableSubWrapper  _load(SHARK2.keymon.com.mx.filehandler __ref) throws Exception{
RDebugUtils.currentModule="filehandler";
if (Debug.shouldDelegate(ba, "load", false))
	 {return ((anywheresoftware.b4a.keywords.Common.ResumableSubWrapper) Debug.delegate(ba, "load", null));}
ResumableSub_Load rsub = new ResumableSub_Load(this,__ref);
rsub.resume(ba, null);
return (anywheresoftware.b4a.keywords.Common.ResumableSubWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.keywords.Common.ResumableSubWrapper(), rsub);
}
public static class ResumableSub_Load extends BA.ResumableSub {
public ResumableSub_Load(SHARK2.keymon.com.mx.filehandler parent,SHARK2.keymon.com.mx.filehandler __ref) {
this.parent = parent;
this.__ref = __ref;
this.__ref = parent;
}
SHARK2.keymon.com.mx.filehandler __ref;
SHARK2.keymon.com.mx.filehandler parent;
anywheresoftware.b4a.phone.Phone.ContentChooser _cc = null;
boolean _success = false;
String _dir = "";
String _filename = "";
SHARK2.keymon.com.mx.filehandler._loadresult _res = null;

@Override
public void resume(BA ba, Object[] result) throws Exception{
RDebugUtils.currentModule="filehandler";

    while (true) {
        switch (state) {
            case -1:
{
parent.__c.ReturnFromResumableSub(this,null);return;}
case 0:
//C
this.state = 1;
RDebugUtils.currentLine=32112641;
 //BA.debugLineNum = 32112641;BA.debugLine="Dim cc As ContentChooser";
_cc = new anywheresoftware.b4a.phone.Phone.ContentChooser();
RDebugUtils.currentLine=32112642;
 //BA.debugLineNum = 32112642;BA.debugLine="cc.Initialize(\"cc\")";
_cc.Initialize("cc");
RDebugUtils.currentLine=32112643;
 //BA.debugLineNum = 32112643;BA.debugLine="cc.Show(\"application/octet-stream\", \"Choose text";
_cc.Show(ba,"application/octet-stream","Choose text file");
RDebugUtils.currentLine=32112644;
 //BA.debugLineNum = 32112644;BA.debugLine="Wait For CC_Result (Success As Boolean, Dir As St";
parent.__c.WaitFor("cc_result", ba, new anywheresoftware.b4a.shell.DebugResumableSub.DelegatableResumableSub(this, "filehandler", "load"), null);
this.state = 7;
return;
case 7:
//C
this.state = 1;
_success = (Boolean) result[1];
_dir = (String) result[2];
_filename = (String) result[3];
;
RDebugUtils.currentLine=32112645;
 //BA.debugLineNum = 32112645;BA.debugLine="Log($\"***************************${CRLF}${Dir}${C";
parent.__c.LogImpl("532112645",("***************************"+parent.__c.SmartStringFormatter("",(Object)(parent.__c.CRLF))+""+parent.__c.SmartStringFormatter("",(Object)(_dir))+""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.CRLF))+" "+parent.__c.SmartStringFormatter("",(Object)(_filename))+""),0);
RDebugUtils.currentLine=32112646;
 //BA.debugLineNum = 32112646;BA.debugLine="Dim res As LoadResult = CreateLoadResult(Success,";
_res = __ref._createloadresult /*SHARK2.keymon.com.mx.filehandler._loadresult*/ (null,_success,_dir,_filename);
RDebugUtils.currentLine=32112647;
 //BA.debugLineNum = 32112647;BA.debugLine="Log($\"***************************${CRLF}${res.Fil";
parent.__c.LogImpl("532112647",("***************************"+parent.__c.SmartStringFormatter("",(Object)(parent.__c.CRLF))+""+parent.__c.SmartStringFormatter("",(Object)(_res.FileName /*String*/ ))+""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.CRLF))+" "+parent.__c.SmartStringFormatter("",(Object)(_res))+""),0);
RDebugUtils.currentLine=32112648;
 //BA.debugLineNum = 32112648;BA.debugLine="If res.Success Then ExtractInformationFromURI(res";
if (true) break;

case 1:
//if
this.state = 6;
if (_res.Success /*boolean*/ ) { 
this.state = 3;
;}if (true) break;

case 3:
//C
this.state = 6;
__ref._extractinformationfromuri /*String*/ (null,_res.FileName /*String*/ ,_res);
if (true) break;

case 6:
//C
this.state = -1;
;
RDebugUtils.currentLine=32112649;
 //BA.debugLineNum = 32112649;BA.debugLine="Return res";
if (true) {
parent.__c.ReturnFromResumableSub(this,(Object)(_res));return;};
RDebugUtils.currentLine=32112650;
 //BA.debugLineNum = 32112650;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public SHARK2.keymon.com.mx.filehandler._loadresult  _checkforreceivedfiles(SHARK2.keymon.com.mx.filehandler __ref) throws Exception{
__ref = this;
RDebugUtils.currentModule="filehandler";
if (Debug.shouldDelegate(ba, "checkforreceivedfiles", false))
	 {return ((SHARK2.keymon.com.mx.filehandler._loadresult) Debug.delegate(ba, "checkforreceivedfiles", null));}
anywheresoftware.b4a.objects.ActivityWrapper _activity = null;
anywheresoftware.b4a.objects.IntentWrapper _in = null;
String _uri = "";
SHARK2.keymon.com.mx.filehandler._loadresult _res = null;
RDebugUtils.currentLine=32374784;
 //BA.debugLineNum = 32374784;BA.debugLine="Public Sub CheckForReceivedFiles As LoadResult";
RDebugUtils.currentLine=32374785;
 //BA.debugLineNum = 32374785;BA.debugLine="Dim Activity As Activity = B4XPages.GetNativePare";
_activity = new anywheresoftware.b4a.objects.ActivityWrapper();
_activity = _b4xpages._getnativeparent /*anywheresoftware.b4a.objects.ActivityWrapper*/ (getActivityBA(),(Object)(_b4xpages._mainpage /*SHARK2.keymon.com.mx.b4xmainpage*/ (getActivityBA())));
RDebugUtils.currentLine=32374786;
 //BA.debugLineNum = 32374786;BA.debugLine="If IsRelevantIntent(Activity.GetStartingIntent) T";
if (__ref._isrelevantintent /*boolean*/ (null,_activity.GetStartingIntent())) { 
RDebugUtils.currentLine=32374787;
 //BA.debugLineNum = 32374787;BA.debugLine="Dim in As Intent = Activity.GetStartingIntent";
_in = new anywheresoftware.b4a.objects.IntentWrapper();
_in = _activity.GetStartingIntent();
RDebugUtils.currentLine=32374788;
 //BA.debugLineNum = 32374788;BA.debugLine="Dim uri As String";
_uri = "";
RDebugUtils.currentLine=32374789;
 //BA.debugLineNum = 32374789;BA.debugLine="If in.HasExtra(\"android.intent.extra.STREAM\") Th";
if (_in.HasExtra("android.intent.extra.STREAM")) { 
RDebugUtils.currentLine=32374790;
 //BA.debugLineNum = 32374790;BA.debugLine="uri = in.As(JavaObject).RunMethod(\"getParcelabl";
_uri = BA.ObjectToString(((anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(_in.getObject()))).RunMethod("getParcelableExtra",new Object[]{(Object)("android.intent.extra.STREAM")}));
 }else {
RDebugUtils.currentLine=32374792;
 //BA.debugLineNum = 32374792;BA.debugLine="uri = in.GetData";
_uri = _in.GetData();
 };
RDebugUtils.currentLine=32374794;
 //BA.debugLineNum = 32374794;BA.debugLine="Dim res As LoadResult = CreateLoadResult(True, \"";
_res = __ref._createloadresult /*SHARK2.keymon.com.mx.filehandler._loadresult*/ (null,__c.True,"ContentDir",_uri);
RDebugUtils.currentLine=32374795;
 //BA.debugLineNum = 32374795;BA.debugLine="ExtractInformationFromURI(res.FileName, res)";
__ref._extractinformationfromuri /*String*/ (null,_res.FileName /*String*/ ,_res);
RDebugUtils.currentLine=32374796;
 //BA.debugLineNum = 32374796;BA.debugLine="Return res";
if (true) return _res;
 };
RDebugUtils.currentLine=32374798;
 //BA.debugLineNum = 32374798;BA.debugLine="Return CreateLoadResult(False, \"\", \"\")";
if (true) return __ref._createloadresult /*SHARK2.keymon.com.mx.filehandler._loadresult*/ (null,__c.False,"","");
RDebugUtils.currentLine=32374799;
 //BA.debugLineNum = 32374799;BA.debugLine="End Sub";
return null;
}
public boolean  _isrelevantintent(SHARK2.keymon.com.mx.filehandler __ref,anywheresoftware.b4a.objects.IntentWrapper _in) throws Exception{
__ref = this;
RDebugUtils.currentModule="filehandler";
if (Debug.shouldDelegate(ba, "isrelevantintent", false))
	 {return ((Boolean) Debug.delegate(ba, "isrelevantintent", new Object[] {_in}));}
RDebugUtils.currentLine=32440320;
 //BA.debugLineNum = 32440320;BA.debugLine="Private Sub IsRelevantIntent(in As Intent) As Bool";
RDebugUtils.currentLine=32440321;
 //BA.debugLineNum = 32440321;BA.debugLine="If in.IsInitialized And in <> OldIntent And in.Ac";
if (_in.IsInitialized() && (_in).equals(__ref._oldintent /*anywheresoftware.b4a.objects.IntentWrapper*/ ) == false && (_in.getAction()).equals(_in.ACTION_VIEW)) { 
RDebugUtils.currentLine=32440322;
 //BA.debugLineNum = 32440322;BA.debugLine="OldIntent = in";
__ref._oldintent /*anywheresoftware.b4a.objects.IntentWrapper*/  = _in;
RDebugUtils.currentLine=32440323;
 //BA.debugLineNum = 32440323;BA.debugLine="Return True";
if (true) return __c.True;
 };
RDebugUtils.currentLine=32440325;
 //BA.debugLineNum = 32440325;BA.debugLine="Return False";
if (true) return __c.False;
RDebugUtils.currentLine=32440326;
 //BA.debugLineNum = 32440326;BA.debugLine="End Sub";
return false;
}
public SHARK2.keymon.com.mx.filehandler._loadresult  _createloadresult(SHARK2.keymon.com.mx.filehandler __ref,boolean _success,String _dir,String _filename) throws Exception{
__ref = this;
RDebugUtils.currentModule="filehandler";
if (Debug.shouldDelegate(ba, "createloadresult", false))
	 {return ((SHARK2.keymon.com.mx.filehandler._loadresult) Debug.delegate(ba, "createloadresult", new Object[] {_success,_dir,_filename}));}
SHARK2.keymon.com.mx.filehandler._loadresult _t1 = null;
RDebugUtils.currentLine=32505856;
 //BA.debugLineNum = 32505856;BA.debugLine="Private Sub CreateLoadResult (Success As Boolean,";
RDebugUtils.currentLine=32505857;
 //BA.debugLineNum = 32505857;BA.debugLine="Dim t1 As LoadResult";
_t1 = new SHARK2.keymon.com.mx.filehandler._loadresult();
RDebugUtils.currentLine=32505858;
 //BA.debugLineNum = 32505858;BA.debugLine="t1.Initialize";
_t1.Initialize();
RDebugUtils.currentLine=32505859;
 //BA.debugLineNum = 32505859;BA.debugLine="t1.Success = Success";
_t1.Success /*boolean*/  = _success;
RDebugUtils.currentLine=32505860;
 //BA.debugLineNum = 32505860;BA.debugLine="t1.Dir = Dir";
_t1.Dir /*String*/  = _dir;
RDebugUtils.currentLine=32505861;
 //BA.debugLineNum = 32505861;BA.debugLine="t1.FileName = FileName";
_t1.FileName /*String*/  = _filename;
RDebugUtils.currentLine=32505862;
 //BA.debugLineNum = 32505862;BA.debugLine="Return t1";
if (true) return _t1;
RDebugUtils.currentLine=32505863;
 //BA.debugLineNum = 32505863;BA.debugLine="End Sub";
return null;
}
public String  _extractinformationfromuri(SHARK2.keymon.com.mx.filehandler __ref,String _uri,SHARK2.keymon.com.mx.filehandler._loadresult _res) throws Exception{
__ref = this;
RDebugUtils.currentModule="filehandler";
if (Debug.shouldDelegate(ba, "extractinformationfromuri", false))
	 {return ((String) Debug.delegate(ba, "extractinformationfromuri", new Object[] {_uri,_res}));}
anywheresoftware.b4a.objects.ContentResolverWrapper _resolver = null;
anywheresoftware.b4a.objects.ContentResolverWrapper.UriWrapper _u = null;
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _rs = null;
SHARK2.keymon.com.mx.b4xset _columns = null;
int _i = 0;
RDebugUtils.currentLine=32309248;
 //BA.debugLineNum = 32309248;BA.debugLine="Private Sub ExtractInformationFromURI (Uri As Stri";
RDebugUtils.currentLine=32309249;
 //BA.debugLineNum = 32309249;BA.debugLine="Try";
try {RDebugUtils.currentLine=32309251;
 //BA.debugLineNum = 32309251;BA.debugLine="Dim resolver As ContentResolver";
_resolver = new anywheresoftware.b4a.objects.ContentResolverWrapper();
RDebugUtils.currentLine=32309252;
 //BA.debugLineNum = 32309252;BA.debugLine="resolver.Initialize(\"\")";
_resolver.Initialize("");
RDebugUtils.currentLine=32309253;
 //BA.debugLineNum = 32309253;BA.debugLine="Dim u As Uri";
_u = new anywheresoftware.b4a.objects.ContentResolverWrapper.UriWrapper();
RDebugUtils.currentLine=32309254;
 //BA.debugLineNum = 32309254;BA.debugLine="u.Parse(Uri)";
_u.Parse(_uri);
RDebugUtils.currentLine=32309255;
 //BA.debugLineNum = 32309255;BA.debugLine="Dim rs As ResultSet = resolver.Query(u, Null, \"\",";
_rs = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_rs = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(_resolver.Query(_u,(String[])(__c.Null),"",(String[])(__c.Null),"").getObject()));
RDebugUtils.currentLine=32309256;
 //BA.debugLineNum = 32309256;BA.debugLine="If rs.NextRow Then";
if (_rs.NextRow()) { 
RDebugUtils.currentLine=32309257;
 //BA.debugLineNum = 32309257;BA.debugLine="Dim columns As B4XSet = B4XCollections.CreateSet";
_columns = _b4xcollections._createset /*SHARK2.keymon.com.mx.b4xset*/ (getActivityBA());
RDebugUtils.currentLine=32309258;
 //BA.debugLineNum = 32309258;BA.debugLine="For i = 0 To rs.ColumnCount - 1";
{
final int step9 = 1;
final int limit9 = (int) (_rs.getColumnCount()-1);
_i = (int) (0) ;
for (;_i <= limit9 ;_i = _i + step9 ) {
RDebugUtils.currentLine=32309259;
 //BA.debugLineNum = 32309259;BA.debugLine="columns.Add(rs.GetColumnName(i))";
_columns._add /*String*/ (null,(Object)(_rs.GetColumnName(_i)));
 }
};
RDebugUtils.currentLine=32309261;
 //BA.debugLineNum = 32309261;BA.debugLine="If columns.Contains(\"_display_name\") Then res.Re";
if (_columns._contains /*boolean*/ (null,(Object)("_display_name"))) { 
_res.RealName /*String*/  = _rs.GetString("_display_name");};
RDebugUtils.currentLine=32309262;
 //BA.debugLineNum = 32309262;BA.debugLine="If columns.Contains(\"_size\") Then res.Size = rs.";
if (_columns._contains /*boolean*/ (null,(Object)("_size"))) { 
_res.Size /*long*/  = _rs.GetLong("_size");};
RDebugUtils.currentLine=32309263;
 //BA.debugLineNum = 32309263;BA.debugLine="If columns.Contains(\"last_modified\") Then res.Mo";
if (_columns._contains /*boolean*/ (null,(Object)("last_modified"))) { 
_res.Modified /*long*/  = _rs.GetLong("last_modified");};
RDebugUtils.currentLine=32309264;
 //BA.debugLineNum = 32309264;BA.debugLine="If columns.Contains(\"mime_type\") Then res.MimeTy";
if (_columns._contains /*boolean*/ (null,(Object)("mime_type"))) { 
_res.MimeType /*String*/  = _rs.GetString("mime_type");};
 };
RDebugUtils.currentLine=32309266;
 //BA.debugLineNum = 32309266;BA.debugLine="rs.Close";
_rs.Close();
 } 
       catch (Exception e19) {
			ba.setLastException(e19);RDebugUtils.currentLine=32309269;
 //BA.debugLineNum = 32309269;BA.debugLine="Log(\"error extracting information from file prov";
__c.LogImpl("532309269","error extracting information from file provider",0);
RDebugUtils.currentLine=32309270;
 //BA.debugLineNum = 32309270;BA.debugLine="Log(LastException)";
__c.LogImpl("532309270",BA.ObjectToString(__c.LastException(getActivityBA())),0);
 };
RDebugUtils.currentLine=32309272;
 //BA.debugLineNum = 32309272;BA.debugLine="End Sub";
return "";
}
public String  _class_globals(SHARK2.keymon.com.mx.filehandler __ref) throws Exception{
__ref = this;
RDebugUtils.currentModule="filehandler";
RDebugUtils.currentLine=31916032;
 //BA.debugLineNum = 31916032;BA.debugLine="Sub Class_Globals";
RDebugUtils.currentLine=31916034;
 //BA.debugLineNum = 31916034;BA.debugLine="Private ion As Object";
_ion = new Object();
RDebugUtils.currentLine=31916035;
 //BA.debugLineNum = 31916035;BA.debugLine="Private OldIntent As Intent";
_oldintent = new anywheresoftware.b4a.objects.IntentWrapper();
RDebugUtils.currentLine=31916037;
 //BA.debugLineNum = 31916037;BA.debugLine="Type LoadResult (Success As Boolean, Dir As Strin";
;
RDebugUtils.currentLine=31916039;
 //BA.debugLineNum = 31916039;BA.debugLine="End Sub";
return "";
}
public Object  _getba(SHARK2.keymon.com.mx.filehandler __ref) throws Exception{
__ref = this;
RDebugUtils.currentModule="filehandler";
if (Debug.shouldDelegate(ba, "getba", false))
	 {return ((Object) Debug.delegate(ba, "getba", null));}
RDebugUtils.currentLine=32243712;
 //BA.debugLineNum = 32243712;BA.debugLine="Private Sub GetBA As Object";
RDebugUtils.currentLine=32243713;
 //BA.debugLineNum = 32243713;BA.debugLine="Return Me.As(JavaObject).RunMethod(\"getBA\", Null)";
if (true) return ((anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(this))).RunMethod("getBA",(Object[])(__c.Null));
RDebugUtils.currentLine=32243714;
 //BA.debugLineNum = 32243714;BA.debugLine="End Sub";
return null;
}
public anywheresoftware.b4a.keywords.Common.ResumableSubWrapper  _saveas(SHARK2.keymon.com.mx.filehandler __ref,anywheresoftware.b4a.objects.streams.File.InputStreamWrapper _source,String _mimetype,String _title) throws Exception{
RDebugUtils.currentModule="filehandler";
if (Debug.shouldDelegate(ba, "saveas", false))
	 {return ((anywheresoftware.b4a.keywords.Common.ResumableSubWrapper) Debug.delegate(ba, "saveas", new Object[] {_source,_mimetype,_title}));}
ResumableSub_SaveAs rsub = new ResumableSub_SaveAs(this,__ref,_source,_mimetype,_title);
rsub.resume(ba, null);
return (anywheresoftware.b4a.keywords.Common.ResumableSubWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.keywords.Common.ResumableSubWrapper(), rsub);
}
public static class ResumableSub_SaveAs extends BA.ResumableSub {
public ResumableSub_SaveAs(SHARK2.keymon.com.mx.filehandler parent,SHARK2.keymon.com.mx.filehandler __ref,anywheresoftware.b4a.objects.streams.File.InputStreamWrapper _source,String _mimetype,String _title) {
this.parent = parent;
this.__ref = __ref;
this._source = _source;
this._mimetype = _mimetype;
this._title = _title;
this.__ref = parent;
}
SHARK2.keymon.com.mx.filehandler __ref;
SHARK2.keymon.com.mx.filehandler parent;
anywheresoftware.b4a.objects.streams.File.InputStreamWrapper _source;
String _mimetype;
String _title;
anywheresoftware.b4a.objects.IntentWrapper _intent = null;
String _methodname = "";
Object[] _args = null;
anywheresoftware.b4a.objects.IntentWrapper _result = null;
anywheresoftware.b4j.object.JavaObject _jo = null;
anywheresoftware.b4j.object.JavaObject _ctxt = null;
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out = null;

@Override
public void resume(BA ba, Object[] result) throws Exception{
RDebugUtils.currentModule="filehandler";

    while (true) {
        switch (state) {
            case -1:
{
parent.__c.ReturnFromResumableSub(this,null);return;}
case 0:
//C
this.state = 1;
RDebugUtils.currentLine=32047105;
 //BA.debugLineNum = 32047105;BA.debugLine="Dim intent As Intent";
_intent = new anywheresoftware.b4a.objects.IntentWrapper();
RDebugUtils.currentLine=32047106;
 //BA.debugLineNum = 32047106;BA.debugLine="intent.Initialize(\"android.intent.action.CREATE_D";
_intent.Initialize("android.intent.action.CREATE_DOCUMENT","");
RDebugUtils.currentLine=32047107;
 //BA.debugLineNum = 32047107;BA.debugLine="intent.AddCategory(\"android.intent.category.OPENA";
_intent.AddCategory("android.intent.category.OPENABLE");
RDebugUtils.currentLine=32047108;
 //BA.debugLineNum = 32047108;BA.debugLine="intent.PutExtra(\"android.intent.extra.TITLE\", Tit";
_intent.PutExtra("android.intent.extra.TITLE",(Object)(_title));
RDebugUtils.currentLine=32047109;
 //BA.debugLineNum = 32047109;BA.debugLine="intent.SetType(MimeType)";
_intent.SetType(_mimetype);
RDebugUtils.currentLine=32047110;
 //BA.debugLineNum = 32047110;BA.debugLine="StartActivityForResult(intent)";
__ref._startactivityforresult /*String*/ (null,_intent);
RDebugUtils.currentLine=32047111;
 //BA.debugLineNum = 32047111;BA.debugLine="Wait For ion_Event (MethodName As String, Args()";
parent.__c.WaitFor("ion_event", ba, new anywheresoftware.b4a.shell.DebugResumableSub.DelegatableResumableSub(this, "filehandler", "saveas"), null);
this.state = 5;
return;
case 5:
//C
this.state = 1;
_methodname = (String) result[1];
_args = (Object[]) result[2];
;
RDebugUtils.currentLine=32047112;
 //BA.debugLineNum = 32047112;BA.debugLine="If -1 = Args(0) Then 'resultCode = RESULT_OK";
if (true) break;

case 1:
//if
this.state = 4;
if (-1==(double)(BA.ObjectToNumber(_args[(int) (0)]))) { 
this.state = 3;
}if (true) break;

case 3:
//C
this.state = 4;
RDebugUtils.currentLine=32047113;
 //BA.debugLineNum = 32047113;BA.debugLine="Dim result As Intent = Args(1)";
_result = new anywheresoftware.b4a.objects.IntentWrapper();
_result = (anywheresoftware.b4a.objects.IntentWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.IntentWrapper(), (android.content.Intent)(_args[(int) (1)]));
RDebugUtils.currentLine=32047114;
 //BA.debugLineNum = 32047114;BA.debugLine="Dim jo As JavaObject = result";
_jo = new anywheresoftware.b4j.object.JavaObject();
_jo = (anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(_result.getObject()));
RDebugUtils.currentLine=32047115;
 //BA.debugLineNum = 32047115;BA.debugLine="Dim ctxt As JavaObject";
_ctxt = new anywheresoftware.b4j.object.JavaObject();
RDebugUtils.currentLine=32047116;
 //BA.debugLineNum = 32047116;BA.debugLine="Dim out As OutputStream = ctxt.InitializeContext";
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
_out = (anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper(), (java.io.OutputStream)(_ctxt.InitializeContext(ba).RunMethodJO("getContentResolver",(Object[])(parent.__c.Null)).RunMethod("openOutputStream",new Object[]{_jo.RunMethod("getData",(Object[])(parent.__c.Null))})));
RDebugUtils.currentLine=32047117;
 //BA.debugLineNum = 32047117;BA.debugLine="File.Copy2(Source, out)";
parent.__c.File.Copy2((java.io.InputStream)(_source.getObject()),(java.io.OutputStream)(_out.getObject()));
RDebugUtils.currentLine=32047118;
 //BA.debugLineNum = 32047118;BA.debugLine="out.Close";
_out.Close();
RDebugUtils.currentLine=32047119;
 //BA.debugLineNum = 32047119;BA.debugLine="Return True";
if (true) {
parent.__c.ReturnFromResumableSub(this,(Object)(parent.__c.True));return;};
 if (true) break;

case 4:
//C
this.state = -1;
;
RDebugUtils.currentLine=32047121;
 //BA.debugLineNum = 32047121;BA.debugLine="Return False";
if (true) {
parent.__c.ReturnFromResumableSub(this,(Object)(parent.__c.False));return;};
RDebugUtils.currentLine=32047122;
 //BA.debugLineNum = 32047122;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public String  _startactivityforresult(SHARK2.keymon.com.mx.filehandler __ref,anywheresoftware.b4a.objects.IntentWrapper _i) throws Exception{
__ref = this;
RDebugUtils.currentModule="filehandler";
if (Debug.shouldDelegate(ba, "startactivityforresult", false))
	 {return ((String) Debug.delegate(ba, "startactivityforresult", new Object[] {_i}));}
anywheresoftware.b4j.object.JavaObject _jo = null;
RDebugUtils.currentLine=32178176;
 //BA.debugLineNum = 32178176;BA.debugLine="Private Sub StartActivityForResult(i As Intent)";
RDebugUtils.currentLine=32178177;
 //BA.debugLineNum = 32178177;BA.debugLine="Dim jo As JavaObject = GetBA";
_jo = new anywheresoftware.b4j.object.JavaObject();
_jo = (anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(__ref._getba /*Object*/ (null)));
RDebugUtils.currentLine=32178178;
 //BA.debugLineNum = 32178178;BA.debugLine="ion = jo.CreateEvent(\"anywheresoftware.b4a.IOnAct";
__ref._ion /*Object*/  = _jo.CreateEvent(ba,"anywheresoftware.b4a.IOnActivityResult","ion",__c.Null);
RDebugUtils.currentLine=32178179;
 //BA.debugLineNum = 32178179;BA.debugLine="jo.RunMethod(\"startActivityForResult\", Array(ion,";
_jo.RunMethod("startActivityForResult",new Object[]{__ref._ion /*Object*/ ,(Object)(_i.getObject())});
RDebugUtils.currentLine=32178180;
 //BA.debugLineNum = 32178180;BA.debugLine="End Sub";
return "";
}
}