mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 15:18:20 +01:00
Mark current week (#100)
This commit is contained in:
parent
d7f0fcad30
commit
67f83a4d2f
@ -17,6 +17,8 @@ public interface AttendanceContract {
|
||||
void setAdapterWithTabLayout();
|
||||
|
||||
boolean isMenuVisible();
|
||||
|
||||
void setThemeForTab(int position);
|
||||
}
|
||||
|
||||
@PerActivity
|
||||
|
@ -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));
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ public interface ExamsContract {
|
||||
void setTabDataToAdapter(String date);
|
||||
|
||||
void setAdapterWithTabLayout();
|
||||
|
||||
void setThemeForTab(int position);
|
||||
}
|
||||
|
||||
@PerActivity
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ public interface TimetableContract {
|
||||
void setAdapterWithTabLayout();
|
||||
|
||||
boolean isMenuVisible();
|
||||
|
||||
void setThemeForTab(int position);
|
||||
}
|
||||
|
||||
@PerFragment
|
||||
|
@ -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));
|
||||
|
@ -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();
|
||||
}
|
||||
|
8
app/src/main/res/layout/current_week_tab.xml
Normal file
8
app/src/main/res/layout/current_week_tab.xml
Normal 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" />
|
Loading…
x
Reference in New Issue
Block a user