Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,15 @@ public class BackgroundQuestion extends SurveyQuestion {
@SerializedName("options")
private Map<String, String> options;

public BackgroundQuestion(String name,
String description,
boolean required,
ResponseType responseType,
public BackgroundQuestion(SurveyQuestion surveyQ,
QuestionType questionType) {
this(name, description, required, responseType, questionType, new HashMap<>());
this(surveyQ.getName(), surveyQ.getDescription(), surveyQ.getRequired(), surveyQ.getResponseType(), questionType, new HashMap<>());
}

public BackgroundQuestion(String name,
String description,
boolean required,
ResponseType responseType,
public BackgroundQuestion(SurveyQuestion surveyQ,
QuestionType questionType,
Map<String, String> options) {
super(name, description, required, responseType);
super(surveyQ.getName(), surveyQ.getDescription(), surveyQ.getRequired(), surveyQ.getResponseType(),);
this.type = questionType;
this.options = options;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,8 @@ public T getDataAt(int position)

@Nullable
@Override
public String getItem(int position) {
//Array
//// [ 0 ]
//// [ 1 ] <- selected array index = 1, loc = 0
//// [ 2 ]
//// [ 3 ]

//Spinner
////Index 0: [ 1 ] <- currently selected
////Index 1: [ 0 ]
////Index 2: [ 2 ]
////Index 3: [ 3 ]

//so if index 0 is clicked, that's our currently selected
//if index 1 is clicked that's actually the value -1

//adjusted position, when accounting for reordering around selected index
public String getItemFromSpinner(int position) {

int adjustedPosition = convertSpinnerToValuesIndex(position);

if(adjustedPosition == -1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ public IndicatorCard(Context context, AttributeSet attributeSet) {
mText.setOnTouchListener((v, event) -> {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: {
pressStartTime = System.currentTimeMillis();
pressedX = event.getX();
pressedY = event.getY();
stayedWithinClickDistance = true;
mText.performClick();
performClickHandler(event.getX(), event.getY());
break;
}
case MotionEvent.ACTION_MOVE: {
Expand Down Expand Up @@ -137,6 +133,13 @@ public IndicatorCard(Context context, AttributeSet attributeSet) {
}
}

public void performClickHandler(float x, float y) {
pressStartTime = System.currentTimeMillis();
pressedX = x;
pressedY = y;
stayedWithinClickDistance = true;
mText.performClick();
}
public void setOption(IndicatorOption option)
{
if(option != null) {
Expand Down Expand Up @@ -202,11 +205,7 @@ public void clearImageFromMemory()
public boolean onTouchEvent(MotionEvent e) {
switch (e.getAction()) {
case MotionEvent.ACTION_DOWN: {
pressStartTime = System.currentTimeMillis();
pressedX = e.getX();
pressedY = e.getY();
stayedWithinClickDistance = true;
performClick();
performClickHandler(e.getX(), e.getY());
break;
}
case MotionEvent.ACTION_MOVE: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import android.arch.lifecycle.ViewModelProviders;
import android.os.Bundle;
import android.support.transition.TransitionManager;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.github.curioustechizen.ago.RelativeTimeTextView;
import org.fundacionparaguaya.adviserplatform.data.model.Snapshot;
import org.fundacionparaguaya.adviserplatform.data.remote.AuthenticationManager;
import org.fundacionparaguaya.adviserplatform.data.repositories.SyncManager;
import org.fundacionparaguaya.adviserplatform.injection.InjectionViewModelFactory;
import org.fundacionparaguaya.adviserplatform.ui.base.AbstractTabbedFrag;
import org.fundacionparaguaya.adviserplatform.ui.base.DisplayBackNavListener;
import org.fundacionparaguaya.adviserplatform.ui.common.AbstractFragSwitcherActivity;
import org.fundacionparaguaya.adviserplatform.util.AppConstants;
import javax.inject.Inject;

public abstract class BaseDashboardActivity extends AbstractFragSwitcherActivity implements DisplayBackNavListener {

TextView mSyncLabel;
LinearLayout mSyncArea;
ImageView mSyncButtonIcon;
RelativeTimeTextView mLastSyncTextView;
TextView mTvTabTitle;
TextView mTvBackLabel;
LinearLayout mBackButton;

@Inject
SyncManager mSyncManager;
@Inject
AuthenticationManager mAuthManager;
@Inject
InjectionViewModelFactory mViewModelFactory;

@Override
public void onBackPressed() {
// Implementation of back navigation
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Common initialization code here...
}

protected void setSyncStatus(boolean b, int icon, int circle) {
// Implementation of sync status setup...
}

@Override
public void onShowBackNav() {
// Implementation of showing back navigation...
}

@Override
public void onHideBackNav() {
// Implementation of hiding back navigation...
}

public void setSyncLabel(Integer id, final long value, final long total) {
// Implementation to set sync label...
}

protected void snapshotsRemainingToSync() {
// Implementation of snapshots remaining to sync...
}

protected void validateStorageCapacity() {
// Implementation of storage capacity validation...
}
}