mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-25 02:18:23 +01:00
Move refreshAccessToken method from RefreshAccessToken class to AccessTokenAuthenticator class. Bind views using Butterknife in PostRecyclerViewAdapter and CommentMultiLevelRecyclerViewAdapter.
This commit is contained in:
parent
4d0a0725c9
commit
ae81b23737
@ -3,19 +3,29 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import okhttp3.Authenticator;
|
import okhttp3.Authenticator;
|
||||||
import okhttp3.Headers;
|
import okhttp3.Headers;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
import okhttp3.Route;
|
import okhttp3.Route;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
class AccessTokenAuthenticator implements Authenticator {
|
class AccessTokenAuthenticator implements Authenticator {
|
||||||
|
private Retrofit mRetrofit;
|
||||||
private SharedPreferences mAuthInfoSharedPreferences;
|
private SharedPreferences mAuthInfoSharedPreferences;
|
||||||
|
|
||||||
AccessTokenAuthenticator(SharedPreferences authInfoSharedPreferences) {
|
AccessTokenAuthenticator(Retrofit retrofit, SharedPreferences authInfoSharedPreferences) {
|
||||||
|
mRetrofit = retrofit;
|
||||||
mAuthInfoSharedPreferences = authInfoSharedPreferences;
|
mAuthInfoSharedPreferences = authInfoSharedPreferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +37,7 @@ class AccessTokenAuthenticator implements Authenticator {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
String accessTokenFromSharedPreferences = mAuthInfoSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN_KEY, "");
|
String accessTokenFromSharedPreferences = mAuthInfoSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN_KEY, "");
|
||||||
if (accessToken.equals(accessTokenFromSharedPreferences)) {
|
if (accessToken.equals(accessTokenFromSharedPreferences)) {
|
||||||
String newAccessToken = RefreshAccessToken.refreshAccessToken(mAuthInfoSharedPreferences);
|
String newAccessToken = refreshAccessToken();
|
||||||
if (!newAccessToken.equals("")) {
|
if (!newAccessToken.equals("")) {
|
||||||
return response.request().newBuilder().headers(Headers.of(RedditUtils.getOAuthHeader(newAccessToken))).build();
|
return response.request().newBuilder().headers(Headers.of(RedditUtils.getOAuthHeader(newAccessToken))).build();
|
||||||
} else {
|
} else {
|
||||||
@ -40,4 +50,31 @@ class AccessTokenAuthenticator implements Authenticator {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String refreshAccessToken() {
|
||||||
|
String refreshToken = mAuthInfoSharedPreferences.getString(SharedPreferencesUtils.REFRESH_TOKEN_KEY, "");
|
||||||
|
|
||||||
|
RedditAPI api = mRetrofit.create(RedditAPI.class);
|
||||||
|
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
params.put(RedditUtils.GRANT_TYPE_KEY, RedditUtils.GRANT_TYPE_REFRESH_TOKEN);
|
||||||
|
params.put(RedditUtils.REFRESH_TOKEN_KEY, refreshToken);
|
||||||
|
|
||||||
|
Call<String> accessTokenCall = api.getAccessToken(RedditUtils.getHttpBasicAuthHeader(), params);
|
||||||
|
try {
|
||||||
|
retrofit2.Response response = accessTokenCall.execute();
|
||||||
|
JSONObject jsonObject = new JSONObject((String) response.body());
|
||||||
|
|
||||||
|
String newAccessToken = jsonObject.getString(RedditUtils.ACCESS_TOKEN_KEY);
|
||||||
|
|
||||||
|
mAuthInfoSharedPreferences.edit().putString(SharedPreferencesUtils.ACCESS_TOKEN_KEY, newAccessToken).apply();
|
||||||
|
|
||||||
|
Log.i("access token", newAccessToken);
|
||||||
|
return newAccessToken;
|
||||||
|
} catch (IOException | JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
class CommentMultiLevelRecyclerViewAdapter extends MultiLevelAdapter {
|
class CommentMultiLevelRecyclerViewAdapter extends MultiLevelAdapter {
|
||||||
@ -255,30 +257,21 @@ class CommentMultiLevelRecyclerViewAdapter extends MultiLevelAdapter {
|
|||||||
expandButton.setImageResource(isExpanded ? R.drawable.ic_expand_less_black_20dp : R.drawable.ic_expand_more_black_20dp);
|
expandButton.setImageResource(isExpanded ? R.drawable.ic_expand_less_black_20dp : R.drawable.ic_expand_more_black_20dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CommentViewHolder extends RecyclerView.ViewHolder {
|
class CommentViewHolder extends RecyclerView.ViewHolder {
|
||||||
private TextView authorTextView;
|
@BindView(R.id.author_text_view_item_post_comment) TextView authorTextView;
|
||||||
private TextView commentTimeTextView;
|
@BindView(R.id.comment_time_text_view_item_post_comment) TextView commentTimeTextView;
|
||||||
private HtmlTextView commentHtmlTextView;
|
@BindView(R.id.comment_html_text_view_item_post_comment) HtmlTextView commentHtmlTextView;
|
||||||
private ImageView upvoteButton;
|
@BindView(R.id.plus_button_item_post_comment) ImageView upvoteButton;
|
||||||
private ImageView downvoteButton;
|
@BindView(R.id.score_text_view_item_post_comment) TextView scoreTextView;
|
||||||
private TextView scoreTextView;
|
@BindView(R.id.minus_button_item_post_comment) ImageView downvoteButton;
|
||||||
private ImageView expandButton;
|
@BindView(R.id.expand_button_item_post_comment) ImageView expandButton;
|
||||||
private ProgressBar loadMoreCommentsProgressBar;
|
@BindView(R.id.load_more_comments_progress_bar) ProgressBar loadMoreCommentsProgressBar;
|
||||||
private ImageView replyButton;
|
@BindView(R.id.reply_button_item_post_comment) ImageView replyButton;
|
||||||
private View verticalBlock;
|
@BindView(R.id.vertical_block_item_post_comment) View verticalBlock;
|
||||||
|
|
||||||
public CommentViewHolder(View itemView) {
|
CommentViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
authorTextView = itemView.findViewById(R.id.author_text_view_item_post_comment);
|
ButterKnife.bind(this, itemView);
|
||||||
commentTimeTextView = itemView.findViewById(R.id.comment_time_text_view_item_post_comment);
|
|
||||||
commentHtmlTextView = itemView.findViewById(R.id.comment_html_text_view_item_post_comment);
|
|
||||||
upvoteButton = itemView.findViewById(R.id.plus_button_item_post_comment);
|
|
||||||
downvoteButton = itemView.findViewById(R.id.minus_button_item_post_comment);
|
|
||||||
scoreTextView = itemView.findViewById(R.id.score_text_view_item_post_comment);
|
|
||||||
loadMoreCommentsProgressBar = itemView.findViewById(R.id.load_more_comments_progress_bar);
|
|
||||||
expandButton = itemView.findViewById(R.id.expand_button_item_post_comment);
|
|
||||||
replyButton = itemView.findViewById(R.id.reply_button_item_post_comment);
|
|
||||||
verticalBlock = itemView.findViewById(R.id.vertical_block_item_post_comment);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,9 @@ class NetworkModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
OkHttpClient provideOkHttpClient(@Named("auth_info") SharedPreferences sharedPreferences) {
|
OkHttpClient provideOkHttpClient(@Named("no_oauth") Retrofit retrofit, @Named("auth_info") SharedPreferences sharedPreferences) {
|
||||||
OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient.Builder();
|
OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient.Builder();
|
||||||
okHttpClientBuilder.authenticator(new AccessTokenAuthenticator(sharedPreferences));
|
okHttpClientBuilder.authenticator(new AccessTokenAuthenticator(retrofit, sharedPreferences));
|
||||||
return okHttpClientBuilder.build();
|
return okHttpClientBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,11 +181,6 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
mFetchPostErrorLinearLayout.setVisibility(View.GONE);
|
mFetchPostErrorLinearLayout.setVisibility(View.GONE);
|
||||||
mProgressBar.setVisibility(View.VISIBLE);
|
mProgressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
/*Retrofit retrofit = new Retrofit.Builder()
|
|
||||||
.baseUrl(RedditUtils.OAUTH_API_BASE_URI)
|
|
||||||
.addConverterFactory(ScalarsConverterFactory.create())
|
|
||||||
.build();*/
|
|
||||||
|
|
||||||
RedditAPI api = mOauthRetrofit.create(RedditAPI.class);
|
RedditAPI api = mOauthRetrofit.create(RedditAPI.class);
|
||||||
|
|
||||||
String accessToken = getActivity().getSharedPreferences(SharedPreferencesUtils.AUTH_CODE_FILE_KEY, Context.MODE_PRIVATE)
|
String accessToken = getActivity().getSharedPreferences(SharedPreferencesUtils.AUTH_CODE_FILE_KEY, Context.MODE_PRIVATE)
|
||||||
@ -246,11 +241,6 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
mFetchPostErrorLinearLayout.setVisibility(View.GONE);
|
mFetchPostErrorLinearLayout.setVisibility(View.GONE);
|
||||||
mProgressBar.setVisibility(View.VISIBLE);
|
mProgressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
/*Retrofit retrofit = new Retrofit.Builder()
|
|
||||||
.baseUrl(RedditUtils.API_BASE_URI)
|
|
||||||
.addConverterFactory(ScalarsConverterFactory.create())
|
|
||||||
.build();*/
|
|
||||||
|
|
||||||
RedditAPI api = mRetrofit.create(RedditAPI.class);
|
RedditAPI api = mRetrofit.create(RedditAPI.class);
|
||||||
Call<String> getPost = api.getPost(mSubredditName, mLastItem);
|
Call<String> getPost = api.getPost(mSubredditName, mLastItem);
|
||||||
getPost.enqueue(new Callback<String>() {
|
getPost.enqueue(new Callback<String>() {
|
||||||
|
@ -92,11 +92,6 @@ class PostPaginationScrollListener extends RecyclerView.OnScrollListener {
|
|||||||
loadSuccess = false;
|
loadSuccess = false;
|
||||||
mPaginationSynchronizer.setLoadingState(true);
|
mPaginationSynchronizer.setLoadingState(true);
|
||||||
|
|
||||||
/*Retrofit retrofit = new Retrofit.Builder()
|
|
||||||
.baseUrl(RedditUtils.OAUTH_API_BASE_URI)
|
|
||||||
.addConverterFactory(ScalarsConverterFactory.create())
|
|
||||||
.build();*/
|
|
||||||
|
|
||||||
RedditAPI api = mRetrofit.create(RedditAPI.class);
|
RedditAPI api = mRetrofit.create(RedditAPI.class);
|
||||||
|
|
||||||
String accessToken = mContext.getSharedPreferences(SharedPreferencesUtils.AUTH_CODE_FILE_KEY, Context.MODE_PRIVATE)
|
String accessToken = mContext.getSharedPreferences(SharedPreferencesUtils.AUTH_CODE_FILE_KEY, Context.MODE_PRIVATE)
|
||||||
@ -155,11 +150,6 @@ class PostPaginationScrollListener extends RecyclerView.OnScrollListener {
|
|||||||
loadSuccess = false;
|
loadSuccess = false;
|
||||||
mPaginationSynchronizer.setLoadingState(true);
|
mPaginationSynchronizer.setLoadingState(true);
|
||||||
|
|
||||||
/*Retrofit retrofit = new Retrofit.Builder()
|
|
||||||
.baseUrl(RedditUtils.API_BASE_URI)
|
|
||||||
.addConverterFactory(ScalarsConverterFactory.create())
|
|
||||||
.build();*/
|
|
||||||
|
|
||||||
RedditAPI api = mRetrofit.create(RedditAPI.class);
|
RedditAPI api = mRetrofit.create(RedditAPI.class);
|
||||||
Call<String> getPost = api.getPost(subredditName, mLastItem);
|
Call<String> getPost = api.getPost(subredditName, mLastItem);
|
||||||
getPost.enqueue(new Callback<String>() {
|
getPost.enqueue(new Callback<String>() {
|
||||||
|
@ -35,6 +35,8 @@ import com.bumptech.glide.request.target.Target;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
import de.hdodenhof.circleimageview.CircleImageView;
|
import de.hdodenhof.circleimageview.CircleImageView;
|
||||||
import jp.wasabeef.glide.transformations.BlurTransformation;
|
import jp.wasabeef.glide.transformations.BlurTransformation;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
@ -517,63 +519,41 @@ class PostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DataViewHolder extends RecyclerView.ViewHolder {
|
class DataViewHolder extends RecyclerView.ViewHolder {
|
||||||
private CardView cardView;
|
@BindView(R.id.card_view_view_post_detail) CardView cardView;
|
||||||
private CircleImageView subredditIconCircleImageView;
|
@BindView(R.id.subreddit_icon_circle_image_view_best_post_item) CircleImageView subredditIconCircleImageView;
|
||||||
private TextView subredditNameTextView;
|
@BindView(R.id.subreddit_text_view_best_post_item) TextView subredditNameTextView;
|
||||||
private ImageView stickiedPostImageView;
|
@BindView(R.id.stickied_post_image_view_best_post_item) ImageView stickiedPostImageView;
|
||||||
private TextView postTimeTextView;
|
@BindView(R.id.post_time_text_view_best_post_item) TextView postTimeTextView;
|
||||||
private TextView titleTextView;
|
@BindView(R.id.title_text_view_best_post_item) TextView titleTextView;
|
||||||
private TextView typeTextView;
|
@BindView(R.id.type_text_view_item_best_post) TextView typeTextView;
|
||||||
private ImageView gildedImageView;
|
@BindView(R.id.gilded_image_view_item_best_post) ImageView gildedImageView;
|
||||||
private TextView gildedNumberTextView;
|
@BindView(R.id.gilded_number_text_view_item_best_post) TextView gildedNumberTextView;
|
||||||
private ImageView crosspostImageView;
|
@BindView(R.id.crosspost_image_view_item_best_post) ImageView crosspostImageView;
|
||||||
private TextView nsfwTextView;
|
@BindView(R.id.nsfw_text_view_item_best_post) TextView nsfwTextView;
|
||||||
private RelativeLayout relativeLayout;
|
@BindView(R.id.image_view_wrapper_item_best_post) RelativeLayout relativeLayout;
|
||||||
private ProgressBar progressBar;
|
@BindView(R.id.progress_bar_best_post_item) ProgressBar progressBar;
|
||||||
private ImageView imageView;
|
@BindView(R.id.image_view_best_post_item) ImageView imageView;
|
||||||
private LinearLayout errorLinearLayout;
|
@BindView(R.id.load_image_error_linear_layout_best_post_item) LinearLayout errorLinearLayout;
|
||||||
private ImageView noPreviewLinkImageView;
|
@BindView(R.id.image_view_no_preview_link_best_post_item) ImageView noPreviewLinkImageView;
|
||||||
private ImageView upvoteButton;
|
@BindView(R.id.plus_button_item_best_post) ImageView upvoteButton;
|
||||||
private TextView scoreTextView;
|
@BindView(R.id.score_text_view_item_best_post) TextView scoreTextView;
|
||||||
private ImageView downvoteButton;
|
@BindView(R.id.minus_button_item_best_post) ImageView downvoteButton;
|
||||||
private ImageView shareButton;
|
@BindView(R.id.share_button_item_best_post) ImageView shareButton;
|
||||||
|
|
||||||
DataViewHolder(View itemView) {
|
DataViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
cardView = itemView.findViewById(R.id.card_view_view_post_detail);
|
ButterKnife.bind(this, itemView);
|
||||||
subredditIconCircleImageView = itemView.findViewById(R.id.subreddit_icon_circle_image_view_best_post_item);
|
|
||||||
subredditNameTextView = itemView.findViewById(R.id.subreddit_text_view_best_post_item);
|
|
||||||
stickiedPostImageView = itemView.findViewById(R.id.stickied_post_image_view_best_post_item);
|
|
||||||
postTimeTextView = itemView.findViewById(R.id.post_time_text_view_best_post_item);
|
|
||||||
titleTextView = itemView.findViewById(R.id.title_text_view_best_post_item);
|
|
||||||
typeTextView = itemView.findViewById(R.id.type_text_view_item_best_post);
|
|
||||||
gildedImageView = itemView.findViewById(R.id.gilded_image_view_item_best_post);
|
|
||||||
gildedNumberTextView = itemView.findViewById(R.id.gilded_number_text_view_item_best_post);
|
|
||||||
crosspostImageView = itemView.findViewById(R.id.crosspost_image_view_item_best_post);
|
|
||||||
nsfwTextView = itemView.findViewById(R.id.nsfw_text_view_item_best_post);
|
|
||||||
relativeLayout = itemView.findViewById(R.id.image_view_wrapper_item_best_post);
|
|
||||||
progressBar = itemView.findViewById(R.id.progress_bar_best_post_item);
|
|
||||||
imageView = itemView.findViewById(R.id.image_view_best_post_item);
|
|
||||||
errorLinearLayout = itemView.findViewById(R.id.load_image_error_linear_layout_best_post_item);
|
|
||||||
noPreviewLinkImageView = itemView.findViewById(R.id.image_view_no_preview_link_best_post_item);
|
|
||||||
|
|
||||||
upvoteButton = itemView.findViewById(R.id.plus_button_item_best_post);
|
|
||||||
scoreTextView = itemView.findViewById(R.id.score_text_view_item_best_post);
|
|
||||||
downvoteButton = itemView.findViewById(R.id.minus_button_item_best_post);
|
|
||||||
shareButton = itemView.findViewById(R.id.share_button_item_best_post);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LoadingViewHolder extends RecyclerView.ViewHolder {
|
class LoadingViewHolder extends RecyclerView.ViewHolder {
|
||||||
private ProgressBar progressBar;
|
@BindView(R.id.progress_bar_footer_progress_bar_item) ProgressBar progressBar;
|
||||||
private RelativeLayout relativeLayout;
|
@BindView(R.id.relative_layout_footer_progress_bar_item) RelativeLayout relativeLayout;
|
||||||
private Button retryButton;
|
@BindView(R.id.retry_button_footer_progress_bar_item) Button retryButton;
|
||||||
|
|
||||||
LoadingViewHolder(LinearLayout itemView) {
|
LoadingViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
progressBar = itemView.findViewById(R.id.progress_bar_footer_progress_bar_item);
|
ButterKnife.bind(this, itemView);
|
||||||
relativeLayout = itemView.findViewById(R.id.relative_layout_footer_progress_bar_item);
|
|
||||||
retryButton = itemView.findViewById(R.id.retry_button_footer_progress_bar_item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Response;
|
|
||||||
import retrofit2.Retrofit;
|
|
||||||
import retrofit2.converter.scalars.ScalarsConverterFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by alex on 3/13/18.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class RefreshAccessToken {
|
|
||||||
static String refreshAccessToken(/*Retrofit oauthRetrofit, */SharedPreferences sharedPreferences) {
|
|
||||||
String refreshToken = sharedPreferences.getString(SharedPreferencesUtils.REFRESH_TOKEN_KEY, "");
|
|
||||||
|
|
||||||
Retrofit retrofit = new Retrofit.Builder()
|
|
||||||
.baseUrl(RedditUtils.API_BASE_URI)
|
|
||||||
.addConverterFactory(ScalarsConverterFactory.create())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
RedditAPI api = retrofit.create(RedditAPI.class);
|
|
||||||
|
|
||||||
Map<String, String> params = new HashMap<>();
|
|
||||||
params.put(RedditUtils.GRANT_TYPE_KEY, RedditUtils.GRANT_TYPE_REFRESH_TOKEN);
|
|
||||||
params.put(RedditUtils.REFRESH_TOKEN_KEY, refreshToken);
|
|
||||||
|
|
||||||
Call<String> accessTokenCall = api.getAccessToken(RedditUtils.getHttpBasicAuthHeader(), params);
|
|
||||||
try {
|
|
||||||
Response response = accessTokenCall.execute();
|
|
||||||
JSONObject jsonObject = new JSONObject((String) response.body());
|
|
||||||
|
|
||||||
String newAccessToken = jsonObject.getString(RedditUtils.ACCESS_TOKEN_KEY);
|
|
||||||
|
|
||||||
sharedPreferences.edit().putString(SharedPreferencesUtils.ACCESS_TOKEN_KEY, newAccessToken).apply();
|
|
||||||
|
|
||||||
Log.i("access token", newAccessToken);
|
|
||||||
return newAccessToken;
|
|
||||||
} catch (IOException | JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,7 +13,6 @@
|
|||||||
android:background="#FFFFFF">
|
android:background="#FFFFFF">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/relative_view_item_best_post"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
|
Loading…
Reference in New Issue
Block a user