Skip to content

Commit

Permalink
use ShareCompat to fix sharing QQ/Weixin files from Island (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
luvletter2333 authored Jun 29, 2023
1 parent 35c96c2 commit 4eee987
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions app/src/main/java/top/linesoft/open2share/ReceiveOpenActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ShareCompat;

public class ReceiveOpenActivity extends AppCompatActivity {

Expand Down Expand Up @@ -35,16 +36,10 @@ protected void onCreate(Bundle savedInstanceState) {
//setContentView(R.layout.activity_receive_open);
//Toast.makeText(this,"已经将打开文件转换为分享文件",Toast.LENGTH_LONG).show();

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
//sendIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
sendIntent.addCategory("android.intent.category.DEFAULT");
// Log.d("分享","Data:"+ getIntent().getData().toString());
// Log.d("分享","Type:"+ getIntent().getType());
sendIntent.putExtra(Intent.EXTRA_STREAM, getIntent().getData());
sendIntent.setType(getIntent().getType());
startActivityForResult(Intent.createChooser(sendIntent,getString(R.string.share_title)),1);
//finish();
new ShareCompat.IntentBuilder(this)
.addStream(getIntent().getData())
.setType(getIntent().getType())
.startChooser();

}
}

0 comments on commit 4eee987

Please sign in to comment.