update Share
This commit is contained in:
parent
15b232f52a
commit
a50a7140fd
@ -21,10 +21,10 @@ public class Line extends AbsShareInterface {
|
|||||||
@Override
|
@Override
|
||||||
public void share(ShareBuilder builder, ICallback callback) {
|
public void share(ShareBuilder builder, ICallback callback) {
|
||||||
try {
|
try {
|
||||||
Intent share = new Intent(Intent.ACTION_VIEW, Uri.parse("https://line.me/R/share?text=" + URLEncoder.encode(builder.getLink(), "UTF-8")));
|
Intent share = new Intent(Intent.ACTION_VIEW, Uri.parse("https://line.me/R/share?text=" + URLEncoder.encode(builder.getText(), "UTF-8")));
|
||||||
mContext.startActivity(share);
|
mContext.startActivity(share);
|
||||||
callback.onSuccess();
|
callback.onSuccess();
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (Exception e) {
|
||||||
callback.onFailure();
|
callback.onFailure();
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ public class MessengerShare extends AbsShareInterface {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(Sharer.Result result) {
|
public void onSuccess(Sharer.Result result) {
|
||||||
ToastUtil.show("Messenger分享成功:"+result.getPostId());
|
ToastUtil.show("Messenger分享成功:"+result.getPostId());
|
||||||
|
callback.onSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -53,6 +54,10 @@ public class MessengerShare extends AbsShareInterface {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialog.show(content);
|
if(dialog.canShow(content)) {
|
||||||
|
dialog.show(content);
|
||||||
|
}else{
|
||||||
|
callback.onFailure();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,17 @@ public class WhatsApp extends AbsShareInterface {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void share(ShareBuilder builder, ICallback callback) {
|
public void share(ShareBuilder builder, ICallback callback) {
|
||||||
Intent sendIntent = new Intent();
|
try {
|
||||||
sendIntent.setAction(Intent.ACTION_SEND);
|
Intent sendIntent = new Intent();
|
||||||
sendIntent.putExtra(Intent.EXTRA_TEXT, builder.getText());
|
sendIntent.setAction(Intent.ACTION_SEND);
|
||||||
sendIntent.setType("text/plain");
|
sendIntent.putExtra(Intent.EXTRA_TEXT, builder.getText());
|
||||||
sendIntent.setPackage("com.whatsapp");
|
sendIntent.setType("text/plain");
|
||||||
mContext.startActivity(sendIntent);
|
sendIntent.setPackage("com.whatsapp");
|
||||||
|
mContext.startActivity(sendIntent);
|
||||||
|
callback.onSuccess();
|
||||||
|
} catch (Exception e) {
|
||||||
|
callback.onFailure();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,9 @@ ext {
|
|||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
//正式
|
//正式
|
||||||
|
|
||||||
serverHost : "https://napi.yaoulive.com",
|
// serverHost : "https://napi.yaoulive.com",
|
||||||
//
|
//
|
||||||
// serverHost : "https://ceshi.yaoulive.com",
|
serverHost : "https://ceshi.yaoulive.com",
|
||||||
|
|
||||||
//腾讯地图
|
//腾讯地图
|
||||||
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||||
|
@ -13,6 +13,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.share.ICallback;
|
import com.yunbao.share.ICallback;
|
||||||
import com.yunbao.share.ShareBuilder;
|
import com.yunbao.share.ShareBuilder;
|
||||||
@ -55,7 +56,7 @@ public class TestActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure() {
|
public void onFailure() {
|
||||||
|
ToastUtil.show("分享失败,应用未安装");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, strs));
|
listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, strs));
|
||||||
|
Loading…
Reference in New Issue
Block a user