杂项

最低21,圆形放大效果

1
ViewAnimationUtils.createCircularReveal()

在使用过场动画:

  • 第一个Activity 在某一个View控件上设置transitionName
  • 第二个Activity 在某一个View上设置同样transitionName
  • startActivity -> OtherActivity

    1
    2
    Intent mIntent = new Intent(this, OtherActivity.class);
    startActivity(mIntent, ActivityOptions.makeSceneTransitionAnimation(this, cardView, cardView.getTransitionName()).toBundle());

    遇见一个问题:
    怎么监听这个动画呢,有没有回调。
    通过Google知道,这个动画是加到windows上面的。
    在OtherActivity上可以写:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    getWindow().getSharedElementEnterTransition().addListener(new Transition.TransitionListener() {
    @Override
    public void onTransitionStart(Transition transition) {
    Log.e("liqiong", "onTransitionStart");

    }

    @Override
    public void onTransitionEnd(Transition transition) {
    Log.e("liqiong", "onTransitionEnd");
    }

    @Override
    public void onTransitionCancel(Transition transition) {
    Log.e("liqiong", "onTransitionCancel");
    }

    @Override
    public void onTransitionPause(Transition transition) {
    Log.e("liqiong", "onTransitionPause");
    }

    @Override
    public void onTransitionResume(Transition transition) {
    Log.e("liqiong", "onTransitionResume");
    }
    });

2016-09-13 18:13 回家啦,家里的网速简直太快了。访问github特别快!!!哦也!!!

Android框架:
Dagger
Retrofit
Fresco

2016-09-25 11:03 Android 权限问题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.example.uitest;

public class MainActivity extends AppCompatActivity {
private CardView cardView = null;
private static final int MY_PERMISSIONS_REQUEST_CAMERA = 1;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
cardView = (CardView) findViewById(R.id.cardlist_item);
}

public void startOtherActivity(View view) {
// Intent mIntent = new Intent(this, OtherActivity.class);
// startActivity(mIntent, ActivityOptions.makeSceneTransitionAnimation(this, cardView, cardView.getTransitionName()).toBundle());

if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
if(ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.CAMERA)){

ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, MY_PERMISSIONS_REQUEST_CAMERA);
}else{
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, MY_PERMISSIONS_REQUEST_CAMERA);
}
} else {
Toast.makeText(this, "!!!!!!WWWWWWWWWWWWW", Toast.LENGTH_SHORT).show();
}
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == MY_PERMISSIONS_REQUEST_CAMERA) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this, "permission OK!", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "permission Denied", Toast.LENGTH_SHORT).show();
}
return;
}
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}

([0-9]*)
[0-9]{6}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import re

def match0(text, *patterns):
"""Scans through a string for substrings matched some patterns (first-subgroups only).

Args:
text: A string to be scanned.
patterns: Arbitrary number of regex patterns.

Returns:
When matches, returns first-subgroups from first match.
When no matches, return None
"""


for pattern in patterns:
try:
match = re.search(pattern, text)
print(match)
except(TypeError):
match = re.search(pattern, str(text))
if match:
return match.group(1) //if match.group(0)=> id=76439873
//if match.group(1)=> 76439873
return None

if __name__ == '__main__':
xx=match0('http://www.acfun.tv/v/ac3142323?id=76439873',r'id=([0-9]*)')
print(xx)

2016-10-01 18:25
嚯嚯嚯,我用python把某某网站的视频爬下来了。出现了一个问题,我用的windows10,python3.5 写的脚本,在装mysqldb的时候,错误❌提示说确实什么鬼vs.bat Google了一把,需要装vs。。。
心真累。。
然后我就想用mac实现,我它喵的用Linux行了吧。
然而,mac是python2.7 。。。xcode编译项目的时候需要用。。。
如果我升级了python到3.5 xcode编译项目肯定过不去。。。
后来后来。。
我把sql直接生成出来了,嚯嚯嚯,生成insert into 插入sql,直接在navicat运行,嚯嚯嚯。
机智如我。