forked from mirrors/Fedilab
		
	Fix issue #62
This commit is contained in:
		
							parent
							
								
									e063eec767
								
							
						
					
					
						commit
						918c32dade
					
				
					 7 changed files with 37 additions and 7 deletions
				
			
		|  | @ -129,7 +129,7 @@ public class ReorderTimelinesActivity extends BaseActivity implements OnStartDra | |||
|         }); | ||||
|         reorderVM.getBottomMenu().observe(ReorderTimelinesActivity.this, _bottomMenu -> { | ||||
|             this.bottomMenu = _bottomMenu; | ||||
|             if (this.bottomMenu == null) { | ||||
|             if (_bottomMenu == null) { | ||||
|                 this.bottomMenu = new BottomMenu(getApplicationContext()).defaultBottomMenu(); | ||||
|                 this.bottomMenu.bottom_menu = new ArrayList<>(); | ||||
|             } | ||||
|  |  | |||
|  | @ -118,10 +118,13 @@ public class BottomMenu implements Serializable { | |||
| 
 | ||||
|     public BottomMenu hydrate(Account account, BottomNavigationView bottomNavigationView) { | ||||
|         bottomNavigationView.getMenu().clear(); | ||||
|         BottomMenu bottomMenu; | ||||
|         BottomMenu bottomMenu = null; | ||||
|         try { | ||||
|             bottomMenu = getAllBottomMenu(account); | ||||
|         } catch (DBException e) { | ||||
|             e.printStackTrace(); | ||||
|         } | ||||
|         if (bottomMenu == null) { | ||||
|             bottomMenu = defaultBottomMenu(); | ||||
|         } | ||||
|         for (BottomMenu.MenuItem menuItem : bottomMenu.bottom_menu) { | ||||
|  | @ -294,6 +297,8 @@ public class BottomMenu implements Serializable { | |||
| 
 | ||||
|     public BottomMenu defaultBottomMenu() { | ||||
|         BottomMenu bottomMenu = new BottomMenu(); | ||||
|         bottomMenu.user_id = MainActivity.currentUserID; | ||||
|         bottomMenu.instance = MainActivity.currentInstance; | ||||
|         bottomMenu.bottom_menu = new ArrayList<>(); | ||||
|         MenuItem menuItemHome = new MenuItem(); | ||||
|         menuItemHome.position = 0; | ||||
|  |  | |||
|  | @ -131,7 +131,6 @@ public class ReorderBottomMenuAdapter extends RecyclerView.Adapter<RecyclerView. | |||
| 
 | ||||
|     @Override | ||||
|     public void onItemDismiss(int position) { | ||||
|         BottomMenu.MenuItem menuItem = bottomMenu.bottom_menu.get(position); | ||||
|         notifyItemChanged(position); | ||||
|         Toasty.info(context, context.getString(R.string.warning_main_timeline), Toast.LENGTH_SHORT).show(); | ||||
|     } | ||||
|  |  | |||
|  | @ -91,6 +91,9 @@ public class ReorderVM extends AndroidViewModel { | |||
|             } catch (DBException e) { | ||||
|                 e.printStackTrace(); | ||||
|             } | ||||
|             if (bottomMenu == null) { | ||||
|                 bottomMenu = new BottomMenu(getApplication().getApplicationContext()).defaultBottomMenu(); | ||||
|             } | ||||
|             Handler mainHandler = new Handler(Looper.getMainLooper()); | ||||
|             BottomMenu finalBottomMenu = bottomMenu; | ||||
|             Runnable myRunnable = () -> bottomMenuMutableLiveData.setValue(finalBottomMenu); | ||||
|  |  | |||
|  | @ -42,7 +42,7 @@ public class TopBarVM extends AndroidViewModel { | |||
|             Handler mainHandler = new Handler(Looper.getMainLooper()); | ||||
|             Pinned pinnedTimeline = null; | ||||
|             try { | ||||
|                 pinnedTimeline = pinned.getPinned(BaseMainActivity.accountWeakReference.get()); | ||||
|                 pinnedTimeline = pinned.getAllPinned(BaseMainActivity.accountWeakReference.get()); | ||||
|             } catch (DBException e) { | ||||
|                 e.printStackTrace(); | ||||
|             } | ||||
|  |  | |||
|  | @ -18,18 +18,30 @@ | |||
| <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_marginStart="@dimen/fab_margin" | ||||
|     android:layout_marginEnd="@dimen/fab_margin" | ||||
|     android:layout_height="match_parent"> | ||||
| 
 | ||||
|     <androidx.constraintlayout.widget.ConstraintLayout | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content"> | ||||
| 
 | ||||
|         <androidx.appcompat.widget.AppCompatTextView | ||||
|             android:id="@+id/title_bottom" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginTop="20dp" | ||||
|             android:text="@string/bottom_menu" | ||||
|             android:textColor="@color/cyanea_accent_reference" | ||||
|             android:textSize="16sp" | ||||
|             app:layout_constraintTop_toTopOf="parent" /> | ||||
| 
 | ||||
|         <androidx.cardview.widget.CardView | ||||
|             android:id="@+id/lv_reorder_bottom_container" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginTop="20dp" | ||||
|             app:layout_constraintTop_toTopOf="parent"> | ||||
|             android:layout_marginTop="10dp" | ||||
|             app:layout_constraintTop_toBottomOf="@+id/title_bottom"> | ||||
| 
 | ||||
|             <androidx.recyclerview.widget.RecyclerView | ||||
|                 android:id="@+id/lv_reorder_bottom" | ||||
|  | @ -38,12 +50,21 @@ | |||
|                 android:scrollbars="none" /> | ||||
|         </androidx.cardview.widget.CardView> | ||||
| 
 | ||||
|         <androidx.appcompat.widget.AppCompatTextView | ||||
|             android:id="@+id/title_top" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginTop="20dp" | ||||
|             android:text="@string/top_menu" | ||||
|             android:textColor="@color/cyanea_accent_reference" | ||||
|             android:textSize="16sp" | ||||
|             app:layout_constraintTop_toBottomOf="@+id/lv_reorder_bottom_container" /> | ||||
| 
 | ||||
|         <androidx.cardview.widget.CardView | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginTop="20dp" | ||||
|             app:layout_constraintTop_toBottomOf="@+id/lv_reorder_bottom_container"> | ||||
|             app:layout_constraintTop_toBottomOf="@+id/title_top"> | ||||
| 
 | ||||
|             <androidx.recyclerview.widget.RecyclerView | ||||
|                 android:id="@+id/lv_reorder_tabs" | ||||
|  |  | |||
|  | @ -1594,6 +1594,8 @@ | |||
|     <string name="poll_duration">Poll duration:</string> | ||||
|     <string name="set_display_bookmark_indication">Always display bookmark button</string> | ||||
|     <string name="display">Display</string> | ||||
|     <string name="bottom_menu">Bottom menu</string> | ||||
|     <string name="top_menu">Top bar menu</string> | ||||
| 
 | ||||
| 
 | ||||
| </resources> | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue