FAB added to history view

This commit is contained in:
serso 2015-01-26 22:39:01 +01:00
parent 141741c446
commit a6577a70b7
14 changed files with 73 additions and 55 deletions

View File

@ -71,36 +71,40 @@
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-shared-1.0-beta-6" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="wagon-http-shared-1.0-beta-6" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="xercesMinimal-1.9.6.2" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="xercesMinimal-1.9.6.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="nekohtml-1.9.6.2" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="nekohtml-1.9.6.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_preferences_1_1_18_classes_jar" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="simple-xml-2.6.1" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="simple-xml-2.6.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_core_build_libs_core_jar" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="commons-cli-1.2" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="commons-cli-1.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="annotations-2.0.1" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="annotations-2.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_views_1_1_18_classes_jar" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="core" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_lists_1_1_18_classes_jar" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="internal_impl-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="stax-1.2.0" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="stax-1.2.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_other_1_1_18_classes_jar" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_menus_1_1_18_classes_jar" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_com_android_support_support_v4_21_0_3_classes_jar" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-msg-1.0.5" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="common-msg-1.0.5" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_db_1_1_18_classes_jar" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-listeners-1.0.7" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="common-listeners-1.0.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="guava-11.0.2" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="guava-11.0.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-text-1.0.7" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="common-text-1.0.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="acra-4.5.0" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="acra-4.5.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_wizard_1_1_18_classes_jar" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_exploded_aar_com_melnykov_floatingactionbutton_1_1_0_classes_jar" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_checkout_0_6_0_classes_jar" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_core_1_1_18_classes_jar" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_com_google_android_gms_play_services_6_5_87_classes_jar" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-core-1.0.7" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="common-core-1.0.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="jscl-1.0.8" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="jscl-1.0.8" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_security_1_1_18_classes_jar" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-security-1.0.7" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="common-security-1.0.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_com_actionbarsherlock_actionbarsherlock_4_4_0_classes_jar" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_exploded_aar_com_android_support_recyclerview_v7_21_0_0_classes_jar" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_sherlock_1_1_18_classes_jar" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_classes_debug" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_dependency_cache_debug" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_classes_debug" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_dependency_cache_debug" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="android" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="android" level="project" />
</component> </component>
</module> </module>

View File

@ -97,12 +97,15 @@
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" /> <orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" /> <orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" /> <orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" name="android-common-menus-1.1.18" level="project" /> <orderEntry type="library" exported="" name="android-common-menus-1.1.18" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-21.0.0" level="project" />
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" /> <orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
<orderEntry type="library" exported="" name="checkout-0.6.0" level="project" /> <orderEntry type="library" exported="" name="checkout-0.6.0" level="project" />
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" /> <orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
<orderEntry type="library" exported="" name="common-msg-1.0.5" level="project" /> <orderEntry type="library" exported="" name="common-msg-1.0.5" level="project" />
<orderEntry type="library" exported="" name="android-common-other-1.1.18" level="project" /> <orderEntry type="library" exported="" name="android-common-other-1.1.18" level="project" />
<orderEntry type="library" exported="" name="floatingactionbutton-1.1.0" level="project" />
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" /> <orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" /> <orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="android-common-lists-1.1.18" level="project" /> <orderEntry type="library" exported="" name="android-common-lists-1.1.18" level="project" />

View File

