Shortcuts to get to phone account settings screens
Helpful because they can be hard to find, and one or both of them is sometimes straight up hidden on some ROMs.
This commit is contained in:
parent
426a4770f3
commit
6313d18291
|
@ -1,6 +1,7 @@
|
|||
package eu.siacs.conversations.ui;
|
||||
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.security.KeyChain;
|
||||
|
@ -28,6 +29,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.R;
|
||||
import eu.siacs.conversations.entities.Account;
|
||||
import eu.siacs.conversations.entities.Contact;
|
||||
import eu.siacs.conversations.services.XmppConnectionService;
|
||||
import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
|
||||
import eu.siacs.conversations.ui.adapter.AccountAdapter;
|
||||
|
@ -72,6 +74,27 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
|||
}
|
||||
invalidateOptionsMenu();
|
||||
mAccountAdapter.notifyDataSetChanged();
|
||||
|
||||
findViewById(R.id.phone_accounts).setVisibility(View.GONE);
|
||||
findViewById(R.id.phone_accounts).setOnClickListener((View v) -> {
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent(new ComponentName("com.android.server.telecom",
|
||||
"com.android.server.telecom.settings.EnableAccountPreferenceActivity"));
|
||||
startActivity(intent);
|
||||
});
|
||||
findViewById(R.id.phone_accounts_settings).setOnClickListener((View v) -> {
|
||||
startActivity(new Intent(android.telecom.TelecomManager.ACTION_CHANGE_PHONE_ACCOUNTS));
|
||||
});
|
||||
|
||||
outer:
|
||||
for (Account account : xmppConnectionService.getAccounts()) {
|
||||
for (Contact contact : account.getRoster().getContacts()) {
|
||||
if (contact.getPresences().anyIdentity("gateway", "pstn")) {
|
||||
findViewById(R.id.phone_accounts).setVisibility(View.VISIBLE);
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -151,7 +151,7 @@
|
|||
<style name="ConversationsTheme.Dark" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="colorPrimary">@color/perpy</item>
|
||||
<item name="colorPrimaryDark">#1E0036</item>
|
||||
<item name="colorAccent">#FFC700</item>
|
||||
<item name="colorAccent">@color/yeller</item>
|
||||
<item name="popupOverlayStyle">@style/ThemeOverlay.AppCompat.Dark</item>
|
||||
<item name="android:navigationBarColor" tools:targetApi="21">@color/black</item>
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="?attr/color_background_primary"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<include layout="@layout/toolbar" />
|
||||
|
||||
|
@ -15,4 +16,57 @@
|
|||
android:dividerHeight="0dp" >
|
||||
</ListView>
|
||||
|
||||
</LinearLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/phone_accounts"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?selectableItemBackground"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/phone_accounts_image"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:src="@drawable/ic_call_white_48dp"
|
||||
android:background="@color/yeller"
|
||||
app:riv_corner_radius="2dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@+id/phone_accounts_image"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/avatar_item_distance">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollHorizontally="false"
|
||||
android:singleLine="true"
|
||||
android:text="Manage Phone Accounts"
|
||||
android:textAppearance="@style/TextAppearance.Conversations.Subhead" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Android system dialler integration"
|
||||
android:textAppearance="@style/TextAppearance.Conversations.Body2" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/phone_accounts_settings"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingRight="16dp"
|
||||
android:src="?attr/icon_settings"
|
||||
app:riv_corner_radius="2dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="perpy">#7401CF</color>
|
||||
<color name="yeller">#FFC700</color>
|
||||
<color name="black">#ff000000</color>
|
||||
<color name="black87">#de000000</color>
|
||||
<color name="black54">#8a000000</color>
|
||||
|
|
Loading…
Reference in a new issue