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
/** | |
* 通过反射修改TabLayout Indicator的宽度(仅在Android 4.2及以上生效) | |
*/ | |
private void setUpIndicatorWidth(TabLayout tabLayout) { | |
Class<?> tabLayoutClass = tabLayout.getClass(); | |
Field tabStrip = null; | |
try { | |
tabStrip = tabLayoutClass.getDeclaredField("mTabStrip"); | |
tabStrip.setAccessible(true); | |
} catch (NoSuchFieldException e) { |
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
/** | |
* get Activity from context | |
* @param context | |
* @return | |
*/ | |
public static Activity getActivity(Context context) { | |
while (context instanceof ContextWrapper) { | |
if (context instanceof Activity) { | |
return (Activity)context; | |
} |
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
/** | |
* @param parameter - this is string that contains parameters for Http POST | |
* @param request - old Request | |
* @return - new {@link Request} with additional parameters | |
* */ | |
public static Request interceptRequest(@NotNull Request request, @NotNull String parameter) | |
throws IOException { | |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
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
/build |