mirror of
				https://github.com/lacerta-doc/Lacerta.git
				synced 2025-11-04 00:40:49 +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.tabs.TabLayout;
 | 
			
		||||
import com.google.android.material.tabs.TabLayoutMediator;
 | 
			
		||||
import com.google.android.material.textfield.TextInputEditText;
 | 
			
		||||
import com.google.android.material.textfield.TextInputLayout;
 | 
			
		||||
 | 
			
		||||
@ -102,6 +103,10 @@ public class ViewerContainerFragment extends Fragment {
 | 
			
		||||
        ViewerViewPagerAdapter viewerViewPagerAdapter = new ViewerViewPagerAdapter(requireActivity());
 | 
			
		||||
        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
 | 
			
		||||
        Toolbar toolbar = view.findViewById(R.id.toolbar);
 | 
			
		||||
        initToolbar(toolbar, true, documentName);
 | 
			
		||||
@ -119,7 +124,6 @@ public class ViewerContainerFragment extends Fragment {
 | 
			
		||||
            });
 | 
			
		||||
        } else {
 | 
			
		||||
            logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined);
 | 
			
		||||
            TabLayout tabLayout = view.findViewById(R.id.tab_layout);
 | 
			
		||||
            tabLayout.setVisibility(View.GONE);
 | 
			
		||||
            viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,7 @@
 | 
			
		||||
package one.nem.lacerta.component.viewer;
 | 
			
		||||
 | 
			
		||||
import androidx.annotation.NonNull;
 | 
			
		||||
import androidx.annotation.Nullable;
 | 
			
		||||
import androidx.fragment.app.Fragment;
 | 
			
		||||
import androidx.fragment.app.FragmentActivity;
 | 
			
		||||
import androidx.fragment.app.FragmentManager;
 | 
			
		||||
@ -35,4 +36,9 @@ public class ViewerViewPagerAdapter extends FragmentStateAdapter {
 | 
			
		||||
    public int getItemCount() {
 | 
			
		||||
        return fragmentArrayList == null ? 0 : fragmentArrayList.size();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Nullable
 | 
			
		||||
    public CharSequence getTabTitle(int position) {
 | 
			
		||||
        return fragmentTitleList.get(position);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user