Skip to content

Commit

Permalink
Merge branch 'feature/improve_details' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
saulmm committed Feb 7, 2016
2 parents 59c897b + 00e1b9d commit ab2a1fa
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public CharacterDetailPresenter(CharacterDetailsUsecase getCharacterInformationU
@Override
public void onCreate() {
if (mCharacterId == -1 || mCharacterName == null)
throw new IllegalStateException("initializePresenter was not well initialised");
throw new IllegalStateException();

askForCharacterDetails();
mCharacterDetailView.disableScroll();
askForCharacterDetails();
}

public void askForCharacterDetails() {
Expand Down Expand Up @@ -61,19 +61,19 @@ public void attachView(View v) {
mCharacterDetailView = (CharacterDetailView) v;
}

@SuppressWarnings("Convert2MethodRef")
public void initializePresenter(int characterId, String characterName) {
mCharacterId = characterId;
mCharacterName = characterName;
}

private void manageCharacterError(Throwable error) {
// TODO
}

private void onCharacterReceived(MarvelCharacter character) {
mCharacterDetailView.bindCharacter(character);
mCharacterDetailView.enableScroll();

if (character.getDescription() != null && !character.getDescription().equals(""))
mCharacterDetailView.enableScroll();
}

public void onComicsIndicatorPressed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ public void hideRevealViewByAlpha() {
}

private void initToolbar() {
mBinding.characterCollapsing.setExpandedTitleTextAppearance(
R.style.Text_CollapsedExpanded);

mBinding.characterToolbar.setNavigationOnClickListener(v -> onBackPressed());
}

Expand All @@ -213,7 +210,6 @@ public void showError(String errorMessage) {
@Override
public void bindCharacter(MarvelCharacter character) {
mBinding.setCharacter(character);
enableScroll();
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/drawable/gradient_dark_up.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

<gradient
android:angle="90"
android:startColor="#262626"
android:centerColor="#22000000"
android:endColor="#00414141"
android:startColor="#AA000000"
android:centerColor="#66000000"
android:endColor="#00000000"
/>
</shape>
54 changes: 28 additions & 26 deletions app/src/main/res/layout/activity_avenger_detail.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!--suppress AndroidUnknownAttribute -->
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
Expand Down Expand Up @@ -29,6 +30,7 @@
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:fitsSystemWindows="true"
app:elevation="0dp"
>

<android.support.design.widget.CollapsingToolbarLayout
Expand All @@ -40,44 +42,44 @@
app:contentScrim="@{darkSwatch.rgb}"
>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_collapseMode="parallax"
android:fitsSystemWindows="true"
>
<ImageView
android:id="@+id/character_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
presenter="@{presenter}"
callback="@{imageCallback}"
source="@{character.imageUrl}"
tools:ignore="ContentDescription"
android:foreground="@drawable/gradient_dark_up"
/>

<ImageView
android:id="@+id/character_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
presenter="@{presenter}"
callback="@{imageCallback}"
source="@{character.imageUrl}"
/>

<View
android:id="@+id/character_image_reveal"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:background="#dc6767"
/>
</FrameLayout>
<View
android:id="@+id/character_image_reveal"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:background="#dc6767"
/>

<!--<View-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:background="@drawable/gradient_dark_up"-->
<!--/>-->

<android.support.v7.widget.Toolbar
android:id="@+id/character_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:elevation="@dimen/elevation_small"
android:elevation="0dp"
app:title="@{character.name}"
style="@style/Toolbar.WithNavigationBack"
app:layout_collapseMode="pin"
android:background="@null"
/>

</android.support.design.widget.CollapsingToolbarLayout>


Expand Down
7 changes: 3 additions & 4 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@
<item name="android:minHeight">0dp</item>
</style>

<style name="Text.CollapsedExpanded">
<style name="Text.Expanded">
<item name="android:gravity">center_horizontal</item>
<item name="android:textColor">@android:color/transparent</item>
<item name="android:fontFamily">sans-serif-light</item>
<item name="android:textSize">24sp</item>
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse</item>
<item name="android:textSize">30sp</item>
</style>

<style name="Text.Counters">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ public class CharacterDetailsUsecase extends Usecase<MarvelCharacter> {

@Override
public Observable<MarvelCharacter> buildObservable() {
mRepository.getCharacters(0)
.observeOn(mUiThread)
.subscribeOn(mExecutorThread);

return mRepository.getCharacter(mCharacterId)
.observeOn(mUiThread)
.subscribeOn(mExecutorThread);
Expand Down

0 comments on commit ab2a1fa

Please sign in to comment.