Skip to content

Commit

Permalink
Fixed drop-down list bug, partial fix of recursive link bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
knirirr committed Dec 7, 2014
1 parent e14944a commit f64ee0e
Show file tree
Hide file tree
Showing 13 changed files with 151 additions and 4 deletions.
13 changes: 13 additions & 0 deletions .idea/libraries/appcompat_v7_20_0_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/commons_lang3_3_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/dropbox_sync_sdk_android.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/libraries/support_annotations_20_0_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/support_v4_20_0_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions beecount/beecount.iml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 20 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="dropbox-sync-sdk-android" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-20.0.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-20.0.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-20.0.0" level="project" />
Expand Down
2 changes: 1 addition & 1 deletion beecount/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 20
versionCode 91
versionCode 92
}
/*
buildTypes {
Expand Down
2 changes: 1 addition & 1 deletion beecount/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.knirirr.beecount"
android:largeHeap="true"
android:versionName="2.3.1">
android:versionName="2.3.2">


<uses-permission android:name="android.permission.WAKE_LOCK" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class EditProjectActivity extends ActionBarActivity implements SharedPref
private View markedForDelete;
private long idToDelete;
private AlertDialog.Builder are_you_sure;
private int too_many;
public ArrayList<String> countNames;
public ArrayList<Long> countIds;
public ArrayList<LinkEditWidget> savedLinks;
Expand All @@ -86,6 +87,8 @@ protected void onCreate(Bundle savedInstanceState)
links_area = (LinearLayout) findViewById(R.id.editingLinksLayout);
existing_links_area = (LinearLayout) findViewById(R.id.existingLinksLayout);

too_many = 10; // used for catching link loops

Bundle extras = getIntent().getExtras();
if(extras !=null)
{
Expand Down Expand Up @@ -305,6 +308,17 @@ public boolean saveData()
stop = true;
message = getString(R.string.zero);
}
/*
* This fails to work and so has been hidden for now, in case it can be brought out later.
*/
/*
if (link_loop())
{
// add a message here
message = "FRC, your links are broken!";
stop = true;
}
*/
}
if (stop)
{
Expand Down Expand Up @@ -502,6 +516,50 @@ public void onClick(DialogInterface dialog, int whichButton)

}

/*
* The purpose of this function is to flip out and loop through all the linked counts, returning
* false if it looks like there are too many nested links.
*/
/*
private boolean link_loop()
{
too_many = 0;
counts = countDataSource.getAllCountsForProject(project_id);
for (Count count : counts)
{
if (check_count(count) == false)
{
return false;
}
}
return true;
}
private boolean check_count(Count count)
{
Log.i(TAG, "COUNT: " + String.valueOf(count.id) + ", " + count.name);
Link link = linkDataSource.getLinkByMasterId(count.id);
if (link != null)
{
Log.i(TAG, "LINK: " + String.valueOf(link.master_id) + ", " + String.valueOf(link.slave_id));
Count new_count = countDataSource.getCountById(link.slave_id);
if (new_count != null)
{
Log.i(TAG, "NEW COUNT: " + String.valueOf(new_count.id) + ", " + new_count.name);
too_many = too_many + 1;
Log.i(TAG,"TOO MANY: " + String.valueOf(too_many));
if (too_many > 5)
{
return false;
}
check_count(new_count);
}
return true;
}
return true;
}
*/


@Override
public boolean onCreateOptionsMenu(Menu menu)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,15 @@ public List<Link> getAllLinksForProject(long project_id)
return links;
}

public Link getLinkByMasterId(long master_id)
{
Cursor cursor = database.query(DbHelper.LINK_TABLE, allColumns,
DbHelper.L_MASTER_ID + " = " + master_id, null, null, null, null);

cursor.moveToFirst();
Link link = cursorToLink(cursor);
cursor.close();
return link;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public void setCountIds(ArrayList<Long> ids)

private void setSpinnerAdapter(String spinner, ArrayList<String> array)
{
int master_position = masterSpinner.getSelectedItemPosition();
int slave_position = slaveSpinner.getSelectedItemPosition();
int choice_position = choiceSpinner.getSelectedItemPosition();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getContext(), R.layout.custom_spinner, array)
{
public View getView(int position, View convertView, ViewGroup parent)
Expand All @@ -104,15 +107,28 @@ public View getDropDownView(int position, View convertView, ViewGroup parent)
return v;
}
};
int maxlen = adapter.getCount();
if (spinner.equals("master"))
{
masterSpinner.setAdapter(adapter);
if (master_position < maxlen)
{
masterSpinner.setSelection(master_position);
}
} else if (spinner.equals("slave"))
{
slaveSpinner.setAdapter(adapter);
if (slave_position < maxlen)
{
slaveSpinner.setSelection(slave_position);
}
} else if (spinner.equals("choice"))
{
choiceSpinner.setAdapter(adapter);
if (choice_position < maxlen)
{
choiceSpinner.setSelection(choice_position);
}
}

}
Expand Down
5 changes: 5 additions & 0 deletions beecount/src/main/res/raw/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
</style>
</head>
<body>
$ 2.3.2
% Version 2.3.2
_ 2014-12-07
* A bug affecting drop-down menus when adding new links has been fixed.
* A small safeguard against recursive linking has been added (this will get more attention in future).
$ 2.3.1
% Version 2.3.1
_ 2014-10-27
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Nov 24 08:34:15 GMT 2014
#Sun Dec 07 13:18:47 GMT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip

0 comments on commit f64ee0e

Please sign in to comment.