Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ex 3 #3

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
944c5da
Implement news section.
nikiJava Nov 11, 2018
c299774
Add another layout (viewType) for criminal news.
nikiJava Nov 16, 2018
df14019
Add placeholder and error drawable into news list.
nikiJava Nov 16, 2018
86afeed
Merge branch 'develop' into feature/ex-3
nikiJava Nov 16, 2018
3858912
Add CollapsingToolbar on news details screen.
nikiJava Nov 16, 2018
3675333
Reformat news list layout.
nikiJava Nov 16, 2018
7c5bab9
Replace GridLayoutManager with StaggeredGridLayoutManager because of …
nikiJava Nov 16, 2018
cae3a12
Remove duplicate keys in gradle properties.
nikiJava Nov 16, 2018
bdf3bd1
Remove redundant chars remained from merge conflict in styles.xml.
nikiJava Nov 17, 2018
6d36e46
Remove redundant strings.xml with the only Russian locale (ru-rRu) (r…
nikiJava Nov 17, 2018
8a82737
Add contentDescription for images in news items.
nikiJava Nov 17, 2018
ceb6a58
Remove redundant kotlin gradle plugin.
nikiJava Dec 1, 2018
8dd910b
Extract androidx version of RecyclerView and CardView into separate v…
nikiJava Dec 1, 2018
69c66b3
Make DateFormatter field in news details screen static so don't creat…
nikiJava Dec 1, 2018
2665259
Extract background color from item_news_big into color resources.
nikiJava Dec 1, 2018
0f67b6d
Replace HashMap with ArrayMap in CompositeDelegateAdapter for better …
nikiJava Dec 1, 2018
4523c9b
Remove from build gradle compiling .jar files from /libs.
nikiJava Dec 1, 2018
554ea4f
Remove redundant contentDescription for RecyclerView in news list lay…
nikiJava Dec 1, 2018
069cefb
Remove redundant attributes of ConstraintLayout in news details layout.
nikiJava Dec 1, 2018
aee79da
Set DateFormatter's formatDateTime method as static
nikiJava Dec 8, 2018
cdd95e1
Create separate color constant for big news item title background
nikiJava Dec 8, 2018
0cbd83f
Implement ratio 1:1 for image in news item
nikiJava Dec 8, 2018
c3ff950
Set StaggeredGridLayoutManager for news list in all configurations
nikiJava Dec 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.cardview:cardview:$androidx_version"
implementation project(":delegateadapter")
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.1.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation "androidx.recyclerview:recyclerview:$androidx_version"
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class NewsDetailsActivity extends AppCompatActivity {

private static String NEWS_KEY = "news_key";
private final DateFormatter dateFormatter = new DateFormatter();
private static final DateFormatter dateFormatter = new DateFormatter();

private News news;

Expand Down
14 changes: 0 additions & 14 deletions app/src/main/res/layout/activity_news_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
android:layout_height="200dp"
android:contentDescription="@string/content_description_image_for_news"
android:scaleType="centerCrop"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@tools:sample/avatars[0]"
/>

Expand Down Expand Up @@ -73,10 +70,6 @@
android:layout_marginTop="@dimen/spacing_normal"
android:layout_marginEnd="@dimen/spacing_normal"
android:textAppearance="@style/TextAppearance.Details.Title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivImage"
tools:text="Create your NewsItem XML layout"
/>
<TextView
Expand All @@ -87,10 +80,6 @@
android:layout_marginTop="@dimen/spacing_normal"
android:layout_marginEnd="@dimen/spacing_normal"
android:textAppearance="@style/TextAppearance.Details.Date"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvTitle"
tools:text="Вчера"
/>
<TextView
Expand All @@ -102,9 +91,6 @@
android:layout_marginEnd="@dimen/spacing_normal"
android:layout_marginBottom="@dimen/spacing_normal"
android:textAppearance="@style/TextAppearance.Details.Text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvDate"
tools:text="Your XML layout should show News category, title, preview text, published date and heading image"
/>
</LinearLayout>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/activity_news_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:contentDescription="@string/content_description_image_for_news"
android:orientation="vertical"
android:padding="@dimen/spacing_micro"
tools:context=".presentation.news.list.NewsListActivity"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_news_big.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
android:id="@+id/tvTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#b4c6c5c5"
android:background="@color/background_transparent_grey"
android:lines="2"
android:paddingStart="@dimen/spacing_normal"
android:paddingTop="@dimen/spacing_micro"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<color name="colorPrimaryDark">#ffd4a515</color>
<color name="colorAccent">#ff962326</color>
<color name="window_background">?android:attr/colorBackground</color>
<color name="background_transparent_grey">#b4c6c5c5</color>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если ты прям акцент хочет на цвете сделать (и много где его юзать), то ок.
А вот если тут акцент скорее на назначении, типа "цвет фона карточки", то может лучше именно так его и назвать. Т.к он может поменяться, но не надо будет ещё и название менять (если он станет, например, синим). Но это не обязательно к исправлению, просто имей в виду.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Создал отдельную константу для фона заголовка карточки

</resources>
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

buildscript {
ext {
kotlin_version = '1.2.71'
glide_version = '4.8.0'
androidx_version = '1.0.0'
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import androidx.annotation.NonNull;
import androidx.collection.ArrayMap;
import androidx.recyclerview.widget.RecyclerView;

public class CompositeDelegateAdapter<T>
Expand Down Expand Up @@ -78,7 +78,7 @@ public static class Builder<T> {
private int count;

public Builder() {
typeToAdapterMap = new HashMap<>();
typeToAdapterMap = new ArrayMap<>();
}

public Builder<T> add(@NonNull final IDelegateAdapter<?, ? extends T> delegateAdapter) {
Expand Down