Skip to content

Commit

Permalink
fix visibility of new download layout
Browse files Browse the repository at this point in the history
  • Loading branch information
SubhamTyagi committed Oct 1, 2024
1 parent 57fbb42 commit 8bcd3cf
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions app/src/main/java/io/github/subhamtyagi/ocr/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

Expand Down Expand Up @@ -89,6 +91,7 @@ public class MainActivity extends AppCompatActivity implements TessBaseAPI.Progr
private LinearProgressIndicator mProgressIndicator;
private SwipeRefreshLayout mSwipeRefreshLayout;
private FloatingActionButton mFloatingActionButton;
private LinearLayout mDownloadLayout;
/**
* Language name to be displayed
*/
Expand Down Expand Up @@ -120,6 +123,7 @@ protected void onCreate(Bundle savedInstanceState) {
mProgressBar = findViewById(R.id.progress_bar);
mProgressTitle = findViewById(R.id.progress_title);
mProgressMessage = findViewById(R.id.progress_message);
mDownloadLayout=findViewById(R.id.download_layout);

executorService = Executors.newFixedThreadPool(4);
handler = new Handler(Looper.getMainLooper());
Expand Down Expand Up @@ -564,19 +568,14 @@ public void run() {
handler.post(() -> {
mProgressTitle.setText(getString(R.string.downloading));
mProgressMessage.setText(getString(R.string.downloading_language));
mProgressTitle.setVisibility(View.VISIBLE);
mProgressMessage.setVisibility(View.VISIBLE);
mProgressSpinner.setVisibility(View.VISIBLE);
mDownloadLayout.setVisibility(View.VISIBLE);
mProgressBar.setVisibility(View.GONE);
});

boolean success = downloadTrainingData(dataType, lang);

handler.post(() -> {
mProgressSpinner.setVisibility(View.GONE);
mProgressBar.setVisibility(View.GONE);
mProgressTitle.setVisibility(View.GONE);
mProgressMessage.setVisibility(View.GONE);
mDownloadLayout.setVisibility(View.GONE);
if (success) {
initializeOCR(Utils.getTrainingDataLanguages(MainActivity.this));
} else {
Expand Down

0 comments on commit 8bcd3cf

Please sign in to comment.