Skip to content

Commit

Permalink
Update operator name to be displayed only when there is no icon
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcoutinho committed Sep 8, 2015
1 parent 113b0be commit 788de15
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion app/src/main/java/com/dc/cowbird/ListProtocolsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public Object getItem(int position) {
@Override
public void bindView(View view, Context context, Cursor cursor) {
Protocol p = new Protocol(cursor);
((TextView) view.findViewById(R.id.lblOperator)).setText("");
if ("VIVO".equalsIgnoreCase(p.getOperator())) {
((ImageView) view.findViewById(R.id.imageView)).setImageResource(R.mipmap.ic_vivo);
} else if ("TIM".equalsIgnoreCase(p.getOperator())) {
Expand All @@ -218,10 +219,11 @@ public void bindView(View view, Context context, Cursor cursor) {
((ImageView) view.findViewById(R.id.imageView)).setImageResource(R.mipmap.ic_oi);
} else {
((ImageView) view.findViewById(R.id.imageView)).setImageDrawable(null);
((TextView) view.findViewById(R.id.lblOperator)).setText(p.getOperator());
}
((TextView) view.findViewById(R.id.lblDate)).setText(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date(p.getDate())));
((TextView) view.findViewById(R.id.lblNumber)).setText(p.getNumber());
((TextView) view.findViewById(R.id.lblOperator)).setText(p.getOperator());

}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/dc/cowbird/ProtocolFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void onDestroyView() {
String number = ((TextView) getView().findViewById(R.id.etNumber)).getText().toString().trim();
if (number.length() > 0) {

Protocol p = new Protocol(number, ((TextView) getView().findViewById(R.id.etOperadora)).getText().toString().trim(), protocolDate.getTimeInMillis(), "");
Protocol p = new Protocol(number, ((TextView) getView().findViewById(R.id.etOperadora)).getText().toString().trim().toUpperCase(), protocolDate.getTimeInMillis(), "");
p.setAuto(false);

getActivity().getContentResolver().insert(ContentConstants.ProtocolURLs.URLProtocol.asURL(), p.toContentValues());
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/res/layout/row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@
android:id="@+id/lblOperator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/imageView"
android:gravity="center"
android:text=""
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_centerVertical="true"
android:layout_alignLeft="@+id/imageView"
android:layout_alignRight="@+id/imageView"
android:layout_alignStart="@+id/imageView"
android:gravity="center_horizontal"
android:text="Operadora"
android:textAppearance="?android:attr/textAppearanceSmall" />
android:layout_alignRight="@+id/imageView"
android:layout_alignEnd="@+id/imageView" />

<TextView
android:id="@+id/lblNumber"
Expand Down

0 comments on commit 788de15

Please sign in to comment.