Commit 2f7b4883 authored by Anton's avatar Anton

dont know

parent ffa5e168
...@@ -6,6 +6,7 @@ import android.content.Intent; ...@@ -6,6 +6,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Bundle; import android.os.Bundle;
import android.os.StrictMode;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
...@@ -87,6 +88,9 @@ public class MainActivity extends TabActivity { ...@@ -87,6 +88,9 @@ public class MainActivity extends TabActivity {
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// Log.i("MainActivity", "-----------------------onCreate"); // Log.i("MainActivity", "-----------------------onCreate");
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
abtSettings = getSharedPreferences(APP_PREFERENCES, Context.MODE_PRIVATE); abtSettings = getSharedPreferences(APP_PREFERENCES, Context.MODE_PRIVATE);
get_tabHost(); get_tabHost();
handIntent1 = getIntent().getStringExtra("IntentNumberPhone"); handIntent1 = getIntent().getStringExtra("IntentNumberPhone");
......
...@@ -24,11 +24,7 @@ import android.view.LayoutInflater; ...@@ -24,11 +24,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.BaseAdapter; import android.widget.*;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import internav.zxnet.abt.CallPhoneActivity; import internav.zxnet.abt.CallPhoneActivity;
import internav.zxnet.abt.ContactInfo; import internav.zxnet.abt.ContactInfo;
import internav.zxnet.abt.MainActivity; import internav.zxnet.abt.MainActivity;
...@@ -76,31 +72,34 @@ public class PhoneBookActivity extends Activity { ...@@ -76,31 +72,34 @@ public class PhoneBookActivity extends Activity {
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
while (true) {
String line = null; if (reader2 != null) {
try { while (true) {
line = reader2.readLine();
} catch (IOException e) { String line = null;
e.printStackTrace(); try {
} line = reader2.readLine();
if (line == null) { } catch (IOException e) {
break; e.printStackTrace();
} }
line = line.trim(); if (line == null) {
if (!(line.length() == 0 || line.charAt(0) == '#' || line.charAt(0) == '[')) { break;
int splitPos = line.indexOf(61); }
if (splitPos != -1) { line = line.trim();
String key = line.substring(0, splitPos); if (!(line.length() == 0 || line.charAt(0) == '#' || line.charAt(0) == '[')) {
String value = line.substring(splitPos + 1, line.length()).trim(); int splitPos = line.indexOf(61);
ContactInfo cci = new ContactInfo(); if (splitPos != -1) {
String key = line.substring(0, splitPos);
String value = line.substring(splitPos + 1, line.length()).trim();
ContactInfo cci = new ContactInfo();
// cci.setContactName(prop.getProperty(key)); // cci.setContactName(prop.getProperty(key));
cci.setContactName(value); cci.setContactName(value);
cci.setUserNumber(key); cci.setUserNumber(key);
listImportContacts.add(cci); listImportContacts.add(cci);
} }
} }
} }
}
if (reader2 != null) { if (reader2 != null) {
try { try {
reader2.close(); reader2.close();
...@@ -235,7 +234,11 @@ public class PhoneBookActivity extends Activity { ...@@ -235,7 +234,11 @@ public class PhoneBookActivity extends Activity {
} }
phones.close(); phones.close();
countAll++; countAll++;
but_importPhoneNumber.setText(textImport + "(Google - " + countAdded + "/" + countAll + ")"); // but_importPhoneNumber.setText(textImport + "(Google - " + countAdded + "/" + countAll + ")");
} }
} }
phoneCursor.close(); phoneCursor.close();
...@@ -282,7 +285,13 @@ public class PhoneBookActivity extends Activity { ...@@ -282,7 +285,13 @@ public class PhoneBookActivity extends Activity {
listImportContacts.clear(); listImportContacts.clear();
listView.setAdapter(listViewAdapter); listView.setAdapter(listViewAdapter);
but_importPhoneNumber.setText(textImport); but_importPhoneNumber.setText(textImport);
getPhoneContacts(); getPhoneContacts();
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
Intent intent = new Intent(IConstant.ACTION_TO_SERVICE); Intent intent = new Intent(IConstant.ACTION_TO_SERVICE);
intent.putExtra("cmd", "importPhoneNumber"); intent.putExtra("cmd", "importPhoneNumber");
sendBroadcast(intent); sendBroadcast(intent);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment