close fab menu after click

This commit is contained in:
Shinokuni 2019-02-22 22:20:39 +00:00
parent e543fa3664
commit 4dd01a6966
2 changed files with 9 additions and 2 deletions

View File

@ -25,6 +25,7 @@ import android.widget.Toast;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader; import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader;
import com.bumptech.glide.util.ViewPreloadSizeProvider; import com.bumptech.glide.util.ViewPreloadSizeProvider;
import com.github.clans.fab.FloatingActionMenu;
import com.readrops.app.database.ItemWithFeed; import com.readrops.app.database.ItemWithFeed;
import com.readrops.app.database.entities.Item; import com.readrops.app.database.entities.Item;
import com.readrops.app.utils.GlideApp; import com.readrops.app.utils.GlideApp;
@ -47,13 +48,15 @@ public class MainActivity extends AppCompatActivity implements SimpleCallback, S
private NavigationView navigationView; private NavigationView navigationView;
private DrawerLayout drawerLayout; private DrawerLayout drawerLayout;
private FloatingActionMenu actionMenu;
private List<ItemWithFeed> newItems; private List<ItemWithFeed> newItems;
private TreeMap<LocalDateTime, Item> itemsMap; private TreeMap<LocalDateTime, Item> itemsMap;
private MainViewModel viewModel; private MainViewModel viewModel;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -67,6 +70,8 @@ public class MainActivity extends AppCompatActivity implements SimpleCallback, S
drawerLayout.addDrawerListener(toggle); drawerLayout.addDrawerListener(toggle);
toggle.syncState(); toggle.syncState();
actionMenu = findViewById(R.id.fab_menu);
navigationView = findViewById(R.id.nav_view); navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener((menuItem) -> { navigationView.setNavigationItemSelectedListener((menuItem) -> {
menuItem.setChecked(true); menuItem.setChecked(true);
@ -208,12 +213,13 @@ public class MainActivity extends AppCompatActivity implements SimpleCallback, S
} }
public void displayAddFeedDialog(View view) { public void displayAddFeedDialog(View view) {
actionMenu.close(true);
Dialog dialog = new AddFeedDialog(this, R.layout.add_feed_layout); Dialog dialog = new AddFeedDialog(this, R.layout.add_feed_layout);
dialog.show(); dialog.show();
} }
public void addFolder(View view) { public void addFolder(View view) {
actionMenu.close(true);
} }
public void insertNewFeed(ParsingResult result) { public void insertNewFeed(ParsingResult result) {

View File

@ -47,6 +47,7 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.github.clans.fab.FloatingActionMenu <com.github.clans.fab.FloatingActionMenu
android:id="@+id/fab_menu"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"