mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 02:36:24 -04:00
added TTS stop button as overlay at the bottom #286
This commit is contained in:
parent
3ee4388e63
commit
6a976ea8db
@ -47,18 +47,36 @@
|
||||
android:src="@drawable/fullscreen_exit"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_backtotop"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:alpha="0.6"
|
||||
android:background="#DDFFFFFF"
|
||||
android:gravity="center"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_backtotop"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:alpha="0.6"
|
||||
android:background="#DDFFFFFF"
|
||||
android:gravity="center"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/button_backtotop"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_stop_tts"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:alpha="0.6"
|
||||
android:background="#DDFFFFFF"
|
||||
android:gravity="center"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
android:text="stop"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
@ -187,6 +187,8 @@ public class KiwixMobileActivity extends AppCompatActivity {
|
||||
|
||||
private Button mBackToTopButton;
|
||||
|
||||
private Button stopTTSButton;
|
||||
|
||||
private ListView mLeftDrawerList;
|
||||
|
||||
private ListView mRightDrawerList;
|
||||
@ -304,6 +306,7 @@ public class KiwixMobileActivity extends AppCompatActivity {
|
||||
isFullscreenOpened = false;
|
||||
mIsSpeaking = false;
|
||||
mBackToTopButton = (Button) findViewById(R.id.button_backtotop);
|
||||
stopTTSButton = (Button) findViewById(R.id.button_stop_tts);
|
||||
mPrefState = new ArrayList<>();
|
||||
mToolbarContainer = (RelativeLayout) findViewById(R.id.toolbar_layout);
|
||||
mProgressBar = (AnimatedProgressBar) findViewById(R.id.progress_view);
|
||||
@ -317,6 +320,16 @@ public class KiwixMobileActivity extends AppCompatActivity {
|
||||
IS_WIDGET_STAR = getIntent().getBooleanExtra("isWidgetStar", false);
|
||||
|
||||
|
||||
stopTTSButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
readAloud();
|
||||
stopTTSButton.setVisibility(View.INVISIBLE);
|
||||
mIsBacktotopEnabled = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
tempForUndo =
|
||||
new KiwixWebView(getApplicationContext()); /** initializing temporary tab value **/
|
||||
snackbarLayout =
|
||||
@ -580,6 +593,7 @@ public class KiwixMobileActivity extends AppCompatActivity {
|
||||
public void run() {
|
||||
menu.findItem(R.id.menu_read_aloud)
|
||||
.setTitle(getResources().getString(R.string.menu_read_aloud_stop));
|
||||
stopTTSButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -592,6 +606,7 @@ public class KiwixMobileActivity extends AppCompatActivity {
|
||||
public void run() {
|
||||
menu.findItem(R.id.menu_read_aloud)
|
||||
.setTitle(getResources().getString(R.string.menu_read_aloud));
|
||||
stopTTSButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -807,6 +822,11 @@ public class KiwixMobileActivity extends AppCompatActivity {
|
||||
|
||||
case R.id.menu_read_aloud:
|
||||
readAloud();
|
||||
stopTTSButton.setVisibility(View.VISIBLE);
|
||||
if(mIsBacktotopEnabled) {
|
||||
mBackToTopButton.setVisibility(View.INVISIBLE);
|
||||
mIsBacktotopEnabled = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.menu_fullscreen:
|
||||
|
Loading…
x
Reference in New Issue
Block a user