Skip to content

Commit

Permalink
fix:fix open reader failed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward259 committed Aug 2, 2023
1 parent 4559d5d commit ff371cc
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@
import android.support.annotation.Nullable;
import android.support.v4.content.FileProvider;
import android.view.View;

import android.widget.Toast;

import androidx.databinding.DataBindingUtil;

import com.onyx.android.demo.R;
import com.onyx.android.demo.databinding.ActivityReaderDemoBinding;
import com.onyx.android.sdk.utils.FileUtils;
import com.onyx.android.sdk.utils.ServiceUtils;
import com.onyx.android.sdk.utils.StringUtils;

import java.io.File;
Expand All @@ -47,17 +45,14 @@ public void btn_open(View view) {
return;
}
Intent intent = new Intent(Intent.ACTION_VIEW);
ComponentName componentName = new ComponentName("com.onyx.kreader", "com.onyx.android.sdk.readerview.service.ReaderService");
ComponentName componentName = new ComponentName("com.onyx.kreader", "com.onyx.kreader.ui.ReaderHomeActivity");
intent.setComponent(componentName);
intent.setData(FileProvider.getUriForFile(this,
getPackageName() + ".onyx.fileprovider",
new File(binding.etFile.getText().toString())));
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
ComponentName result = ServiceUtils.startServiceSafely(this, intent);
if (result == null) {
Toast.makeText(getApplicationContext(), "Service does not exist", Toast.LENGTH_SHORT).show();
}
startActivity(intent);
}

public void btn_query_progress(View view) {
Expand Down

0 comments on commit ff371cc

Please sign in to comment.