mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-01-29 21:49:16 +01:00
add new note from menu, remove fab. Fixes #52
This commit is contained in:
parent
c00a35379c
commit
fe30dce6f0
@ -39,12 +39,6 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
||||
|
||||
pager_title_strip.setTextSize(TypedValue.COMPLEX_UNIT_PX, getTextSize())
|
||||
pager_title_strip.layoutParams.height = (pager_title_strip.height + resources.getDimension(R.dimen.activity_margin) * 2).toInt()
|
||||
|
||||
notes_fab.setOnClickListener { displayNewNoteDialog() }
|
||||
notes_fab.viewTreeObserver.addOnGlobalLayoutListener {
|
||||
val heightDiff = notes_coordinator.rootView.height - notes_coordinator.height
|
||||
notes_fab.visibility = if (heightDiff > dpToPx(200f)) View.INVISIBLE else View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
fun initViewPager() {
|
||||
@ -97,6 +91,10 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
||||
displayOpenNoteDialog()
|
||||
true
|
||||
}
|
||||
R.id.new_note -> {
|
||||
displayNewNoteDialog()
|
||||
true
|
||||
}
|
||||
R.id.rename_note -> {
|
||||
displayRenameDialog()
|
||||
true
|
||||
|
@ -1,32 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
<com.simplemobiletools.notes.views.MyViewPager
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/notes_coordinator"
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.simplemobiletools.notes.views.MyViewPager
|
||||
android:id="@+id/view_pager"
|
||||
<android.support.v4.view.PagerTitleStrip
|
||||
android:id="@+id/pager_title_strip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v4.view.PagerTitleStrip
|
||||
android:id="@+id/pager_title_strip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"/>
|
||||
</com.simplemobiletools.notes.views.MyViewPager>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/notes_fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/activity_margin"
|
||||
android:src="@mipmap/plus"
|
||||
app:backgroundTint="@color/colorPrimary"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
android:layout_gravity="top"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"/>
|
||||
</com.simplemobiletools.notes.views.MyViewPager>
|
||||
|
@ -6,6 +6,11 @@
|
||||
android:icon="@mipmap/open_note"
|
||||
android:title="@string/open_note"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/new_note"
|
||||
android:icon="@mipmap/plus"
|
||||
android:title="@string/new_note"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/rename_note"
|
||||
android:icon="@mipmap/rename"
|
||||
|
Loading…
x
Reference in New Issue
Block a user