Línea 22... |
Línea 22... |
22 |
import androidx.lifecycle.Observer;
|
22 |
import androidx.lifecycle.Observer;
|
23 |
import androidx.lifecycle.ViewModelProvider;
|
23 |
import androidx.lifecycle.ViewModelProvider;
|
24 |
import androidx.recyclerview.widget.LinearLayoutManager;
|
24 |
import androidx.recyclerview.widget.LinearLayoutManager;
|
25 |
import androidx.recyclerview.widget.RecyclerView;
|
25 |
import androidx.recyclerview.widget.RecyclerView;
|
Línea 26... |
Línea -... |
26 |
|
- |
|
27 |
import com.bumptech.glide.Glide;
|
- |
|
28 |
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
- |
|
29 |
import com.bumptech.glide.load.model.GlideUrl;
|
- |
|
30 |
import com.bumptech.glide.load.model.LazyHeaders;
|
- |
|
- |
|
26 |
|
31 |
import com.bumptech.glide.request.RequestOptions;
|
27 |
|
32 |
import com.cesams.twogetskills.inconcert.Constants;
|
28 |
import com.cesams.twogetskills.inconcert.Constants;
|
33 |
import com.cesams.twogetskills.inconcert.R;
|
29 |
import com.cesams.twogetskills.inconcert.R;
|
34 |
import com.cesams.twogetskills.inconcert.activity.MainActivity;
|
30 |
import com.cesams.twogetskills.inconcert.activity.MainActivity;
|
35 |
import com.cesams.twogetskills.inconcert.adapter.UserProfileListViewAdapter;
|
31 |
import com.cesams.twogetskills.inconcert.adapter.UserProfileListViewAdapter;
|
36 |
import com.cesams.twogetskills.inconcert.dao.CompanyDao;
|
32 |
import com.cesams.twogetskills.inconcert.dao.CompanyDao;
|
37 |
import com.cesams.twogetskills.inconcert.dao.UserExtendedDao;
|
33 |
import com.cesams.twogetskills.inconcert.dao.UserExtendedDao;
|
38 |
import com.cesams.twogetskills.inconcert.entity.Company;
|
34 |
import com.cesams.twogetskills.inconcert.entity.Company;
|
- |
|
35 |
import com.cesams.twogetskills.inconcert.entity.UserExtended;
|
39 |
import com.cesams.twogetskills.inconcert.entity.UserExtended;
|
36 |
import com.cesams.twogetskills.inconcert.library.ImageService;
|
40 |
import com.cesams.twogetskills.inconcert.skeleton.IReloadData;
|
37 |
import com.cesams.twogetskills.inconcert.skeleton.IReloadData;
|
41 |
import com.cesams.twogetskills.inconcert.viewdata.UserProfileViewData;
|
38 |
import com.cesams.twogetskills.inconcert.viewdata.UserProfileViewData;
|
42 |
import com.cesams.twogetskills.inconcert.library.MD5;
|
39 |
import com.cesams.twogetskills.inconcert.library.MD5;
|
43 |
import com.cesams.twogetskills.inconcert.skeleton.ITwoGetSkills;
|
40 |
import com.cesams.twogetskills.inconcert.skeleton.ITwoGetSkills;
|
Línea 157... |
Línea 154... |
157 |
listView.setAdapter(adapter);
|
154 |
listView.setAdapter(adapter);
|
158 |
listView.setLayoutManager(layoutManager);
|
155 |
listView.setLayoutManager(layoutManager);
|
Línea 159... |
Línea 156... |
159 |
|
156 |
|
160 |
|
- |
|
161 |
headerUserImage = getView().findViewById(R.id.fragment_userprofile_header_user_image);
|
- |
|
162 |
TimeZone timeZone = TimeZone.getTimeZone("UTC");
|
- |
|
163 |
Calendar calendar = Calendar.getInstance(timeZone);
|
- |
|
164 |
TimeZone tz = calendar.getTimeZone();
|
- |
|
165 |
int created = (int) (calendar.getTimeInMillis() / 1000);
|
- |
|
166 |
|
- |
|
167 |
Random random = new Random(created);
|
157 |
|
168 |
int rand = 1000 + random.nextInt(8999);
|
- |
|
169 |
|
- |
|
170 |
|
- |
|
171 |
String deviceUuid = iTwoGetSkills.getPreference().getDeviceUuid();
|
- |
|
172 |
String password = iTwoGetSkills.getPreference().getPassword();
|
- |
|
173 |
|
- |
|
174 |
Log.d(TAG, "token = " + deviceUuid);
|
- |
|
175 |
Log.d(TAG, "created = " + created);
|
- |
|
176 |
Log.d(TAG, "rand = " + rand);
|
- |
|
177 |
Log.d(TAG, "calc = " + password + ':' + created + ':' + rand);
|
- |
|
178 |
|
- |
|
179 |
String secret = MD5.generar(password + ':' + created + ':' + rand);
|
158 |
headerUserImage = getView().findViewById(R.id.fragment_userprofile_header_user_image);
|
180 |
|
- |
|
181 |
GlideUrl url = new GlideUrl(iTwoGetSkills.getPreference().getImage(), new LazyHeaders.Builder()
|
- |
|
182 |
.addHeader(Constants.HTTP_HEADER_ACCEPT, Constants.HTTP_HEADER_ACCEPT_VALUE)
|
- |
|
183 |
.addHeader(Constants.HTTP_HEADER_SECURITY_TOKEN, deviceUuid)
|
- |
|
184 |
.addHeader(Constants.HTTP_HEADER_SECURITY_SECRET, secret)
|
- |
|
185 |
.addHeader(Constants.HTTP_HEADER_SECURITY_CREATED, String.valueOf(created))
|
- |
|
186 |
.addHeader(Constants.HTTP_HEADER_SECURITY_RAND, String.valueOf(rand))
|
- |
|
187 |
.build());
|
- |
|
188 |
|
- |
|
189 |
RequestOptions options = new RequestOptions()
|
- |
|
190 |
.diskCacheStrategy(DiskCacheStrategy.ALL);
|
- |
|
191 |
|
- |
|
192 |
/*
|
- |
|
193 |
Glide.with(requireActivity()).load(url)
|
- |
|
194 |
.thumbnail()
|
- |
|
195 |
.apply(options)
|
- |
|
196 |
.into(headerUserImage);
|
- |
|
197 |
|
- |
|
198 |
*/
|
- |
|
199 |
|
- |
|
200 |
Glide.with(requireActivity()).load(url)
|
- |
|
Línea 201... |
Línea 159... |
201 |
.apply(options)
|
159 |
|
202 |
.into(headerUserImage);
|
160 |
ImageService.retrieve(getContext(), iTwoGetSkills.getPreference().getImage(), headerUserImage);
|
203 |
|
161 |
|
204 |
headerUserName = getView().findViewById(R.id.fragment_userprofile_header_user_name);
|
162 |
headerUserName = getView().findViewById(R.id.fragment_userprofile_header_user_name);
|