mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 17:53:14 +00:00
タイトルを表示できるように WIP
This commit is contained in:
parent
3a13b8e4b7
commit
0210bcaeb6
|
@ -13,6 +13,7 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
import com.google.android.material.tabs.TabLayoutMediator;
|
||||||
import com.google.android.material.textfield.TextInputEditText;
|
import com.google.android.material.textfield.TextInputEditText;
|
||||||
import com.google.android.material.textfield.TextInputLayout;
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
|
|
||||||
|
@ -102,6 +103,10 @@ public class ViewerContainerFragment extends Fragment {
|
||||||
ViewerViewPagerAdapter viewerViewPagerAdapter = new ViewerViewPagerAdapter(requireActivity());
|
ViewerViewPagerAdapter viewerViewPagerAdapter = new ViewerViewPagerAdapter(requireActivity());
|
||||||
viewPager.setAdapter(viewerViewPagerAdapter);
|
viewPager.setAdapter(viewerViewPagerAdapter);
|
||||||
|
|
||||||
|
// Init tab layout
|
||||||
|
TabLayout tabLayout = view.findViewById(R.id.tab_layout);
|
||||||
|
new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> tab.setText(viewerViewPagerAdapter.getTabTitle(position))).attach();
|
||||||
|
|
||||||
// Init toolbar
|
// Init toolbar
|
||||||
Toolbar toolbar = view.findViewById(R.id.toolbar);
|
Toolbar toolbar = view.findViewById(R.id.toolbar);
|
||||||
initToolbar(toolbar, true, documentName);
|
initToolbar(toolbar, true, documentName);
|
||||||
|
@ -119,7 +124,6 @@ public class ViewerContainerFragment extends Fragment {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined);
|
logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined);
|
||||||
TabLayout tabLayout = view.findViewById(R.id.tab_layout);
|
|
||||||
tabLayout.setVisibility(View.GONE);
|
tabLayout.setVisibility(View.GONE);
|
||||||
viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName);
|
viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package one.nem.lacerta.component.viewer;
|
package one.nem.lacerta.component.viewer;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
@ -35,4 +36,9 @@ public class ViewerViewPagerAdapter extends FragmentStateAdapter {
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return fragmentArrayList == null ? 0 : fragmentArrayList.size();
|
return fragmentArrayList == null ? 0 : fragmentArrayList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public CharSequence getTabTitle(int position) {
|
||||||
|
return fragmentTitleList.get(position);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user