Back to project page action-send-gridview.
The source code is released under:
Apache License
If you think the Android project action-send-gridview listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.urbancups.actionsendgridview; /*from w w w . ja v a 2 s . c om*/ import android.content.Intent; import android.graphics.drawable.Drawable; import java.util.HashMap; import java.util.Map; /** * Created by Yonatan Moskovich on 07/09/2014 */ public class IntentShare { private Drawable bitmap; private String label; private Intent intent=new Intent(Intent.ACTION_SEND); private int precedence=99; private Map<String,Integer> precedenceMap= new HashMap<String,Integer>(); public IntentShare() { this.intent.setType("text/plain"); } public void setBitmap(Drawable bitmap) { this.bitmap=bitmap; } public void setLabel(String label) { this.label=label; if (precedenceMap.containsKey(label.toUpperCase())) { precedence=precedenceMap.get(label.toUpperCase()); } } public void setPackageName(String packageName) { this.intent.setPackage(packageName); } public void setSubject(String subject) { this.intent.putExtra(Intent.EXTRA_SUBJECT,subject); } public void setPayload(String payload) { this.intent.putExtra(Intent.EXTRA_TEXT,payload); } public void setIntent(Intent intent) { this.intent=intent; } public Drawable getBitmap() { return bitmap; } public String getLabel() { return label; } public Intent getIntent() { return intent; } public int getPrecedence() { return precedence; } public void setPrecedenceMap(Map<String,Integer> inpPrecedenceMap) { //protect the object against someone attempting to pass an empty hashmap if (!inpPrecedenceMap.isEmpty()) { this.precedenceMap = inpPrecedenceMap; Map<String, Integer> UpperCasedMap = new HashMap<String, Integer>(); for (Map.Entry<String, Integer> entry : precedenceMap.entrySet()) { String key = entry.getKey(); Integer value = entry.getValue(); UpperCasedMap.put(key.toUpperCase(), value); } precedenceMap.clear(); precedenceMap.putAll(UpperCasedMap); } } }