小编And*_*llo的帖子

检查 SASS 父选择器是否存在。是否可以

我有个问题。所以在混合中,我引用了父选择器“&”。只要 mixin 没有嵌套,这就会起作用。有没有办法检测混合是否在非嵌套场景中使用,或者检查“&”是否为空?

这在 mixin 调用未嵌套时有效

=myresponsiveMixin($media)
  @if $media == small {
    @media only screen and (max-width: $break-small)
       @content
  @else if $media == medium
    @media only screen and (min-width: $break-small + 1) and (max-width: $break-large - 1)
       @content
Run Code Online (Sandbox Code Playgroud)

当 mixin 调用嵌套时,这很有效,但在未嵌套时不会解析 '&'

 =myresponsiveMixin($media)
      @if $media == small {
        @media only screen and (max-width: $break-small)
           .classInHTMLToAllowMediaQueries &
               @content
      @else if $media == medium
        @media only screen and (min-width: $break-small + 1) and (max-width: $break-large - 1)
           .classInHTMLToAllowMediaQueries &
               @content
Run Code Online (Sandbox Code Playgroud)

所以问题是,是否有一种方法可以检查父选择器“&”的值,以便我可以在单个混合中覆盖所有基数?

sass

3
推荐指数
1
解决办法
7377
查看次数

从通知中的pendingIntent调用接收方

所以我将代码更改为调用广播接收器,而不是调用主要活动

Intent notificationIntent = new Intent(context, com.plugin.statusNotificationForGCM.statusNotificationForGCMReceiver.class);

notificationIntent.putExtra(NOTIF_RESPOND, runThis);
notificationIntent.setAction(Intent.ACTION_VIEW);
notificationIntent = notificationIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

//contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
contentIntent = PendingIntent.getBroadcast(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Run Code Online (Sandbox Code Playgroud)

问题是我在接收器中添加了它,但认为它没有运行。单击通知后看不到标签并登录控制台

public class statusNotificationForGCMReceiver extends BroadcastReceiver {
    private static final String TAG = "statusNOTIFICATIONReceiver";

    @Override
    public final void onReceive(Context context, Intent intent) {
        Log.v(TAG,"ASDFSJD FASDF ASDPFJA SDFPAUS DFPAS DFASDF");
    }
}
Run Code Online (Sandbox Code Playgroud)

我有什么想念的吗?我是否必须在清单文件中添加一些内容?

谢谢

android

2
推荐指数
1
解决办法
4553
查看次数

标签 统计

android ×1

sass ×1