-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #360 from PSPDFKit/reinhard/property-inspector-sample
Add support for hiding the main toolbar
- Loading branch information
Showing
14 changed files
with
368 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
android/src/main/java/com/pspdfkit/views/ReactMainToolbar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.pspdfkit.views; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
import com.pspdfkit.ui.toolbar.MainToolbar; | ||
|
||
/** Custom toolbar that allows us to force a visibility. */ | ||
public class ReactMainToolbar extends MainToolbar { | ||
|
||
private @Nullable Integer forcedVisibility; | ||
|
||
public ReactMainToolbar(@NonNull Context context) { | ||
super(context); | ||
} | ||
|
||
public ReactMainToolbar(@NonNull Context context, @Nullable AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public ReactMainToolbar(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
} | ||
|
||
/** | ||
* Sets a forced visibility that will override all future calls to {@link #setVisibility(int)}. The visibility will also immediately be applied. | ||
* | ||
* @param visibility The visibility to force or {@code null} to not force any specific visibility. | ||
*/ | ||
public void setForcedVisibility(@Nullable final Integer visibility) { | ||
forcedVisibility = visibility; | ||
if (forcedVisibility != null) { | ||
setVisibility(forcedVisibility); | ||
} | ||
} | ||
|
||
@Override | ||
public void setVisibility(int visibility) { | ||
if (forcedVisibility == null) { | ||
super.setVisibility(visibility); | ||
} else { | ||
super.setVisibility(forcedVisibility); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!-- | ||
~ pspdf__toolbar_main.xml | ||
~ | ||
~ PSPDFKit | ||
~ | ||
~ Copyright © 2014-2020 PSPDFKit GmbH. All rights reserved. | ||
~ | ||
~ THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW | ||
~ AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT. | ||
~ UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. | ||
~ This notice may not be removed from this file. | ||
--> | ||
|
||
<com.pspdfkit.views.ReactMainToolbar xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/pspdf__toolbar_main" | ||
android:layout_width="match_parent" | ||
android:layout_height="?attr/actionBarSize" | ||
android:elevation="@dimen/pspdf__toolbar_elevation" | ||
android:focusable="true" | ||
android:focusableInTouchMode="true" | ||
app:contentInsetEnd="16dp" | ||
app:contentInsetRight="16dp" | ||
tools:ignore="Overdraw,UnusedAttribute" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.