mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-09 15:27:55 -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:src="@drawable/fullscreen_exit"
|
||||||
android:visibility="invisible"/>
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button_backtotop"
|
<Button
|
||||||
android:layout_width="fill_parent"
|
android:id="@+id/button_backtotop"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:alpha="0.6"
|
android:layout_centerHorizontal="true"
|
||||||
android:background="#DDFFFFFF"
|
android:alpha="0.6"
|
||||||
android:gravity="center"
|
android:background="#DDFFFFFF"
|
||||||
android:textColor="@android:color/black"
|
android:gravity="center"
|
||||||
android:textStyle="bold"
|
android:textColor="@android:color/black"
|
||||||
android:visibility="invisible"/>
|
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>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
@ -187,6 +187,8 @@ public class KiwixMobileActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private Button mBackToTopButton;
|
private Button mBackToTopButton;
|
||||||
|
|
||||||
|
private Button stopTTSButton;
|
||||||
|
|
||||||
private ListView mLeftDrawerList;
|
private ListView mLeftDrawerList;
|
||||||
|
|
||||||
private ListView mRightDrawerList;
|
private ListView mRightDrawerList;
|
||||||
@ -304,6 +306,7 @@ public class KiwixMobileActivity extends AppCompatActivity {
|
|||||||
isFullscreenOpened = false;
|
isFullscreenOpened = false;
|
||||||
mIsSpeaking = false;
|
mIsSpeaking = false;
|
||||||
mBackToTopButton = (Button) findViewById(R.id.button_backtotop);
|
mBackToTopButton = (Button) findViewById(R.id.button_backtotop);
|
||||||
|
stopTTSButton = (Button) findViewById(R.id.button_stop_tts);
|
||||||
mPrefState = new ArrayList<>();
|
mPrefState = new ArrayList<>();
|
||||||
mToolbarContainer = (RelativeLayout) findViewById(R.id.toolbar_layout);
|
mToolbarContainer = (RelativeLayout) findViewById(R.id.toolbar_layout);
|
||||||
mProgressBar = (AnimatedProgressBar) findViewById(R.id.progress_view);
|
mProgressBar = (AnimatedProgressBar) findViewById(R.id.progress_view);
|
||||||
@ -317,6 +320,16 @@ public class KiwixMobileActivity extends AppCompatActivity {
|
|||||||
IS_WIDGET_STAR = getIntent().getBooleanExtra("isWidgetStar", false);
|
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 =
|
tempForUndo =
|
||||||
new KiwixWebView(getApplicationContext()); /** initializing temporary tab value **/
|
new KiwixWebView(getApplicationContext()); /** initializing temporary tab value **/
|
||||||
snackbarLayout =
|
snackbarLayout =
|
||||||
@ -580,6 +593,7 @@ public class KiwixMobileActivity extends AppCompatActivity {
|
|||||||
public void run() {
|
public void run() {
|
||||||
menu.findItem(R.id.menu_read_aloud)
|
menu.findItem(R.id.menu_read_aloud)
|
||||||
.setTitle(getResources().getString(R.string.menu_read_aloud_stop));
|
.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() {
|
public void run() {
|
||||||
menu.findItem(R.id.menu_read_aloud)
|
menu.findItem(R.id.menu_read_aloud)
|
||||||
.setTitle(getResources().getString(R.string.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:
|
case R.id.menu_read_aloud:
|
||||||
readAloud();
|
readAloud();
|
||||||
|
stopTTSButton.setVisibility(View.VISIBLE);
|
||||||
|
if(mIsBacktotopEnabled) {
|
||||||
|
mBackToTopButton.setVisibility(View.INVISIBLE);
|
||||||
|
mIsBacktotopEnabled = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.menu_fullscreen:
|
case R.id.menu_fullscreen:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user