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
... | |
@Override | |
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { | |
super.onCreateOptionsMenu(menu, inflater); | |
inflater.inflate(R.menu.fragment_photo_gallery, menu); | |
MenuItem searchItem = menu.findItem(R.id.menu_item_search); | |
final SearchView searchView = (SearchView)searchItem.getActionView(); | |
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { |
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
private boolean isNetworkAvailableAndConnected() { | |
ConnectivityManager cm = (ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE); | |
boolean isNetworkAvailable = cm.getActiveNetworkInfo() != null; | |
boolean isNetworkConnected = isNetworkAvailable && cm.getActiveNetworkInfo().isConnected(); | |
return isNetworkConnected; | |
} |
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 abstract class SingleFragmentActivity extends AppCompatActivity { | |
protected abstract Fragment createFragment(); | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_fragment); | |
FragmentManager fm = getSupportFragmentManager(); | |
Fragment fragment = fm.findFragmentById(R.id.fragment_container); | |
if (fragment == null) { | |
fragment = createFragment(); |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<color name="White">#FFFFFF</color> | |
<color name="Ivory">#FFFFF0</color> | |
<color name="LightYellow">#FFFFE0</color> | |
<color name="Yellow">#FFFF00</color> | |
<color name="Snow">#FFFAFA</color> | |
<color name="FloralWhite">#FFFAF0</color> | |
<color name="LemonChiffon">#FFFACD</color> | |
<color name="Cornsilk">#FFF8DC</color> |
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
# Built application files | |
*.apk | |
*.ap_ | |
# Files for the ART/Dalvik VM | |
*.dex | |
# Java class files | |
*.class |
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
File file = new File(System.getProperty("user.home") + "/Downloads/" + "1.jpg"); |
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
100% — FF | |
95% — F2 | |
90% — E6 | |
85% — D9 | |
80% — CC | |
75% — BF | |
70% — B3 | |
65% — A6 | |
60% — 99 | |
55% — 8C |
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
// with Glide | |
Glide.with(context) | |
.load(url) | |
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(radius))) | |
.into(imageView); | |
// with Drawable xml | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shape="rectangle"> |
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 class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != | |
PackageManager.PERMISSION_GRANTED){ | |
Log.i(TAG, "onCreate: 准备申请权限"); |
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
Process: Vivaldi [1994] | |
Path: /Applications/Vivaldi.app/Contents/MacOS/Vivaldi | |
Identifier: com.vivaldi.Vivaldi | |
Version: 2.0.1309.29 (2.0.1309.29) | |
Code Type: X86-64 (Native) | |
Parent Process: ??? [1] | |
Responsible: Vivaldi [1994] | |
User ID: 502 | |
Date/Time: 2018-09-30 09:57:48.491 +0800 |