Skip to content

Commit

Permalink
Disable more(...) button for Asset-voices
Browse files Browse the repository at this point in the history
  • Loading branch information
lumpidu committed Feb 8, 2024
1 parent 83fdcd6 commit 8a83ec3
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions app/src/main/java/com/grammatek/simaromur/VoiceInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.grammatek.simaromur.device.TTSAudioControl;
import com.grammatek.simaromur.network.ConnectionCheck;

import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;

/**
Expand Down Expand Up @@ -121,6 +122,8 @@ private void updateUi() {

// more options (3 dots ...)
CardView moreOptions = findViewById(R.id.moreOptionsBackground);
moreOptions.setVisibility(View.INVISIBLE);
moreOptions.setEnabled(false);
moreOptions.setOnClickListener(view -> {
// TODO: update not yet implemented
boolean isUpdateAvailable = false;
Expand Down Expand Up @@ -158,6 +161,9 @@ private void updateUi() {
}
} else if (mVoice.needsDownload()){
Log.v(LOG_TAG, "updateUi: voice needs download");
moreOptions.setVisibility(View.VISIBLE);
moreOptions.setEnabled(true);

// set text view and play button
typeTextView.setText(getResources().getString(R.string.type_local_downloaded));
speakableTextView.setText(getResources().getString(R.string.voice_test_text_on_device));
Expand All @@ -178,15 +184,17 @@ private void updateUi() {
mNetworkAvailabilityIcon.setImageResource(R.drawable.ic_action_download);
mNetworkAvailabilityIcon.setColorFilter(getResources().getColor(android.R.color.holo_green_light, null));
typeTextView.setText(getResources().getString(R.string.type_local));
if (mVoice.isFast()) {
moreOptions.setVisibility(View.VISIBLE);
moreOptions.setEnabled(true);
speakableTextView.setText(getResources().getString(R.string.voice_test_text_on_device_fast));
} else {
if (mVoice.url.equals("assets")) {
Log.v(LOG_TAG, "updateUi: voice is inside assets, cannot delete or update");
moreOptions.setVisibility(View.INVISIBLE);
moreOptions.setEnabled(false);
speakableTextView.setText(getResources().getString(R.string.voice_test_text_on_device));

} else {
Log.v(LOG_TAG, "updateUi: voice is deletable");
moreOptions.setVisibility(View.VISIBLE);
moreOptions.setEnabled(true);
}
speakableTextView.setText(getResources().getString(R.string.voice_test_text_on_device_fast));
speakableTextView.setVisibility(View.VISIBLE);
playButton.setVisibility(View.VISIBLE);
}
Expand Down

0 comments on commit 8a83ec3

Please sign in to comment.