~singpolyma/cheogram-android

04748f92f9aa0a912167fc3df366484977f392f7 — Stephen Paul Weber 1 year, 8 months ago dcf3e50 + 6313d18
Merge branch 'manage-calling-accounts'

* manage-calling-accounts:
  Shortcuts to get to phone account settings screens
M src/cheogram/java/eu/siacs/conversations/ui/ManageAccountActivity.java => src/cheogram/java/eu/siacs/conversations/ui/ManageAccountActivity.java +23 -0
@@ 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

M src/cheogram/res/values/themes.xml => src/cheogram/res/values/themes.xml +1 -1
@@ 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>


M src/main/res/layout/activity_manage_accounts.xml => src/main/res/layout/activity_manage_accounts.xml +56 -2
@@ 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>
\ No newline at end of file
    <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>

M src/main/res/values/colors.xml => src/main/res/values/colors.xml +1 -0
@@ 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>