Skip to content

Commit

Permalink
Atualização de bugs
Browse files Browse the repository at this point in the history
Correção de bugs e novas cores adicionadas, novo icone
  • Loading branch information
mattsousa committed Jul 28, 2017
1 parent 6fe4098 commit 26f47d5
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 48 deletions.
2 changes: 0 additions & 2 deletions EconoApp/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added EconoApp/app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected void onCreate(Bundle savedInstanceState) {
btnAdd = (Button)findViewById(R.id.main_btn_add);
btnRemove = (Button)findViewById(R.id.main_btn_remove);

rcvwHistory.addItemDecoration(new ItemDecorator(10));
rcvwHistory.addItemDecoration(new ItemDecorator(15));
format = new DecimalFormat("#0.00");
format.setRoundingMode(RoundingMode.FLOOR);
user = UserDAO.getUser(getApplicationContext());
Expand All @@ -70,6 +70,7 @@ protected void onCreate(Bundle savedInstanceState) {
getApplicationContext(),
getString(R.string.main_wellcome_back)+user.getName(),
Toast.LENGTH_SHORT).show();

Log.i(TAG,"Data Object Access Called!");
}

Expand All @@ -96,9 +97,19 @@ protected void onResume() {
Log.i(TAG,"Start onResume Method");
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
updateList();
updateState();
rcvwHistory.setLayoutManager(layoutManager);
}

private void updateState(){
if(user.getFunds() > 0.0d)
txwState.setText(getString(R.string.main_state_good));
else{
txwState.setText(getString(R.string.main_state_bad));
}
Log.i(TAG,"Updated state");
}

protected AlertDialog stdDialogName(){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
final EditText edtName = new EditText(this);
Expand Down Expand Up @@ -152,10 +163,11 @@ public void onClick(DialogInterface dialogInterface, int i) {

OperationDAO.insert(getApplicationContext(),user.getLastOperation());
UserDAO.alter(getApplicationContext(),user);
txwValue.setText(getString(R.string.main_coin)+user.getFunds());
txwValue.setText(getString(R.string.main_coin)+format.format(user.getFunds()));
Log.i(TAG,"User's row update called!");
amount = 0;
updateList();
updateState();
}
}).setNegativeButton(R.string.main_dialog_negative, new DialogInterface.OnClickListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import android.view.ViewGroup;
import android.widget.TextView;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;

import br.com.bluedogs.econoapp.R;
Expand All @@ -33,20 +35,20 @@ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
// TODO: 19/01/2017 Create a boolean method that returns if a object remove or add funds
NumberFormat format = new DecimalFormat("#0.00");
if(operations[position].getType() != null){
if(operations[position].getType().getOperationType() == new SimpleAddingOperation().getOperationType()) {
//Change this textview color to green
holder.txwListValue.setTextColor(Color.GREEN);
holder.txwListValue.setText("+"+String.valueOf(operations[position].getValue()));
holder.txwListValue.setText("+"+format.format(operations[position].getValue()));
}
else if(operations[position].getType().getOperationType() == new SimpleRemovingOperation().getOperationType()){
//Change this textview color to red
holder.txwListValue.setTextColor(Color.RED);
holder.txwListValue.setText("-"+String.valueOf(operations[position].getValue()));
holder.txwListValue.setText("-"+format.format(operations[position].getValue()));
}
}
try {
holder.txwListDate.setText("");
holder.txwListDate.setText(operations[position].getRecyclerViewDate());
} catch (ParseException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
import br.com.bluedogs.econoapp.model.operation.SimpleRemovingOperation;
import br.com.bluedogs.econoapp.model.User;

/**
* Created by Sarah Francis on 13/01/2017.
*/

public class OperationDAO{

Expand All @@ -28,11 +25,7 @@ public static void insert(Context context,Operation operation){
int i = 1;
values.put(coluns[i], operation.getDateAndTime());
i+=1;
if(operation.getType().getOperationType() == new SimpleAddingOperation().getOperationType()){
values.put(coluns[i],""+new SimpleAddingOperation().getOperationType());
}else if(operation.getType().getOperationType() == new SimpleRemovingOperation().getOperationType()){
values.put(coluns[i],""+new SimpleRemovingOperation().getOperationType());
}
values.put(coluns[i],""+operation.getOperationType());
i+=1;
values.put(coluns[i], operation.getValue());
dao.getWritableDatabase().insert(DAO.TABELAS[1],null,values);
Expand All @@ -54,7 +47,6 @@ public static Operation getOperationByID(Context context,int id){
String tipo = cursor.getString(cursor.getColumnIndex(coluns[2]));
operation.setId(cursor.getInt(cursor.getColumnIndex(coluns[0])));
operation.setDateAndTime(cursor.getString(cursor.getColumnIndex(coluns[1])));
// TODO: 19/01/2017 Create a factory to Operation supertype
if (tipo.equalsIgnoreCase(new SimpleAddingOperation().getOperationType()+"")){
operation.setType(new SimpleAddingOperation());
}else if(tipo.equalsIgnoreCase(new SimpleRemovingOperation().getOperationType()+"")){
Expand All @@ -63,6 +55,7 @@ public static Operation getOperationByID(Context context,int id){
operation.setValue(cursor.getDouble(cursor.getColumnIndex(coluns[3])));
}
}
cursor.close();
return operation;
}

Expand Down Expand Up @@ -92,6 +85,7 @@ public static List<Operation> getOperations(Context context){
operations.add(operation);
}while(cursor.moveToNext());
}
cursor.close();
return operations;
}

Expand Down Expand Up @@ -123,6 +117,7 @@ public static List<Operation> getOperationsByDate(Context context,Date date){
operations.add(operation);
}while(cursor.moveToNext());
}
cursor.close();
return operations;
}

