小编sar*_*ter的帖子

为什么我的 makefile 在构建后会调用 rm 依赖项?

当我运行时make -j tests,它使测试正常,但随后删除了依赖项。为什么会这样?我该如何解决?对于复杂的 makefile,我深表歉意。makefile 的相关部分是测试部分。

生成文件:

# Build tools
CC = clang++ -g --std=gnu++11 -O3
LEX = flex
YACC = bison -d

# Includes
CC_HEADERS   = `llvm-config-3.5 --cppflags`
CC_LIBRARIES = -lboost_program_options `llvm-config-3.5 --libs all --ldflags` -ltinfo -lpthread -lffi -ldl -lm -lz

# Created files
GENERATED_SOURCES = parser.cpp tokens.cpp
GENERATED_FILES   = $(GENERATED_SOURCES)
EXEC = brainfuck.out

# Test cases
TESTS            = $(wildcard ./tests/*.bf)
TESTS_IN         = $(TESTS:.bf=.in)
TESTS_BUILD      = $(TESTS:.bf=.build)
TESTS_EXPECTED   = $(TESTS:.bf=.expected)
TESTS_ACTUAL     = $(TESTS:.bf=.actual)
TESTS_DIFF       = $(TESTS:.bf=.diff)
GENERATED_FILES += …
Run Code Online (Sandbox Code Playgroud)

makefile

6
推荐指数
1
解决办法
898
查看次数

SwipeRefreshLayout干扰ViewPager中的ScrollView

我在ViewPager周围有一个SwipeRefreshLayout.ViewPager加载的片段包含ScrollViews.当我向下滚动它工作正常,但当我向上滚动时,SwipeRefreshLayout激活而不让ScrollView首先向上滚动.如何确保ScrollView具有优先权?

当SwipeRefreshLayout位于ScrollView外部的各个片段中时,它工作正常,但我需要它在ViewPager周围的活动本身.

以下是相关布局:

活动:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#EEEEEE"
    android:fitsSystemWindows="true">

    <include layout="@layout/toolbar" />

    <io.karim.MaterialTabs
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:background="@color/primary"
        app:mtIndicatorColor="@color/icons"
        app:mtIndicatorHeight="2dp"
        app:mtSameWeightTabs="true"
        app:mtPaddingMiddle="false"
        app:mtTextColorSelected="@color/icons"
        android:textColor="@color/icons"
        android:elevation="4dp"
        tools:ignore="UnusedAttribute" />

    <android.support.v4.widget.SwipeRefreshLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/swipeRefresh"
        android:layout_height="wrap_content"
        android:layout_width="match_parent">

        <android.support.v4.view.ViewPager
            android:id="@+id/pager"
            android:layout_width="match_parent"
            android:layout_height="0dp" />

    </android.support.v4.widget.SwipeRefreshLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

ViewPager加载的片段(有5个标签,每个标签都有一个):

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="me.sargunvohra.android.purduediningcourts.presenter.MenuFragment">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:paddingStart="@dimen/activity_horizontal_margin"
            android:paddingEnd="@dimen/activity_horizontal_margin"
            android:paddingTop="@dimen/activity_vertical_margin"
            android:paddingBottom="@dimen/activity_vertical_margin"
            >

            <!-- Content snipped for brevity -->

            <!-- blah blah... lots of content here -->

        </LinearLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

如果您需要更多信息,请点击 GitHub上的回购:https …

android android-layout android-fragments android-scrollview android-viewpager

5
推荐指数
2
解决办法
6753
查看次数

Kotlin 中带有 val 的循环引用

在 Kotlin 中,假设我有data class A (val f: B)data class B (val f: A)。我想初始化 localvar a: Avar b: Bisa.fbis b.f。并且必须保留 vals。这种循环实例化可能吗?aA.fB.f

data class A(val f: B)

data class B(val f: A)

fun foo() {
    var a: A
    var b: B
    // instantiate a and b here with a.f == b and b.f == a ??
}
Run Code Online (Sandbox Code Playgroud)

immutability circular-reference kotlin

5
推荐指数
1
解决办法
2440
查看次数