Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions android/res/layout/tts_toolbar.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Layout for TTS dialog -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tts_toolbar_body"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dip"
android:layout_marginBottom="3dip"
android:background="?attr/tts_toolbar_background"
android:baselineAligned="true"
android:orientation="vertical">
android:layout_height="fill_parent">

<LinearLayout
android:id="@+id/tts_glass_panel"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#00000000"
android:gravity="top">
</LinearLayout>

<LinearLayout
android:id="@+id/tts_toolbar_body"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="3dip"
android:layout_marginBottom="3dip"
android:background="?attr/tts_toolbar_background"
android:baselineAligned="true"
android:orientation="vertical">

<LinearLayout
android:id="@+id/tts_toolbar_buttons"
Expand Down Expand Up @@ -189,3 +203,4 @@
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
14 changes: 13 additions & 1 deletion android/src/org/coolreader/crengine/TTSToolbarDlg.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
Expand All @@ -65,6 +66,8 @@ public class TTSToolbarDlg implements Settings {
private final PopupWindow mWindow;
private final CoolReader mCoolReader;
private final ReaderView mReaderView;
private final LinearLayout glassPanel;
private final LinearLayout toolbarBody;
private final TTSControlServiceAccessor mTTSControl;
private final ImageButton mPlayPauseButton;
private final TextView mVolumeTextView;
Expand All @@ -77,6 +80,7 @@ public class TTSToolbarDlg implements Settings {
private boolean mClosed;
private Selection mCurrentSelection;
private boolean isSpeaking;
private boolean isToolbarHidden;
private int mMotionTimeout;
private boolean mAutoSetDocLang;
private String mBookAuthors;
Expand Down Expand Up @@ -438,6 +442,14 @@ public TTSToolbarDlg(CoolReader coolReader, ReaderView readerView, TTSControlSer
LayoutInflater inflater = LayoutInflater.from(context);
View panel = inflater.inflate(R.layout.tts_toolbar, null);

glassPanel = panel.findViewById(R.id.tts_glass_panel);
toolbarBody = panel.findViewById(R.id.tts_toolbar_body);

glassPanel.setOnClickListener(v -> {
isToolbarHidden = !isToolbarHidden;
toolbarBody.setVisibility(isToolbarHidden ? View.INVISIBLE: View.VISIBLE);
});

mPlayPauseButton = panel.findViewById(R.id.tts_play_pause);
mPlayPauseButton.setImageResource(Utils.resolveResourceIdByAttr(mCoolReader, R.attr.ic_media_play_drawable, R.drawable.ic_media_play));
ImageButton backButton = panel.findViewById(R.id.tts_back);
Expand Down Expand Up @@ -557,7 +569,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {

mWindow.setBackgroundDrawable(new BitmapDrawable());
mWindow.setWidth(WindowManager.LayoutParams.FILL_PARENT);
mWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
mWindow.setHeight(WindowManager.LayoutParams.FILL_PARENT);
mWindow.setFocusable(true);
mWindow.setTouchable(true);
mWindow.setOutsideTouchable(true);
Expand Down