我在通知栏上发送了一些通知,我希望在点击其中一个通知时清除所有通知.现在我通过使用Flag逐个清除.我知道notificationManager.cancelAll()可以清除所有通知但我应该放在哪里,以便一旦点击通知之一我就可以触发.
private static void generateNotification(Context context, String message) {
int icon = R.drawable.ic_launcher;
long when = System.currentTimeMillis();
NotificationManager notificationManager = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, message, when);
String title = context.getString(R.string.app_name);
Intent notificationIntent = new Intent(context, MainActivity.class);
// set intent so it does not start a new activity
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent =
PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, title, message, intent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(msgid, notification);
//notificationManager.cancelAll(); //i wan to clear all when the notification …Run Code Online (Sandbox Code Playgroud) 我正在使用Intervention/imagecache来缓存我的图像.但是,缓存图像的加载速度比源图像文件慢.几乎额外的60-70毫秒的时间latancy(测试铬检查元件网络)
这是我在Route.php上加载图像的代码
Route::get('images/cars/{src}', function ($src){
$cacheimage = Image::cache(function($image) use($src){
return $image->make("images/products/".$src);
},1440);
return Response::make($cacheimage,200, array('Content-Type'=>'image/jpg'));
});
Run Code Online (Sandbox Code Playgroud)
在刀片中
<img src="{{ URL::asset('/images/cars/theimage.jpg' }}" alt="">
Run Code Online (Sandbox Code Playgroud)
存储图像缓存的任何想法或更好的方法?
我有一个刷新按钮,我希望根据情况可见.
单击" 刷新"按钮时,我可以使其不可见而不会出现问题,但是,一旦该AsyncTask过程完成,我就无法再将其显示出来.我无法将MenuItem值传回给AsyncTask.
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getSupportMenuInflater().inflate(R.menu.refresh_action_provider, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.menu_refresh:
item.setVisible(false); //hide refresh button
setSupportProgressBarIndeterminateVisibility(true);
Toast.makeText(getApplicationContext(), "REFRESH CLiCKED", Toast.LENGTH_SHORT).show();
new DownloadNewsTask().execute();
return true;
}
return false;
}
Run Code Online (Sandbox Code Playgroud) 我的html有相同类的mutliple下拉框.我从每个输入框中获取一个值,然后将其传递给<select>选择器.我从输入框得到的值是正确的,但我在选择下拉框时遇到问题.
HTML:
<div id="orange">
<input type="text" class="hide" value="AM" />
<select class="ampm">
<option value="AM">AM</option>
<option value="PM">PM</option>
</select>
<br>
<input type="text" class="hide" value="AM" />
<select class="ampm">
<option value="AM">AM</option>
<option value="PM">PM</option>
</select>
<br>
<input type="text" class="hide" value="PM" />
<select class="ampm">
<option value="AM">AM</option>
<option value="PM">PM</option>
</select>
</div>
<div id="apple">
<input type="text" class="hide" value="AM" />
<select class="ampm">
<option value="AM">AM</option>
<option value="PM">PM</option>
</select>
<br>
<input type="text" class="hide" value="PM" />
<select class="ampm">
<option value="AM">AM</option>
<option value="PM">PM</option>
</select>
</div>
Run Code Online (Sandbox Code Playgroud)
JS:
$(function () {
$('div').each(function(){
$(this).find('.hide').each(function () …Run Code Online (Sandbox Code Playgroud)