当前位置: 首页>>代码示例>>Java>>正文


Java PDFView类代码示例

本文整理汇总了Java中com.github.barteksc.pdfviewer.PDFView的典型用法代码示例。如果您正苦于以下问题:Java PDFView类的具体用法?Java PDFView怎么用?Java PDFView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PDFView类属于com.github.barteksc.pdfviewer包,在下文中一共展示了PDFView类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getViews

import com.github.barteksc.pdfviewer.PDFView; //导入依赖的package包/类
@Override
public void getViews() {
    mPdfView = (PDFView) findViewById(R.id.pdfview);
    mPdfNameTv = (TextView) findViewById(R.id.tv_center);
    mBackBtn = (ImageView) findViewById(R.id.iv_left);
    mExitBtn = (TextView) findViewById(R.id.tv_right);
    mLockScreenIv = (ImageView) findViewById(R.id.iv_lockscreen);
    mPageCountTv = (TextView) findViewById(R.id.tv_page_count);
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:10,代码来源:PdfPreviewActivity.java

示例2: onPostExecute

import com.github.barteksc.pdfviewer.PDFView; //导入依赖的package包/类
/**
 * After completing background task
 * Dismiss the progress dialog
 **/
@Override
protected void onPostExecute(String file_url) {
    // dismiss the dialog after the file was downloaded
    dismissDialog(progress_bar_type);
    check=true;
    pdfview = (PDFView) findViewById(R.id.pdfview);
    // Displaying downloaded image into image view
    // Reading image path from sdcard
    String imagePath = Environment.getExternalStorageDirectory().toString() + "/College Doc/"+t+"/" + u + ".pdf";
    // setting downloaded into image view
    File file = new File(Environment.getExternalStorageDirectory().toString() + "/College Doc/"+t+"/" + u + ".pdf");
    if (file.exists()) {

        pdfview.fromFile(file).load();
       /* Uri path = Uri.fromFile(file);
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(path, "application/pdf");
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

        try {
            startActivity(intent);
        } catch (Exception e) {
            Toast.makeText(PdfSelector.this,
                    "No Application Available to View PDF",
                    Toast.LENGTH_SHORT).show();
            Log.w("", "failed", e);
            //finish();
        }*/
    }

}
 
开发者ID:Shobhit-pandey,项目名称:CollegeDoc,代码行数:36,代码来源:PdfSelector.java

示例3: onCreate

import com.github.barteksc.pdfviewer.PDFView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pdf_view);
    pdfview = (PDFView) findViewById(R.id.pdfview);
    Intent intent = new Intent();
    intent.setType("application/pdf");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    try {
        startActivityForResult(Intent.createChooser(intent, "Select a PDF "), SELECT_PDF);
    } catch (ActivityNotFoundException f) {
        Toast.makeText(PdfView.this, "Activity Not Found", Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:Shobhit-pandey,项目名称:CollegeDoc,代码行数:15,代码来源:PdfView.java

示例4: setupLayout

import com.github.barteksc.pdfviewer.PDFView; //导入依赖的package包/类
@Override
public void setupLayout(PDFView pdfView) {
    int align, width, height;
    Drawable background;
    // determine handler position, default is right (when scrolling vertically) or bottom (when scrolling horizontally)
    if (pdfView.isSwipeVertical()) {
        width = HANDLE_LONG;
        height = HANDLE_SHORT;
        if (inverted) { // left
            align = ALIGN_PARENT_LEFT;
            background = ContextCompat.getDrawable(context, R.drawable.default_scroll_handle_left);
        } else { // right
            align = ALIGN_PARENT_RIGHT;
            background = ContextCompat.getDrawable(context, R.drawable.default_scroll_handle_right);
        }
    } else {
        width = HANDLE_SHORT;
        height = HANDLE_LONG;
        if (inverted) { // top
            align = ALIGN_PARENT_TOP;
            background = ContextCompat.getDrawable(context, R.drawable.default_scroll_handle_top);
        } else { // bottom
            align = ALIGN_PARENT_BOTTOM;
            background = ContextCompat.getDrawable(context, R.drawable.default_scroll_handle_bottom);
        }
    }

    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
        setBackgroundDrawable(background);
    } else {
        setBackground(background);
    }

    LayoutParams lp = new LayoutParams(Util.getDP(context, width), Util.getDP(context, height));
    lp.setMargins(0, 0, 0, 0);

    LayoutParams tvlp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    tvlp.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);

    addView(textView, tvlp);

    lp.addRule(align);
    pdfView.addView(this, lp);

    this.pdfView = pdfView;
}
 
开发者ID:bramach5,项目名称:Bala-PdfViewer-with-Voice,代码行数:47,代码来源:DefaultScrollHandle.java

示例5: showLocal

import com.github.barteksc.pdfviewer.PDFView; //导入依赖的package包/类
/**
 * Shows the local attachment embedded in our application.  Also sets up the open button
 * to show the local file in an external viewer.
 * @param local Location of attachment locally (on the phone)
 */
