Skip to content

Commit

Permalink
[Android] Hopefully fixed meetings crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
OneCricketeer committed Feb 4, 2014
1 parent 5bc444c commit 43686e4
Show file tree
Hide file tree
Showing 42 changed files with 678 additions and 590 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public DayPickerView(Context context,
mHandler = new Handler();
mController = controller;
mController.registerOnDateChangedListener(this);
setLayoutParams(new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
setLayoutParams(new LayoutParams(
android.view.ViewGroup.LayoutParams.MATCH_PARENT,
android.view.ViewGroup.LayoutParams.MATCH_PARENT));
setDrawSelectorOnTop(false);
init(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
} else {
v = new SimpleMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
LayoutParams params = new LayoutParams(
android.view.ViewGroup.LayoutParams.MATCH_PARENT,
android.view.ViewGroup.LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public YearPickerView(Context context,
mController = controller;
mController.registerOnDateChangedListener(this);
ViewGroup.LayoutParams frame = new ViewGroup.LayoutParams(
android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
android.view.ViewGroup.LayoutParams.MATCH_PARENT,
android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
setLayoutParams(frame);
Resources res = context.getResources();
mViewSize = res
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ public void onClick(View v) {
mAmPmTextView.setVisibility(View.GONE);

RelativeLayout.LayoutParams paramsSeparator = new RelativeLayout.LayoutParams(
android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
paramsSeparator.addRule(RelativeLayout.CENTER_IN_PARENT);
TextView separatorView = (TextView) view
.findViewById(R.id.separator);
Expand Down
1 change: 1 addition & 0 deletions DroidRage/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<!-- Pase SDK Keys -->
<string name="parse_application_id">EMatFstc8b29syE3hcVBrNndCdwjRudulpFBUwdt</string>
<string name="parse_client_key">pmsPdsBrpUyQIQfYR8sFe5sNpeHnLKlz1rfLuaEP</string>

<string name="title_activity_agenda">AgendaActivity</string>
<string name="title_activity_profile">ProfileActivity</string>
<string name="title_activity_view_task">ViewTaskActivity</string>
Expand Down
4 changes: 2 additions & 2 deletions DroidRage/src/com/meetingninja/csse/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ private void selectItem(int position) {
frag_notes = (NotesFragment) nextPage;
break;
case TASKS:
//nextPage = new TasksFragment();
// nextPage = new TasksFragment();
nextPage = TasksFragment.getInstance();
frag_tasks = new TasksFragment();
break;
Expand Down Expand Up @@ -410,7 +410,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
Toast.makeText(this, "Refreshing Meetings", Toast.LENGTH_SHORT)
.show();
frag_meetings.fetchMeetings();
// frag_meetings.populateList();
// frag_meetings.populateList();
return true;
case NOTES:
Toast.makeText(this, "Refreshing Notes", Toast.LENGTH_SHORT)
Expand Down
11 changes: 5 additions & 6 deletions DroidRage/src/com/meetingninja/csse/SearchableUserFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,

UserVolleyAdapter.fetchAllUsers(this);

// SQLiteUserAdapter sqlite = new SQLiteUserAdapter(mContext);
// allUsers = sqlite.getAllUsers(); println(allUsers);
// sqlite.close();
// SQLiteUserAdapter sqlite = new SQLiteUserAdapter(mContext);
// allUsers = sqlite.getAllUsers(); println(allUsers);
// sqlite.close();

autoAdapter = new AutoCompleteAdapter(getActivity(), allUsers);

complete = (ContactTokenTextView) view
Expand All @@ -124,13 +124,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,

// token listener when autocompleted
addedIDsView = (TextView) view.findViewById(R.id.completed_ids);

addedAdapter = new UserArrayAdapter(getActivity(),
R.layout.list_item_user, addedUsers);
mListView = (AbsListView) view.findViewById(android.R.id.list);
((AdapterView<ListAdapter>) mListView).setAdapter(addedAdapter);


// Set OnItemClickListener so we can be notified on item clicks
mListView.setOnItemClickListener(this);

Expand Down
10 changes: 5 additions & 5 deletions DroidRage/src/com/meetingninja/csse/SessionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class SessionManager {
public static final String TITLE = "edu.meetingninja.rhit.preferences.title";
public static final String LOCATION = "edu.meetingninja.rhit.preferences.location";
public static final String PAGE = "edu.meetingninja.rhit.preferences.page";

public static final String TIME = "edu.meetingninja.rhit.preferences.syncedTime";

// Sharedpref login state
Expand Down Expand Up @@ -184,19 +184,19 @@ public synchronized void setPage(int position) {
public synchronized int getPage() {
return pref.getInt(PAGE, 0);
}

public synchronized long getLastSyncTime() {
return pref.getLong(TIME, System.currentTimeMillis());
}

public synchronized boolean needsSync() {
int _3min = 3*60*1000;
int _3min = 3 * 60 * 1000;
if (System.currentTimeMillis() - getLastSyncTime() >= _3min) {
return true;
}
return false;
}

public synchronized void setSynced() {
Editor editor = pref.edit();
editor.putLong(TIME, System.currentTimeMillis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,12 @@ public void onClick(View v) {
case R.id.agenda_addTopicBtn:
Topic t = new Topic(); // TODO : Create a Topic
t.setTitle("new topic");
final EditText mTitle = (EditText) ((View) v.getParent()).findViewById(R.id.agenda_title_edittext);

System.out.println("FOUND:" +mTitle);
final EditText mTitle = (EditText) ((View) v.getParent())
.findViewById(R.id.agenda_title_edittext);

System.out.println("FOUND:" + mTitle);
t.setTitle(mTitle.getText().toString());

displayedAgenda.addTopic(t);
reconstructTree();

Expand Down
75 changes: 37 additions & 38 deletions DroidRage/src/com/meetingninja/csse/agenda/AgendaItemAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,24 +124,25 @@ public void addhash(Topic s) {
public LinearLayout updateView(final View view,
final TreeNodeInfo<Topic> treeNodeInfo) {

final LinearLayout rowView = (LinearLayout) view;
final LinearLayout rowView = (LinearLayout) view;

final Topic rowTopic = treeNodeInfo.getId();

// System.out.println("Echo: Checked" + rowTopic + " " + counter + " "
// + Comparison.size() + " " + checked);
// System.out.println("Echo: Checked" + rowTopic + " " + counter + " "
// + Comparison.size() + " " + checked);

final EditText mTitle = (EditText) rowView
.findViewById(R.id.agenda_edit_topic);

final TextView mTime = (TextView) rowView
.findViewById(R.id.agenda_topic_time);
if(TextHandlers.containsKey(mTitle)){
if (TextHandlers.containsKey(mTitle)) {
mTitle.removeTextChangedListener(TextHandlers.get(mTitle));
}
mTitle.setText(rowTopic.getTitle());

// System.out.println("Echo: Here" + rowTopic.getTitle() + " " + rowView);
// System.out.println("Echo: Here" + rowTopic.getTitle() + " " +
// rowView);

TextWatcher c = new TextWatcher() {

Expand All @@ -154,11 +155,9 @@ public void onTextChanged(CharSequence s, int start, int before,
mTitle.setTag(text);
rowTopic.setTitle(text);


Log.d(TAG, "Text changed" + treeNodeInfo.getLevel() + " "
+ treeNodeInfo.getId());
manager.getChildren(treeNodeInfo.getId());


}

Expand Down Expand Up @@ -188,17 +187,17 @@ public void afterTextChanged(Editable s) {

// Set Time Button
mTimeBtn.setTag(rowTopic);
mTimeBtn.setOnClickListener(new OnTimeBtnClick(rowTopic,mTime));
mTimeBtn.setOnClickListener(new OnTimeBtnClick(rowTopic, mTime));

Map<String, String> info = getDescription(rowTopic);

String time = info.containsKey("time") ? info.get("time") : "";
time = "("+rowTopic.getTime()+"m)";
time = "(" + rowTopic.getTime() + "m)";
mTime.setText(time);

// If a topic has subTopics, then its time is determined by the sum of
// the subTopics
if (getManager().getChildren(rowTopic).size()!=0){
if (getManager().getChildren(rowTopic).size() != 0) {
// mTimeBtn.setVisibility(View.GONE);
mTime.setVisibility(View.GONE);
mTimeBtn.setVisibility(View.GONE);
Expand All @@ -223,7 +222,6 @@ public void afterTextChanged(Editable s) {
// }
// }


@Override
public long getItemId(final int position) {

Expand All @@ -238,28 +236,28 @@ public int getViewTypeCount() {
private class OnTimeBtnClick implements OnClickListener {
private final Topic topic;
private final TextView changeText;
public OnTimeBtnClick(Topic topic,TextView changeText){

public OnTimeBtnClick(Topic topic, TextView changeText) {
this.topic = topic;
this.changeText = changeText;
}

@Override
public void onClick(View v) {
HmsPickerBuilder hms = new HmsPickerBuilder().setFragmentManager(
((FragmentActivity) getActivity())
.getSupportFragmentManager()).setStyleResId(
R.style.BetterPickersDialogFragment);
hms.addHmsPickerDialogHandler(new HmsPickerDialogHandler(){
hms.addHmsPickerDialogHandler(new HmsPickerDialogHandler() {

@Override
public void onDialogHmsSet(int reference, int hours,
int minutes, int seconds) {
topic.setTime(""+minutes+hours*60);
topic.setTime("" + minutes + hours * 60);
changeText.setText(topic.getTime());

}

});
hms.show();
Topic t = (Topic) v.getTag();
Expand All @@ -280,40 +278,41 @@ public SubTopicListener(Topic parent) {
public void onClick(View v) {
// final Topic t = (Topic) v.getTag();
Topic subT = new Topic(); // TODO : Make new subtopic
subT.setTitle(""+subT);
subT.setTitle("" + subT);
subT.setTime("0");
parent.addTopic(subT);
// System.out.println("Echo: Created" + subT + " " + parent);
// List<Topic> childList = getManager().getChildren(parent);
// System.out.println(childList.size());
// if(childList.size()!=0){
//
// Topic nextChild = childList.get(childList.size()-1);
// getManager().addAfterChild(parent, subT, nextChild);
// }else{
// getManager().addAfterChild(parent, subT, null);
// }
// System.out.println("Echo: Created" + subT + " " + parent);
// List<Topic> childList = getManager().getChildren(parent);
// System.out.println(childList.size());
// if(childList.size()!=0){
//
// Topic nextChild = childList.get(childList.size()-1);
// getManager().addAfterChild(parent, subT, nextChild);
// }else{
// getManager().addAfterChild(parent, subT, null);
// }
PrintTree();
activty.reconstructTree();
getManager().notifyDataSetChanged();
}

}

public void PrintTree(){
public void PrintTree() {
System.out.println("Printing Manager Tree");
List<Topic> top = getManager().getChildren(null);
for(Topic c: top){
List<Topic> top = getManager().getChildren(null);
for (Topic c : top) {
printRecur(c, 0);

}
}
public void printRecur(Topic c,int i){
System.out.println("Topic:"+c.getTitle()+" "+i);
for(Topic d: getManager().getChildren(c))
printRecur(d,i+1);

public void printRecur(Topic c, int i) {
System.out.println("Topic:" + c.getTitle() + " " + i);
for (Topic d : getManager().getChildren(c))
printRecur(d, i + 1);
}

public void addActivity(AgendaActivity agendaActivity) {
this.activty = agendaActivity;
}
Expand Down
Loading

0 comments on commit 43686e4

Please sign in to comment.