diff --git a/APIVersions/ReadWriteStrict/AndroidManifest.xml b/APIVersions/ReadWriteStrict/AndroidManifest.xml old mode 100755 new mode 100644 diff --git a/APIVersions/ReadWriteStrict/res/layout/main.xml b/APIVersions/ReadWriteStrict/res/layout/main.xml old mode 100755 new mode 100644 index 2a672c6..77998b8 --- a/APIVersions/ReadWriteStrict/res/layout/main.xml +++ b/APIVersions/ReadWriteStrict/res/layout/main.xml @@ -1,8 +1,8 @@ + android:id="@+id/editor" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:singleLine="false" + android:gravity="top" + /> diff --git a/APIVersions/ReadWriteStrict/res/values/strings.xml b/APIVersions/ReadWriteStrict/res/values/strings.xml old mode 100755 new mode 100644 index af36c8f..e5be035 --- a/APIVersions/ReadWriteStrict/res/values/strings.xml +++ b/APIVersions/ReadWriteStrict/res/values/strings.xml @@ -1,4 +1,4 @@ - ReadWriteFileDemo + ReadWriteFileDemo \ No newline at end of file diff --git a/APIVersions/ReadWriteStrict/src/com/commonsware/android/readwrite/ReadWriteFileDemo.java b/APIVersions/ReadWriteStrict/src/com/commonsware/android/readwrite/ReadWriteFileDemo.java old mode 100755 new mode 100644 index a667631..31f8a49 --- a/APIVersions/ReadWriteStrict/src/com/commonsware/android/readwrite/ReadWriteFileDemo.java +++ b/APIVersions/ReadWriteStrict/src/com/commonsware/android/readwrite/ReadWriteFileDemo.java @@ -1,15 +1,15 @@ /*** - Copyright (c) 2008-2011 CommonsWare, LLC - - Licensed under the Apache License, Version 2.0 (the "License"); you may - not use this file except in compliance with the License. You may obtain - a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Copyright (c) 2008-2011 CommonsWare, LLC + + Licensed under the Apache License, Version 2.0 (the "License"); you may + not use this file except in compliance with the License. You may obtain + a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ package com.commonsware.android.readwrite; @@ -28,63 +28,63 @@ import java.io.OutputStreamWriter; public class ReadWriteFileDemo extends Activity { - private final static String NOTES="notes.txt"; - private EditText editor; - - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - setContentView(R.layout.main); - - StrictWrapper.init(); - - editor=(EditText)findViewById(R.id.editor); - } - - public void onResume() { - super.onResume(); - - try { - InputStream in=openFileInput(NOTES); - - if (in!=null) { - InputStreamReader tmp=new InputStreamReader(in); - BufferedReader reader=new BufferedReader(tmp); - String str; - StringBuilder buf=new StringBuilder(); - - while ((str = reader.readLine()) != null) { - buf.append(str+"\n"); - } - - in.close(); - editor.setText(buf.toString()); - } - } - catch (java.io.FileNotFoundException e) { - // that's OK, we probably haven't created it yet - } - catch (Throwable t) { - Toast - .makeText(this, "Exception: "+t.toString(), Toast.LENGTH_LONG) - .show(); - } - } - - public void onPause() { - super.onPause(); - - try { - OutputStreamWriter out= - new OutputStreamWriter(openFileOutput(NOTES, 0)); - - out.write(editor.getText().toString()); - out.close(); - } - catch (Throwable t) { - Toast - .makeText(this, "Exception: "+t.toString(), Toast.LENGTH_LONG) - .show(); - } - } + private final static String NOTES="notes.txt"; + private EditText editor; + + @Override + public void onCreate(Bundle icicle) { + super.onCreate(icicle); + setContentView(R.layout.main); + + StrictWrapper.init(); + + editor=(EditText)findViewById(R.id.editor); + } + + public void onResume() { + super.onResume(); + + try { + InputStream in=openFileInput(NOTES); + + if (in!=null) { + InputStreamReader tmp=new InputStreamReader(in); + BufferedReader reader=new BufferedReader(tmp); + String str; + StringBuilder buf=new StringBuilder(); + + while ((str = reader.readLine()) != null) { + buf.append(str+"\n"); + } + + in.close(); + editor.setText(buf.toString()); + } + } + catch (java.io.FileNotFoundException e) { + // that's OK, we probably haven't created it yet + } + catch (Throwable t) { + Toast + .makeText(this, "Exception: "+t.toString(), Toast.LENGTH_LONG) + .show(); + } + } + + public void onPause() { + super.onPause(); + + try { + OutputStreamWriter out= + new OutputStreamWriter(openFileOutput(NOTES, 0)); + + out.write(editor.getText().toString()); + out.close(); + } + catch (Throwable t) { + Toast + .makeText(this, "Exception: "+t.toString(), Toast.LENGTH_LONG) + .show(); + } + } } \ No newline at end of file diff --git a/APIVersions/ReadWriteStrict/src/com/commonsware/android/readwrite/StrictForRealz.java b/APIVersions/ReadWriteStrict/src/com/commonsware/android/readwrite/StrictForRealz.java index a336189..0c3bda7 100644 --- a/APIVersions/ReadWriteStrict/src/com/commonsware/android/readwrite/StrictForRealz.java +++ b/APIVersions/ReadWriteStrict/src/com/commonsware/android/readwrite/StrictForRealz.java @@ -1,15 +1,15 @@ /*** - Copyright (c) 2011 CommonsWare, LLC - - Licensed under the Apache License, Version 2.0 (the "License"); you may - not use this file except in compliance with the License. You may obtain - a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Copyright (c) 2011 CommonsWare, LLC + + Licensed under the Apache License, Version 2.0 (the "License"); you may + not use this file except in compliance with the License. You may obtain + a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ package com.commonsware.android.readwrite; @@ -17,10 +17,10 @@ import android.os.StrictMode; class StrictForRealz extends StrictWrapper { - StrictForRealz() { - StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() - .detectAll() - .penaltyLog() - .build()); - } + StrictForRealz() { + StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() + .detectAll() + .penaltyLog() + .build()); + } } \ No newline at end of file diff --git a/APIVersions/ReadWriteStrict/src/com/commonsware/android/readwrite/StrictWrapper.java b/APIVersions/ReadWriteStrict/src/com/commonsware/android/readwrite/StrictWrapper.java index 1772b75..c217ddd 100644 --- a/APIVersions/ReadWriteStrict/src/com/commonsware/android/readwrite/StrictWrapper.java +++ b/APIVersions/ReadWriteStrict/src/com/commonsware/android/readwrite/StrictWrapper.java @@ -1,15 +1,15 @@ /*** - Copyright (c) 2011 CommonsWare, LLC - - Licensed under the Apache License, Version 2.0 (the "License"); you may - not use this file except in compliance with the License. You may obtain - a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Copyright (c) 2011 CommonsWare, LLC + + Licensed under the Apache License, Version 2.0 (the "License"); you may + not use this file except in compliance with the License. You may obtain + a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ package com.commonsware.android.readwrite; @@ -17,18 +17,18 @@ import android.os.Build; abstract class StrictWrapper { - static private StrictWrapper INSTANCE=null; - - static public void init() { - if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.GINGERBREAD) { - INSTANCE=new StrictForRealz(); - } - else { - INSTANCE=new NotAllThatStrict(); - } - } - - static class NotAllThatStrict extends StrictWrapper { - // no methods needed - } + static private StrictWrapper INSTANCE=null; + + static public void init() { + if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.GINGERBREAD) { + INSTANCE=new StrictForRealz(); + } + else { + INSTANCE=new NotAllThatStrict(); + } + } + + static class NotAllThatStrict extends StrictWrapper { + // no methods needed + } } \ No newline at end of file diff --git a/Activities/IntentTab/AndroidManifest.xml b/Activities/IntentTab/AndroidManifest.xml old mode 100755 new mode 100644 diff --git a/Activities/IntentTab/res/layout/main.xml b/Activities/IntentTab/res/layout/main.xml old mode 100755 new mode 100644 index 3b808d3..24eeb2a --- a/Activities/IntentTab/res/layout/main.xml +++ b/Activities/IntentTab/res/layout/main.xml @@ -1,12 +1,12 @@ - + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + > + \ No newline at end of file diff --git a/Activities/IntentTab/res/values/strings.xml b/Activities/IntentTab/res/values/strings.xml old mode 100755 new mode 100644 index cac7fa8..091ba6d --- a/Activities/IntentTab/res/values/strings.xml +++ b/Activities/IntentTab/res/values/strings.xml @@ -1,4 +1,4 @@ - IntentTabDemo + IntentTabDemo \ No newline at end of file diff --git a/Activities/IntentTab/src/com/commonsware/android/intenttab/CWBrowser.java b/Activities/IntentTab/src/com/commonsware/android/intenttab/CWBrowser.java old mode 100755 new mode 100644 index f7c8d92..90b3eec --- a/Activities/IntentTab/src/com/commonsware/android/intenttab/CWBrowser.java +++ b/Activities/IntentTab/src/com/commonsware/android/intenttab/CWBrowser.java @@ -1,15 +1,15 @@ /*** - Copyright (c) 2008-2011 CommonsWare, LLC - - Licensed under the Apache License, Version 2.0 (the "License"); you may - not use this file except in compliance with the License. You may obtain - a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Copyright (c) 2008-2011 CommonsWare, LLC + + Licensed under the Apache License, Version 2.0 (the "License"); you may + not use this file except in compliance with the License. You may obtain + a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ package com.commonsware.android.intenttab; @@ -21,16 +21,16 @@ import android.webkit.WebView; public class CWBrowser extends Activity { - public static final String URL="com.commonsware.android.intenttab.URL"; - private WebView browser; - - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - - browser=new WebView(this); - setContentView(browser); - browser.loadUrl(getIntent().getStringExtra(URL)); - } + public static final String URL="com.commonsware.android.intenttab.URL"; + private WebView browser; + + @Override + public void onCreate(Bundle icicle) { + super.onCreate(icicle); + + browser=new WebView(this); + setContentView(browser); + browser.loadUrl(getIntent().getStringExtra(URL)); + } } diff --git a/Activities/IntentTab/src/com/commonsware/android/intenttab/IntentTabDemo.java b/Activities/IntentTab/src/com/commonsware/android/intenttab/IntentTabDemo.java old mode 100755 new mode 100644 index 8b5aefb..8695961 --- a/Activities/IntentTab/src/com/commonsware/android/intenttab/IntentTabDemo.java +++ b/Activities/IntentTab/src/com/commonsware/android/intenttab/IntentTabDemo.java @@ -1,15 +1,15 @@ /*** - Copyright (c) 2008-2011 CommonsWare, LLC - - Licensed under the Apache License, Version 2.0 (the "License"); you may - not use this file except in compliance with the License. You may obtain - a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Copyright (c) 2008-2011 CommonsWare, LLC + + Licensed under the Apache License, Version 2.0 (the "License"); you may + not use this file except in compliance with the License. You may obtain + a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ package com.commonsware.android.intenttab; @@ -23,22 +23,22 @@ import android.widget.TabHost; public class IntentTabDemo extends TabActivity { - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); - TabHost host=getTabHost(); - Intent i=new Intent(this, CWBrowser.class); - - i.putExtra(CWBrowser.URL, "http://commonsware.com"); - host.addTab(host.newTabSpec("one") - .setIndicator("CW") - .setContent(i)); - - i=new Intent(i); - i.putExtra(CWBrowser.URL, "http://www.android.com"); - host.addTab(host.newTabSpec("two") - .setIndicator("Android") - .setContent(i)); - } + TabHost host=getTabHost(); + Intent i=new Intent(this, CWBrowser.class); + + i.putExtra(CWBrowser.URL, "http://commonsware.com"); + host.addTab(host.newTabSpec("one") + .setIndicator("CW") + .setContent(i)); + + i=new Intent(i); + i.putExtra(CWBrowser.URL, "http://www.android.com"); + host.addTab(host.newTabSpec("two") + .setIndicator("Android") + .setContent(i)); + } } diff --git a/Activities/Launch/AndroidManifest.xml b/Activities/Launch/AndroidManifest.xml old mode 100755 new mode 100644 diff --git a/Activities/Launch/res/layout/main.xml b/Activities/Launch/res/layout/main.xml old mode 100755 new mode 100644 index cc04dbd..e14c492 --- a/Activities/Launch/res/layout/main.xml +++ b/Activities/Launch/res/layout/main.xml @@ -1,44 +1,44 @@ - - - - - - - -