diff --git a/app/src/main/java/org/mmu/tinkoffkinolab/CardActivity.java b/app/src/main/java/org/mmu/tinkoffkinolab/CardActivity.java index 01669e7..99bbaae 100644 --- a/app/src/main/java/org/mmu/tinkoffkinolab/CardActivity.java +++ b/app/src/main/java/org/mmu/tinkoffkinolab/CardActivity.java @@ -47,7 +47,6 @@ public class CardActivity extends AppCompatActivity private WebDataDownloadTask downloadTask; private TextView txtHeader; private TextView txtContent; - private View androidContentView; private View progBar; private boolean _isHorizontal; @@ -174,7 +173,6 @@ public void onFragmentViewCreated(@NonNull FragmentManager fm, @NonNull Fragment imgPoster = v.findViewById(R.id.poster_image_view); txtHeader = v.findViewById(R.id.card_title); txtContent = v.findViewById(R.id.card_content); - androidContentView = v.findViewById(android.R.id.content); super.onFragmentViewCreated(fm, f, v, savedInstanceState); getFilmDataAsync(); } @@ -189,12 +187,10 @@ public void onConfigurationChanged(@NonNull Configuration newConfig) if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { _isHorizontal = true; - //Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show(); } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { _isHorizontal = false; - //Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show(); } } @@ -270,7 +266,7 @@ public void onError(Exception e) */ private void showSnackBar(String message) { - var popup = Snackbar.make(androidContentView, message, Snackbar.LENGTH_INDEFINITE); + var popup = Snackbar.make(this.imgPoster, message, Snackbar.LENGTH_INDEFINITE); popup.setAction(R.string.repeat_button_caption, view -> { getFilmDataAsync(); popup.dismiss(); diff --git a/app/src/main/java/org/mmu/tinkoffkinolab/MainActivity.java b/app/src/main/java/org/mmu/tinkoffkinolab/MainActivity.java index 86807e1..dc5203d 100644 --- a/app/src/main/java/org/mmu/tinkoffkinolab/MainActivity.java +++ b/app/src/main/java/org/mmu/tinkoffkinolab/MainActivity.java @@ -7,7 +7,6 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.cardview.widget.CardView; import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentContainerView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import android.annotation.SuppressLint; @@ -26,7 +25,6 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.ImageView; import android.widget.LinearLayout; @@ -213,7 +211,7 @@ private int downloadPopularFilmList(int pageNumber) */ private AsyncTask downloadTask; private TextInputEditText txtQuery; - private View androidContentView; + private View coordinatorView; private LinearLayout cardsContainer; private LayoutInflater layoutInflater; private boolean isFiltered; @@ -344,7 +342,7 @@ protected void onCreate(Bundle savedInstanceState) this.isRus = Locale.getDefault().getLanguage().equalsIgnoreCase("ru"); this.layoutInflater = getLayoutInflater(); - this.androidContentView = findViewById(android.R.id.content); + this.coordinatorView = findViewById(R.id.root_container); this.progBar = findViewById(R.id.progress_bar); this.progBar.setVisibility(View.GONE); this.txtQuery = findViewById(R.id.txt_input); @@ -910,7 +908,7 @@ private boolean addToOrRemoveFromFavourites(String id, Map cardD */ private Snackbar showErrorSnackBar(String message) { - var popup = Snackbar.make(this.androidContentView, message, Snackbar.LENGTH_INDEFINITE); + var popup = Snackbar.make(coordinatorView, message, Snackbar.LENGTH_INDEFINITE); popup.setAction(R.string.repeat_button_caption, view -> { var text = Objects.requireNonNull(txtQuery.getText()).toString().replace("null", ""); this.startTopFilmsDownloadTask(_nextPageNumber); diff --git a/app/src/main/res/layout/activity_card.xml b/app/src/main/res/layout/activity_card.xml index 7c6df63..cbb3120 100644 --- a/app/src/main/res/layout/activity_card.xml +++ b/app/src/main/res/layout/activity_card.xml @@ -1,5 +1,4 @@ - - - - - - - - + + android:scaleType="centerCrop" + android:contentDescription="@string/filmposter_image_alt_text" + tools:srcCompat="@tools:sample/backgrounds/scenic" /> - + android:orientation="vertical" + > + + + + - - \ No newline at end of file + + \ No newline at end of file