This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main() { | |
echo "start to check chrome driver ..." | |
chromedriver -v | |
if [ $? -eq 0 ]; then | |
echo "chromedriver is install" | |
else | |
echo "chrome driver not install yet." | |
if [ "$(uname)"=="Linux" ]; then | |
echo "You are using linux." | |
elif [ "$(uname)" == "Darwin" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding:utf-8 | |
import scrapy | |
from fundspider.items import FundspiderItem, FundNetValueItem | |
import json | |
import re | |
from datetime import datetime | |
from bs4 import BeautifulSoup | |
import numpy as np | |
import logging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@JAction(ai = DemoInterceptor.class) | |
public class DemoActivity extends AppCompatActivity { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
} | |
@Override | |
protected void onDestroy() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DemoInterceptor implements Interceptor { | |
@Override | |
public boolean check(final Context context, final Intent intent) { | |
// do what you like, make sure if go to next activity or just stay here. | |
return true; | |
} | |
@Override | |
public boolean check() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean startActivity(Context context, Intent intent) { | |
try { | |
String className = intent.getComponent().getClassName(); | |
if (className.endsWith("_")) { | |
className = className.substring(0, className.length() - 1); | |
} | |
Class<?> c = Class.forName(className); | |
Action ac = c.getAnnotation(Action.class); | |
if (ac == null) { | |
Log.d(TAG, className + "start activity without annotation"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Interceptor { | |
public boolean check(Context context, Intent intent); | |
public boolean check(); | |
public class Stub implements Interceptor { | |
@Override | |
public boolean check() { | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Retention(RetentionPolicy.RUNTIME) | |
public @interface Action { | |
Class<?> ai(); | |
} |