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 MyApplication extends Application { | |
private static final int JOB_ID = 3 * 9; | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
if(!isJobServiceOn()){ | |
ComponentName mComponentName = new ComponentName(this, AnalyticsService.class); | |
//Now create a JobInfo and give | |
JobInfo mJobInfo = new JobInfo.Builder(JOB_ID, mComponentName) |
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
<service android:name="com.beeonics.android.fs.analytics.AnalyticsService" | |
android:permission="android.permission.BIND_JOB_SERVICE"/> |
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 AnalyticsService extends JobService { | |
@Override | |
public boolean onStartJob(JobParameters params) { | |
//let's update the analytics stuff when the job starts | |
//you can skip this method if it seems complex. we will understand this in GreenDAO tutorials | |
updateAnaliticsData(); | |
//return false if the task is small and it will finish inside this onStartJob method or else true if your task is bigger | |
//I am returning true because I am running a network operation which will use a background thread |
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
package com.myapplicationpalettetest; | |
import android.graphics.Bitmap; | |
import android.graphics.drawable.BitmapDrawable; | |
import android.os.Bundle; | |
import android.support.annotation.Nullable; | |
import android.support.v7.app.AppCompatActivity; | |
import android.support.v7.graphics.Palette; | |
import android.widget.Button; | |
import android.widget.ImageView; |
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"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<ImageView | |
android:id="@+id/image" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:src="@drawable/tiger" | |
android:layout_weight="4"/> |
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
dependencies { | |
implementation 'com.android.support:palette-v7:28.0.0' | |
} |
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
//Fresco Image Loader | |
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(new Interceptor() { | |
@Override | |
public Response intercept(Chain chain) throws IOException { | |
return chain.proceed(chain.request().newBuilder().addHeader("YOUR_KEY", "YOUR_VALUE").build());//here key and value are provided by the server | |
} | |
}).build(); | |
ImagePipelineConfig config = OkHttpImagePipelineConfigFactory | |
.newBuilder(this, client) |
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
String url = "Your Image Url"; | |
Uri uri = Uri.parse(url); | |
your)simple_draweeview.setImageURI(uri); |
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
package com.ajk.frescotestapp; | |
import android.app.Application; | |
import com.facebook.drawee.backends.pipeline.Fresco; | |
public class MyApplication extends Application { | |
@Override | |
public void 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
dependencies { | |
implementation fileTree(dir: 'libs', include: ['*.jar']) | |
implementation 'com.android.support:appcompat-v7:28.0.0' | |
implementation 'com.android.support.constraint:constraint-layout:1.1.3' | |
/*Fresco Image Loader*/ | |
implementation 'com.facebook.fresco:fresco:1.13.0' | |
} |
NewerOlder