mirror of
https://github.com/nerzhul/ownCloud-SMS-App.git
synced 2026-08-23 06:13:04 +00:00
Improve restore activity a little, not perfect but better
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package fr.unix_experience.owncloud_sms.adapters;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -10,20 +9,18 @@ import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import fr.unix_experience.owncloud_sms.R;
|
||||
|
||||
public class ContactListAdapter extends ArrayAdapter<String> {
|
||||
private final ArrayList<String> _objects;
|
||||
private static int _itemLayout;
|
||||
private static int _fieldId;
|
||||
private final Activity _activity;
|
||||
|
||||
// Design
|
||||
private final static int _itemLayout = R.layout.contact_list_item;
|
||||
private final static int _fieldId = R.id.contactname;
|
||||
|
||||
public ContactListAdapter(Context context, int resource,
|
||||
ArrayList<String> objects, int itemLayout,
|
||||
int fieldId, Activity activity) {
|
||||
super(context, resource, objects);
|
||||
public ContactListAdapter(Context context, ArrayList<String> objects) {
|
||||
super(context, android.R.layout.simple_spinner_item, objects);
|
||||
_objects = objects;
|
||||
ContactListAdapter._itemLayout = itemLayout;
|
||||
ContactListAdapter._fieldId = fieldId;
|
||||
_activity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package fr.unix_experience.owncloud_sms.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import fr.unix_experience.owncloud_sms.R;
|
||||
|
||||
public class RecoveryPhoneNumberListViewAdapter extends ArrayAdapter<String> {
|
||||
private static final String TAG = "RecPhoneNumberListVAdp";
|
||||
private static int _fieldId = R.id.recovery_phone;
|
||||
private static int _itemLayout = R.layout.recovery_phone_list_item;
|
||||
private static int resource = android.R.layout.simple_list_item_2;
|
||||
|
||||
public RecoveryPhoneNumberListViewAdapter(Context context) {
|
||||
super(context, resource, new ArrayList<String>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View v = convertView;
|
||||
if (v == null) {
|
||||
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
v = inflater.inflate(RecoveryPhoneNumberListViewAdapter._itemLayout, null);
|
||||
}
|
||||
|
||||
TextView label = (TextView) v.findViewById(RecoveryPhoneNumberListViewAdapter._fieldId);
|
||||
if (label != null) {
|
||||
final String l = getItem(position).toString();
|
||||
label.setText(getItem(position).toString());
|
||||
v.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Log.d(TAG, "Clicked on phone " + l);
|
||||
}
|
||||
});
|
||||
v.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
Log.d(TAG, "Long clicked on phone " + l);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user