小编Moh*_*hin的帖子

IntelliJ IDEA中的自动增量版本代码(Android)

如何在Android项目的IntelliJ IDEA中自动增加versionCode(或versionName)?

这是另一个已经问过Eclipse的SO问题.

android build intellij-idea

5
推荐指数
0
解决办法
660
查看次数

Slow MediaExtractor seekTo

我使用MediaCodec和创建了一个视频播放器MediaExtractor,但当我尝试使用MediaExtractor seekTo方法更改媒体位置时,它非常慢(需要10秒才能寻找1080P视频),而SDK MediaPlayer可以实时搜索.有什么想法解决这个问题?

MediaExtractor extractor = new MediaExtractor();
extractor.setDataSource(SAMPLE);    
.
.
.
extractor.seekTo(480000000, MediaExtractor.SEEK_TO_CLOSEST_SYNC);
Run Code Online (Sandbox Code Playgroud)

更新

Theo原创项目就在这里

android seek android-mediaplayer

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

SurfaceView在PopupWindow中无法正常工作

我将使用PopupWindow基于三星SPen的AirView功能显示预览

但问题是SurfaceView没有创建,也没有SurfaceHolder.Callback调用方法.

显示弹出窗口时,表面区域变为透明,因为根本不创建表面.

SurfaceView 没有创建并且是透明的:

在此输入图像描述

HoverPreview:

public class HoverPreview extends LinearLayout implements View.OnHoverListener, SurfaceHolder.Callback {
    private static final String TAG = "HoverPreview";
    private SurfaceHolder mHolder = null;
    View mAnchorView = null;
    String videoPath;
    int position;
    private boolean IsMediaPlayerReady = false;
    private MediaPlayer mMediaPlayer;
    private SurfaceView mSurfaceView;
    Context context;

    public HoverPreview(Context context, String videoPath, int position) {
        super(context);
        this.videoPath = videoPath;
        this.position = position;
        setupLayout(context);
    }

    public HoverPreview(Context context, AttributeSet attrs) …
Run Code Online (Sandbox Code Playgroud)

android popupwindow surfaceview surfaceholder

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

用于RTL语言的右对齐ActionBarDrawerToggle

是否可以自定义ActionBarDrawerToggle将其图标放在操作栏的右侧?

layout_gravity="right"应用DrawerLayout ListView仅影响菜单列表不是ActionBarDrawerToggle.

android android-actionbar android-support-library navigation-drawer

5
推荐指数
0
解决办法
364
查看次数

实体框架7和登录失败

我正在尝试使用ef7和asp.net mvc 6,但是当我尝试使用db时,会出现以下异常:

无法打开登录请求的数据库"帖子".登录失败.

用户'alexpc\Alexandr'登录失败.

在DbContext类中,我使用以下代码:

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    optionsBuilder.UseSqlServer(@"Data Source=alexpc;Database=Posts;Integrated security=True;");
}
Run Code Online (Sandbox Code Playgroud)

看起来ConnectionString是对的,哪里有问题?

c# asp.net asp.net-mvc entity-framework-core

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

android.os.Build的哪些属性是固定的?

我需要android.os.Build类的固定属性列表.我从这里获得了这个列表,我把那些我知道的那些大胆修复了.通过修复我的意思是没有固件更新,重置工厂,...

  1. android.os.Build.VERSION.RELEASE //当前开发代号,如果是发布版本,则为字符串"REL".

  2. android.os.Build.BOARD //底层板的名称,如"goldfish".

  3. android.os.Build.BOOTLOADER //系统引导程序版本号.

  4. android.os.Build.BRAND //软件定制的品牌(例如,运营商),如果有的话.

  5. android.os.Build.CPU_ABI //本机代码的指令集名称(CPU类型+ ABI约定).

  6. android.os.Build.CPU_ABI2 //本机代码的第二个指令集(CPU类型+ ABI约定)的名称.

  7. android.os.Build.DEVICE //工业设计的名称.

  8. android.os.Build.DISPLAY //用于向用户显示的构建ID字符串

  9. android.os.Build.FINGERPRINT //唯一标识此构建的字符串.

  10. android.os.Build.HARDWARE //硬件的名称(来自内核命令行或/ proc).

  11. android.os.Build.HOST

  12. android.os.Build.ID //更改列表编号或"M4-rc20"之类的标签.

  13. android.os.Build.MANUFACTURER //产品/硬件的制造商.

  14. android.os.Build.MODEL //最终产品的最终用户可见名称.

  15. android.os.Build.PRODUCT //整个产品的名称.

  16. android.os.Build.TAGS //描述构建的逗号分隔标签,如"unsigned,debug".

  17. android.os.Build.TYPE //构建类型,如"user"或"eng".

  18. android.os.Build.USER

