mirror of
				https://codeberg.org/tom79/Fedilab.git
				synced 2025-10-20 11:20:16 +03:00 
			
		
		
		
	Fix some crashes
This commit is contained in:
		
							parent
							
								
									44677c7af6
								
							
						
					
					
						commit
						ba640a0991
					
				
					 2 changed files with 31 additions and 27 deletions
				
			
		|  | @ -663,7 +663,7 @@ public class ProfileActivity extends BaseActivity { | ||||||
|     public boolean onCreateOptionsMenu(@NonNull Menu menu) { |     public boolean onCreateOptionsMenu(@NonNull Menu menu) { | ||||||
|         getMenuInflater().inflate(R.menu.activity_profile, menu); |         getMenuInflater().inflate(R.menu.activity_profile, menu); | ||||||
|         if (account != null) { |         if (account != null) { | ||||||
|             final boolean isOwner = account.id != null && account.id.compareToIgnoreCase(BaseMainActivity.currentUserID) == 0; |             final boolean isOwner = account.id != null && BaseMainActivity.currentUserID != null && account.id.compareToIgnoreCase(BaseMainActivity.currentUserID) == 0; | ||||||
|             String[] splitAcct = account.acct.split("@"); |             String[] splitAcct = account.acct.split("@"); | ||||||
|             //check if user is from the same instance |             //check if user is from the same instance | ||||||
|             if (splitAcct.length <= 1) { //If yes, these entries must be hidden |             if (splitAcct.length <= 1) { //If yes, these entries must be hidden | ||||||
|  |  | ||||||
|  | @ -156,6 +156,29 @@ public class FragmentMastodonTimeline extends Fragment { | ||||||
|         return found ? position : -1; |         return found ? position : -1; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Returned list of checked status id for reports | ||||||
|  |      * | ||||||
|  |      * @return List<String> | ||||||
|  |      */ | ||||||
|  |     public List<String> getCheckedStatusesId() { | ||||||
|  |         List<String> stringList = new ArrayList<>(); | ||||||
|  |         for (Status status : statuses) { | ||||||
|  |             if (status.isChecked) { | ||||||
|  |                 stringList.add(status.id); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return stringList; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void scrollToTop() { | ||||||
|  |         if (binding != null) { | ||||||
|  |             binding.recyclerView.scrollToPosition(0); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     public View onCreateView(@NonNull LayoutInflater inflater, |     public View onCreateView(@NonNull LayoutInflater inflater, | ||||||
|                              ViewGroup container, Bundle savedInstanceState) { |                              ViewGroup container, Bundle savedInstanceState) { | ||||||
| 
 | 
 | ||||||
|  | @ -195,33 +218,7 @@ public class FragmentMastodonTimeline extends Fragment { | ||||||
|         LocalBroadcastManager.getInstance(requireActivity()).registerReceiver(receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION)); |         LocalBroadcastManager.getInstance(requireActivity()).registerReceiver(receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION)); | ||||||
|         binding = FragmentPaginationBinding.inflate(inflater, container, false); |         binding = FragmentPaginationBinding.inflate(inflater, container, false); | ||||||
|         binding.getRoot().setBackgroundColor(ThemeHelper.getBackgroundColor(requireActivity())); |         binding.getRoot().setBackgroundColor(ThemeHelper.getBackgroundColor(requireActivity())); | ||||||
|         return binding.getRoot(); |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     /** |  | ||||||
|      * Returned list of checked status id for reports |  | ||||||
|      * |  | ||||||
|      * @return List<String> |  | ||||||
|      */ |  | ||||||
|     public List<String> getCheckedStatusesId() { |  | ||||||
|         List<String> stringList = new ArrayList<>(); |  | ||||||
|         for (Status status : statuses) { |  | ||||||
|             if (status.isChecked) { |  | ||||||
|                 stringList.add(status.id); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         return stringList; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void scrollToTop() { |  | ||||||
|         if (binding != null) { |  | ||||||
|             binding.recyclerView.scrollToPosition(0); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     @Override |  | ||||||
|     public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |  | ||||||
|         super.onViewCreated(view, savedInstanceState); |  | ||||||
|         int c1 = getResources().getColor(R.color.cyanea_accent_reference); |         int c1 = getResources().getColor(R.color.cyanea_accent_reference); | ||||||
|         binding.swipeContainer.setProgressBackgroundColorSchemeColor(getResources().getColor(R.color.cyanea_primary_reference)); |         binding.swipeContainer.setProgressBackgroundColorSchemeColor(getResources().getColor(R.color.cyanea_primary_reference)); | ||||||
|         binding.swipeContainer.setColorSchemeColors( |         binding.swipeContainer.setColorSchemeColors( | ||||||
|  | @ -238,6 +235,13 @@ public class FragmentMastodonTimeline extends Fragment { | ||||||
|         max_id = statusReport != null ? statusReport.id : null; |         max_id = statusReport != null ? statusReport.id : null; | ||||||
|         flagLoading = false; |         flagLoading = false; | ||||||
|         router(null); |         router(null); | ||||||
|  | 
 | ||||||
|  |         return binding.getRoot(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | ||||||
|  |         super.onViewCreated(view, savedInstanceState); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue