forked from clojure/clojure
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 in MOB/climate-android from ~MANAV.SINGHAL/cl…
…imate-android:basic-634 to master Squashed commit of the following: commit 42519eb01983362a4f1a405fa56c90e2a941e3ec Author: Manav Singhal <manav.singhal@climate.com> Date: Tue Feb 24 16:16:18 2015 -0800 added recent activity on field summary page
- Loading branch information
Manav Singhal
committed
Feb 25, 2015
1 parent
5b29eef
commit 3b89eef
Showing
15 changed files
with
277 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
ClimateGrowersProject/ClimateAuthLib-release/ClimateAuthLib-release.iml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
...ateGrowersApp/src/main/java/com/climate/growers/android/renderers/ActivityModuleCard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package com.climate.growers.android.renderers; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
import android.widget.ImageView; | ||
import android.widget.RelativeLayout; | ||
import android.widget.TextView; | ||
|
||
import com.climate.growers.android.R; | ||
import com.climate.growers.android.managers.pojos.FarmerEventSummary; | ||
|
||
import java.text.DateFormat; | ||
|
||
public class ActivityModuleCard extends RelativeLayout { | ||
|
||
private TextView eventType, dateLabel; | ||
private ImageView icon; | ||
private FarmerEventSummary eventData; | ||
private View progressBar; | ||
private DateFormat dateFormat; | ||
|
||
public ActivityModuleCard(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public ActivityModuleCard(Context context, AttributeSet attrs, int defStyle) { | ||
super(context, attrs, defStyle); | ||
} | ||
|
||
@Override | ||
protected void onFinishInflate() { | ||
super.onFinishInflate(); | ||
eventType = (TextView)findViewById(R.id.eventType); | ||
dateLabel = (TextView)findViewById(R.id.dateLabel); | ||
icon = (ImageView)findViewById(R.id.icon); | ||
progressBar = findViewById(R.id.progressBar); | ||
} | ||
|
||
public void setRecentActivity(FarmerEventSummary farmerEventSummary) { | ||
eventData = farmerEventSummary; | ||
bindData(); | ||
} | ||
|
||
private void bindData() { | ||
if (eventData == null) { | ||
eventType.setText(""); | ||
dateLabel.setText(""); | ||
icon.setImageResource(R.drawable.ic_activity_planted); | ||
} else { | ||
|
||
eventType.setText(getActivityString()); | ||
icon.setImageResource(R.drawable.ic_activity_planted); | ||
if ("scouting".equals(eventData.getActivityType())) icon.setImageResource(R.drawable.ic_activity_scouted); | ||
dateFormat = DateFormat.getDateInstance(DateFormat.LONG); | ||
String format = dateFormat.format(eventData.getActivityDateDate()); | ||
dateLabel.setText(format); | ||
} | ||
} | ||
|
||
private String getActivityString(){ | ||
|
||
if (FarmerEventSummary.TYPE_HARVEST.equalsIgnoreCase(eventData.getActivityType())) { | ||
return getContext().getString(R.string.title_activity_logging_harvesting).toUpperCase(); | ||
} else if (FarmerEventSummary.TYPE_NITROGEN.equalsIgnoreCase(eventData.getActivityType())) { | ||
return getContext().getString(R.string.title_activity_logging_soil).toUpperCase(); | ||
} else if (FarmerEventSummary.TYPE_PEST.equalsIgnoreCase(eventData.getActivityType())) { | ||
return getContext().getString(R.string.title_activity_logging_pest_mgt).toUpperCase(); | ||
} else if (FarmerEventSummary.TYPE_PLANTING.equalsIgnoreCase(eventData.getActivityType())) { | ||
return (getContext().getString(R.string.title_activity_logging_planting).toUpperCase()); | ||
} else if (FarmerEventSummary.TYPE_TILLAGE.equalsIgnoreCase(eventData.getActivityType())) { | ||
return (getContext().getString(R.string.title_activity_logging_tillage).toUpperCase()); | ||
} else if (FarmerEventSummary.TYPE_OTHER.equalsIgnoreCase(eventData.getActivityType())) { | ||
return (getContext().getString(R.string.title_activity_logging_other).toUpperCase()); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public void updateLoadingStatus(boolean showLoading) { | ||
if (showLoading) { | ||
progressBar.setVisibility(View.VISIBLE); | ||
} else { | ||
progressBar.setVisibility(View.GONE); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.