| Línea 1... |
Línea 1... |
| 1 |
package com.cesams.twogetskills.fragment;
|
1 |
package com.cesams.twogetskills.fragment;
|
| Línea -... |
Línea 2... |
| - |
|
2 |
|
| 2 |
|
3 |
import android.media.Image;
|
| 3 |
import android.os.Bundle;
|
4 |
import android.os.Bundle;
|
| 4 |
import android.text.TextUtils;
|
5 |
import android.text.TextUtils;
|
| 5 |
import android.util.Log;
|
6 |
import android.util.Log;
|
| 6 |
import android.view.LayoutInflater;
|
7 |
import android.view.LayoutInflater;
|
| Línea 19... |
Línea 20... |
| 19 |
import androidx.lifecycle.Observer;
|
20 |
import androidx.lifecycle.Observer;
|
| 20 |
import androidx.lifecycle.ViewModelProvider;
|
21 |
import androidx.lifecycle.ViewModelProvider;
|
| 21 |
import androidx.recyclerview.widget.LinearLayoutManager;
|
22 |
import androidx.recyclerview.widget.LinearLayoutManager;
|
| 22 |
import androidx.recyclerview.widget.RecyclerView;
|
23 |
import androidx.recyclerview.widget.RecyclerView;
|
| Línea 23... |
Línea -... |
| 23 |
|
- |
|
| 24 |
import com.bumptech.glide.Glide;
|
- |
|
| 25 |
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
- |
|
| 26 |
import com.bumptech.glide.load.model.GlideUrl;
|
- |
|
| 27 |
import com.bumptech.glide.load.model.LazyHeaders;
|
- |
|
| - |
|
24 |
|
| 28 |
import com.bumptech.glide.request.RequestOptions;
|
25 |
|
| 29 |
import com.cesams.twogetskills.Constants;
|
26 |
import com.cesams.twogetskills.Constants;
|
| 30 |
import com.cesams.twogetskills.R;
|
27 |
import com.cesams.twogetskills.R;
|
| 31 |
import com.cesams.twogetskills.adapter.UserProfileListViewAdapter;
|
28 |
import com.cesams.twogetskills.adapter.UserProfileListViewAdapter;
|
| 32 |
import com.cesams.twogetskills.dao.CompanyDao;
|
29 |
import com.cesams.twogetskills.dao.CompanyDao;
|
| 33 |
import com.cesams.twogetskills.dao.UserExtendedDao;
|
30 |
import com.cesams.twogetskills.dao.UserExtendedDao;
|
| 34 |
import com.cesams.twogetskills.entity.Company;
|
31 |
import com.cesams.twogetskills.entity.Company;
|
| - |
|
32 |
import com.cesams.twogetskills.entity.UserExtended;
|
| 35 |
import com.cesams.twogetskills.entity.UserExtended;
|
33 |
import com.cesams.twogetskills.library.ImageService;
|
| 36 |
import com.cesams.twogetskills.viewdata.UserProfileViewData;
|
34 |
import com.cesams.twogetskills.viewdata.UserProfileViewData;
|
| 37 |
import com.cesams.twogetskills.library.MD5;
|
35 |
import com.cesams.twogetskills.library.MD5;
|
| 38 |
import com.cesams.twogetskills.skeleton.ITwoGetSkills;
|
36 |
import com.cesams.twogetskills.skeleton.ITwoGetSkills;
|
| Línea 115... |
Línea 113... |
| 115 |
listView.setAdapter(adapter);
|
113 |
listView.setAdapter(adapter);
|
| 116 |
listView.setLayoutManager(layoutManager);
|
114 |
listView.setLayoutManager(layoutManager);
|
| Línea 117... |
Línea 115... |
| 117 |
|
115 |
|
| 118 |
|
- |
|
| 119 |
headerUserImage = getView().findViewById(R.id.fragment_userprofile_header_user_image);
|
- |
|
| 120 |
TimeZone timeZone = TimeZone.getTimeZone("UTC");
|
- |
|
| 121 |
Calendar calendar = Calendar.getInstance(timeZone);
|
- |
|
| 122 |
TimeZone tz = calendar.getTimeZone();
|
- |
|
| 123 |
int created = (int) (calendar.getTimeInMillis() / 1000);
|
- |
|
| 124 |
|
- |
|
| 125 |
Random random = new Random(created);
|
116 |
|
| 126 |
int rand = 1000 + random.nextInt(8999);
|
- |
|
| 127 |
|
- |
|
| 128 |
|
- |
|
| 129 |
String deviceUuid = iTwoGetSkills.getPreference().getDeviceUuid();
|
- |
|
| 130 |
String password = iTwoGetSkills.getPreference().getPassword();
|
- |
|
| 131 |
|
- |
|
| 132 |
Log.d(TAG, "token = " + deviceUuid);
|
- |
|
| 133 |
Log.d(TAG, "created = " + created);
|
- |
|
| 134 |
Log.d(TAG, "rand = " + rand);
|
- |
|
| 135 |
Log.d(TAG, "calc = " + password + ':' + created + ':' + rand);
|
- |
|
| 136 |
|
- |
|
| 137 |
String secret = MD5.generar(password + ':' + created + ':' + rand);
|
117 |
headerUserImage = getView().findViewById(R.id.fragment_userprofile_header_user_image);
|
| 138 |
|
- |
|
| 139 |
GlideUrl url = new GlideUrl(iTwoGetSkills.getPreference().getImage(), new LazyHeaders.Builder()
|
- |
|
| 140 |
.addHeader(Constants.HTTP_HEADER_ACCEPT, Constants.HTTP_HEADER_ACCEPT_VALUE)
|
- |
|
| 141 |
.addHeader(Constants.HTTP_HEADER_SECURITY_TOKEN, deviceUuid)
|
- |
|
| 142 |
.addHeader(Constants.HTTP_HEADER_SECURITY_SECRET, secret)
|
- |
|
| 143 |
.addHeader(Constants.HTTP_HEADER_SECURITY_CREATED, String.valueOf(created))
|
- |
|
| 144 |
.addHeader(Constants.HTTP_HEADER_SECURITY_RAND, String.valueOf(rand))
|
- |
|
| 145 |
.build());
|
- |
|
| 146 |
|
- |
|
| 147 |
RequestOptions options = new RequestOptions()
|
- |
|
| 148 |
.diskCacheStrategy(DiskCacheStrategy.ALL);
|
- |
|
| 149 |
|
- |
|
| 150 |
/*
|
- |
|
| 151 |
Glide.with(requireActivity()).load(url)
|
- |
|
| 152 |
.thumbnail()
|
- |
|
| 153 |
.apply(options)
|
- |
|
| 154 |
.into(headerUserImage);
|
- |
|
| 155 |
|
- |
|
| 156 |
*/
|
- |
|
| 157 |
|
- |
|
| 158 |
Glide.with(requireActivity()).load(url)
|
- |
|
| Línea 159... |
Línea 118... |
| 159 |
.apply(options)
|
118 |
|
| 160 |
.into(headerUserImage);
|
119 |
ImageService.retrieve(requireActivity(), iTwoGetSkills.getPreference().getImage(), headerUserImage);
|
| 161 |
|
120 |
|
| 162 |
headerUserName = getView().findViewById(R.id.fragment_userprofile_header_user_name);
|
121 |
headerUserName = getView().findViewById(R.id.fragment_userprofile_header_user_name);
|