mirror of
https://github.com/nerzhul/ownCloud-SMS-App.git
synced 2025-06-24 00:06:22 +00:00
Remote account interface improvements
This commit is contained in:
parent
b3f43ce1f5
commit
3895b8cf0b
@ -43,7 +43,7 @@ public class ContactListActivity extends Activity implements ASyncContactLoad {
|
||||
ContactListActivity._accountMgr = AccountManager.get(getBaseContext());
|
||||
Account[] myAccountList =
|
||||
ContactListActivity._accountMgr.getAccountsByType(getString(R.string.account_type));
|
||||
|
||||
|
||||
// Init view
|
||||
objects = new ArrayList<>();
|
||||
setContentView(R.layout.restore_activity_contactlist);
|
||||
@ -54,19 +54,18 @@ public class ContactListActivity extends Activity implements ASyncContactLoad {
|
||||
android.R.color.holo_green_light,
|
||||
android.R.color.holo_orange_light,
|
||||
android.R.color.holo_red_light);
|
||||
|
||||
|
||||
adapter = new ContactListAdapter(getBaseContext(),
|
||||
android.R.layout.simple_spinner_item,
|
||||
objects,
|
||||
R.layout.contact_list_item,
|
||||
R.id.contactname, this);
|
||||
|
||||
|
||||
final Spinner sp = (Spinner) findViewById(R.id.contact_spinner);
|
||||
final LinearLayout contactInfos = (LinearLayout) findViewById(R.id.contactinfos_layout);
|
||||
final ProgressBar contactProgressBar = (ProgressBar) findViewById(R.id.contactlist_pgbar);
|
||||
final TextView contactPhoneList = (TextView) findViewById(R.id.contact_phonelist);
|
||||
|
||||
sp.setVisibility(View.INVISIBLE);
|
||||
contactInfos.setVisibility(View.INVISIBLE);
|
||||
|
||||
sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@ -139,22 +138,21 @@ public class ContactListActivity extends Activity implements ASyncContactLoad {
|
||||
if (element.name.equals(accountName)) {
|
||||
// Load "contacts"
|
||||
contactProgressBar.setVisibility(View.VISIBLE);
|
||||
sp.setVisibility(View.INVISIBLE);
|
||||
new ContactLoadTask(element, getBaseContext(), adapter, objects, _layout, contactProgressBar, sp).execute();
|
||||
new ContactLoadTask(element, getBaseContext(), adapter, objects, _layout, contactProgressBar, contactInfos).execute();
|
||||
|
||||
// Add refresh handler
|
||||
_layout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
_layout.setRefreshing(true);
|
||||
sp.setVisibility(View.INVISIBLE);
|
||||
contactInfos.setVisibility(View.INVISIBLE);
|
||||
contactProgressBar.setVisibility(View.VISIBLE);
|
||||
(new Handler()).post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
objects.clear();
|
||||
adapter.notifyDataSetChanged();
|
||||
new ContactLoadTask(element, getBaseContext(), adapter, objects, _layout, contactProgressBar, sp).execute();
|
||||
new ContactLoadTask(element, getBaseContext(), adapter, objects, _layout, contactProgressBar, contactInfos).execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ import android.os.AsyncTask;
|
||||
import android.provider.ContactsContract;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@ -32,11 +32,11 @@ public interface ASyncContactLoad {
|
||||
private final ArrayList<String> _objects;
|
||||
private final SwipeRefreshLayout _layout;
|
||||
private final ProgressBar _pg;
|
||||
private final Spinner _contactSpinner;
|
||||
private final LinearLayout _contactLayout;
|
||||
|
||||
public ContactLoadTask(Account account, Context context,
|
||||
ContactListAdapter adapter, ArrayList<String> objects, SwipeRefreshLayout layout,
|
||||
ProgressBar pg, Spinner sp) {
|
||||
ProgressBar pg, LinearLayout sp) {
|
||||
if (ContactLoadTask._accountMgr == null) {
|
||||
ContactLoadTask._accountMgr = AccountManager.get(context);
|
||||
}
|
||||
@ -47,7 +47,7 @@ public interface ASyncContactLoad {
|
||||
_objects = objects;
|
||||
_layout = layout;
|
||||
_pg = pg;
|
||||
_contactSpinner = sp;
|
||||
_contactLayout = sp;
|
||||
}
|
||||
@Override
|
||||
protected Boolean doInBackground(Void... params) {
|
||||
@ -141,8 +141,8 @@ public interface ASyncContactLoad {
|
||||
_pg.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
if (_contactSpinner != null) {
|
||||
_contactSpinner.setVisibility(View.VISIBLE);
|
||||
if (_contactLayout != null) {
|
||||
_contactLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@
|
||||
style="@style/StandardButton"
|
||||
android:text="@string/ma_button_sync_accounts_now" />
|
||||
|
||||
<!--<TextView
|
||||
<TextView
|
||||
android:id="@+id/tv_remoteaccount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -124,7 +124,7 @@
|
||||
android:onClick="selectRemoteAccount"
|
||||
android:background="@drawable/standard_button"
|
||||
style="@style/StandardButton"
|
||||
android:text="@string/choose_account" />-->
|
||||
android:text="@string/choose_account" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView1"
|
||||
@ -132,9 +132,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/textView1"
|
||||
android:layout_alignStart="@+id/textView1"
|
||||
android:layout_below="@+id/main_button_sync"
|
||||
android:layout_below="@+id/main_button_choose_account"
|
||||
android:layout_marginTop="33dp"
|
||||
android:src="@drawable/next_arrow" />
|
||||
<!-- android:layout_below="@+id/main_button_choose_account" -->
|
||||
<!-- android:layout_below="@+id/main_button_sync" -->
|
||||
|
||||
</RelativeLayout>
|
@ -35,28 +35,27 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<Spinner
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/contact_spinner"
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/contactlist_pgbar"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:indeterminateOnly="true"
|
||||
android:indeterminate="true"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/contactinfos_layout">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="@string/contactinfos_list"
|
||||
android:id="@+id/contactinfos_list"
|
||||
android:paddingLeft="10dp"
|
||||
android:textColor="@android:color/holo_blue_dark"/>
|
||||
|
||||
<Spinner
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/contact_spinner"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -83,7 +82,13 @@
|
||||
android:autoText="false"
|
||||
android:paddingLeft="40dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ProgressBar
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/contactlist_pgbar"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:indeterminateOnly="true"
|
||||
android:indeterminate="true"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
@ -164,5 +164,6 @@ Contributors and issue\'s reporters</string>
|
||||
<string name="choose_account">Choose account</string>
|
||||
<string name="subtitle_contact_phones">> Contact phones</string>
|
||||
<string name="pref_title_bulk_messages">Max messages to send per sync</string>
|
||||
<string name="contactinfos_list">Contact list</string>
|
||||
|
||||
</resources>
|
||||
|
@ -149,4 +149,5 @@ Les contributeurs et rapporteurs de bugs</string>
|
||||
<string name="err_sync_create_json_request_encoding">Erreur #7: Encodage inconnu à la conversion</string>
|
||||
<string name="err_sync_craft_http_request">Erreur #2: Echec de la création de la requête</string>
|
||||
<string name="pref_title_bulk_messages">Nombre maximum de messages à envoyer par synchronisation</string>
|
||||
<string name="contactinfos_list">Liste des contacts</string>
|
||||
</resources>
|
||||
|
@ -193,4 +193,5 @@ Contributors and issue\'s reporters</string>
|
||||
<string name="contactinfos_title">Contact informations</string>
|
||||
<string name="subtitle_contact_phones">> Contact phones</string>
|
||||
<string name="pref_title_bulk_messages">Max messages to send per sync</string>
|
||||
<string name="contactinfos_list">Contact list</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user