/**
 * @author AndresCotes ([email protected])
 */
package life.inventor.WebAddon;

import android.util.Log;

import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.common.*;
import com.google.appinventor.components.runtime.*;
import com.google.appinventor.components.runtime.util.*;
import com.google.appinventor.components.runtime.collect.Lists;
import com.google.appinventor.components.runtime.collect.Maps;

@DesignerComponent(version = WebAddon.VERSION,                           
    description = ""
    ,
    category = ComponentCategory.EXTENSION,
    nonVisible = true,
    iconName = "https://drive.google.com/uc?export=download&id=15d3J8LyeA_JRfkRuozcxUSS9XnPv8GaF")
@SimpleObject(external = true)

@UsesPermissions(permissionNames = "android.permission.INTERNET," +
  "android.permission.WRITE_EXTERNAL_STORAGE," +
  "android.permission.READ_EXTERNAL_STORAGE"+
      "android.permission.WAKE_LOCK" +
      "android.permission.INTERNET"+
      "android.permission.ACCESS_NETWORK_STATE"+
      "android.permission.READ_PHONE_STATE")

public class WebAddon extends AndroidNonvisibleComponent implements Component {
    public static final int VERSION = 1;
    private ComponentContainer container;
    private static final String LOG_TAG = "WebAddon";

    
public WebAddon(ComponentContainer container) {
        super(container.$form());
        this.container = container;
        Log.d(LOG_TAG, "WebAddon" );
        }


@SimpleFunction(description = "")
public void DownloadDrive(Web web, String path , YailList nameList, YailList codeDrive, int item  ){
    
        String url = "https://drive.google.com/uc?export=download&id=";
    
        String nameString = YailList.YailListElementToString(nameList.get(item));
        String codeString = YailList.YailListElementToString(codeDrive.get(item));
    
        web.SaveResponse(true);
        web.ResponseFileName( path + nameString ); 
        web.Url(url + codeString);
        web.Get();  
}

@SimpleFunction(description = "")
public void DownloadImageUrl(Web web, String path , YailList nameList, YailList urllist, int item  ){
    
            String url = "";
    
        String nameString = YailList.YailListElementToString(nameList.get(item));
        String codeString = YailList.YailListElementToString(urllist.get(item));
    
        web.SaveResponse(true);
        web.ResponseFileName( path + nameString ); 
        web.Url(url + codeString);
        web.Get();  
}


@SimpleFunction(description = "")
public void DownloadImageDropbox(Web web, 
                            String path , 
                       YailList nameList, 
                          YailList codes, 
                                int item  ){
    

        String nameString = YailList.YailListElementToString(nameList.get(item));
        String codeString = YailList.YailListElementToString(codes.get(item));
        
        String url = "https://www.dropbox.com/s/"+  codeString + "/" + nameString +"?dl=1";
    
        web.SaveResponse(true);
        web.ResponseFileName(path + nameString ); 
        web.Url(url);
        web.Get();  
}

}

Terms and Conditions

  • THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • This is is the only authorized place to download this extension. It is not allowed to host this extension somewhere else and offer it for others to download, be it on another website or market place or similar. The reason is, everybody should be able to have the opportunity to donate something in case you like my work. You are allowed to provide a link to this site, so others can download the extension here. You will find the most up to date version always here including documentation and usage examples. Thank you for your kind understanding.
WhatsApp chat