private void showLocal(File local) {
	// Show the file in the PDF viewer
	PDFView pdfView = (PDFView) findViewById(R.id.pdfView);
	pdfView.setVisibility(View.VISIBLE);
	pdfView.fromFile(local)
			.enableSwipe(true)
			.enableDoubletap(true)
			.swipeVertical(false)
			.defaultPage(1)
			.showMinimap(false)
			.enableAnnotationRendering(false)
			.password(null)
			.showPageWithAnimation(true)
			.load();

	// Determine if we can open this file in an external reader
	// Create an external app chooser for the resource
	final Intent intentOpen = new Intent(Intent.ACTION_VIEW);
	Button openInButton = (Button) findViewById(R.id.openInButton);
	intentOpen.setDataAndType(Uri.fromFile(local), "application/pdf");
	intentOpen.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
	if (getPackageManager().queryIntentActivities(intentOpen, 0).size() > 0) {
		// Attach the open in button
		openInButton.setVisibility(View.VISIBLE);
		openInButton.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				openResourceExternally(intentOpen);
			}
		});
	}
}
 
开发者ID:DoSomethingArchive,项目名称:LetsDoThis-Android,代码行数:38,代码来源:CampaignResourceActivity.java

示例6: initViewerContentView

import com.github.barteksc.pdfviewer.PDFView; //导入依赖的package包/类
protected View initViewerContentView(Context context) {
	pdfView = new PDFView(context, null);
	return pdfView;
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:5,代码来源:PagePDFViewer.java

示例7: onCreate

import com.github.barteksc.pdfviewer.PDFView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pdf_selector);
    checkconnection();
    Intent j = getIntent();
    u = j.getStringExtra("URI");
    t = j.getStringExtra("CAT");
    uri = t + "/" + u + ".pdf";
    pdfview = (PDFView) findViewById(R.id.pdfview);
    File file = new File(Environment.getExternalStorageDirectory().toString() + "/College Doc/"+t+"/" + u + ".pdf");
    if (file.exists()) {

        pdfview.fromFile(file).load();
    }
    else if(!running)
    {
        int su=0;
        Toast.makeText(PdfSelector.this, "No Internet... Downloading not possible", Toast.LENGTH_SHORT).show();
        Intent i = new Intent(PdfSelector.this, Subjects.class);
        i.putExtra ("SU" ,su);
        startActivity(i);
        finish();
    }
    else {
            check=false;
        FirebaseStorage storage = FirebaseStorage.getInstance();
        StorageReference storageRef = storage.getReference();
        final StorageReference pdfdownload = storageRef.child(uri);
        pdfdownload.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
            @Override
            public void onSuccess(Uri uric) {
                // Got the download URL for 'users/me/profile.png'
                pdfdownload.getFile(uric);
                //checkconnection();
                //pdfview.loadPages();
                //temp = (TextView) findViewById(R.id.temp);
                //temp.setText(uric.toString());
                Uri ur = Uri.parse(uric.toString());
                file_url = uric.toString();
                new DownloadFileFromURL().execute(file_url);
                // startActivity(new Intent(PdfSelector.this,Topics.class));
        /*Intent webIntent = new Intent(Intent.ACTION_VIEW, ur);
        if (webIntent.resolveActivity(getPackageManager()) != null){
            startActivity(webIntent);
        }*/

            }
        }).addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception exception) {
                // Handle any errors
                //startActivity(new Intent(PdfSelector.this,Subjects.class));
                check=true;
                if(running)
                    Toast.makeText(PdfSelector.this, "File Not Exist", Toast.LENGTH_SHORT).show();
                else
                    Toast.makeText(PdfSelector.this, "downloading failed", Toast.LENGTH_SHORT).show();
                checkconnection();
                finish();
            }
        });
    }
}
 
开发者ID:Shobhit-pandey,项目名称:CollegeDoc,代码行数:65,代码来源:PdfSelector.java

示例8: DefaultLinkHandler

import com.github.barteksc.pdfviewer.PDFView; //导入依赖的package包/类
public DefaultLinkHandler(PDFView pdfView) {
    this.pdfView = pdfView;
}
 
开发者ID:barteksc,项目名称:AndroidPdfViewer,代码行数:4,代码来源:DefaultLinkHandler.java

示例9: setupLayout

import com.github.barteksc.pdfviewer.PDFView; //导入依赖的package包/类
/**
 * Method called by PDFView after setting scroll handle.
 * Do not call this method manually.
 * For usage sample see {@link DefaultScrollHandle}
 *
 * @param pdfView PDFView instance
 */
void setupLayout(PDFView pdfView);
 
开发者ID:barteksc,项目名称:AndroidPdfViewerV2,代码行数:9,代码来源:ScrollHandle.java


注:本文中的com.github.barteksc.pdfviewer.PDFView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。