forked from openMF/android-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Survey First Two Screens Added Survey First Two Screens Added
- Loading branch information
Showing
22 changed files
with
928 additions
and
11 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
55 changes: 55 additions & 0 deletions
55
mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/ClientChooseAdapter.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,55 @@ | ||
package com.mifos.mifosxdroid.adapters; | ||
import android.content.Context; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
import com.amulyakhare.textdrawable.TextDrawable; | ||
import com.amulyakhare.textdrawable.util.ColorGenerator; | ||
import com.mifos.mifosxdroid.R; | ||
import com.mifos.mifosxdroid.core.adapters.BaseListAdapter; | ||
import com.mifos.objects.client.Client; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by Nasim Banu on 19,January,2016. | ||
*/ | ||
public class ClientChooseAdapter extends BaseListAdapter<Client> { | ||
private ColorGenerator mColorGenerator = ColorGenerator.MATERIAL; | ||
private TextDrawable.IBuilder mDrawableBuilder; | ||
|
||
public ClientChooseAdapter(Context context, List<Client> list, int layoutId) { | ||
super(context, list, layoutId); | ||
mDrawableBuilder = TextDrawable.builder().round(); | ||
} | ||
|
||
@Override | ||
public View getView(int position, View convertView, ViewGroup parent) { | ||
ViewHolder holder; | ||
final Client item; | ||
|
||
if (convertView == null) { | ||
convertView = getLayout(); | ||
holder = new ViewHolder(convertView); | ||
convertView.setTag(holder); | ||
} else { | ||
holder = (ViewHolder) convertView.getTag(); | ||
} | ||
item = getItem(position); | ||
holder.tv_clientName.setText(item.getDisplayName()); | ||
TextDrawable drawable = mDrawableBuilder.build(String.valueOf(item.getDisplayName().charAt(0)), mColorGenerator.getColor(item.getDisplayName())); | ||
holder.iv_clientImage.setImageDrawable(drawable); | ||
return convertView; | ||
} | ||
|
||
public static class ViewHolder { | ||
private ImageView iv_clientImage; | ||
private TextView tv_clientName; | ||
|
||
public ViewHolder(View view) { | ||
iv_clientImage = (ImageView) view.findViewById(R.id.icon); | ||
tv_clientName = (TextView) view.findViewById(R.id.name); | ||
} | ||
} | ||
} | ||
|
75 changes: 75 additions & 0 deletions
75
mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/SurveyListAdapter.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,75 @@ | ||
package com.mifos.mifosxdroid.adapters; | ||
import android.content.Context; | ||
import android.content.res.Resources; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import com.mifos.mifosxdroid.R; | ||
import com.mifos.objects.survey.Survey; | ||
|
||
import java.util.List; | ||
|
||
import butterknife.ButterKnife; | ||
import butterknife.InjectView; | ||
import android.widget.BaseAdapter; | ||
|
||
/** | ||
* Created by Nasim Banu on 19,January,2016. | ||
*/ | ||
public class SurveyListAdapter extends BaseAdapter{ | ||
private LayoutInflater layoutInflater; | ||
private List<Survey> listSurvey; | ||
private Resources resources; | ||
|
||
public SurveyListAdapter(Context context, List<Survey> listSurvey){ | ||
|
||
layoutInflater = LayoutInflater.from(context); | ||
this.listSurvey = listSurvey; | ||
resources = context.getResources(); | ||
} | ||
@Override | ||
public int getCount() { | ||
return this.listSurvey.size(); | ||
} | ||
|
||
@Override | ||
public Survey getItem(int i) { | ||
return this.listSurvey.get(i); | ||
} | ||
|
||
@Override | ||
public long getItemId(int i) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public View getView(int i, View view, ViewGroup viewGroup) { | ||
|
||
ViewHolder viewHolder; | ||
if(view==null){ | ||
view = layoutInflater.inflate(R.layout.row_survey_list_item,viewGroup,false); | ||
viewHolder = new ViewHolder(view); | ||
view.setTag(viewHolder); | ||
}else{ | ||
viewHolder = (ViewHolder) view.getTag(); | ||
} | ||
final Survey survey = listSurvey.get(i); | ||
viewHolder.tv_survey_name.setText(survey.getName()); | ||
viewHolder.tv_description.setText(survey.getDescription()); | ||
return view; | ||
} | ||
|
||
public static class ViewHolder{ | ||
@InjectView(R.id.tv_survey_name) | ||
TextView tv_survey_name; | ||
@InjectView(R.id.tv_description) | ||
TextView tv_description; | ||
|
||
public ViewHolder(View view) { | ||
ButterKnife.inject(this, view); | ||
} | ||
|
||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
mifosng-android/src/main/java/com/mifos/mifosxdroid/core/BaseActivityCallback.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,14 @@ | ||
package com.mifos.mifosxdroid.core; | ||
|
||
/** | ||
* Created by Nasim Banu on 19,January,2016. | ||
*/ | ||
public interface BaseActivityCallback { | ||
void showProgress(String message); | ||
|
||
void hideProgress(); | ||
|
||
void logout(); | ||
|
||
int getActionbarHeight(); | ||
} |
52 changes: 52 additions & 0 deletions
52
mifosng-android/src/main/java/com/mifos/mifosxdroid/core/BaseFragment.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,52 @@ | ||
package com.mifos.mifosxdroid.core; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.os.Bundle; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v7.widget.Toolbar; | ||
import android.view.View; | ||
import android.view.inputmethod.InputMethodManager; | ||
|
||
/** | ||
* Created by Nasim Banu on 19,January,2016. | ||
*/ | ||
public class BaseFragment extends Fragment{ | ||
private BaseActivityCallback callback; | ||
private Activity activity; | ||
private InputMethodManager inputManager; | ||
|
||
@Override | ||
public void onAttach(Activity activity) { | ||
super.onAttach(activity); | ||
this.activity = activity; | ||
} | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
inputManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); | ||
} | ||
|
||
public Toolbar getToolbar() { | ||
return ((BaseActivity) getActivity()).getToolbar(); | ||
} | ||
|
||
protected void showProgress(String message) { | ||
if (callback != null) | ||
callback.showProgress(message); | ||
} | ||
|
||
protected void hideProgress() { | ||
if (callback != null) | ||
callback.hideProgress(); | ||
} | ||
|
||
protected void logout() { | ||
callback.logout(); | ||
} | ||
|
||
public void hideKeyboard(View view) { | ||
inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY); | ||
} | ||
} |
Oops, something went wrong.