mirror of
https://github.com/derekbrameyer/MacroDroid.git
synced 2026-09-03 07:15:14 +08:00
First commit
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
bin
|
||||
gen
|
||||
.classpath
|
||||
.project
|
||||
local.properties
|
||||
44
AndroidManifest.xml
Normal file
44
AndroidManifest.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.doomonafireball.macrodroid"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="7" />
|
||||
|
||||
<application
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme.NoTitleBar" >
|
||||
<activity
|
||||
android:label="@string/app_name"
|
||||
android:name=".MainActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:configChanges="keyboardHidden|orientation" >
|
||||
<intent-filter >
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:label="@string/app_name"
|
||||
android:name=".MyMacrosActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:configChanges="keyboardHidden|orientation" >
|
||||
</activity>
|
||||
<activity
|
||||
android:label="@string/app_name"
|
||||
android:name=".MyMacrosCalculateActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:configChanges="keyboardHidden|orientation" >
|
||||
</activity>
|
||||
<activity
|
||||
android:label="@string/app_name"
|
||||
android:name=".MyMacrosIKnowActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:configChanges="keyboardHidden|orientation" >
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
40
proguard.cfg
Normal file
40
proguard.cfg
Normal file
@@ -0,0 +1,40 @@
|
||||
-optimizationpasses 5
|
||||
-dontusemixedcaseclassnames
|
||||
-dontskipnonpubliclibraryclasses
|
||||
-dontpreverify
|
||||
-verbose
|
||||
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
|
||||
|
||||
-keep public class * extends android.app.Activity
|
||||
-keep public class * extends android.app.Application
|
||||
-keep public class * extends android.app.Service
|
||||
-keep public class * extends android.content.BroadcastReceiver
|
||||
-keep public class * extends android.content.ContentProvider
|
||||
-keep public class * extends android.app.backup.BackupAgentHelper
|
||||
-keep public class * extends android.preference.Preference
|
||||
-keep public class com.android.vending.licensing.ILicensingService
|
||||
|
||||
-keepclasseswithmembernames class * {
|
||||
native <methods>;
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||
}
|
||||
|
||||
-keepclassmembers class * extends android.app.Activity {
|
||||
public void *(android.view.View);
|
||||
}
|
||||
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
|
||||
-keep class * implements android.os.Parcelable {
|
||||
public static final android.os.Parcelable$Creator *;
|
||||
}
|
||||
11
project.properties
Normal file
11
project.properties
Normal file
@@ -0,0 +1,11 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-7
|
||||
BIN
res/drawable-hdpi/ic_launcher.png
Normal file
BIN
res/drawable-hdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
BIN
res/drawable-ldpi/ic_launcher.png
Normal file
BIN
res/drawable-ldpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
res/drawable-mdpi/ic_launcher.png
Normal file
BIN
res/drawable-mdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
44
res/layout/main_activity.xml
Normal file
44
res/layout/main_activity.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center|center_vertical" >
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center|center_vertical"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
style="@style/CenteredHeaderTV"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:text="@string/app_name" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/BTN_today"
|
||||
style="@style/MainButtons"
|
||||
android:text="@string/main_activity_today" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/BTN_previous"
|
||||
style="@style/MainButtons"
|
||||
android:text="@string/main_activity_previous" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/BTN_my_foods"
|
||||
style="@style/MainButtons"
|
||||
android:text="@string/main_activity_my_foods" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/BTN_my_macros"
|
||||
style="@style/MainButtons"
|
||||
android:text="@string/main_activity_my_macros" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/BTN_settings"
|
||||
style="@style/MainButtons"
|
||||
android:text="@string/main_activity_settings" />
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
121
res/layout/my_macros_activity.xml
Normal file
121
res/layout/my_macros_activity.xml
Normal file
@@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center|center_vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/LL_button_container"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/BTN_calculate"
|
||||
style="@style/WideButtons"
|
||||
android:text="@string/my_macros_calculate" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/BTN_i_know"
|
||||
style="@style/WideButtons"
|
||||
android:text="@string/my_macros_i_know" />
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_above="@id/LL_button_container"
|
||||
android:layout_alignParentTop="true"
|
||||
android:fillViewport="true" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center|center_vertical"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TV_no_input"
|
||||
style="@style/CenteredHeaderTV"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:text="@string/my_macros_no_input" />
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/TL_macros"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/Macros"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TableRow >
|
||||
|
||||
<TextView
|
||||
style="@style/MyMacrosLeftColumnTL"
|
||||
android:text="@string/my_macros_kCal_day" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TV_kCal"
|
||||
style="@style/MyMacrosRightColumnTL"
|
||||
android:text="2500" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow >
|
||||
|
||||
<TextView
|
||||
style="@style/MyMacrosLeftColumnTL"
|
||||
android:text="@string/my_macros_deficit" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TV_deficit"
|
||||
style="@style/MyMacrosRightColumnTL"
|
||||
android:text="700" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow >
|
||||
|
||||
<TextView
|
||||
style="@style/MyMacrosLeftColumnTL"
|
||||
android:text="@string/my_macros_protein" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TV_protein"
|
||||
style="@style/MyMacrosRightColumnTL"
|
||||
android:text="250" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow >
|
||||
|
||||
<TextView
|
||||
style="@style/MyMacrosLeftColumnTL"
|
||||
android:text="@string/my_macros_carbs" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TV_carbs"
|
||||
style="@style/MyMacrosRightColumnTL"
|
||||
android:text="250" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow >
|
||||
|
||||
<TextView
|
||||
style="@style/MyMacrosLeftColumnTL"
|
||||
android:text="@string/my_macros_fat" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TV_fat"
|
||||
style="@style/MyMacrosRightColumnTL"
|
||||
android:text="50" />
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</RelativeLayout>
|
||||
27
res/values/strings.xml
Normal file
27
res/values/strings.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="hello">Hello World, MainActivity!</string>
|
||||
<string name="app_name">MacroDroid</string>
|
||||
<string name="kCal_day">kCal/day</string>
|
||||
<string name="deficit">deficit</string>
|
||||
<string name="protein">protein</string>
|
||||
<string name="carbs">carbs</string>
|
||||
<string name="fat">fat</string>
|
||||
<string name="Macros">Macros</string>
|
||||
<string name="Measurements">Measurements</string>
|
||||
<string name="main_activity_today">Today</string>
|
||||
<string name="main_activity_previous">Previous</string>
|
||||
<string name="main_activity_my_foods">My Foods</string>
|
||||
<string name="main_activity_my_macros">My Macros</string>
|
||||
<string name="main_activity_settings">Settings/Info/FAQ</string>
|
||||
<string name="my_macros_calculate">Calculate my macros!</string>
|
||||
<string name="my_macros_i_know">I know my macros!</string>
|
||||
<string name="my_macros_no_input">You have not inputted or calculated your macros. Please select one of the buttons below to do so.</string>
|
||||
<string name="my_macros_kCal_day">kCal/day</string>
|
||||
<string name="my_macros_deficit">deficit [kCal]</string>
|
||||
<string name="my_macros_protein">protein [g]</string>
|
||||
<string name="my_macros_carbs">carbs [g]</string>
|
||||
<string name="my_macros_fat">fat [g]</string>
|
||||
|
||||
</resources>
|
||||
62
res/values/styles.xml
Normal file
62
res/values/styles.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="MyMacrosRightColumnTL">
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:paddingBottom">5dp</item>
|
||||
<item name="android:paddingLeft">10dp</item>
|
||||
<item name="android:paddingRight">10dp</item>
|
||||
<item name="android:paddingTop">5dp</item>
|
||||
<item name="android:gravity">right</item>
|
||||
</style>
|
||||
|
||||
<style name="MyMacrosLeftColumnTL">
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:paddingBottom">5dp</item>
|
||||
<item name="android:paddingLeft">10dp</item>
|
||||
<item name="android:paddingRight">10dp</item>
|
||||
<item name="android:paddingTop">5dp</item>
|
||||
<item name="android:gravity">right</item>
|
||||
</style>
|
||||
|
||||
<style name="CenteredHeaderTV">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:textSize">24sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="MainButtons">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_marginLeft">40dp</item>
|
||||
<item name="android:layout_marginRight">40dp</item>
|
||||
<item name="android:paddingBottom">20dp</item>
|
||||
<item name="android:paddingLeft">20dp</item>
|
||||
<item name="android:paddingRight">20dp</item>
|
||||
<item name="android:paddingTop">20dp</item>
|
||||
<item name="android:textColor">@android:color/black</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="WideButtons">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_marginLeft">10dp</item>
|
||||
<item name="android:layout_marginRight">10dp</item>
|
||||
<item name="android:paddingBottom">15dp</item>
|
||||
<item name="android:paddingLeft">15dp</item>
|
||||
<item name="android:paddingRight">15dp</item>
|
||||
<item name="android:paddingTop">15dp</item>
|
||||
<item name="android:textColor">@android:color/black</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
65
src/com/doomonafireball/macrodroid/MainActivity.java
Normal file
65
src/com/doomonafireball/macrodroid/MainActivity.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.doomonafireball.macrodroid;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
private Button todayBTN;
|
||||
private Button previousBTN;
|
||||
private Button myFoodsBTN;
|
||||
private Button myMacrosBTN;
|
||||
private Button settingsBTN;
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main_activity);
|
||||
|
||||
todayBTN = (Button) findViewById(R.id.BTN_today);
|
||||
previousBTN = (Button) findViewById(R.id.BTN_previous);
|
||||
myFoodsBTN = (Button) findViewById(R.id.BTN_my_foods);
|
||||
myMacrosBTN = (Button) findViewById(R.id.BTN_my_macros);
|
||||
settingsBTN = (Button) findViewById(R.id.BTN_settings);
|
||||
|
||||
todayBTN.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
previousBTN.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
myFoodsBTN.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
myMacrosBTN.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
startActivity(new Intent(MainActivity.this, MyMacrosActivity.class));
|
||||
}
|
||||
});
|
||||
settingsBTN.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
46
src/com/doomonafireball/macrodroid/MyMacrosActivity.java
Normal file
46
src/com/doomonafireball/macrodroid/MyMacrosActivity.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package com.doomonafireball.macrodroid;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class MyMacrosActivity extends Activity {
|
||||
private Button calculateBTN;
|
||||
private Button iKnowBTN;
|
||||
private TextView noInputTV;
|
||||
private TableLayout macrosTL;
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.my_macros_activity);
|
||||
|
||||
calculateBTN = (Button) findViewById(R.id.BTN_calculate);
|
||||
iKnowBTN = (Button) findViewById(R.id.BTN_i_know);
|
||||
noInputTV = (TextView) findViewById(R.id.TV_no_input);
|
||||
macrosTL = (TableLayout) findViewById(R.id.TL_macros);
|
||||
|
||||
// TODO Hide/show noInputTV vs. macrosTL
|
||||
|
||||
calculateBTN.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// Launch Calculate Activity
|
||||
startActivity(new Intent(MyMacrosActivity.this, MyMacrosCalculateActivity.class));
|
||||
}
|
||||
});
|
||||
iKnowBTN.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.doomonafireball.macrodroid;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class MyMacrosCalculateActivity extends Activity {
|
||||
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.my_macros_activity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.doomonafireball.macrodroid;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class MyMacrosIKnowActivity extends Activity {
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.my_macros_activity);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user