From 8981aea5b61d70b03d5669c785b527ca69e5558b Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 12 Sep 2016 19:40:36 -0500 Subject: [PATCH] Since so many bugs have been fixed, doing a release as 1.2.2, before the 1.3 work. --- app/app.iml | 18 ++++----- app/build.gradle | 2 +- .../fwknop2/ConfigDetailFragment.java | 24 +++++++++--- .../fwknop2/ConnectionListLoader.java | 14 +++++++ .../fwknop2/ConnectionSpinnerAdapter.java | 39 ++++++++++++++----- 5 files changed, 73 insertions(+), 24 deletions(-) diff --git a/app/app.iml b/app/app.iml index 3ff726f..d547799 100644 --- a/app/app.iml +++ b/app/app.iml @@ -65,23 +65,23 @@ - - - - - - - - - + + + + + + + + + diff --git a/app/build.gradle b/app/build.gradle index 3f07b8e..59f4685 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,7 +13,7 @@ model { applicationId = "org.cipherdyne.fwknop2" minSdkVersion.apiLevel = 16 targetSdkVersion.apiLevel = 24 - versionCode = 27 + versionCode = 31 versionName = "1.2.2" } //lintOptions { diff --git a/app/src/main/java/biz/incomsystems/fwknop2/ConfigDetailFragment.java b/app/src/main/java/biz/incomsystems/fwknop2/ConfigDetailFragment.java index b23f78d..7e7c194 100644 --- a/app/src/main/java/biz/incomsystems/fwknop2/ConfigDetailFragment.java +++ b/app/src/main/java/biz/incomsystems/fwknop2/ConfigDetailFragment.java @@ -164,7 +164,7 @@ public boolean onOptionsItemSelected(MenuItem item) { } else if (id == R.id.qr_code) { try { IntentIntegrator.forSupportFragment(this).setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES).initiateScan(); - } catch (Exception e) { // This is where the play store is called if the app is not installed + } catch (Throwable e) { // This is where the play store is called if the app is not installed } } else if (id == R.id.save) { @@ -352,11 +352,21 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { // @Override //This is all the setup stuff for this fragment. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + Thread.setDefaultUncaughtExceptionHandler( + new Thread.UncaughtExceptionHandler() { + @Override public void uncaughtException(Thread t, Throwable e) { + Log.e("fwknop2", t.getName()+": "+e); + //MyWorker worker = new MyWorker(); + //worker.start(); + } + }); + View rootView = inflater.inflate(R.layout.fragment_config_detail, container, false); active_Nick = getArguments().getString("item_id"); try { myJuice = new PluginContract(); - } catch (Exception e) { + } catch (Throwable e) { Log.e("fwknop2", "Juicessh exception"); } @@ -458,8 +468,12 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean ischecked) { new String[]{"com.sonelli.juicessh.api.v1.permission.READ_CONNECTIONS", "com.sonelli.juicessh.api.v1.permission.OPEN_SESSIONS"}, 0); } - juice_adapt = new ConnectionSpinnerAdapter(getActivity()); - spn_juice.setAdapter(juice_adapt); + try { + juice_adapt = new ConnectionSpinnerAdapter(getActivity()); + spn_juice.setAdapter(juice_adapt); + } catch (Throwable ex) { + Log.e("fwknop2", "Juicessh error"); + } } else { list.remove(3); adapter_ssh.notifyDataSetChanged(); @@ -507,7 +521,7 @@ public void onLoaded() { // This is so ugly... } else { getActivity().getSupportLoaderManager().restartLoader(0, null, connectionListLoader); } - } catch (Exception e) { + } catch (Throwable e) { Log.e("fwknop2", "Juicessh error"); } } else { diff --git a/app/src/main/java/biz/incomsystems/fwknop2/ConnectionListLoader.java b/app/src/main/java/biz/incomsystems/fwknop2/ConnectionListLoader.java index 4ef9271..bd7eee6 100644 --- a/app/src/main/java/biz/incomsystems/fwknop2/ConnectionListLoader.java +++ b/app/src/main/java/biz/incomsystems/fwknop2/ConnectionListLoader.java @@ -6,6 +6,7 @@ import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; +import android.util.Log; import com.sonelli.juicessh.pluginlibrary.PluginContract; @@ -36,6 +37,7 @@ public void setOnLoadedListener(OnLoadedListener listener) { @Override public Loader onCreateLoader(int id, Bundle bundle) { + try { return new CursorLoader( context, PluginContract.Connections.CONTENT_URI, @@ -44,6 +46,10 @@ public Loader onCreateLoader(int id, Bundle bundle) { null, PluginContract.Connections.SORT_ORDER_DEFAULT ); + } catch (Throwable ex) { + Log.e("fwknop2", "Juice error"); + } + return null; } @@ -54,12 +60,16 @@ public Loader onCreateLoader(int id, Bundle bundle) { */ @Override public void onLoadFinished(Loader cursorLoader, Cursor cursor) { + try { if (adapter != null) { adapter.swapCursor(cursor); if (listener != null) { listener.onLoaded(); } } + } catch (Throwable ex) { + Log.e("fwknop2", "Juice error"); + } } /** @@ -69,8 +79,12 @@ public void onLoadFinished(Loader cursorLoader, Cursor cursor) { */ @Override public void onLoaderReset(Loader cursorLoader) { + try { if (adapter != null) { adapter.swapCursor(null); } + } catch (Throwable ex) { + Log.e("fwknop2", "Juice error"); + } } } \ No newline at end of file diff --git a/app/src/main/java/biz/incomsystems/fwknop2/ConnectionSpinnerAdapter.java b/app/src/main/java/biz/incomsystems/fwknop2/ConnectionSpinnerAdapter.java index ec8d111..200264c 100644 --- a/app/src/main/java/biz/incomsystems/fwknop2/ConnectionSpinnerAdapter.java +++ b/app/src/main/java/biz/incomsystems/fwknop2/ConnectionSpinnerAdapter.java @@ -4,6 +4,7 @@ import android.content.Context; import android.database.Cursor; import android.support.v4.widget.CursorAdapter; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -30,8 +31,13 @@ public class ConnectionSpinnerAdapter extends CursorAdapter { * @param context Context used to inflate layout */ public ConnectionSpinnerAdapter(Context context) { - super(context, null, false); - this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + + super(context, null, false); + try { + this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } catch (Throwable e) { + Log.e("fwknop2", "Juice Error"); + } } /** @@ -43,14 +49,17 @@ public ConnectionSpinnerAdapter(Context context) { public UUID getConnectionId(int position) { UUID id = null; - - if (getCursor() != null) { - if(getCursor().moveToPosition(position)) { - int idIndex = getCursor().getColumnIndex(PluginContract.Connections.COLUMN_ID); - if (idIndex > -1) { - id = UUID.fromString(getCursor().getString(idIndex)); + try { + if (getCursor() != null) { + if (getCursor().moveToPosition(position)) { + int idIndex = getCursor().getColumnIndex(PluginContract.Connections.COLUMN_ID); + if (idIndex > -1) { + id = UUID.fromString(getCursor().getString(idIndex)); + } } } + } catch (Throwable ex) { + Log.e("fwknop2", "Juice error"); } return id; @@ -66,7 +75,7 @@ public UUID getConnectionId(int position) { public String getConnectionName(int position) { String name = null; - + try { if (getCursor() != null) { if(getCursor().moveToPosition(position)) { int idIndex = getCursor().getColumnIndex(PluginContract.Connections.COLUMN_NAME); @@ -75,6 +84,9 @@ public String getConnectionName(int position) { } } } + } catch (Throwable ex) { + Log.e("fwknop2", "Juice error"); + } return name; } @@ -86,11 +98,17 @@ public boolean areAllItemsEnabled() { @Override public View newView(Context context, Cursor cursor, ViewGroup viewGroup) { + try { return inflater.inflate(R.layout.spinner_list_item, null, false); + } catch (Throwable ex) { + Log.e("fwknop2", "Juice error"); + } + return null; } @Override public void bindView(View view, final Context context, Cursor cursor) { + try { int nameColumn = cursor.getColumnIndex(PluginContract.Connections.COLUMN_NAME); @@ -101,6 +119,9 @@ public void bindView(View view, final Context context, Cursor cursor) { textView.setText(name); } + } catch (Throwable ex) { + Log.e("fwknop2", "Juice error"); + } }