Fiw layout for Android4.0 and Simplify some code
This commit is contained in:
parent
1573577752
commit
cb5428f67c
@ -3,5 +3,6 @@
|
|||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="src" path="gen"/>
|
<classpathentry kind="src" path="gen"/>
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||||
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
key.store=/home/mathieu/mathieu/Android/keys/KeyOpenWide
|
key.store=/home/mathieu/Android/Keys/KeyOpenWide
|
||||||
key.alias=openwide
|
key.alias=openwide
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
# This file is automatically generated by Android Tools.
|
|
||||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
|
||||||
#
|
|
||||||
# This file must be checked in Version Control Systems.
|
|
||||||
#
|
|
||||||
# To customize properties used by the Ant build system use,
|
|
||||||
# "build.properties", and override values to adapt the script to your
|
|
||||||
# project structure.
|
|
||||||
|
|
||||||
# Project target.
|
|
||||||
target=android-8
|
|
36
proguard.cfg
36
proguard.cfg
@ -1,36 +0,0 @@
|
|||||||
-optimizationpasses 5
|
|
||||||
-dontusemixedcaseclassnames
|
|
||||||
-dontskipnonpubliclibraryclasses
|
|
||||||
-dontpreverify
|
|
||||||
-verbose
|
|
||||||
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
|
|
||||||
|
|
||||||
-keep public class * extends android.app.Activity
|
|
||||||
-keep public class * extends android.app.Application
|
|
||||||
-keep public class * extends android.app.Service
|
|
||||||
-keep public class * extends android.content.BroadcastReceiver
|
|
||||||
-keep public class * extends android.content.ContentProvider
|
|
||||||
-keep public class * extends android.app.backup.BackupAgentHelper
|
|
||||||
-keep public class * extends android.preference.Preference
|
|
||||||
-keep public class com.android.vending.licensing.ILicensingService
|
|
||||||
|
|
||||||
-keepclasseswithmembernames class * {
|
|
||||||
native <methods>;
|
|
||||||
}
|
|
||||||
|
|
||||||
-keepclasseswithmembernames class * {
|
|
||||||
public <init>(android.content.Context, android.util.AttributeSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
-keepclasseswithmembernames class * {
|
|
||||||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
|
||||||
}
|
|
||||||
|
|
||||||
-keepclassmembers enum * {
|
|
||||||
public static **[] values();
|
|
||||||
public static ** valueOf(java.lang.String);
|
|
||||||
}
|
|
||||||
|
|
||||||
-keep class * implements android.os.Parcelable {
|
|
||||||
public static final android.os.Parcelable$Creator *;
|
|
||||||
}
|
|
@ -2,8 +2,10 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
<ListView android:id="@+id/android:list" android:layout_width="fill_parent"
|
<ListView android:id="@+id/android:list"
|
||||||
android:layout_height="wrap_content" android:choiceMode="singleChoice" />
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:choiceMode="singleChoice" />
|
||||||
<TextView android:id="@+id/android:empty"
|
<TextView android:id="@+id/android:empty"
|
||||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
android:text="@string/nodelivery" />
|
android:text="@string/nodelivery" />
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<EditText android:id="@+id/editor" android:layout_width="fill_parent"
|
<EditText android:id="@+id/editor" android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent" android:autoText="true"
|
android:layout_height="0dip" android:autoText="true"
|
||||||
android:capitalize="sentences" android:layout_weight="1"
|
android:capitalize="sentences" android:layout_weight="1"
|
||||||
android:hint="@string/entermessage"
|
android:hint="@string/entermessage"
|
||||||
android:nextFocusRight="@+id/send"
|
android:nextFocusRight="@+id/send"
|
||||||
|
@ -1,16 +1,40 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
android:id="@+id/row_background"
|
||||||
android:orientation="horizontal">
|
android:layout_width="fill_parent"
|
||||||
<CheckBox android:id="@+id/CheckBox" android:layout_width="wrap_content" android:layout_height="wrap_content"></CheckBox>
|
android:layout_height="wrap_content"
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
android:orientation="horizontal" >
|
||||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
<CheckBox
|
||||||
android:orientation="vertical">
|
android:id="@+id/CheckBox"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="5dip" >
|
||||||
|
</CheckBox>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:padding="5dip"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/phone"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:padding="5dip"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<TextView android:id="@+id/name" android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
<TextView android:id="@+id/phone" android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -29,4 +29,5 @@
|
|||||||
<string name="message_sent">Messagen(s) enviadas</string>
|
<string name="message_sent">Messagen(s) enviadas</string>
|
||||||
<string name="enter_number">Digite o número ou selecione o contato através do ícone</string>
|
<string name="enter_number">Digite o número ou selecione o contato através do ícone</string>
|
||||||
<string name="warning_many_message">Você está prestes a enviar mais de 50 mensagens, isso poderá causar um erro no aplicativo, ocorrerá uma pausa entre o envio das mensagens. Deseja continuar o envio?</string>
|
<string name="warning_many_message">Você está prestes a enviar mais de 50 mensagens, isso poderá causar um erro no aplicativo, ocorrerá uma pausa entre o envio das mensagens. Deseja continuar o envio?</string>
|
||||||
|
<string name="more_message">Você está pronto para 50 mensagens mais?</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
package com.hectorone.multismssender;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
public class ContactRow extends LinearLayout {
|
|
||||||
|
|
||||||
CheckBox mSelectedCheckBox;
|
|
||||||
TextView mNameTextView;
|
|
||||||
TextView mNumberView;
|
|
||||||
LinearLayout mInfoLayout;
|
|
||||||
Long mId;
|
|
||||||
|
|
||||||
public ContactRow(Context context) {
|
|
||||||
super(context);
|
|
||||||
|
|
||||||
mSelectedCheckBox = new CheckBox(context);
|
|
||||||
mInfoLayout = new LinearLayout(context);
|
|
||||||
|
|
||||||
mNameTextView = new TextView(context);
|
|
||||||
mNumberView = new TextView(context);
|
|
||||||
|
|
||||||
mNameTextView.setTextSize(30,0);
|
|
||||||
mNumberView.setTextSize(18,0);
|
|
||||||
|
|
||||||
|
|
||||||
mSelectedCheckBox.setText("");
|
|
||||||
mSelectedCheckBox.setFocusable(false);
|
|
||||||
|
|
||||||
|
|
||||||
this.addView(mSelectedCheckBox, new LayoutParams(LayoutParams.WRAP_CONTENT,
|
|
||||||
LayoutParams.FILL_PARENT));
|
|
||||||
mInfoLayout.setOrientation(LinearLayout.VERTICAL);
|
|
||||||
mInfoLayout.addView(mNameTextView, new LayoutParams(LayoutParams.FILL_PARENT,
|
|
||||||
LayoutParams.WRAP_CONTENT));
|
|
||||||
mInfoLayout.addView(mNumberView, new LayoutParams(LayoutParams.FILL_PARENT,
|
|
||||||
LayoutParams.WRAP_CONTENT));
|
|
||||||
|
|
||||||
this.addView(mInfoLayout, new LayoutParams(LayoutParams.WRAP_CONTENT,
|
|
||||||
LayoutParams.FILL_PARENT));
|
|
||||||
|
|
||||||
this.setOnClickListener(new OnClickListener() {
|
|
||||||
|
|
||||||
public void onClick(View v) {
|
|
||||||
mSelectedCheckBox.performClick();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void display(String name, String number, boolean isSelected) {
|
|
||||||
mNameTextView.setText(name);
|
|
||||||
mNumberView.setText(number);
|
|
||||||
mSelectedCheckBox.setChecked(isSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void display(String name, String number, boolean isSelected, long id) {
|
|
||||||
display( name, number, isSelected);
|
|
||||||
mId = id;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -17,6 +17,7 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.SimpleCursorAdapter;
|
import android.widget.SimpleCursorAdapter;
|
||||||
|
|
||||||
public class GroupEditActivity extends ListActivity {
|
public class GroupEditActivity extends ListActivity {
|
||||||
@ -148,42 +149,52 @@ public class GroupEditActivity extends ListActivity {
|
|||||||
Cursor c = getCursor();
|
Cursor c = getCursor();
|
||||||
startManagingCursor(c);
|
startManagingCursor(c);
|
||||||
c.moveToPosition(position);
|
c.moveToPosition(position);
|
||||||
String name = c.getString(nameidx);
|
// String name = c.getString(nameidx);
|
||||||
String number = c.getString(numberidx);
|
String contactNumber = c.getString(numberidx);
|
||||||
long id = c.getLong(idIdx);
|
long id = c.getLong(idIdx);
|
||||||
ContactRow contact;
|
|
||||||
if (convertView == null) {
|
|
||||||
contact = new ContactRow(mContext);
|
|
||||||
}else {
|
|
||||||
contact = (ContactRow) convertView;
|
|
||||||
}
|
|
||||||
contact.display(name, number, selected.contains(number), id);
|
|
||||||
contact.mSelectedCheckBox.setOnClickListener(new addNumberToGroupClickListener(contact));
|
|
||||||
|
|
||||||
return contact;
|
View v = super.getView(position, convertView, parent);
|
||||||
|
LinearLayout background = (LinearLayout)v.findViewById(R.id.row_background);
|
||||||
|
|
||||||
|
CheckBox checkbox = (CheckBox)v.findViewById(R.id.CheckBox);
|
||||||
|
checkbox.setOnClickListener(new addNumberToGroupClickListener(id));
|
||||||
|
checkbox.setChecked(selected.contains(contactNumber));
|
||||||
|
|
||||||
|
|
||||||
|
background.setOnClickListener(new OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
CheckBox checkbox = (CheckBox)v.findViewById(R.id.CheckBox);
|
||||||
|
checkbox.performClick();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return v;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class addNumberToGroupClickListener implements OnClickListener{
|
private class addNumberToGroupClickListener implements OnClickListener{
|
||||||
|
|
||||||
ContactRow mContact;
|
Long mId;
|
||||||
|
|
||||||
|
|
||||||
public addNumberToGroupClickListener(ContactRow mContact) {
|
public addNumberToGroupClickListener(Long id) {
|
||||||
super();
|
super();
|
||||||
this.mContact = mContact;
|
this.mId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
CheckBox cBox = (CheckBox)v;
|
CheckBox cBox = (CheckBox)v;
|
||||||
createGroup();
|
createGroup();
|
||||||
long phoneId = mContact.mId;
|
|
||||||
if(cBox.isChecked()) {
|
if(cBox.isChecked()) {
|
||||||
mDb.addPhoneToGroup(mGid, phoneId);
|
mDb.addPhoneToGroup(mGid, mId);
|
||||||
}else {
|
}else {
|
||||||
mDb.removePhoneToGroup(mGid, phoneId);
|
mDb.removePhoneToGroup(mGid, mId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,7 @@ public class ListEntryActivity extends ListActivity {
|
|||||||
public EntryCursorAdapter(Context context, int layout, Cursor c,
|
public EntryCursorAdapter(Context context, int layout, Cursor c,
|
||||||
String[] from, int[] to) {
|
String[] from, int[] to) {
|
||||||
super(context, layout, c, from, to);
|
super(context, layout, c, from, to);
|
||||||
|
//TODO this.getCursor()
|
||||||
this.c = c;
|
this.c = c;
|
||||||
deliveredIdx = c.getColumnIndex(DeliveryDbAdapter.KEY_DELIVERY_ENTRY_DELIVERED);
|
deliveredIdx = c.getColumnIndex(DeliveryDbAdapter.KEY_DELIVERY_ENTRY_DELIVERED);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.hectorone.multismssender;
|
|||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -18,7 +17,9 @@ import android.view.View.OnClickListener;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.SimpleCursorAdapter;
|
import android.widget.SimpleCursorAdapter;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
public class PhoneNumberSelection extends ListActivity
|
public class PhoneNumberSelection extends ListActivity
|
||||||
@ -85,11 +86,6 @@ public class PhoneNumberSelection extends ListActivity
|
|||||||
Contacts.DISPLAY_NAME, Phone.NUMBER
|
Contacts.DISPLAY_NAME, Phone.NUMBER
|
||||||
}, new int[] {R.id.name, R.id.phone}, mSelectedSet);
|
}, new int[] {R.id.name, R.id.phone}, mSelectedSet);
|
||||||
|
|
||||||
/*Cursor c = getContentResolver().query(Phones.CONTENT_URI, null, null, null, Phones.NAME);
|
|
||||||
startManagingCursor(c);
|
|
||||||
mAdpater = new PhoneDataListAdapter(this, R.layout.number_row, c, new String[] {
|
|
||||||
Phones.NAME, Phones.NUMBER
|
|
||||||
}, new int[] {R.id.name, R.id.phone}, mSelectedSet);*/
|
|
||||||
|
|
||||||
setListAdapter(mAdpater);
|
setListAdapter(mAdpater);
|
||||||
}
|
}
|
||||||
@ -97,7 +93,6 @@ public class PhoneNumberSelection extends ListActivity
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
super.onCreateOptionsMenu(menu);
|
super.onCreateOptionsMenu(menu);
|
||||||
//menu.add(0, INSERT_ID,0, R.string.add_group);
|
|
||||||
menu.add(0, SELECT_ALL_ID, 0, R.string.select_all);
|
menu.add(0, SELECT_ALL_ID, 0, R.string.select_all);
|
||||||
menu.add(0, DESELECT_ALL_ID, 0, R.string.deselect_all);
|
menu.add(0, DESELECT_ALL_ID, 0, R.string.deselect_all);
|
||||||
return true;
|
return true;
|
||||||
@ -161,53 +156,51 @@ public class PhoneNumberSelection extends ListActivity
|
|||||||
|
|
||||||
public class PhoneDataListAdapter extends SimpleCursorAdapter{
|
public class PhoneDataListAdapter extends SimpleCursorAdapter{
|
||||||
|
|
||||||
int nameidx;
|
|
||||||
int numberidx;
|
|
||||||
Context mContext;
|
|
||||||
|
|
||||||
public PhoneDataListAdapter(Context context, int layout, Cursor c,
|
public PhoneDataListAdapter(Context context, int layout, Cursor c,
|
||||||
String[] from, int[] to, HashSet<String> selected) {
|
String[] from, int[] to, HashSet<String> selected) {
|
||||||
super(context, layout, c, from, to);
|
super(context, layout, c, from, to);
|
||||||
nameidx = c.getColumnIndex(Contacts.DISPLAY_NAME);
|
|
||||||
numberidx = c.getColumnIndex(Phone.NUMBER);
|
|
||||||
mContext = context;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
Cursor c = getCursor();
|
|
||||||
c.moveToPosition(position);
|
|
||||||
String name = c.getString(nameidx);
|
|
||||||
String number = c.getString(numberidx);
|
|
||||||
ContactRow contact;
|
|
||||||
if (convertView == null) {
|
|
||||||
contact = new ContactRow(mContext);
|
|
||||||
}else {
|
|
||||||
contact = (ContactRow) convertView;
|
|
||||||
}
|
|
||||||
contact.display(name, number, mSelectedSet.contains(number));
|
|
||||||
contact.mSelectedCheckBox.setOnClickListener(new addNumberToSelectedClickListener(contact));
|
|
||||||
|
|
||||||
return contact;
|
View v = super.getView(position, convertView, parent);
|
||||||
|
LinearLayout background = (LinearLayout)v.findViewById(R.id.row_background);
|
||||||
|
String contactNumber = ((TextView)v.findViewById(R.id.phone)).getText().toString();
|
||||||
|
|
||||||
|
CheckBox checkbox = (CheckBox)v.findViewById(R.id.CheckBox);
|
||||||
|
checkbox.setOnClickListener(new addNumberToSelectedClickListener(contactNumber));
|
||||||
|
checkbox.setChecked(mSelectedSet.contains(contactNumber));
|
||||||
|
|
||||||
|
|
||||||
|
background.setOnClickListener(new OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
CheckBox checkbox = (CheckBox)v.findViewById(R.id.CheckBox);
|
||||||
|
checkbox.performClick();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class addNumberToSelectedClickListener implements OnClickListener{
|
private class addNumberToSelectedClickListener implements OnClickListener{
|
||||||
|
|
||||||
ContactRow contact;
|
String contactNumber;
|
||||||
|
|
||||||
public addNumberToSelectedClickListener(ContactRow contact) {
|
public addNumberToSelectedClickListener(String contact) {
|
||||||
this.contact = contact;
|
this.contactNumber = contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
CheckBox checkBox = (CheckBox)v;
|
CheckBox checkBox = (CheckBox)v;
|
||||||
if(checkBox.isChecked()) {
|
if(checkBox.isChecked()) {
|
||||||
mSelectedSet.add(contact.mNumberView.getText().toString());
|
mSelectedSet.add(contactNumber);
|
||||||
}else {
|
}else {
|
||||||
mSelectedSet.remove(contact.mNumberView.getText().toString());
|
mSelectedSet.remove(contactNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user