Mark current week (#100)

This commit is contained in:
Rafał Borcz 2018-05-07 17:57:58 +02:00 committed by Mikołaj Pich
parent d7f0fcad30
commit 67f83a4d2f
10 changed files with 41 additions and 0 deletions

View File

@ -17,6 +17,8 @@ public interface AttendanceContract {
void setAdapterWithTabLayout();
boolean isMenuVisible();
void setThemeForTab(int position);
}
@PerActivity

View File

@ -80,6 +80,14 @@ public class AttendanceFragment extends BaseFragment implements AttendanceContra
viewPager.setCurrentItem(position, false);
}
@Override
public void setThemeForTab(int position) {
TabLayout.Tab tab = tabLayout.getTabAt(position);
if (tab != null) {
tab.setCustomView(R.layout.current_week_tab);
}
}
@Override
public void setActivityTitle() {
setTitle(getString(R.string.attendance_text));

View File

@ -80,6 +80,7 @@ public class AttendancePresenter extends BasePresenter<AttendanceContract.View>
public void onEndLoadingAsync(boolean result, Exception exception) {
if (result) {
getView().setAdapterWithTabLayout();
getView().setThemeForTab(positionToScroll);
getView().scrollViewPagerToPosition(positionToScroll);
listener.onFragmentIsReady();
}

View File

@ -17,6 +17,8 @@ public interface ExamsContract {
void setTabDataToAdapter(String date);
void setAdapterWithTabLayout();
void setThemeForTab(int position);
}
@PerActivity

View File

@ -73,6 +73,14 @@ public class ExamsFragment extends BaseFragment implements ExamsContract.View {
viewPager.setCurrentItem(position, false);
}
@Override
public void setThemeForTab(int position) {
TabLayout.Tab tab = tabLayout.getTabAt(position);
if (tab != null) {
tab.setCustomView(R.layout.current_week_tab);
}
}
@Override
public void setTabDataToAdapter(String date) {
pagerAdapter.addFragment(ExamsTabFragment.newInstance(date), date);

View File

@ -84,6 +84,7 @@ public class ExamsPresenter extends BasePresenter<ExamsContract.View>
public void onEndLoadingAsync(boolean result, Exception exception) {
if (result) {
getView().setAdapterWithTabLayout();
getView().setThemeForTab(positionToScroll);
getView().scrollViewPagerToPosition(positionToScroll);
listener.onFragmentIsReady();
}

View File

@ -17,6 +17,8 @@ public interface TimetableContract {
void setAdapterWithTabLayout();
boolean isMenuVisible();
void setThemeForTab(int position);
}
@PerFragment

View File

@ -78,6 +78,14 @@ public class TimetableFragment extends BaseFragment implements TimetableContract
viewPager.setCurrentItem(position, false);
}
@Override
public void setThemeForTab(int position) {
TabLayout.Tab tab = tabLayout.getTabAt(position);
if (tab != null) {
tab.setCustomView(R.layout.current_week_tab);
}
}
@Override
public void setActivityTitle() {
setTitle(getString(R.string.timetable_text));

View File

@ -79,6 +79,7 @@ public class TimetablePresenter extends BasePresenter<TimetableContract.View>
public void onEndLoadingAsync(boolean result, Exception exception) {
if (result) {
getView().setAdapterWithTabLayout();
getView().setThemeForTab(positionToScroll);
getView().scrollViewPagerToPosition(positionToScroll);
listener.onFragmentIsReady();
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textColor="@color/colorPrimaryDark"
android:textSize="14sp" />