Material redesign

pull/30/head
Alinson S. Xavier 11 years ago
parent 7577277425
commit c41e71003b

@ -14,7 +14,7 @@
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.Light" >
android:theme="@style/AppTheme" >
<meta-data
android:name="AA_DB_NAME"
android:value="uhabits.db" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

@ -10,10 +10,10 @@
</shape>
</item>
<item
android:bottom="6dp"
android:left="4dp"
android:bottom="5dp"
android:left="2dp"
android:right="4dp"
android:top="2dp">
android:top="1dp">
<shape android:shape="oval" >
<solid android:color="#ffffff" />
</shape>

@ -10,10 +10,10 @@
</shape>
</item>
<item
android:bottom="6dp"
android:left="4dp"
android:bottom="5dp"
android:left="2dp"
android:right="4dp"
android:top="2dp">
android:top="1dp">
<shape android:shape="oval" >
<solid android:color="#20000000" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

@ -0,0 +1,6 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/grey"> <!-- ripple color -->
<item android:drawable="@color/white"/> <!-- normal color -->
</ripple>

@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="8dp"
tools:context="org.isoron.uhabits.dialogs.EditHabitFragment"
tools:ignore="MergeRootFrame" >
@ -13,7 +14,9 @@
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:orientation="vertical"
android:padding="8dp" >
android:paddingLeft="24dp"
android:paddingRight="24dp"
>
<LinearLayout
android:id="@+id/namePanel"
@ -27,7 +30,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="10"
android:background="@drawable/apptheme_edit_text_holo_light"
android:ems="10"
android:hint="Name"
android:textColor="#cc2222" >
@ -55,6 +57,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="280dp"
android:orientation="horizontal"
android:gravity="start">
@ -126,37 +129,36 @@
</LinearLayout>
<LinearLayout
android:id="@+id/buttonPanel"
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="?android:attr/dividerHorizontal"
android:dividerPadding="0dip"
android:orientation="vertical"
android:showDividers="beginning" >
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onClick"
android:orientation="horizontal" >
<Button
android:id="@+id/button_discard"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Discard" />
<Button
android:id="@+id/button_save"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Save" />
</LinearLayout>
android:layout_height="48dp"
android:gravity="end"
android:onClick="onClick"
android:paddingRight="16dp"
android:paddingLeft="16dp"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:orientation="horizontal" >
<Button
style="?android:attr/buttonBarButtonStyle"
android:id="@+id/button_discard"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="8dp"
android:text="Discard" />
<Button
style="?android:attr/buttonBarButtonStyle"
android:id="@+id/button_save"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="8dp"
android:text="Save" />
</LinearLayout>
</LinearLayout>

@ -17,8 +17,8 @@
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#00000000"
android:dividerHeight="0dp"
android:divider="#10000000"
android:dividerHeight="1dp"
dslv:drag_enabled="true"
dslv:drag_handle_id="@drawable/habits_header_check"
dslv:drag_start_mode="onMove"
@ -31,7 +31,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@drawable/habits_header" >
android:elevation="2dp"
android:background="#ffffff"
android:paddingRight="4dp"
>
<TextView
android:id="@+id/tvStarHeader"

@ -7,4 +7,5 @@
android:focusable="false"
android:minHeight="42dp"
android:minWidth="42dp"
android:textSize="10sp" />
android:textSize="10sp"
android:textColor="#606060" />

@ -2,34 +2,48 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/habits_item"
android:background="#10000000"
android:baselineAligned="false"
android:clipToPadding="false"
android:gravity="center_vertical"
android:orientation="horizontal" >
android:orientation="horizontal"
android:paddingTop="0dp"
android:paddingBottom="4dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
>
<TextView
android:id="@+id/tvStar"
android:layout_width="30dp"
android:layout_height="match_parent"
android:layout_marginTop="0dp"
android:gravity="center"
android:paddingTop="1dp"
android:textSize="16sp" />
<TextView
android:id="@+id/tvName"
android:layout_width="0dip"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingBottom="6dp"
android:paddingLeft="0dp"
android:paddingRight="6dp"
android:paddingTop="6dp" />
android:background="@drawable/ripple_background"
android:elevation="1dp" >
<LinearLayout
android:id="@+id/llButtons"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:orientation="horizontal" />
<TextView
android:id="@+id/tvStar"
android:layout_width="30dp"
android:layout_height="match_parent"
android:layout_marginTop="0dp"
android:gravity="center"
android:paddingTop="1dp"
android:textSize="16sp" />
<TextView
android:id="@+id/tvName"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingBottom="6dp"
android:paddingLeft="0dp"
android:paddingRight="6dp"
android:paddingTop="10dp" />
<LinearLayout
android:id="@+id/llButtons"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:gravity="center"
android:orientation="horizontal" />
</LinearLayout>
</LinearLayout>

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tvCheck"
android:layout_width="42dp"
android:layout_height="match_parent"
android:layout_marginRight="18dp"
android:minHeight="42dp"
android:minWidth="42dp"
android:focusable="false"
android:background="@drawable/habits_item_check" />
android:focusable="false"
android:minHeight="42dp"
android:minWidth="42dp"
android:gravity="center"
android:background="@drawable/ripple_background" />