请帮我完成清单

android build uniqueidentifier

4
推荐指数
1
解决办法
7866
查看次数

TextView中动态文本颜色更改的最有效方法

我想用计时器多次改变文本部分的颜色.

最简单的方法是:

SpannableStringBuilder ssb = new SpannableStringBuilder(mainText);
ForegroundColorSpan span = new ForegroundColorSpan(Color.BLUE);
ssb.setSpan(span, start, end, 0);
tv.setText(ssb);
Run Code Online (Sandbox Code Playgroud)

但是如果我在一秒钟内多次运行上面的代码,我实际上TextView每次都会更改整个(大)文本,因此特别是在低端设备上会发生不需要的内存CPU负载.

我怎样才能Span打开一个TextView并且只改变Span开始和结束位置?

它会起作用还是全文替换将在幕后发生?

我的文字是固定的,永远不会改变.

android textview spannablestring

4
推荐指数
1
解决办法
2685
查看次数

GetByteArrayRegion导致ArrayIndexOutOfBoundsException

我正在尝试使用Speex库解码Speex编码的音频文件,但我总是得到 ArrayIndexOutOfBoundsException

JNIEXPORT jint JNICALL Java_com_app_shared_Speex_decode
    (JNIEnv *env, jobject obj, jbyteArray encoded, jshortArray lin, jint size) {

        jbyte buffer[dec_frame_size ];
        jshort output_buffer[dec_frame_size ];
        jsize encoded_length = size;

        if (!codec_open)
            return 0;

        env->GetByteArrayRegion(encoded, rtp_header, encoded_length, buffer);

        /*  
        jboolean isCopy;
        jbyte* data = env->GetByteArrayElements(encoded, &isCopy);
        if(isCopy){
        memcpy(buffer, data, encoded_length);               
        env->ReleaseByteArrayElements(encoded, data, JNI_ABORT);
        }
        */

        speex_bits_read_from(&dbits, (char *)buffer, encoded_length);
        speex_decode_int(dec_state, &dbits, output_buffer);

        std::string bufStr;

        for(int i=0; i<20; i++){
            char buff[100];
            sprintf(buff, "Speex test %d => %d", i, output_buffer[i]);
            bufStr = buff;
            LOGI(bufStr.c_str());
        } …
Run Code Online (Sandbox Code Playgroud)

android memory-leaks speex android-ndk

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

专注于gridview内的文本框

我创建了一个带有的WPF页面GridView.因为每行GridView有5个TextBoxes.当我TextBox在第一行中的第一行输入数据然后按Tab键时,焦点移动到下一行TextBox.我在那里输入数据TextBox然后按Tab键等等......最后我输入该TextBox行最后一个数据,然后按回车键.焦点移动到外面的元素GridView.

我希望焦点移动到TextBox第二行的第一行GridView.

c# asp.net wpf gridview textbox

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

在IdentityServer4中禁止使用授权过滤器

在使用AspNetAuthorization教程测试IdentityServer4时,我添加了一个简单的,从那时起我收到此错误:[Authorize(Roles = "Administrator")]

AuthenticationScheme:禁止持票人.

我的用户有这样的主张: new Claim(ClaimTypes.Role, "Administrator", ClaimValueTypes.String).

ConfigureServices方法中:

 services.AddAuthorization(options =>
        {
            options.AddPolicy("AdministratorOnly", policy => policy.RequireRole("Administrator"));
        });

        services.AddMvc(config =>
        {
            var policy = new AuthorizationPolicyBuilder()
                        .RequireAuthenticatedUser()
                        .Build();

            config.Filters.Add(new AuthorizeFilter(policy));
        });
Run Code Online (Sandbox Code Playgroud)

并在Configure方法中:

   app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions()
        {
            Authority = "http://localhost:5000",
            ScopeName = "openid",
            AutomaticAuthenticate = true,
            AutomaticChallenge = true,
            RequireHttpsMetadata = false,
        });
Run Code Online (Sandbox Code Playgroud)

调试输出:

Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Debug: Executing action LearningEntityServer4.OAuth.ValuesController.Get (LearningEntityServer4.OAuth)
Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization was successful for user: myuser.
Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization failed …
Run Code Online (Sandbox Code Playgroud)

c# authentication authorization asp.net-core identityserver4

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