Skip to content

Commit 132e696

Browse files
committed
Initial version of FAB
1 parent 243ce22 commit 132e696

21 files changed

+71
-29
lines changed

Readme.md

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ TODOs (some may be implemented in the future):
1818
- [ ] Custom sorting
1919
- [ ] Provide apk/Merge into upstream
2020

21+
## Included projects
22+
Tools and Libraries that are used:
23+
24+
- [Material Design Icons](https://www.google.com/design/icons/), License: CC BY 4.0
25+
2126
## Original app
2227

2328
Copyright (C) 2012 Rahul Agarwal

World Clock/World Clock.iml

+8-3
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,20 @@
116116
<orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />
117117
<orderEntry type="sourceFolder" forTests="false" />
118118
<orderEntry type="library" name="com.android.support:animated-vector-drawable-27.0.1" level="project" />
119-
<orderEntry type="library" name="android.arch.lifecycle:runtime-1.0.0" level="project" />
120119
<orderEntry type="library" name="com.android.support:appcompat-v7-27.0.1" level="project" />
121-
<orderEntry type="library" name="com.android.support:support-annotations:27.0.1@jar" level="project" />
120+
<orderEntry type="library" name="com.android.support:design-27.0.1" level="project" />
122121
<orderEntry type="library" name="android.arch.lifecycle:common:1.0.0@jar" level="project" />
123-
<orderEntry type="library" name="com.android.support:support-fragment-27.0.1" level="project" />
124122
<orderEntry type="library" name="android.arch.core:common:1.0.0@jar" level="project" />
125123
<orderEntry type="library" name="com.android.support:support-compat-27.0.1" level="project" />
124+
<orderEntry type="library" name="com.android.support:transition-27.0.1" level="project" />
126125
<orderEntry type="library" name="com.android.support:support-core-utils-27.0.1" level="project" />
127126
<orderEntry type="library" name="com.android.support:support-core-ui-27.0.1" level="project" />
127+
<orderEntry type="library" name="android.arch.lifecycle:runtime-1.0.0" level="project" />
128+
<orderEntry type="library" name="com.android.support:recyclerview-v7-27.0.1" level="project" />
129+
<orderEntry type="library" name="com.android.support:support-media-compat-27.0.1" level="project" />
130+
<orderEntry type="library" name="com.android.support:support-annotations:27.0.1@jar" level="project" />
131+
<orderEntry type="library" name="com.android.support:support-fragment-27.0.1" level="project" />
132+
<orderEntry type="library" name="com.android.support:support-v4-27.0.1" level="project" />
128133
<orderEntry type="library" name="com.android.support:support-vector-drawable-27.0.1" level="project" />
129134
</component>
130135
</module>

World Clock/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ android {
2020

2121
dependencies {
2222
compile 'com.android.support:appcompat-v7:27.0.1'
23-
compile 'com.android.support:support-compat:27.0.1'
2423
compile 'com.android.support:design:27.0.1'
2524
}

World Clock/src/main/AndroidManifest.xml

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@
2121
android:versionCode="3"
2222
android:versionName="0.7" >
2323

24-
<uses-sdk android:minSdkVersion="10" />
25-
2624
<!-- Clock image from http://openclipart.org/detail/12597/analog-clock-by-anonymous-12597 -->
2725
<application
2826
android:icon="@drawable/clock_icon"
29-
android:label="@string/app_name" >
27+
android:label="@string/app_name"
28+
android:theme="@style/Theme.AppCompat.Light">
3029

3130
<!-- Activity to show main world clock app -->
3231
<activity

World Clock/src/main/java/com/irahul/worldclock/WorldClockActivity.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919

2020
import java.util.TimeZone;
2121

22-
import android.app.Activity;
2322
import android.app.AlertDialog;
2423
import android.content.ComponentName;
2524
import android.content.Intent;
2625
import android.os.Bundle;
26+
import android.support.design.widget.FloatingActionButton;
27+
import android.support.v7.app.AppCompatActivity;
2728
import android.text.SpannableString;
2829
import android.text.method.LinkMovementMethod;
2930
import android.text.util.Linkify;
@@ -36,7 +37,6 @@
3637
import android.view.View;
3738
import android.view.View.OnClickListener;
3839
import android.widget.AdapterView;
39-
import android.widget.Button;
4040
import android.widget.ListView;
4141
import android.widget.TextView;
4242

@@ -46,7 +46,7 @@
4646
* @author rahul
4747
*
4848
*/
49-
public class WorldClockActivity extends Activity {
49+
public class WorldClockActivity extends AppCompatActivity {
5050
private static final String TAG = WorldClockActivity.class.getName();
5151
//
5252
//Intent extras map keys
@@ -77,9 +77,9 @@ public void onCreate(Bundle savedInstanceState) {
7777

7878
// register to get context event to edit/delete
7979
ListView mainListView = (ListView)findViewById(R.id.main_list_view);
80-
registerForContextMenu(mainListView);
80+
registerForContextMenu(mainListView);
8181

82-
Button mainAddButton = (Button)findViewById(R.id.main_button_add);
82+
FloatingActionButton mainAddButton = findViewById(R.id.main_button_add);
8383
mainAddButton.setOnClickListener(new OnClickListener() {
8484

8585
public void onClick(View v) {
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<merge xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto">
4+
5+
<RelativeLayout
6+
android:id="@+id/fab_container"
7+
android:layout_width="match_parent"
8+
android:layout_height="match_parent"
9+
android:layout_marginBottom="@dimen/activity_vertical_margin"
10+
android:layout_marginRight="@dimen/activity_horizontal_margin"
11+
android:elevation="@dimen/fab_elevation"
12+
android:clipChildren="false"
13+
android:layout_marginEnd="@dimen/activity_horizontal_margin">
14+
15+
<android.support.design.widget.FloatingActionButton
16+
android:id="@+id/main_button_add"
17+
android:layout_width="wrap_content"
18+
android:layout_height="wrap_content"
19+
android:src="@drawable/ic_add_white_24dp"
20+
android:layout_alignParentBottom="true"
21+
android:layout_alignParentEnd="true"
22+
android:layout_alignParentRight="true" />
23+
</RelativeLayout>
24+
</merge>

World Clock/src/main/res/layout/worldclock_main.xml

+17-17
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@
1818
-->
1919

2020
<!-- Main activity -->
21-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
22-
android:layout_width="fill_parent"
23-
android:layout_height="wrap_content"
24-
android:orientation="vertical"
25-
android:gravity="center">
21+
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
22+
android:id="@+id/DrawerLayout"
23+
android:layout_width="match_parent"
24+
android:layout_height="match_parent"
25+
android:elevation="7dp">
2626

27-
<Button
28-
android:id="@+id/main_button_add"
29-
android:layout_width="wrap_content"
30-
android:layout_height="wrap_content"
31-
android:drawableLeft="@drawable/menu_add"
32-
android:text="@string/menu_add" />
33-
34-
<ListView
35-
android:id="@+id/main_list_view"
27+
<LinearLayout
3628
android:layout_width="match_parent"
37-
android:layout_height="fill_parent" >
29+
android:layout_height="match_parent"
30+
android:orientation="vertical">
31+
32+
<ListView
33+
android:id="@+id/main_list_view"
34+
android:layout_width="match_parent"
35+
android:layout_height="fill_parent" >
36+
</ListView>
37+
</LinearLayout>
3838

39-
</ListView>
39+
<include layout="@layout/fab" />
4040

41-
</LinearLayout>
41+
</android.support.v4.widget.DrawerLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
<dimen name="activity_vertical_margin">16dp</dimen>
3+
<dimen name="activity_horizontal_margin">16dp</dimen>
4+
<dimen name="fab_elevation">5dp</dimen>
5+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
<style name="MyFloatingButton" parent="Theme.AppCompat.Light">
3+
<item name="colorAccent">@android:color/background_dark</item>
4+
</style>
5+
</resources>

0 commit comments

Comments
 (0)