Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80f7f771 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Resolve all build resource conflicts."

parents ecb63000 e760e420
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -331,7 +331,7 @@ public class CallSubjectDialog extends Activity {
      mNumberView.setText(
          TextUtils.isEmpty(mNumberLabel)
              ? mDisplayNumber
              : getString(R.string.call_subject_type_and_number, mNumberLabel, mDisplayNumber));
              : getString(R.string.old_call_subject_type_and_number, mNumberLabel, mDisplayNumber));
    } else {
      mNumberView.setVisibility(View.GONE);
      mNumberView.setText(null);
+1 −1
Original line number Diff line number Diff line
@@ -395,7 +395,7 @@

  <!-- String used to build a phone number type and phone number string.
       Example: Mobile 650-555-1212  -->
  <string name="call_subject_type_and_number"><xliff:g example="Mobile" id="type">%1$s</xliff:g> <xliff:g example="(650) 555-1212" id="number">%2$s</xliff:g></string>
  <string name="old_call_subject_type_and_number"><xliff:g example="Mobile" id="type">%1$s</xliff:g> <xliff:g example="(650) 555-1212" id="number">%2$s</xliff:g></string>

  <!-- String format to describe a tab e.g.call history tab. -->
  <string name="tab_title"><xliff:g id="title">%1$s</xliff:g> tab.</string>
+0 −34
Original line number Diff line number Diff line
@@ -16,34 +16,21 @@

package com.android.dialer.app;

import android.annotation.TargetApi;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.support.v4.content.pm.ShortcutInfoCompat;
import android.support.v4.content.pm.ShortcutManagerCompat;
import android.support.v4.graphics.drawable.IconCompat;
import com.android.dialer.configprovider.ConfigProviderBindings;

/** This class is a copy of dialer.main.impl.MainImpl to get around a dependency issue. */
public class MainComponent {

  private static final String SHORTCUT_KEY = "nui_launcher_shortcut";

  public static boolean isNewUiEnabled(Context context) {
    return ConfigProviderBindings.get(context).getBoolean("is_nui_shortcut_enabled", false);
  }

  public static void createNewUiLauncherShortcut(Context context) {
    enableComponent(context);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
      createLauncherShortcutO(context);
    } else {
      createLauncherShortcutPreO(context);
    }
  }

  public static boolean isNuiComponentEnabled(Context context) {
@@ -70,27 +57,6 @@ public class MainComponent {
            PackageManager.DONT_KILL_APP);
  }

  @TargetApi(VERSION_CODES.O)
  private static void createLauncherShortcutO(Context context) {
    ShortcutInfoCompat shortcutInfo =
        new ShortcutInfoCompat.Builder(context, SHORTCUT_KEY)
            .setIcon(IconCompat.createWithResource(context, R.drawable.nui_launcher_icon))
            .setIntent(getIntent(context))
            .setShortLabel(context.getString(R.string.nui_shortcut_name))
            .build();
    ShortcutManagerCompat.requestPinShortcut(context, shortcutInfo, null);
  }

  private static void createLauncherShortcutPreO(Context context) {
    Intent intent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
    intent.putExtra(
        Intent.EXTRA_SHORTCUT_ICON,
        Intent.ShortcutIconResource.fromContext(context, R.drawable.nui_launcher_icon));
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, context.getString(R.string.nui_shortcut_name));
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, getIntent(context));
    context.sendBroadcast(intent);
  }

  /**
   * @param context Context of the application package implementing MainActivity class.
   * @return intent for MainActivity.class
Loading