Skip to content

Commit

Permalink
converted tabs to spaces for better GitHub rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Murphy committed Oct 25, 2011
1 parent 3685228 commit a867b82
Show file tree
Hide file tree
Showing 413 changed files with 8,892 additions and 8,892 deletions.
Empty file modified APIVersions/ReadWriteStrict/AndroidManifest.xml
100755 → 100644
Empty file.
12 changes: 6 additions & 6 deletions APIVersions/ReadWriteStrict/res/layout/main.xml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/editor"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:singleLine="false"
android:gravity="top"
/>
android:id="@+id/editor"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:singleLine="false"
android:gravity="top"
/>
2 changes: 1 addition & 1 deletion APIVersions/ReadWriteStrict/res/values/strings.xml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">ReadWriteFileDemo</string>
<string name="app_name">ReadWriteFileDemo</string>
</resources>
140 changes: 70 additions & 70 deletions APIVersions/ReadWriteStrict/src/com/commonsware/android/readwrite/ReadWriteFileDemo.java
100755 → 100644
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
/***
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;

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());
}
}
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
/***
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;

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
}
}
Empty file modified Activities/IntentTab/AndroidManifest.xml
100755 → 100644
Empty file.
18 changes: 9 additions & 9 deletions Activities/IntentTab/res/layout/main.xml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, IntentTabDemo"
/>
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, IntentTabDemo"
/>
</LinearLayout>
2 changes: 1 addition & 1 deletion Activities/IntentTab/res/values/strings.xml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">IntentTabDemo</string>
<string name="app_name">IntentTabDemo</string>
</resources>
44 changes: 22 additions & 22 deletions Activities/IntentTab/src/com/commonsware/android/intenttab/CWBrowser.java
100755 → 100644
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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));
}
}

Loading

0 comments on commit a867b82

Please sign in to comment.