Created EditAlarmActivity

This commit is contained in:
Phillip Hsu 2016-07-27 19:58:30 -07:00
parent 180a1c0af8
commit 297910d306
5 changed files with 195 additions and 2 deletions

View File

@ -78,6 +78,9 @@
android:enabled="true" android:enabled="true"
android:exported="false"> android:exported="false">
</service> </service>
<activity android:name=".edittimer.EditTimerActivity">
</activity>
</application> </application>
</manifest> </manifest>

View File

@ -0,0 +1,24 @@
package com.philliphsu.clock2.edittimer;
import android.os.Bundle;
import com.philliphsu.clock2.BaseActivity;
import com.philliphsu.clock2.R;
public class EditTimerActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
protected int layoutResId() {
return R.layout.activity_edit_timer;
}
@Override
protected int menuResId() {
return 0;
}
}

View File

@ -1,6 +1,7 @@
package com.philliphsu.clock2.timers; package com.philliphsu.clock2.timers;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
@ -9,7 +10,10 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.philliphsu.clock2.OnListItemInteractionListener;
import com.philliphsu.clock2.R; import com.philliphsu.clock2.R;
import com.philliphsu.clock2.Timer;
import com.philliphsu.clock2.edittimer.EditTimerActivity;
import com.philliphsu.clock2.timers.dummy.DummyContent; import com.philliphsu.clock2.timers.dummy.DummyContent;
import butterknife.ButterKnife; import butterknife.ButterKnife;
@ -32,7 +36,17 @@ public class TimersFragment extends Fragment {
RecyclerView rv = ButterKnife.findById(view, R.id.list); RecyclerView rv = ButterKnife.findById(view, R.id.list);
rv.setLayoutManager(new LinearLayoutManager(getActivity())); rv.setLayoutManager(new LinearLayoutManager(getActivity()));
rv.setAdapter(new TimerAdapter(DummyContent.ITEMS, null)); rv.setAdapter(new TimerAdapter(DummyContent.ITEMS, new OnListItemInteractionListener<Timer>() {
@Override
public void onListItemClick(Timer item) {
startActivity(new Intent(getActivity(), EditTimerActivity.class));
}
@Override
public void onListItemDeleted(Timer item) {
}
}));
return view; return view;
} }

View File

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.philliphsu.clock2.edittimer.EditTimerActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- If you add elevation, also add to the ProgressBar. -->
<RelativeLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:popupTheme="@style/AppTheme.PopupOverlay"
android:layout_alignParentTop="true"
app:contentInsetStart="72dp">
<!-- Set inputType to text to get single-line input -->
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Add label"
android:background="@android:color/transparent"
android:inputType="text"/>
</android.support.v7.widget.Toolbar>
<TextView
android:id="@+id/duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="00h 00m 00s"
android:textSize="45sp"
android:layout_below="@id/toolbar"
android:layout_centerHorizontal="true"/>
<Space
android:id="@+id/space"
android:layout_width="match_parent"
android:layout_height="8dp"
android:layout_below="@id/duration"/>
<!-- Keep same dimens as FAB for proper alignment -->
<ImageButton
android:layout_width="56dp"
android:layout_height="56dp"
android:src="@drawable/ic_half_day_1_black_24dp"
android:layout_alignParentStart="true"
android:background="?selectableItemBackground"
android:layout_below="@id/space"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_half_day_1_black_24dp"
android:layout_below="@id/space"
android:layout_centerHorizontal="true"/>
<!-- Keep same dimens as FAB for proper alignment -->
<ImageButton
android:id="@+id/stop"
android:layout_width="56dp"
android:layout_height="56dp"
android:src="@drawable/ic_half_day_1_black_24dp"
android:layout_alignParentEnd="true"
android:background="?selectableItemBackground"
android:layout_below="@id/space"/>
<Space
android:layout_width="match_parent"
android:layout_height="8dp"
android:layout_below="@id/stop"/>
</RelativeLayout>
<!-- Must be fixed height or vertical divider will
stretch the entire height -->
<LinearLayout
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="48dp"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:text="@string/delete"/>
<View style="@style/Divider.Vertical"/>
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:text="@string/save"/>
</LinearLayout>
<!-- For the synced devices list. Probably better than a ScrollView. -->
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/appbar"
android:layout_above="@id/footer"
android:paddingTop="8dp"/>
<View style="@style/Divider.Horizontal"
android:layout_above="@id/footer"/>
</RelativeLayout>
<ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_anchor="@id/appbar"
app:layout_anchorGravity="bottom"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:progress="90"/>
<android.support.v7.widget.GridLayout
android:id="@+id/bottom_sheet_numpad"
android:layout_width="match_parent"
android:layout_height="@dimen/numpad_height"
app:columnCount="3"
app:layout_behavior="@string/bottom_sheet_behavior"
app:behavior_hideable="true"
app:behavior_peekHeight="100dp"
android:background="#FFF">
<include layout="@layout/content_grid_layout_numpad"/>
</android.support.v7.widget.GridLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@ -19,7 +19,8 @@
<!-- NumpadTimePickerDialog --> <!-- NumpadTimePickerDialog -->
<dimen name="numpad_height">300dp</dimen> <dimen name="numpad_height">300dp</dimen>
<dimen name="time_input_text_size">45sp</dimen> <dimen name="time_input_text_size">45sp</dimen>
<dimen name="fab_cell_height">88dp</dimen> <!-- 56dp fab size + 16dp top margin + 16dp bottom margin --> <dimen name="fab_cell_height">88dp
</dimen> <!-- 56dp fab size + 16dp top margin + 16dp bottom margin -->
<!-- Bottom sheet specs --> <!-- Bottom sheet specs -->
<dimen name="bottom_sheet_edge_margin">24dp</dimen> <dimen name="bottom_sheet_edge_margin">24dp</dimen>