update Share

This commit is contained in:
zlzw 2023-02-13 11:21:40 +08:00
parent 15b232f52a
commit a50a7140fd
5 changed files with 24 additions and 12 deletions

View File

@ -21,10 +21,10 @@ public class Line extends AbsShareInterface {
@Override
public void share(ShareBuilder builder, ICallback callback) {
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);
callback.onSuccess();
} catch (UnsupportedEncodingException e) {
} catch (Exception e) {
callback.onFailure();
throw new RuntimeException(e);
}

View File

@ -40,6 +40,7 @@ public class MessengerShare extends AbsShareInterface {
@Override
public void onSuccess(Sharer.Result result) {
ToastUtil.show("Messenger分享成功:"+result.getPostId());
callback.onSuccess();
}
@Override
@ -53,6 +54,10 @@ public class MessengerShare extends AbsShareInterface {
e.printStackTrace();
}
});
if(dialog.canShow(content)) {
dialog.show(content);
}else{
callback.onFailure();
}
}
}

View File

@ -14,11 +14,17 @@ public class WhatsApp extends AbsShareInterface {
@Override
public void share(ShareBuilder builder, ICallback callback) {
try {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, builder.getText());
sendIntent.setType("text/plain");
sendIntent.setPackage("com.whatsapp");
mContext.startActivity(sendIntent);
callback.onSuccess();
} catch (Exception e) {
callback.onFailure();
}
}
}

View File

@ -10,9 +10,9 @@ ext {
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",

View File

@ -13,6 +13,7 @@ import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.main.R;
import com.yunbao.share.ICallback;
import com.yunbao.share.ShareBuilder;
@ -55,7 +56,7 @@ public class TestActivity extends AppCompatActivity {
@Override
public void onFailure() {
ToastUtil.show("分享失败,应用未安装");
}
};
listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, strs));