From 4be219e4a05f4b9d3c92cf8dbfc55546518c5099 Mon Sep 17 00:00:00 2001 From: Mikhail M Date: Mon, 27 Feb 2023 16:28:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C=20"=D1=81=D0=BC=D0=B0=D1=85=D0=BD=D1=83=D1=82=D1=8C"=20?= =?UTF-8?q?=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE?= =?UTF-8?q?=D0=B1=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B5=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20=D0=B4=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D1=85=20=D0=B8=D0=B7=20=D0=A1=D0=B5=D1=82=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/mmu/tinkoffkinolab/CardActivity.java | 6 +- .../org/mmu/tinkoffkinolab/MainActivity.java | 8 +- app/src/main/res/layout/activity_card.xml | 1 - app/src/main/res/layout/activity_main.xml | 1 + app/src/main/res/layout/fragment_card.xml | 95 ++++++++++--------- 5 files changed, 55 insertions(+), 56 deletions(-) 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