version:1.5

fix:
update:天气界面增加返回
This commit is contained in:
2022-01-22 14:26:33 +08:00
parent 2e9b26b100
commit 0b4e854b95
5 changed files with 112 additions and 2 deletions

View File

@@ -1,6 +1,9 @@
package com.uiui.os.activity.weather; package com.uiui.os.activity.weather;
import android.content.res.Resources; import android.content.res.Resources;
import android.media.Image;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
@@ -24,6 +27,9 @@ public class WeatherActivity extends BaseActivity implements WeatherContact.Weat
RecyclerView rv_weather; RecyclerView rv_weather;
@BindView(R.id.tv_location) @BindView(R.id.tv_location)
TextView tv_location; TextView tv_location;
@BindView(R.id.iv_back)
ImageView iv_back;
private WeatherPresenter mPresenter; private WeatherPresenter mPresenter;
private WeatherDayApdapter mWeatherDayApdapter; private WeatherDayApdapter mWeatherDayApdapter;
@@ -47,7 +53,12 @@ public class WeatherActivity extends BaseActivity implements WeatherContact.Weat
// rv_weather.addItemDecoration(new RecyclerItemDecoration(ScreenUtils.dp2px(resources, 10), ScreenUtils.dp2px(resources, 10), 3)); // rv_weather.addItemDecoration(new RecyclerItemDecoration(ScreenUtils.dp2px(resources, 10), ScreenUtils.dp2px(resources, 10), 3));
mWeatherDayApdapter = new WeatherDayApdapter(); mWeatherDayApdapter = new WeatherDayApdapter();
rv_weather.setAdapter(mWeatherDayApdapter); rv_weather.setAdapter(mWeatherDayApdapter);
iv_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
} }
@Override @Override

View File

@@ -16,6 +16,7 @@
android:id="@+id/iv_back" android:id="@+id/iv_back"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/back" android:src="@drawable/back"

View File

@@ -6,6 +6,34 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".activity.weather.WeatherActivity"> tools:context=".activity.weather.WeatherActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:adjustViewBounds="true"
android:layout_marginStart="8dp"
android:scaleType="centerCrop"
android:src="@drawable/back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="最近7天趋势预报"
android:textColor="@color/white"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_back"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_weather" android:id="@+id/rv_weather"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -13,7 +41,7 @@
app:layout_constraintBottom_toTopOf="@+id/constraintLayout2" app:layout_constraintBottom_toTopOf="@+id/constraintLayout2"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toBottomOf="@+id/constraintLayout3" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout2" android:id="@+id/constraintLayout2"

View File

@@ -16,6 +16,7 @@
android:id="@+id/iv_back" android:id="@+id/iv_back"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/back" android:src="@drawable/back"

View File

@@ -6,4 +6,73 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".activity.weather.WeatherActivity"> tools:context=".activity.weather.WeatherActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:adjustViewBounds="true"
android:layout_marginStart="8dp"
android:scaleType="centerCrop"
android:src="@drawable/back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="最近7天趋势预报"
android:textColor="@color/white"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_back"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_weather"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/constraintLayout2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout3" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="32dp"
android:layout_height="32dp"
android:adjustViewBounds="true"
android:scaleType="centerInside"
android:src="@drawable/icon_location"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="位置"
android:textColor="@color/white"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="@+id/imageView"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toTopOf="@+id/imageView" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>