fixed issue with backtotop and stoptts buttons

This commit is contained in:
Elad Keyshawn 2016-09-04 02:24:10 +03:00
parent 63cc3e294e
commit a7c87b7e00
8 changed files with 21 additions and 14 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@ -4,7 +4,7 @@
<item android:drawable="@android:color/white"/>
<item>
<bitmap
android:src="@drawable/kiwix_icon__with_title"
android:src="@drawable/kiwix_icon_with_title"
android:gravity="center"
/>
</item>

View File

@ -11,7 +11,7 @@
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
android:background="@color/blue_grey">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -75,7 +75,7 @@
android:textColor="@android:color/black"
android:textStyle="bold"
android:text="stop"
android:visibility="invisible"/>
android:visibility="gone"/>
</RelativeLayout>

View File

@ -17,4 +17,5 @@
<color name="greyed_out_selected">#BDBDBD</color>
<color name="black_regular_mat_design">#212121</color>
<color name="grey">#808080</color>
<color name="blue_grey">#ECEFF1</color>
</resources>

View File

@ -62,7 +62,7 @@
<string name="clear_recent_history_dialog">Are you sure you want to delete your search history?</string>
<string name="clear_recent_and_tabs_history_dialog">Are you sure you want to delete your search history and reset all active tabs?</string>
<string name="delete_recent_search_item">Delete this item?</string>
<string name="pref_clear_all_history_title">Clear History</string>
<string name="pref_clear_all_history_title">Clear history</string>
<string name="pref_clear_all_history_summary">Clear recent searches and tabs history</string>
<string name="all_history_cleared_toast">All History Cleared</string>
<string name="clear_all_history_dialog_title">Clear All History</string>

View File

@ -322,8 +322,8 @@ public class KiwixMobileActivity extends AppCompatActivity {
@Override
public void onClick(View view) {
readAloud();
stopTTSButton.setVisibility(View.INVISIBLE);
mIsBacktotopEnabled = true;
stopTTSButton.setVisibility(View.GONE);
}
});
@ -608,7 +608,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);
stopTTSButton.setVisibility(View.GONE);
}
});
}
@ -829,12 +829,18 @@ public class KiwixMobileActivity extends AppCompatActivity {
break;
case R.id.menu_read_aloud:
readAloud();
stopTTSButton.setVisibility(View.VISIBLE);
if(stopTTSButton.getVisibility() == View.GONE) {
if(mIsBacktotopEnabled) {
mBackToTopButton.setVisibility(View.INVISIBLE);
mIsBacktotopEnabled = false;
}
} else if (stopTTSButton.getVisibility() == View.VISIBLE){
if(mIsBacktotopEnabled) {
mBackToTopButton.setVisibility(View.VISIBLE);
}
}
readAloud();
break;
case R.id.menu_fullscreen:
@ -1270,7 +1276,7 @@ public class KiwixMobileActivity extends AppCompatActivity {
public void onPageChanged(int page, int maxPages) {
if (mIsBacktotopEnabled) {
if (getCurrentWebView().getScrollY() > 200) {
if (mBackToTopButton.getVisibility() == View.INVISIBLE) {
if (mBackToTopButton.getVisibility() == View.INVISIBLE && stopTTSButton.getVisibility() == View.GONE ) {
mBackToTopButton.setText(R.string.button_backtotop);
mBackToTopButton.setVisibility(View.VISIBLE);
@ -1279,7 +1285,7 @@ public class KiwixMobileActivity extends AppCompatActivity {
mBackToTopButton.setVisibility(View.INVISIBLE);
Animation fadeAnimation =
AnimationUtils.loadAnimation(KiwixMobileActivity.this, android.R.anim.fade_out);
fadeAnimation.setStartOffset(1500);
fadeAnimation.setStartOffset(1200);
mBackToTopButton.startAnimation(fadeAnimation);
}
} else {