| Línea 12... |
Línea 12... |
| 12 |
import android.view.Menu;
|
12 |
import android.view.Menu;
|
| 13 |
import android.view.MenuInflater;
|
13 |
import android.view.MenuInflater;
|
| 14 |
import android.view.View;
|
14 |
import android.view.View;
|
| 15 |
import android.view.ViewGroup;
|
15 |
import android.view.ViewGroup;
|
| Línea 16... |
Línea -... |
| 16 |
|
- |
|
| 17 |
import com.bumptech.glide.Glide;
|
- |
|
| 18 |
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
- |
|
| 19 |
import com.bumptech.glide.load.model.GlideUrl;
|
- |
|
| 20 |
import com.bumptech.glide.load.model.LazyHeaders;
|
- |
|
| 21 |
import com.bumptech.glide.request.RequestOptions;
|
16 |
|
| 22 |
import com.cesams.twogetskills.inconcert.Constants;
|
17 |
import com.cesams.twogetskills.inconcert.Constants;
|
| Línea 23... |
Línea 18... |
| 23 |
import com.cesams.twogetskills.inconcert.R;
|
18 |
import com.cesams.twogetskills.inconcert.R;
|
| 24 |
|
19 |
|
| Línea 31... |
Línea 26... |
| 31 |
import androidx.recyclerview.widget.LinearLayoutManager;
|
26 |
import androidx.recyclerview.widget.LinearLayoutManager;
|
| 32 |
import androidx.recyclerview.widget.RecyclerView;
|
27 |
import androidx.recyclerview.widget.RecyclerView;
|
| 33 |
import com.cesams.twogetskills.inconcert.adapter.TimelineListViewAdapter;
|
28 |
import com.cesams.twogetskills.inconcert.adapter.TimelineListViewAdapter;
|
| 34 |
import com.cesams.twogetskills.inconcert.dao.UserLogDao;
|
29 |
import com.cesams.twogetskills.inconcert.dao.UserLogDao;
|
| 35 |
import com.cesams.twogetskills.inconcert.entity.UserLog;
|
30 |
import com.cesams.twogetskills.inconcert.entity.UserLog;
|
| - |
|
31 |
import com.cesams.twogetskills.inconcert.library.ImageService;
|
| 36 |
import com.cesams.twogetskills.inconcert.library.MD5;
|
32 |
import com.cesams.twogetskills.inconcert.library.MD5;
|
| 37 |
import com.cesams.twogetskills.inconcert.skeleton.ITwoGetSkills;
|
33 |
import com.cesams.twogetskills.inconcert.skeleton.ITwoGetSkills;
|
| 38 |
import com.cesams.twogetskills.inconcert.viewmodel.TimeLineViewModel;
|
34 |
import com.cesams.twogetskills.inconcert.viewmodel.TimeLineViewModel;
|
| Línea 39... |
Línea 35... |
| 39 |
|
35 |
|
| Línea 105... |
Línea 101... |
| 105 |
|
101 |
|
| 106 |
|
102 |
|
| Línea 107... |
Línea -... |
| 107 |
headerUserImage = (ImageView) getView().findViewById(R.id.fragment_timeline_header_user_image);
|
- |
|
| 108 |
if(!TextUtils.isEmpty(iTwoGetSkills.getPreference().getImage())) {
|
- |
|
| 109 |
|
- |
|
| 110 |
TimeZone timeZone = TimeZone.getTimeZone("UTC");
|
- |
|
| 111 |
Calendar calendar = Calendar.getInstance(timeZone);
|
- |
|
| 112 |
TimeZone tz = calendar.getTimeZone();
|
- |
|
| 113 |
int created = (int) (calendar.getTimeInMillis() / 1000);
|
- |
|
| 114 |
|
- |
|
| 115 |
Random random = new Random(created);
|
- |
|
| 116 |
int rand = 1000 + random.nextInt(8999);
|
- |
|
| 117 |
|
- |
|
| 118 |
|
- |
|
| 119 |
String deviceUuid = iTwoGetSkills.getPreference().getDeviceUuid();
|
- |
|
| 120 |
String password = iTwoGetSkills.getPreference().getPassword();
|
- |
|
| 121 |
|
- |
|
| 122 |
Log.d(TAG, "token = " + deviceUuid);
|
- |
|
| 123 |
Log.d(TAG, "created = " + created);
|
- |
|
| 124 |
Log.d(TAG, "rand = " + rand);
|
- |
|
| 125 |
Log.d(TAG, "calc = " + password + ':' + created + ':' + rand);
|
- |
|
| 126 |
|
103 |
headerUserImage = (ImageView) getView().findViewById(R.id.fragment_timeline_header_user_image);
|
| 127 |
String secret = MD5.generar(password + ':' + created + ':' + rand);
|
- |
|
| 128 |
|
- |
|
| 129 |
GlideUrl url = new GlideUrl(iTwoGetSkills.getPreference().getImage(), new LazyHeaders.Builder()
|
- |
|
| 130 |
.addHeader(Constants.HTTP_HEADER_ACCEPT, Constants.HTTP_HEADER_ACCEPT_VALUE)
|
- |
|
| 131 |
.addHeader(Constants.HTTP_HEADER_SECURITY_TOKEN, deviceUuid)
|
- |
|
| 132 |
.addHeader(Constants.HTTP_HEADER_SECURITY_SECRET, secret)
|
- |
|
| 133 |
.addHeader(Constants.HTTP_HEADER_SECURITY_CREATED, String.valueOf(created))
|
- |
|
| 134 |
.addHeader(Constants.HTTP_HEADER_SECURITY_RAND, String.valueOf(rand))
|
- |
|
| 135 |
.build());
|
- |
|
| 136 |
|
- |
|
| 137 |
RequestOptions options = new RequestOptions()
|
- |
|
| 138 |
.diskCacheStrategy(DiskCacheStrategy.ALL);
|
- |
|
| 139 |
|
- |
|
| 140 |
Glide.with(requireActivity()).load(url)
|
- |
|
| 141 |
.thumbnail()
|
104 |
if(!TextUtils.isEmpty(iTwoGetSkills.getPreference().getImage())) {
|
| Línea 142... |
Línea 105... |
| 142 |
.apply(options)
|
105 |
|
| 143 |
.into(headerUserImage);
|
106 |
ImageService.retrieve(getContext(), iTwoGetSkills.getPreference().getImage(), headerUserImage);
|
| 144 |
}
|
107 |
}
|