Skip to content
This repository has been archived by the owner on Sep 30, 2021. It is now read-only.

Commit

Permalink
now clicking followers/following from profile page navigates to the f…
Browse files Browse the repository at this point in the history
…ollower/following tabs to close #33 and commit files now expand when the commit expands to close #30
  • Loading branch information
Kosh committed Feb 28, 2017
1 parent fac8676 commit b896309
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/src/main/java/com/fastaccess/helper/ParseDateFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public String format(Date date) {
public static CharSequence getTimeAgo(@Nullable Date parsedDate) {
if (parsedDate != null) {
long toLocalTime = parsedDate.getTime() + getInstance().timeZone.getRawOffset() + getInstance().timeZone.getDSTSavings();
Logger.e(INSTANCE.timeZone.getID());
if (INSTANCE.timeZone.getID().equalsIgnoreCase("UTC")) {
toLocalTime = parsedDate.getTime();
}
return DateUtils.getRelativeTimeSpanString(toLocalTime, System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS);
}
return "N/A";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ public class CommitFilesViewHolder extends BaseViewHolder<CommitFileModel> {
private void onToggle(boolean expanded) {
if (!expanded) {
patch.setText(".....");
name.setMaxLines(2);
toggle.setRotation(0.0f);
} else {
name.setMaxLines(5);
setPatchText(pathText);
toggle.setRotation(180f);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
* Created by Kosh on 03 Dec 2016, 7:59 AM
*/

interface ProfilePagerMvp {
public interface ProfilePagerMvp {

interface View extends BaseMvp.FAView {}
interface View extends BaseMvp.FAView {
void onNavigateToFollowers();

void onNavigateToFollowing();
}

interface Presenter extends BaseMvp.FAPresenter {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,12 @@ public static ProfilePagerView newInstance(@NonNull String login) {
@NonNull @Override public ProfilePagerPresenter providePresenter() {
return new ProfilePagerPresenter();
}

@Override public void onNavigateToFollowers() {
pager.setCurrentItem(4);
}

@Override public void onNavigateToFollowing() {
pager.setCurrentItem(5);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.fastaccess.ui.modules.profile.overview;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
Expand All @@ -13,11 +14,13 @@
import com.fastaccess.helper.InputHelper;
import com.fastaccess.helper.ParseDateFormat;
import com.fastaccess.ui.base.BaseFragment;
import com.fastaccess.ui.modules.profile.ProfilePagerMvp;
import com.fastaccess.ui.widgets.AvatarLayout;
import com.fastaccess.ui.widgets.FontTextView;
import com.fastaccess.ui.widgets.SpannableBuilder;

import butterknife.BindView;
import butterknife.OnClick;
import icepick.State;

/**
Expand All @@ -40,12 +43,36 @@ public class ProfileOverviewView extends BaseFragment<ProfileOverviewMvp.View, P

@State UserModel userModel;

private ProfilePagerMvp.View profileCallback;

public static ProfileOverviewView newInstance(String login) {
ProfileOverviewView view = new ProfileOverviewView();
view.setArguments(Bundler.start().put(BundleConstant.EXTRA, login).end());
return view;
}

@OnClick({R.id.following, R.id.followers}) void onClick(View view) {
if (view.getId() == R.id.followers) {
profileCallback.onNavigateToFollowers();
} else {
profileCallback.onNavigateToFollowing();
}
}

@Override public void onAttach(Context context) {
super.onAttach(context);
if (getParentFragment() instanceof ProfilePagerMvp.View) {
profileCallback = (ProfilePagerMvp.View) getParentFragment();
} else {
profileCallback = (ProfilePagerMvp.View) context;
}
}

@Override public void onDetach() {
profileCallback = null;
super.onDetach();
}

@Override protected int fragmentLayout() {
return R.layout.profile_overview_layout;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import android.support.annotation.NonNull;

import com.fastaccess.ui.base.mvp.BaseMvp;
import com.fastaccess.ui.modules.profile.ProfilePagerMvp;

/**
* Created by Kosh on 04 Dec 2016, 1:11 PM
*/

interface UserPagerMvp {
public interface UserPagerMvp {

interface View extends BaseMvp.FAView {
interface View extends BaseMvp.FAView, ProfilePagerMvp.View {
void onInvalidateMenuItem();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,12 @@ public static Intent createIntent(@NonNull Context context, @NonNull String logi
@Override public void onInvalidateMenuItem() {
supportInvalidateOptionsMenu();
}

@Override public void onNavigateToFollowers() {
pager.setCurrentItem(4);
}

@Override public void onNavigateToFollowing() {
pager.setCurrentItem(5);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
android:layout_gravity="start|bottom|center"
android:layout_marginEnd="@dimen/spacing_xs_large"
android:layout_marginStart="@dimen/spacing_xs_large"
android:background="?selectableItemBackgroundBorderless"
android:gravity="center"
tools:text="Following\n40"/>

Expand All @@ -102,6 +103,7 @@
android:layout_gravity="end|bottom|center"
android:layout_marginEnd="@dimen/spacing_xs_large"
android:layout_marginStart="@dimen/spacing_xs_large"
android:background="?selectableItemBackgroundBorderless"
android:gravity="center"
tools:text="Followers\n140"/>
</FrameLayout>
Expand Down

0 comments on commit b896309

Please sign in to comment.