Expand All @@ -137,7 +132,6 @@ public static List<Operation> getOperationsByValue(Context context,double value)
" FROM "+DAO.TABELAS[1]+
" WHERE "+coluns[3]+" = "+value;
Cursor cursor = dao.getReadableDatabase().rawQuery(dql,null);
ContentValues values = new ContentValues();
if(cursor.moveToFirst()){
do{
Operation operation = new Operation();
Expand All @@ -154,6 +148,7 @@ public static List<Operation> getOperationsByValue(Context context,double value)
operations.add(operation);
}while(cursor.moveToNext());
}
cursor.close();
return operations;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

import br.com.bluedogs.econoapp.model.User;

/**
* Created by Sarah Francis on 13/01/2017.
*/

public class UserDAO {
private static final String coluns[] = {"_id","nome","quantia"};
Expand Down Expand Up @@ -46,6 +43,7 @@ public static User getUser(Context context){

}while(cursor.moveToNext());
}
cursor.close();
return user;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public String getRecyclerViewDate() throws ParseException {
return dateFormat;
}


public String getOperationType(){
return ""+getType().getOperationType();
}

public long getId() {
return id;
Expand Down

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions EconoApp/app/src/main/res/layout/recyclerview_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/blueGrey50"
>

<LinearLayout
Expand Down
Binary file modified EconoApp/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified EconoApp/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified EconoApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified EconoApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified EconoApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions EconoApp/app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
<string name="main_seconds">" segundos atrás"</string>
<string name="main_value">R$00,00</string>
<string name="main_wellcome">"Bem-vindo "</string>
<string name="main_state_bad">CUIDADO!!</string>
<string name="main_state_good">Pode gastar</string>
</resources>
10 changes: 7 additions & 3 deletions EconoApp/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#ff4081</color>
<color name="colorPrimary">@color/amber500</color>
<color name="colorPrimaryDark">@color/amber700</color>
<color name="colorAccent">@color/blueGrey500</color>

<color name="amber500">#ffc107</color>
<color name="amber700">#ffa000</color>
<color name="blueGrey500">#607d8b</color>

<color name="blueGrey50">#eceff1</color>

</resources>
2 changes: 2 additions & 0 deletions EconoApp/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
<string name="main_dialog_name">Enter your name</string>
<string name="main_wellcome">"Wellcome "</string>
<string name="main_wellcome_back">"Name: "</string>
<string name="main_state_bad">CAREFUL!!</string>
<string name="main_state_good">Good for spending</string>

<!-- Principal Activity Strings -->
</resources>

0 comments on commit 26f47d5

Please sign in to comment.