@ -71,7 +71,7 @@ dependencies {
compile 'org.solovyev.android:checkout:0.6.0@aar' compile 'org.solovyev.android:checkout:0.6.0@aar'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar' compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile 'com.google.android.gms:play-services:6.5.87@aar' compile 'com.google.android.gms:play-services:6.5.87@aar'
compile 'com.melnykov:floatingactionbutton:1.1.0'
} }
task androidJavadocs(type: Javadoc) { task androidJavadocs(type: Javadoc) {

View File

@ -35,12 +35,11 @@ import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ListView; import android.widget.ListView;
import com.actionbarsherlock.app.SherlockListFragment; import com.actionbarsherlock.app.SherlockListFragment;
import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
import com.melnykov.fab.FloatingActionButton;
import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.R;
import org.solovyev.android.calculator.jscl.JsclOperation; import org.solovyev.android.calculator.jscl.JsclOperation;
@ -55,7 +54,6 @@ import org.solovyev.common.text.Strings;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
@ -149,6 +147,15 @@ public abstract class BaseHistoryFragment extends SherlockListFragment implement
final ListView lv = getListView(); final ListView lv = getListView();
lv.setTextFilterEnabled(true); lv.setTextFilterEnabled(true);
final FloatingActionButton fab = (FloatingActionButton) root.findViewById(R.id.fab);
fab.attachToListView(lv);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Locator.getInstance().getCalculator().fireCalculatorEvent(clear_history_requested, null);
}
});
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(final AdapterView<?> parent, public void onItemClick(final AdapterView<?> parent,
final View view, final View view,
@ -361,13 +368,6 @@ public abstract class BaseHistoryFragment extends SherlockListFragment implement
private static enum HistoryMenu implements IdentifiableMenuItem<MenuItem> { private static enum HistoryMenu implements IdentifiableMenuItem<MenuItem> {
clear_history(R.id.menu_history_clear_history) {
@Override
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
Locator.getInstance().getCalculator().fireCalculatorEvent(clear_history_requested, null);
}
},
toggle_datetime(R.id.menu_history_toggle_datetime) { toggle_datetime(R.id.menu_history_toggle_datetime) {
@Override @Override
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) { public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {

View File

@ -99,7 +99,7 @@ public class HistoryArrayAdapter extends ArrayAdapter<CalculatorHistoryState> {
} }
}); });
} else { } else {
status.setVisibility(INVISIBLE); status.setVisibility(GONE);
status.setOnClickListener(null); status.setOnClickListener(null);
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

View File

@ -23,19 +23,34 @@
--> -->
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:id="@+id/main_fragment_layout" xmlns:fab="http://schemas.android.com/apk/res-auto"
style="?cpp_fragment_layout_style" a:id="@+id/main_fragment_layout"
a:layout_width="match_parent" style="?cpp_fragment_layout_style"
a:layout_height="match_parent"> a:layout_width="match_parent"
a:layout_height="match_parent">
<TextView <TextView
a:id="@+id/fragment_title" a:id="@+id/fragment_title"
a:layout_height="wrap_content"
a:layout_width="match_parent"
style="?cpp_fragment_title_style" />
<include layout="@layout/ad" />
<FrameLayout
a:layout_width="match_parent"
a:layout_height="match_parent">
<ListView style="?cpp_fragment_list_view_style" />
<com.melnykov.fab.FloatingActionButton
a:id="@+id/fab"
a:layout_width="wrap_content"
a:layout_height="wrap_content" a:layout_height="wrap_content"
a:layout_width="match_parent" a:layout_gravity="bottom|right"
style="?cpp_fragment_title_style"/> a:layout_margin="16dp"
a:src="@drawable/ic_delete_white_36dp"
<include layout="@layout/ad"/> fab:fab_colorNormal="#393939"
fab:fab_colorRipple="#40000000" />
<ListView style="?cpp_fragment_list_view_style"/> </FrameLayout>
</LinearLayout> </LinearLayout>

View File

@ -48,12 +48,11 @@
</LinearLayout> </LinearLayout>
<ImageView a:id="@+id/history_item_status_icon" <ImageView a:id="@+id/history_item_status_icon"
a:layout_gravity="center_vertical" a:layout_gravity="center_vertical|right"
a:scaleType="centerInside" a:scaleType="centerInside"
a:padding="6dp"
a:src="@drawable/ic_save_grey600_48dp" a:src="@drawable/ic_save_grey600_48dp"
a:visibility="invisible" a:visibility="gone"
a:layout_width="wrap_content" a:layout_width="30dp"
a:layout_height="match_parent"/> a:layout_height="30dp"/>
</LinearLayout> </LinearLayout>

View File

@ -36,10 +36,4 @@
a:title="@string/c_toggle_datetime" a:title="@string/c_toggle_datetime"
a:showAsAction="always"/> a:showAsAction="always"/>
<item
a:id="@+id/menu_history_clear_history"
a:icon="@drawable/ic_delete_grey600_48dp"
a:title="@string/c_clear_history"
a:showAsAction="always"/>
</menu> </menu>

View File

@ -22,9 +22,12 @@
<resources> <resources>
<style name="history_time" parent="math_entity_description"/> <style name="history_time" parent="math_entity_description" />
<style name="history_item" parent="math_entity_text"/> <style name="history_item" parent="math_entity_text">
<item name="android:maxLines">2</item>
<item name="android:ellipsize">end</item>
</style>
<style name="history_item_label" parent="math_entity_description"> <style name="history_item_label" parent="math_entity_description">
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>

View File

@ -60,7 +60,7 @@
<style name="cpp_default_fragment_list_view_style"> <style name="cpp_default_fragment_list_view_style">
<item name="android:id">@android:id/list</item> <item name="android:id">@android:id/list</item>
<item name="android:dividerHeight">1dp</item> <item name="android:dividerHeight">1px</item>
<item name="android:divider">@color/cpp_list_divider</item> <item name="android:divider">@color/cpp_list_divider</item>
<item name="android:cacheColorHint">@android:color/transparent</item> <item name="android:cacheColorHint">@android:color/transparent</item>
<item name="android:layout_height">match_parent</item> <item name="android:layout_height">match_parent</item>