@ -0,0 +1,9 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="org.isoron.uhabits.MainActivity" >
<item
android:id="@+id/action_add"
android:title="@string/add_habit" android:showAsAction="always" android:icon="@drawable/ic_action_add_dark"/>
</menu>

@ -1,11 +0,0 @@
<resources>
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>

@ -1,12 +0,0 @@
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>

@ -0,0 +1,14 @@
<resources>
<style name="AppBaseTheme" parent="android:Theme.Material">
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorPrimaryDark">@color/primary_darker</item>
<item name="android:dialogTheme">@style/MyDialogStyle</item>
<item name="android:alertDialogTheme">@style/MyDialogStyle</item>
</style>
<style name="MyDialogStyle" parent="android:Theme.Material.Light.Dialog">
</style>
</resources>

@ -15,8 +15,14 @@
limitations under the License.
-->
<resources>
<color name="primary">#00517b</color>
<color name="primary_darker">#003d5d</color>
<color name="accent">#9a4000</color>
<color name="white">#ffffff</color>
<color name="grey">#cccccc</color>
<color name="circle_background">#f2f2f2</color>
<color name="line_background">#cccccc</color>
<color name="ampm_text_color">#8c8c8c</color>
@ -24,6 +30,7 @@
<color name="done_text_color_disabled">#cccccc</color>
<color name="numbers_text_color">#8c8c8c</color>
<color name="transparent">#00000000</color>
<color name="transparent_black">#7f000000</color>
<color name="blue">#33b5e5</color>
<color name="blue_focused">#c1e8f7</color>

@ -49,5 +49,4 @@
<dimen name="day_number_size">16sp</dimen>
<dimen name="year_label_height">64dp</dimen>
<dimen name="year_label_text_size">22dp</dimen>
</resources>

@ -1,21 +1,8 @@
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="AppBaseTheme" parent="android:Theme.Holo.Light" />
<style name="AppTheme" parent="AppBaseTheme" />
<!-- Date and time picker -->
<style name="time_label">

@ -42,6 +42,8 @@ public class MainActivity extends Activity
{
super.onCreate(savedInstanceState);
getActionBar().setElevation(5);
setContentView(R.layout.main_activity);
showHabitsFragment = (ShowHabitsFragment) getFragmentManager().findFragmentById(
R.id.fragment1);

@ -144,12 +144,12 @@ public class EditHabitFragment extends DialogFragment implements OnClickListener
private void changeColor(Integer color)
{
SolidColorMatrix matrix = new SolidColorMatrix(color);
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
Drawable background = getActivity().getResources().getDrawable(
R.drawable.apptheme_edit_text_holo_light);
background.setColorFilter(filter);
tvName.setBackgroundDrawable(background);
// SolidColorMatrix matrix = new SolidColorMatrix(color);
// ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
// Drawable background = getActivity().getResources().getDrawable(
// R.drawable.apptheme_edit_text_holo_light);
// background.setColorFilter(filter);
// tvName.setBackgroundDrawable(background);
tvName.setTextColor(color);
}

@ -14,6 +14,7 @@ import org.isoron.uhabits.models.Habit;
import android.app.Fragment;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Outline;
import android.graphics.Point;
import android.graphics.Typeface;
import android.os.Bundle;
@ -29,6 +30,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
@ -117,12 +119,17 @@ public class ShowHabitsFragment extends Fragment implements OnSavedListener, OnI
Point size = new Point();
display.getSize(size);
LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
llp.setMargins(10, 5, 10, 5);
for (int i = 0; i < button_count; i++)
{
View check = inflater.inflate(R.layout.show_habits_item_check, null);
Button btCheck = (Button) check.findViewById(R.id.tvCheck);
TextView btCheck = (TextView) check.findViewById(R.id.tvCheck);
btCheck.setTypeface(fontawesome);
btCheck.setOnLongClickListener(ShowHabitsFragment.this);
// btCheck.setLayoutParams(llp);
((LinearLayout) view.findViewById(R.id.llButtons)).addView(check);
}
@ -139,6 +146,7 @@ public class ShowHabitsFragment extends Fragment implements OnSavedListener, OnI
}
int inactiveColor = Color.rgb(230, 230, 230);
int inactiveBackgroundColor = Color.WHITE;
int activeColor = habit.color;
tvName.setText(habit.name);
@ -172,7 +180,7 @@ public class ShowHabitsFragment extends Fragment implements OnSavedListener, OnI
for (int i = 0; i < m; i++)
{
Button tvCheck = (Button) llButtons.getChildAt(i);
TextView tvCheck = (TextView) llButtons.getChildAt(i);
tvCheck.setTag(R.string.habit_key, habit.getId());
tvCheck.setTag(R.string.offset_key, i);

Loading…
Cancel
Save