mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
remove fab library
This commit is contained in:
parent
e657a2262d
commit
a7f401cb14
8 changed files with 30 additions and 256 deletions
|
|
@ -75,8 +75,6 @@ dependencies {
|
|||
implementation('com.mikepenz:aboutlibraries:5.9.4@aar') {
|
||||
transitive = true
|
||||
}
|
||||
// a better fab alternative
|
||||
implementation 'com.github.clans:fab:1.6.4'
|
||||
//Eventbus
|
||||
implementation 'org.greenrobot:eventbus:3.1.1'
|
||||
// IAP Handling / Verification
|
||||
|
|
@ -150,7 +148,7 @@ android {
|
|||
buildConfigField "String", "TESTING_LEVEL", "\"production\""
|
||||
multiDexEnabled true
|
||||
|
||||
versionCode 2146
|
||||
versionCode 2149
|
||||
versionName "1.10"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,88 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.github.clans.fab.FloatingActionMenu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:fab="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/fab.menu"
|
||||
app:layout_behavior="com.habitrpg.android.habitica.ui.helpers.FloatingActionMenuBehavior"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginRight="8dp"
|
||||
fab:menu_fab_size="normal"
|
||||
fab:menu_colorNormal="?colorPrimaryOffset"
|
||||
fab:menu_colorPressed="?colorPrimaryOffset"
|
||||
fab:menu_colorRipple="#FFFFFF"
|
||||
fab:menu_animationDelayPerItem="50"
|
||||
fab:menu_icon="@drawable/fab_add"
|
||||
fab:menu_buttonSpacing="2dp"
|
||||
fab:menu_labels_margin="4dp"
|
||||
fab:menu_fab_show_animation="@anim/fab_slide_in"
|
||||
fab:menu_fab_hide_animation="@anim/fab_slide_out">
|
||||
|
||||
<com.github.clans.fab.FloatingActionButton
|
||||
android:id="@+id/fab.new.habit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
fab:fab_colorNormal="@color/white"
|
||||
fab:fab_colorPressed="?colorPrimaryDistinct"
|
||||
fab:fab_colorRipple="#FFFFFF"
|
||||
|
||||
fab:fab_shadowColor="#000"
|
||||
fab:fab_elevationCompat="4dp"
|
||||
android:src="@drawable/add_habit"
|
||||
fab:fab_size="mini"
|
||||
fab:fab_label="@string/new_habit" />
|
||||
|
||||
<com.github.clans.fab.FloatingActionButton
|
||||
android:id="@+id/fab.new.daily"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
fab:fab_colorNormal="@color/white"
|
||||
fab:fab_colorPressed="?colorPrimaryDistinct"
|
||||
fab:fab_colorRipple="#FFFFFF"
|
||||
|
||||
fab:fab_shadowColor="#000"
|
||||
fab:fab_elevationCompat="4dp"
|
||||
|
||||
android:src="@drawable/add_daily"
|
||||
fab:fab_size="mini"
|
||||
fab:fab_label="@string/new_daily" />
|
||||
|
||||
<com.github.clans.fab.FloatingActionButton
|
||||
android:id="@+id/fab.new.todo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
fab:fab_colorNormal="@color/white"
|
||||
fab:fab_colorPressed="?colorPrimaryDistinct"
|
||||
fab:fab_colorRipple="#FFFFFF"
|
||||
|
||||
fab:fab_shadowColor="#000"
|
||||
fab:fab_elevationCompat="4dp"
|
||||
|
||||
android:src="@drawable/add_todo"
|
||||
fab:fab_size="mini"
|
||||
fab:fab_label="@string/new_todo" />
|
||||
|
||||
<com.github.clans.fab.FloatingActionButton
|
||||
android:id="@+id/fab.new.reward"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
fab:fab_colorNormal="@color/white"
|
||||
fab:fab_colorPressed="?colorPrimaryDistinct"
|
||||
fab:fab_colorRipple="#FFFFFF"
|
||||
|
||||
fab:fab_shadowColor="#000"
|
||||
fab:fab_elevationCompat="4dp"
|
||||
|
||||
android:src="@drawable/add_rewards"
|
||||
fab:fab_size="mini"
|
||||
fab:fab_label="@string/new_reward" />
|
||||
|
||||
</com.github.clans.fab.FloatingActionMenu>
|
||||
|
|
@ -5,9 +5,9 @@
|
|||
android:gravity="center_horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/add_task_icon"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:src="@drawable/fab_add"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/fab_plus"
|
||||
android:background="@drawable/widget_add_habit_background"
|
||||
android:scaleType="center" />
|
||||
<TextView
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:layout_weight="1">
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/fab_add"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/fab_plus"
|
||||
android:scaleType="center"
|
||||
android:background="@drawable/widget_add_habit_background" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -33,9 +34,10 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:layout_weight="1">
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/fab_add"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/fab_plus"
|
||||
android:scaleType="center"
|
||||
android:background="@drawable/widget_add_daily_background" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -56,9 +58,10 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:layout_weight="1">
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/fab_add"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/fab_plus"
|
||||
android:scaleType="center"
|
||||
android:background="@drawable/widget_add_todo_background" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -73,9 +76,10 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:layout_weight="1">
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/fab_add"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/fab_plus"
|
||||
android:scaleType="center"
|
||||
android:background="@drawable/widget_add_reward_background" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import android.content.Intent
|
|||
import android.os.Bundle
|
||||
import android.view.*
|
||||
import androidx.fragment.app.FragmentPagerAdapter
|
||||
import com.github.clans.fab.FloatingActionMenu
|
||||
import com.habitrpg.android.habitica.HabiticaBaseApplication
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.components.UserComponent
|
||||
|
|
@ -35,7 +34,6 @@ class TasksFragment : BaseMainFragment() {
|
|||
lateinit var appConfigManager: AppConfigManager
|
||||
|
||||
private var refreshItem: MenuItem? = null
|
||||
private var floatingMenu: FloatingActionMenu? = null
|
||||
internal var viewFragmentsDictionary: MutableMap<Int, TaskRecyclerViewFragment>? = WeakHashMap()
|
||||
|
||||
private var displayingTaskForm: Boolean = false
|
||||
|
|
@ -310,7 +308,6 @@ class TasksFragment : BaseMainFragment() {
|
|||
}
|
||||
TASK_UPDATED_RESULT -> this.displayingTaskForm = false
|
||||
}
|
||||
floatingMenu?.close(true)
|
||||
}
|
||||
|
||||
private fun onTaskCreatedResult(resultCode: Int, data: Intent?) {
|
||||
|
|
|
|||
|
|
@ -1,146 +0,0 @@
|
|||
package com.habitrpg.android.habitica.ui.helpers;
|
||||
|
||||
// https://gist.github.com/lodlock/e3cd12130bad70a098db
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
import com.github.clans.fab.FloatingActionMenu;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FloatingActionMenuBehavior extends CoordinatorLayout.Behavior {
|
||||
|
||||
private final int FAB_ANIMATION_DURATION = 500;
|
||||
|
||||
private float mTranslationY;
|
||||
|
||||
private Context context;
|
||||
private boolean isAnimating;
|
||||
private boolean isOffScreen;
|
||||
@Nullable
|
||||
private FloatingActionMenu fab;
|
||||
|
||||
public FloatingActionMenuBehavior(Context context, AttributeSet attrs) {
|
||||
super();
|
||||
this.context = context;
|
||||
isAnimating = false;
|
||||
isOffScreen = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
|
||||
return dependency instanceof Snackbar.SnackbarLayout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
|
||||
if (child instanceof FloatingActionMenu && dependency instanceof Snackbar.SnackbarLayout) {
|
||||
this.updateTranslation(parent, child, dependency);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void updateTranslation(CoordinatorLayout parent, View child, View dependency) {
|
||||
float translationY = this.getTranslationY(parent, child);
|
||||
if (translationY != this.mTranslationY) {
|
||||
ViewCompat.animate(child)
|
||||
.cancel();
|
||||
if (Math.abs(translationY - this.mTranslationY) == (float) dependency.getHeight()) {
|
||||
ViewCompat.animate(child)
|
||||
.translationY(translationY)
|
||||
.setListener(null);
|
||||
} else {
|
||||
child.setTranslationY(translationY);
|
||||
}
|
||||
|
||||
this.mTranslationY = translationY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private float getTranslationY(CoordinatorLayout parent, View child) {
|
||||
float minOffset = 0.0F;
|
||||
List dependencies = parent.getDependencies(child);
|
||||
int i = 0;
|
||||
|
||||
for (int z = dependencies.size(); i < z; ++i) {
|
||||
View view = (View) dependencies.get(i);
|
||||
if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(child, view)) {
|
||||
minOffset = Math.min(minOffset, view.getTranslationY() - (float) view.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
return minOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, View child, View directTargetChild, View target, int nestedScrollAxes) {
|
||||
ViewGroup fabContainer = child.findViewById(R.id.snackbar_container);
|
||||
if (fabContainer.getChildCount() > 0) {
|
||||
if (fabContainer.getChildAt(0).getClass().equals(FloatingActionMenu.class)) {
|
||||
fab = (FloatingActionMenu) fabContainer.getChildAt(0);
|
||||
}
|
||||
}
|
||||
return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL ||
|
||||
super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNestedScroll(CoordinatorLayout coordinatorLayout, final View child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
|
||||
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
|
||||
|
||||
if (fab == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
Logic:
|
||||
- If we're scrolling downwards or we're at the bottom of the screen
|
||||
AND if we're not animating and not on screen > HIDE
|
||||
*/
|
||||
if ((dyConsumed > 20 || (dyConsumed == 0 && dyUnconsumed > 0)) && !isAnimating && !isOffScreen) {
|
||||
isAnimating = true;
|
||||
slideFabOffScreen(fab);
|
||||
resetAnimatingStatusWithDelay(fab);
|
||||
isOffScreen = true;
|
||||
|
||||
/*
|
||||
Logic:
|
||||
- If we're not on screen
|
||||
AND we're scrolling upwards and not animating OR we're at the top of the screen > SHOW
|
||||
*/
|
||||
} else if (isOffScreen && ((dyConsumed < -10 && !isAnimating) || dyUnconsumed < 0)) {
|
||||
isAnimating = true;
|
||||
slideFabOnScreen(fab);
|
||||
resetAnimatingStatusWithDelay(fab);
|
||||
isOffScreen = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void resetAnimatingStatusWithDelay(final FloatingActionMenu child) {
|
||||
child.postDelayed(() -> {
|
||||
isAnimating = false;
|
||||
if (isOffScreen && fab != null) {
|
||||
child.hideMenu(false);
|
||||
}
|
||||
}, FAB_ANIMATION_DURATION);
|
||||
}
|
||||
|
||||
private void slideFabOffScreen(FloatingActionMenu view) {
|
||||
view.hideMenu(true);
|
||||
}
|
||||
|
||||
private void slideFabOnScreen(FloatingActionMenu view) {
|
||||
view.showMenu(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,9 @@ package com.habitrpg.android.habitica.ui.views.navigation
|
|||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.view.animation.RotateAnimation
|
||||
import android.widget.ImageButton
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.RelativeLayout
|
||||
|
|
@ -81,6 +84,13 @@ class HabiticaBottomNavigationView @JvmOverloads constructor(
|
|||
|
||||
private fun showSubmenu() {
|
||||
isShowingSubmenu = true
|
||||
|
||||
val rotate = RotateAnimation(0f, 135f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f)
|
||||
rotate.duration = 300
|
||||
rotate.interpolator = LinearInterpolator()
|
||||
rotate.fillAfter = true
|
||||
addButton.startAnimation(rotate)
|
||||
|
||||
var pos = 4
|
||||
submenuWrapper.removeAllViews()
|
||||
for (taskType in listOf(Task.TYPE_HABIT, Task.TYPE_DAILY, Task.TYPE_TODO, Task.TYPE_REWARD)) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
This beta update stores the apps authentication credentials more securely. The app should automatically update to the new storage method without you having to log in again. If you experience any issues with this, please report them through the in-app-reporting option or to admin@habitica.com
|
||||
We updated the app with a new modal design
|
||||
|
||||
|
||||
Be sure to download this update now for a better Habitica experience!
|
||||
|
|
|
|||
Loading…
Reference in a new issue