Add custom icons and make them work - Page 2 - RadaeePDF.com - Results from #6
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1
  • 2

TOPIC: Add custom icons and make them work

Add custom icons and make them work 2 years 8 months ago #11306

  • jorisk
  • jorisk's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 37
  • Karma: 1
  • Thank you received: 0
Here is the bar_cmd.xml file :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:minHeight="?attr/actionBarSize"
    android:background="@color/pdfreaderact_toolbar_background">

    <ImageView
        android:id="@+id/btn_return"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_centerVertical="true"
        android:layout_margin="2dp"
        android:clickable="true"
        android:icon="@drawable/btn_back" />

    <ImageView
        android:id="@+id/btn_summary"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@id/btn_return" android:layout_toEndOf="@id/btn_return"
        android:layout_margin="2dp"
        android:clickable="true"
        android:icon="@drawable/ic_action_list_2" />

    <ImageView
        android:id="@+id/btn_find"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@id/btn_summary" android:layout_toEndOf="@id/btn_summary"
        android:layout_margin="2dp"
        android:clickable="true"
        android:src="@drawable/ic_action_search" />

</RelativeLayout>
And here is the result:

These are the missing icons:
Attachments:

Please Log in or Create an account to join the conversation.

Add custom icons and make them work 2 years 8 months ago #11307

  • nermeen
  • nermeen's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 868
  • Karma: 23
  • Thank you received: 71
Please replace:
android:icon="@drawable/ic_action_list_2"
android:icon="@drawable/btn_back"
with:
android:src="@drawable/ic_action_list_2"
android:src="@drawable/btn_back"
The following user(s) said Thank You: jorisk

Please Log in or Create an account to join the conversation.

Add custom icons and make them work 2 years 8 months ago #11309

  • jorisk
  • jorisk's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 37
  • Karma: 1
  • Thank you received: 0
Wow, I didn't even see that... Thanks!

For the quit method, I know how and where to make the click method, but I don't know how to make it work because PDFViewAct.onDestroy() is not working from PDFLayoutView, and m_doc.Close() close the document but not the Activity.

Please Log in or Create an account to join the conversation.

Add custom icons and make them work 2 years 8 months ago #11310

  • nermeen
  • nermeen's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 868
  • Karma: 23
  • Thank you received: 71
You can do as the following;
  1. Create an interface in PDFViewController:
    public interface PDFViewControllerListener {
    		public void OnBackClicked();
    	}
  2. Create a listener variable in PDFViewController:
    PDFViewControllerListener mListener;
  3. Pass the listener to the PDFViewController constructor and save it:
    public PDFViewController(RelativeLayout parent, PDFLayoutView view, PDFViewControllerListener listener) {
    		mListener = listener;
  4. In the onClick of your button call the listener:
    mListener.OnBackClicked();
  5. In the PDFViewAct, pass the listener implementation:
    m_controller = new PDFViewController(m_layout, m_view, new PDFViewController.PDFViewControllerListener() {
    				@Override
    				public void OnBackClicked() {
    					finish();
    				}
    			});
The following user(s) said Thank You: jorisk

Please Log in or Create an account to join the conversation.

Add custom icons and make them work 2 years 8 months ago #11311

  • jorisk
  • jorisk's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 37
  • Karma: 1
  • Thank you received: 0
It works thank you!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Powered by Kunena Forum