mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
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 -> {
|
reorderVM.getBottomMenu().observe(ReorderTimelinesActivity.this, _bottomMenu -> {
|
||||||
this.bottomMenu = _bottomMenu;
|
this.bottomMenu = _bottomMenu;
|
||||||
if (this.bottomMenu == null) {
|
if (_bottomMenu == null) {
|
||||||
this.bottomMenu = new BottomMenu(getApplicationContext()).defaultBottomMenu();
|
this.bottomMenu = new BottomMenu(getApplicationContext()).defaultBottomMenu();
|
||||||
this.bottomMenu.bottom_menu = new ArrayList<>();
|
this.bottomMenu.bottom_menu = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,10 +118,13 @@ public class BottomMenu implements Serializable {
|
||||||
|
|
||||||
public BottomMenu hydrate(Account account, BottomNavigationView bottomNavigationView) {
|
public BottomMenu hydrate(Account account, BottomNavigationView bottomNavigationView) {
|
||||||
bottomNavigationView.getMenu().clear();
|
bottomNavigationView.getMenu().clear();
|
||||||
BottomMenu bottomMenu;
|
BottomMenu bottomMenu = null;
|
||||||
try {
|
try {
|
||||||
bottomMenu = getAllBottomMenu(account);
|
bottomMenu = getAllBottomMenu(account);
|
||||||
} catch (DBException e) {
|
} catch (DBException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (bottomMenu == null) {
|
||||||
bottomMenu = defaultBottomMenu();
|
bottomMenu = defaultBottomMenu();
|
||||||
}
|
}
|
||||||
for (BottomMenu.MenuItem menuItem : bottomMenu.bottom_menu) {
|
for (BottomMenu.MenuItem menuItem : bottomMenu.bottom_menu) {
|
||||||
|
@ -294,6 +297,8 @@ public class BottomMenu implements Serializable {
|
||||||
|
|
||||||
public BottomMenu defaultBottomMenu() {
|
public BottomMenu defaultBottomMenu() {
|
||||||
BottomMenu bottomMenu = new BottomMenu();
|
BottomMenu bottomMenu = new BottomMenu();
|
||||||
|
bottomMenu.user_id = MainActivity.currentUserID;
|
||||||
|
bottomMenu.instance = MainActivity.currentInstance;
|
||||||
bottomMenu.bottom_menu = new ArrayList<>();
|
bottomMenu.bottom_menu = new ArrayList<>();
|
||||||
MenuItem menuItemHome = new MenuItem();
|
MenuItem menuItemHome = new MenuItem();
|
||||||
menuItemHome.position = 0;
|
menuItemHome.position = 0;
|
||||||
|
|
|
@ -131,7 +131,6 @@ public class ReorderBottomMenuAdapter extends RecyclerView.Adapter<RecyclerView.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemDismiss(int position) {
|
public void onItemDismiss(int position) {
|
||||||
BottomMenu.MenuItem menuItem = bottomMenu.bottom_menu.get(position);
|
|
||||||
notifyItemChanged(position);
|
notifyItemChanged(position);
|
||||||
Toasty.info(context, context.getString(R.string.warning_main_timeline), Toast.LENGTH_SHORT).show();
|
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) {
|
} catch (DBException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
if (bottomMenu == null) {
|
||||||
|
bottomMenu = new BottomMenu(getApplication().getApplicationContext()).defaultBottomMenu();
|
||||||
|
}
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
BottomMenu finalBottomMenu = bottomMenu;
|
BottomMenu finalBottomMenu = bottomMenu;
|
||||||
Runnable myRunnable = () -> bottomMenuMutableLiveData.setValue(finalBottomMenu);
|
Runnable myRunnable = () -> bottomMenuMutableLiveData.setValue(finalBottomMenu);
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class TopBarVM extends AndroidViewModel {
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
Pinned pinnedTimeline = null;
|
Pinned pinnedTimeline = null;
|
||||||
try {
|
try {
|
||||||
pinnedTimeline = pinned.getPinned(BaseMainActivity.accountWeakReference.get());
|
pinnedTimeline = pinned.getAllPinned(BaseMainActivity.accountWeakReference.get());
|
||||||
} catch (DBException e) {
|
} catch (DBException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,18 +18,30 @@
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_marginStart="@dimen/fab_margin"
|
||||||
|
android:layout_marginEnd="@dimen/fab_margin"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
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
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/lv_reorder_bottom_container"
|
android:id="@+id/lv_reorder_bottom_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="10dp"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toBottomOf="@+id/title_bottom">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/lv_reorder_bottom"
|
android:id="@+id/lv_reorder_bottom"
|
||||||
|
@ -38,12 +50,21 @@
|
||||||
android:scrollbars="none" />
|
android:scrollbars="none" />
|
||||||
</androidx.cardview.widget.CardView>
|
</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
|
<androidx.cardview.widget.CardView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/lv_reorder_bottom_container">
|
app:layout_constraintTop_toBottomOf="@+id/title_top">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/lv_reorder_tabs"
|
android:id="@+id/lv_reorder_tabs"
|
||||||
|
|
|
@ -1594,6 +1594,8 @@
|
||||||
<string name="poll_duration">Poll duration:</string>
|
<string name="poll_duration">Poll duration:</string>
|
||||||
<string name="set_display_bookmark_indication">Always display bookmark button</string>
|
<string name="set_display_bookmark_indication">Always display bookmark button</string>
|
||||||
<string name="display">Display</string>
|
<string name="display">Display</string>
|
||||||
|
<string name="bottom_menu">Bottom menu</string>
|
||||||
|
<string name="top_menu">Top bar menu</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue