From 9bceebd68a89046a2a6ad9730c5d9761996ef21c Mon Sep 17 00:00:00 2001 From: Ryan Hansberry Date: Tue, 20 Oct 2015 14:55:07 -0700 Subject: Update from Support Library 23.0.1 to 23.1.0. This also fixes background issues with FABs for pre Android 4.0 devices. --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 1526ab7..84b3bd6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,7 +6,7 @@ apply from: '../config/translations.gradle' apply from: '../config/jacoco.gradle' ext { - supportLibraryVersion = '23.0.1' + supportLibraryVersion = '23.1.0' testRunnerVersion = '0.3' espressoVersion = '2.2' } -- cgit v1.2.3 From 2bda23f8f7c519ca97dca8a5df20cfa6a318d3b6 Mon Sep 17 00:00:00 2001 From: Jeremy Klein Date: Tue, 20 Oct 2015 11:02:38 -0700 Subject: Scroll to the previously selected view asynchronously. This avoids a race condition in ViewPager. See #301. Note that this still looks a bit janky because the pager noticably scrolls away and back to the right view. A bug has been filed with the support library team to look into a better solution. Also update the support library version. --- app/src/main/java/org/connectbot/ConsoleActivity.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java index 3aebd41..389ddcc 100644 --- a/app/src/main/java/org/connectbot/ConsoleActivity.java +++ b/app/src/main/java/org/connectbot/ConsoleActivity.java @@ -170,10 +170,15 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne // create views for all bridges on this service adapter.notifyDataSetChanged(); - int requestedIndex = bound.getBridges().indexOf(requestedBridge); + final int requestedIndex = bound.getBridges().indexOf(requestedBridge); if (requestedIndex != -1) { - setDisplayedTerminal(requestedIndex); + pager.post(new Runnable() { + @Override + public void run() { + setDisplayedTerminal(requestedIndex); + } + }); } } -- cgit v1.2.3 From aa24bfcc6d12c9bd03e50281d91613d50fc8c3c0 Mon Sep 17 00:00:00 2001 From: Jeremy Klein Date: Tue, 20 Oct 2015 15:25:37 -0700 Subject: Save the last selected Uri in onSaveInstanceState. --- app/src/main/java/org/connectbot/ConsoleActivity.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java index 389ddcc..0bb7858 100644 --- a/app/src/main/java/org/connectbot/ConsoleActivity.java +++ b/app/src/main/java/org/connectbot/ConsoleActivity.java @@ -183,9 +183,9 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne } public void onServiceDisconnected(ComponentName className) { + bound = null; adapter.notifyDataSetChanged(); updateEmptyVisible(); - bound = null; } }; @@ -1040,8 +1040,8 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne // Maintain selected host if connected. if (adapter.getCurrentTerminalView() != null && !adapter.getCurrentTerminalView().bridge.isDisconnected()) { - Uri uri = adapter.getCurrentTerminalView().bridge.host.getUri(); - savedInstanceState.putString(STATE_SELECTED_URI, uri.toString()); + requested = adapter.getCurrentTerminalView().bridge.host.getUri(); + savedInstanceState.putString(STATE_SELECTED_URI, requested.toString()); } super.onSaveInstanceState(savedInstanceState); -- cgit v1.2.3 From 5167296d8afe1bc945908f3b6b2476feed48a8d1 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Wed, 21 Oct 2015 11:22:04 -0700 Subject: Better lint output for Travis-CI This uses xqilla to run a better XPath 2.0 query that outputs a terse one-line description of the problem which is easier to diff in Travis-CI build output. --- .travis.yml | 2 +- scripts/check-lint-count.sh | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index c3ea0d5..54230d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ addons: - ia32-libs-multiarch - libgd2-xpm - p7zip-full - - libxml2-utils # ./scripts/check-lint-count.sh + - xqilla # ./scripts/check-lint-count.sh coverity_scan: project: name: "connectbot/connectbot" diff --git a/scripts/check-lint-count.sh b/scripts/check-lint-count.sh index 5184e13..0397477 100755 --- a/scripts/check-lint-count.sh +++ b/scripts/check-lint-count.sh @@ -12,10 +12,10 @@ fi lint_file="$1" historical_file="$2" -xmllint="$(which xmllint)" +xqilla="$(which xqilla)" -if [[ ! -x $xmllint ]]; then \ - echo "Error: cannot find xmllint" +if [[ ! -x $xqilla ]]; then \ + echo "Error: cannot find xqilla" exit 1 fi @@ -31,22 +31,22 @@ trap "rm -rf $tmp_dir" ERR EXIT lint_results="$tmp_dir/lint.txt" hist_results="$tmp_dir/hist.txt" -echo "cat //issue/location" | \ - xmllint --shell $historical_file | \ - grep '$lint_results - -echo "cat //issue/location" | \ - xmllint --shell $lint_file | \ - grep '$hist_results +run_query() { + local xqilla_script='string-join(//issue/location/(concat("file=", @file, " line=", @line, " column=", @column, " reason=", ../@summary)), " ")' + xqilla -i $1 <(echo $xqilla_script) | sed "s,$PWD/,,g" > $2 +} -old_count=$(cat $lint_results | wc -l) -new_count=$(cat $hist_results | wc -l) +run_query $lint_file $lint_results +run_query $historical_file $hist_results -echo "Historical count : $old_count, new count : $new_count" +old_count=$(cat $hist_results | wc -l) +new_count=$(cat $lint_results | wc -l) + +echo "Historical count: $old_count, new count: $new_count" if [[ $new_count > $old_count ]]; then \ echo "FAILURE: lint issues increased from $old_count to $new_count" - diff $lint_results $hist_results + diff -u $hist_results $lint_results exit 2 fi -- cgit v1.2.3 From 0d5194f4db059a50aa253458631f1f2410f15e86 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Wed, 21 Oct 2015 11:30:23 -0700 Subject: Rename check-lint-count.sh to .bash linthub.io was examining these as POSIX scripts to it was complaining about bash-isms. Move this to .bash to give it a better hint about what kind of file this is. --- .travis.yml | 4 +-- scripts/check-lint-count.bash | 57 +++++++++++++++++++++++++++++++++++++++++++ scripts/check-lint-count.sh | 57 ------------------------------------------- 3 files changed, 59 insertions(+), 59 deletions(-) create mode 100755 scripts/check-lint-count.bash delete mode 100755 scripts/check-lint-count.sh diff --git a/.travis.yml b/.travis.yml index 54230d8..ef9e16c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ addons: - ia32-libs-multiarch - libgd2-xpm - p7zip-full - - xqilla # ./scripts/check-lint-count.sh + - xqilla # ./scripts/check-lint-count.bash coverity_scan: project: name: "connectbot/connectbot" @@ -55,6 +55,6 @@ android: script: - ./gradlew clean build check jacocoUnitTestDebugReport - - ./scripts/check-lint-count.sh app/build/outputs/lint-results.xml $HOME/.cache/lint/lint-results.xml + - ./scripts/check-lint-count.bash app/build/outputs/lint-results.xml $HOME/.cache/lint/lint-results.xml after_success: ./gradlew coveralls diff --git a/scripts/check-lint-count.bash b/scripts/check-lint-count.bash new file mode 100755 index 0000000..0397477 --- /dev/null +++ b/scripts/check-lint-count.bash @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# +# Checks the number of lint issues against historical values. Used in +# Travis CI builds to fail when the number increases by exploiting the +# caching mechanism. + +if [[ $# != 2 || ! -f $1 ]]; then \ + echo "Usage: $0 " + exit 1 +fi + +lint_file="$1" +historical_file="$2" + +xqilla="$(which xqilla)" + +if [[ ! -x $xqilla ]]; then \ + echo "Error: cannot find xqilla" + exit 1 +fi + +if [[ ! -f $historical_file ]]; then \ + # no cache history, store this one and exit + cp $lint_file $historical_file + exit 0 +fi + +tmp_dir="$(mktemp -d lint.XXXXXXXX)" +trap "rm -rf $tmp_dir" ERR EXIT + +lint_results="$tmp_dir/lint.txt" +hist_results="$tmp_dir/hist.txt" + +run_query() { + local xqilla_script='string-join(//issue/location/(concat("file=", @file, " line=", @line, " column=", @column, " reason=", ../@summary)), " ")' + xqilla -i $1 <(echo $xqilla_script) | sed "s,$PWD/,,g" > $2 +} + +run_query $lint_file $lint_results +run_query $historical_file $hist_results + +old_count=$(cat $hist_results | wc -l) +new_count=$(cat $lint_results | wc -l) + +echo "Historical count: $old_count, new count: $new_count" + +if [[ $new_count > $old_count ]]; then \ + echo "FAILURE: lint issues increased from $old_count to $new_count" + diff -u $hist_results $lint_results + exit 2 +fi + +if [[ $TRAVIS_PULL_REQUEST == false ]]; then \ + # Okay, we either stayed the same or reduced our number. + # Write it out so we can check it next build! + cp $lint_file $historical_file +fi diff --git a/scripts/check-lint-count.sh b/scripts/check-lint-count.sh deleted file mode 100755 index 0397477..0000000 --- a/scripts/check-lint-count.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env bash -# -# Checks the number of lint issues against historical values. Used in -# Travis CI builds to fail when the number increases by exploiting the -# caching mechanism. - -if [[ $# != 2 || ! -f $1 ]]; then \ - echo "Usage: $0 " - exit 1 -fi - -lint_file="$1" -historical_file="$2" - -xqilla="$(which xqilla)" - -if [[ ! -x $xqilla ]]; then \ - echo "Error: cannot find xqilla" - exit 1 -fi - -if [[ ! -f $historical_file ]]; then \ - # no cache history, store this one and exit - cp $lint_file $historical_file - exit 0 -fi - -tmp_dir="$(mktemp -d lint.XXXXXXXX)" -trap "rm -rf $tmp_dir" ERR EXIT - -lint_results="$tmp_dir/lint.txt" -hist_results="$tmp_dir/hist.txt" - -run_query() { - local xqilla_script='string-join(//issue/location/(concat("file=", @file, " line=", @line, " column=", @column, " reason=", ../@summary)), " ")' - xqilla -i $1 <(echo $xqilla_script) | sed "s,$PWD/,,g" > $2 -} - -run_query $lint_file $lint_results -run_query $historical_file $hist_results - -old_count=$(cat $hist_results | wc -l) -new_count=$(cat $lint_results | wc -l) - -echo "Historical count: $old_count, new count: $new_count" - -if [[ $new_count > $old_count ]]; then \ - echo "FAILURE: lint issues increased from $old_count to $new_count" - diff -u $hist_results $lint_results - exit 2 -fi - -if [[ $TRAVIS_PULL_REQUEST == false ]]; then \ - # Okay, we either stayed the same or reduced our number. - # Write it out so we can check it next build! - cp $lint_file $historical_file -fi -- cgit v1.2.3 From 0b4542c535e14c09b0341021d82ec444642e7e04 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Wed, 21 Oct 2015 11:37:33 -0700 Subject: Quote all files in check-lint-results.bash To prevent premature variable expansion, word-splitting, and globbing quote all the things that could be affected by these problems. --- scripts/check-lint-count.bash | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/check-lint-count.bash b/scripts/check-lint-count.bash index 0397477..901eded 100755 --- a/scripts/check-lint-count.bash +++ b/scripts/check-lint-count.bash @@ -21,37 +21,37 @@ fi if [[ ! -f $historical_file ]]; then \ # no cache history, store this one and exit - cp $lint_file $historical_file + cp "$lint_file" "$historical_file" exit 0 fi tmp_dir="$(mktemp -d lint.XXXXXXXX)" -trap "rm -rf $tmp_dir" ERR EXIT +trap 'rm -rf $tmp_dir' ERR EXIT lint_results="$tmp_dir/lint.txt" hist_results="$tmp_dir/hist.txt" run_query() { local xqilla_script='string-join(//issue/location/(concat("file=", @file, " line=", @line, " column=", @column, " reason=", ../@summary)), " ")' - xqilla -i $1 <(echo $xqilla_script) | sed "s,$PWD/,,g" > $2 + xqilla -i "$1" <(echo "$xqilla_script") | sed "s,$PWD/,,g" > "$2" } -run_query $lint_file $lint_results -run_query $historical_file $hist_results +run_query "$lint_file" "$lint_results" +run_query "$historical_file" "$hist_results" -old_count=$(cat $hist_results | wc -l) -new_count=$(cat $lint_results | wc -l) +old_count=$(wc -l < "$hist_results") +new_count=$(wc -l < "$lint_results") echo "Historical count: $old_count, new count: $new_count" if [[ $new_count > $old_count ]]; then \ echo "FAILURE: lint issues increased from $old_count to $new_count" - diff -u $hist_results $lint_results + diff -u "$hist_results" "$lint_results" exit 2 fi if [[ $TRAVIS_PULL_REQUEST == false ]]; then \ # Okay, we either stayed the same or reduced our number. # Write it out so we can check it next build! - cp $lint_file $historical_file + cp "$lint_file" "$historical_file" fi -- cgit v1.2.3 From 5d0a7919825c7ae01f29050b059559aad5ad6d46 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Wed, 21 Oct 2015 11:45:36 -0700 Subject: Change check-lint-results.bash indentation Use two spaces consistently throughout the file. --- scripts/check-lint-count.bash | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/check-lint-count.bash b/scripts/check-lint-count.bash index 901eded..c02f70e 100755 --- a/scripts/check-lint-count.bash +++ b/scripts/check-lint-count.bash @@ -5,8 +5,8 @@ # caching mechanism. if [[ $# != 2 || ! -f $1 ]]; then \ - echo "Usage: $0 " - exit 1 + echo "Usage: $0 " + exit 1 fi lint_file="$1" @@ -15,8 +15,8 @@ historical_file="$2" xqilla="$(which xqilla)" if [[ ! -x $xqilla ]]; then \ - echo "Error: cannot find xqilla" - exit 1 + echo "Error: cannot find xqilla" + exit 1 fi if [[ ! -f $historical_file ]]; then \ @@ -45,13 +45,13 @@ new_count=$(wc -l < "$lint_results") echo "Historical count: $old_count, new count: $new_count" if [[ $new_count > $old_count ]]; then \ - echo "FAILURE: lint issues increased from $old_count to $new_count" - diff -u "$hist_results" "$lint_results" - exit 2 + echo "FAILURE: lint issues increased from $old_count to $new_count" + diff -u "$hist_results" "$lint_results" + exit 2 fi if [[ $TRAVIS_PULL_REQUEST == false ]]; then \ - # Okay, we either stayed the same or reduced our number. - # Write it out so we can check it next build! - cp "$lint_file" "$historical_file" + # Okay, we either stayed the same or reduced our number. + # Write it out so we can check it next build! + cp "$lint_file" "$historical_file" fi -- cgit v1.2.3