Commit 2f7b4883 authored by Anton's avatar Anton

dont know

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