Minor writing style changes.
This commit is contained in:
parent
727d262e55
commit
dacfbb3455
|
@ -88,7 +88,7 @@ public class AboutActivity extends BaseActivity {
|
||||||
onSearchFailed();
|
onSearchFailed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mastodonAPI.searchAccounts("Tusky@mastodon.social", true, null).enqueue(callback);
|
mastodonApi.searchAccounts("Tusky@mastodon.social", true, null).enqueue(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSearchFailed() {
|
private void onSearchFailed() {
|
||||||
|
|
|
@ -205,7 +205,7 @@ public class AccountActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void obtainAccount() {
|
private void obtainAccount() {
|
||||||
mastodonAPI.account(accountId).enqueue(new Callback<Account>() {
|
mastodonApi.account(accountId).enqueue(new Callback<Account>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<Account> call, Response<Account> response) {
|
public void onResponse(Call<Account> call, Response<Account> response) {
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
|
@ -313,7 +313,7 @@ public class AccountActivity extends BaseActivity {
|
||||||
private void obtainRelationships() {
|
private void obtainRelationships() {
|
||||||
List<String> ids = new ArrayList<>(1);
|
List<String> ids = new ArrayList<>(1);
|
||||||
ids.add(accountId);
|
ids.add(accountId);
|
||||||
mastodonAPI.relationships(ids).enqueue(new Callback<List<Relationship>>() {
|
mastodonApi.relationships(ids).enqueue(new Callback<List<Relationship>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<List<Relationship>> call,
|
public void onResponse(Call<List<Relationship>> call,
|
||||||
Response<List<Relationship>> response) {
|
Response<List<Relationship>> response) {
|
||||||
|
@ -474,8 +474,8 @@ public class AccountActivity extends BaseActivity {
|
||||||
|
|
||||||
Assert.expect(followState != FollowState.REQUESTED);
|
Assert.expect(followState != FollowState.REQUESTED);
|
||||||
switch (followState) {
|
switch (followState) {
|
||||||
case NOT_FOLLOWING: { mastodonAPI.followAccount(id).enqueue(cb); break; }
|
case NOT_FOLLOWING: { mastodonApi.followAccount(id).enqueue(cb); break; }
|
||||||
case FOLLOWING: { mastodonAPI.unfollowAccount(id).enqueue(cb); break; }
|
case FOLLOWING: { mastodonApi.unfollowAccount(id).enqueue(cb); break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,9 +523,9 @@ public class AccountActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (blocking) {
|
if (blocking) {
|
||||||
mastodonAPI.unblockAccount(id).enqueue(cb);
|
mastodonApi.unblockAccount(id).enqueue(cb);
|
||||||
} else {
|
} else {
|
||||||
mastodonAPI.blockAccount(id).enqueue(cb);
|
mastodonApi.blockAccount(id).enqueue(cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,9 +562,9 @@ public class AccountActivity extends BaseActivity {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (muting) {
|
if (muting) {
|
||||||
mastodonAPI.unmuteAccount(id).enqueue(cb);
|
mastodonApi.unmuteAccount(id).enqueue(cb);
|
||||||
} else {
|
} else {
|
||||||
mastodonAPI.muteAccount(id).enqueue(cb);
|
mastodonApi.muteAccount(id).enqueue(cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ import com.keylesspalace.tusky.entity.Session;
|
||||||
import com.keylesspalace.tusky.json.SpannedTypeAdapter;
|
import com.keylesspalace.tusky.json.SpannedTypeAdapter;
|
||||||
import com.keylesspalace.tusky.json.StringWithEmoji;
|
import com.keylesspalace.tusky.json.StringWithEmoji;
|
||||||
import com.keylesspalace.tusky.json.StringWithEmojiTypeAdapter;
|
import com.keylesspalace.tusky.json.StringWithEmojiTypeAdapter;
|
||||||
import com.keylesspalace.tusky.network.MastodonAPI;
|
import com.keylesspalace.tusky.network.MastodonApi;
|
||||||
import com.keylesspalace.tusky.network.TuskyApi;
|
import com.keylesspalace.tusky.network.TuskyApi;
|
||||||
import com.keylesspalace.tusky.util.OkHttpUtils;
|
import com.keylesspalace.tusky.util.OkHttpUtils;
|
||||||
import com.keylesspalace.tusky.util.PushNotificationClient;
|
import com.keylesspalace.tusky.util.PushNotificationClient;
|
||||||
|
@ -57,7 +57,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
||||||
public class BaseActivity extends AppCompatActivity {
|
public class BaseActivity extends AppCompatActivity {
|
||||||
private static final String TAG = "BaseActivity"; // logging tag
|
private static final String TAG = "BaseActivity"; // logging tag
|
||||||
|
|
||||||
public MastodonAPI mastodonAPI;
|
public MastodonApi mastodonApi;
|
||||||
public TuskyApi tuskyApi;
|
public TuskyApi tuskyApi;
|
||||||
protected PushNotificationClient pushNotificationClient;
|
protected PushNotificationClient pushNotificationClient;
|
||||||
protected Dispatcher mastodonApiDispatcher;
|
protected Dispatcher mastodonApiDispatcher;
|
||||||
|
@ -67,7 +67,7 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
redirectIfNotLoggedIn();
|
redirectIfNotLoggedIn();
|
||||||
createMastodonAPI();
|
createMastodonApi();
|
||||||
createTuskyApi();
|
createTuskyApi();
|
||||||
createPushNotificationClient();
|
createPushNotificationClient();
|
||||||
|
|
||||||
|
@ -81,7 +81,9 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
if(mastodonApiDispatcher != null) mastodonApiDispatcher.cancelAll();
|
if (mastodonApiDispatcher != null) {
|
||||||
|
mastodonApiDispatcher.cancelAll();
|
||||||
|
}
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +126,7 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
return "https://" + preferences.getString("domain", null);
|
return "https://" + preferences.getString("domain", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createMastodonAPI() {
|
protected void createMastodonApi() {
|
||||||
mastodonApiDispatcher = new Dispatcher();
|
mastodonApiDispatcher = new Dispatcher();
|
||||||
|
|
||||||
Gson gson = new GsonBuilder()
|
Gson gson = new GsonBuilder()
|
||||||
|
@ -158,7 +160,7 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
mastodonAPI = retrofit.create(MastodonAPI.class);
|
mastodonApi = retrofit.create(MastodonApi.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createTuskyApi() {
|
protected void createTuskyApi() {
|
||||||
|
|
|
@ -697,7 +697,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm
|
||||||
onSendFailure();
|
onSendFailure();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mastodonAPI.createStatus(content, inReplyToId, spoilerText, visibility, sensitive, mediaIds)
|
mastodonApi.createStatus(content, inReplyToId, spoilerText, visibility, sensitive, mediaIds)
|
||||||
.enqueue(callback);
|
.enqueue(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1031,7 +1031,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm
|
||||||
RequestBody requestFile = RequestBody.create(MediaType.parse(mimeType), content);
|
RequestBody requestFile = RequestBody.create(MediaType.parse(mimeType), content);
|
||||||
MultipartBody.Part body = MultipartBody.Part.createFormData("file", filename, requestFile);
|
MultipartBody.Part body = MultipartBody.Part.createFormData("file", filename, requestFile);
|
||||||
|
|
||||||
item.uploadRequest = mastodonAPI.uploadMedia(body);
|
item.uploadRequest = mastodonApi.uploadMedia(body);
|
||||||
|
|
||||||
item.uploadRequest.enqueue(new Callback<Media>() {
|
item.uploadRequest.enqueue(new Callback<Media>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1263,7 +1263,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm
|
||||||
private ArrayList<Account> autocompleteMention(String mention) {
|
private ArrayList<Account> autocompleteMention(String mention) {
|
||||||
ArrayList<Account> resultList = new ArrayList<>();
|
ArrayList<Account> resultList = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
List<Account> accountList = mastodonAPI.searchAccounts(mention, false, 40)
|
List<Account> accountList = mastodonApi.searchAccounts(mention, false, 40)
|
||||||
.execute()
|
.execute()
|
||||||
.body();
|
.body();
|
||||||
if (accountList != null) {
|
if (accountList != null) {
|
||||||
|
|
|
@ -157,7 +157,7 @@ public class EditProfileActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mastodonAPI.accountVerifyCredentials().enqueue(new Callback<Account>() {
|
mastodonApi.accountVerifyCredentials().enqueue(new Callback<Account>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<Account> call, Response<Account> response) {
|
public void onResponse(Call<Account> call, Response<Account> response) {
|
||||||
if (!response.isSuccessful()) {
|
if (!response.isSuccessful()) {
|
||||||
|
@ -309,7 +309,7 @@ public class EditProfileActivity extends BaseActivity {
|
||||||
profile.note = newNote;
|
profile.note = newNote;
|
||||||
profile.avatar = avatarBase64;
|
profile.avatar = avatarBase64;
|
||||||
profile.header = headerBase64;
|
profile.header = headerBase64;
|
||||||
mastodonAPI.accountUpdateCredentials(profile).enqueue(new Callback<Account>() {
|
mastodonApi.accountUpdateCredentials(profile).enqueue(new Callback<Account>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<Account> call, Response<Account> response) {
|
public void onResponse(Call<Account> call, Response<Account> response) {
|
||||||
if (!response.isSuccessful()) {
|
if (!response.isSuccessful()) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import com.keylesspalace.tusky.entity.AccessToken;
|
import com.keylesspalace.tusky.entity.AccessToken;
|
||||||
import com.keylesspalace.tusky.entity.AppCredentials;
|
import com.keylesspalace.tusky.entity.AppCredentials;
|
||||||
import com.keylesspalace.tusky.network.MastodonAPI;
|
import com.keylesspalace.tusky.network.MastodonApi;
|
||||||
import com.keylesspalace.tusky.util.CustomTabsHelper;
|
import com.keylesspalace.tusky.util.CustomTabsHelper;
|
||||||
import com.keylesspalace.tusky.util.OkHttpUtils;
|
import com.keylesspalace.tusky.util.OkHttpUtils;
|
||||||
|
|
||||||
|
@ -150,14 +150,14 @@ public class LoginActivity extends AppCompatActivity {
|
||||||
return scheme + "://" + host + "/";
|
return scheme + "://" + host + "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
private MastodonAPI getApiFor(String domain) {
|
private MastodonApi getApiFor(String domain) {
|
||||||
Retrofit retrofit = new Retrofit.Builder()
|
Retrofit retrofit = new Retrofit.Builder()
|
||||||
.baseUrl("https://" + domain)
|
.baseUrl("https://" + domain)
|
||||||
.client(OkHttpUtils.getCompatibleClient())
|
.client(OkHttpUtils.getCompatibleClient())
|
||||||
.addConverterFactory(GsonConverterFactory.create())
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
return retrofit.create(MastodonAPI.class);
|
return retrofit.create(MastodonApi.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -267,7 +267,7 @@ public class LoginActivity extends AppCompatActivity {
|
||||||
private void redirectUserToAuthorizeAndLogin(EditText editText) {
|
private void redirectUserToAuthorizeAndLogin(EditText editText) {
|
||||||
/* To authorize this app and log in it's necessary to redirect to the domain given,
|
/* To authorize this app and log in it's necessary to redirect to the domain given,
|
||||||
* activity_login there, and the server will redirect back to the app with its response. */
|
* activity_login there, and the server will redirect back to the app with its response. */
|
||||||
String endpoint = MastodonAPI.ENDPOINT_AUTHORIZE;
|
String endpoint = MastodonApi.ENDPOINT_AUTHORIZE;
|
||||||
String redirectUri = getOauthRedirectUri();
|
String redirectUri = getOauthRedirectUri();
|
||||||
Map<String, String> parameters = new HashMap<>();
|
Map<String, String> parameters = new HashMap<>();
|
||||||
parameters.put("client_id", clientId);
|
parameters.put("client_id", clientId);
|
||||||
|
|
|
@ -387,7 +387,7 @@ public class MainActivity extends BaseActivity {
|
||||||
loggedInAccountUsername = username;
|
loggedInAccountUsername = username;
|
||||||
}
|
}
|
||||||
|
|
||||||
mastodonAPI.accountVerifyCredentials().enqueue(new Callback<Account>() {
|
mastodonApi.accountVerifyCredentials().enqueue(new Callback<Account>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<Account> call, Response<Account> response) {
|
public void onResponse(Call<Account> call, Response<Account> response) {
|
||||||
if (!response.isSuccessful()) {
|
if (!response.isSuccessful()) {
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class ReportActivity extends BaseActivity {
|
||||||
|
|
||||||
private void sendReport(final String accountId, final String[] statusIds,
|
private void sendReport(final String accountId, final String[] statusIds,
|
||||||
final String comment) {
|
final String comment) {
|
||||||
mastodonAPI.report(accountId, Arrays.asList(statusIds), comment).enqueue(new Callback<ResponseBody>() {
|
mastodonApi.report(accountId, Arrays.asList(statusIds), comment).enqueue(new Callback<ResponseBody>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ResponseBody> call, retrofit2.Response<ResponseBody> response) {
|
public void onResponse(Call<ResponseBody> call, retrofit2.Response<ResponseBody> response) {
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
|
@ -155,7 +155,7 @@ public class ReportActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchRecentStatuses(String accountId) {
|
private void fetchRecentStatuses(String accountId) {
|
||||||
mastodonAPI.accountStatuses(accountId, null, null, null).enqueue(new Callback<List<Status>>() {
|
mastodonApi.accountStatuses(accountId, null, null, null).enqueue(new Callback<List<Status>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<List<Status>> call, retrofit2.Response<List<Status>> response) {
|
public void onResponse(Call<List<Status>> call, retrofit2.Response<List<Status>> response) {
|
||||||
if (!response.isSuccessful()) {
|
if (!response.isSuccessful()) {
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class SearchActivity extends BaseActivity implements SearchView.OnQueryTe
|
||||||
onSearchFailure();
|
onSearchFailure();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mastodonAPI.search(query, false)
|
mastodonApi.search(query, false)
|
||||||
.enqueue(callback);
|
.enqueue(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ import com.keylesspalace.tusky.BaseActivity;
|
||||||
import com.keylesspalace.tusky.entity.Account;
|
import com.keylesspalace.tusky.entity.Account;
|
||||||
import com.keylesspalace.tusky.entity.Relationship;
|
import com.keylesspalace.tusky.entity.Relationship;
|
||||||
import com.keylesspalace.tusky.interfaces.AccountActionListener;
|
import com.keylesspalace.tusky.interfaces.AccountActionListener;
|
||||||
import com.keylesspalace.tusky.network.MastodonAPI;
|
import com.keylesspalace.tusky.network.MastodonApi;
|
||||||
import com.keylesspalace.tusky.R;
|
import com.keylesspalace.tusky.R;
|
||||||
import com.keylesspalace.tusky.util.ThemeUtils;
|
import com.keylesspalace.tusky.util.ThemeUtils;
|
||||||
import com.keylesspalace.tusky.view.EndlessOnScrollListener;
|
import com.keylesspalace.tusky.view.EndlessOnScrollListener;
|
||||||
|
@ -70,7 +70,7 @@ public class AccountListFragment extends BaseFragment implements AccountActionLi
|
||||||
private EndlessOnScrollListener scrollListener;
|
private EndlessOnScrollListener scrollListener;
|
||||||
private AccountAdapter adapter;
|
private AccountAdapter adapter;
|
||||||
private TabLayout.OnTabSelectedListener onTabSelectedListener;
|
private TabLayout.OnTabSelectedListener onTabSelectedListener;
|
||||||
private MastodonAPI api;
|
private MastodonApi api;
|
||||||
|
|
||||||
public static AccountListFragment newInstance(Type type) {
|
public static AccountListFragment newInstance(Type type) {
|
||||||
Bundle arguments = new Bundle();
|
Bundle arguments = new Bundle();
|
||||||
|
@ -153,10 +153,10 @@ public class AccountListFragment extends BaseFragment implements AccountActionLi
|
||||||
layout.addOnTabSelectedListener(onTabSelectedListener);
|
layout.addOnTabSelectedListener(onTabSelectedListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MastodonAPI on the base activity is only guaranteed to be initialised after the parent
|
/* MastodonApi on the base activity is only guaranteed to be initialised after the parent
|
||||||
* activity is created, so everything needing to access the api object has to be delayed
|
* activity is created, so everything needing to access the api object has to be delayed
|
||||||
* until here. */
|
* until here. */
|
||||||
api = activity.mastodonAPI;
|
api = activity.mastodonApi;
|
||||||
scrollListener = new EndlessOnScrollListener(layoutManager) {
|
scrollListener = new EndlessOnScrollListener(layoutManager) {
|
||||||
@Override
|
@Override
|
||||||
public void onLoadMore(int page, int totalItemsCount, RecyclerView view) {
|
public void onLoadMore(int page, int totalItemsCount, RecyclerView view) {
|
||||||
|
@ -266,7 +266,7 @@ public class AccountListFragment extends BaseFragment implements AccountActionLi
|
||||||
/* If somehow an unmute button is clicked after onCreateView but before
|
/* If somehow an unmute button is clicked after onCreateView but before
|
||||||
* onActivityCreated, then this would get called with a null api object, so this eats
|
* onActivityCreated, then this would get called with a null api object, so this eats
|
||||||
* that input. */
|
* that input. */
|
||||||
Log.d(TAG, "MastodonAPI isn't initialised so this mute can't occur.");
|
Log.d(TAG, "MastodonApi isn't initialised so this mute can't occur.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ public class AccountListFragment extends BaseFragment implements AccountActionLi
|
||||||
/* If somehow an unblock button is clicked after onCreateView but before
|
/* If somehow an unblock button is clicked after onCreateView but before
|
||||||
* onActivityCreated, then this would get called with a null api object, so this eats
|
* onActivityCreated, then this would get called with a null api object, so this eats
|
||||||
* that input. */
|
* that input. */
|
||||||
Log.d(TAG, "MastodonAPI isn't initialised so this block can't occur.");
|
Log.d(TAG, "MastodonApi isn't initialised so this block can't occur.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ public class AccountListFragment extends BaseFragment implements AccountActionLi
|
||||||
/* If somehow an response button is clicked after onCreateView but before
|
/* If somehow an response button is clicked after onCreateView but before
|
||||||
* onActivityCreated, then this would get called with a null api object, so this eats
|
* onActivityCreated, then this would get called with a null api object, so this eats
|
||||||
* that input. */
|
* that input. */
|
||||||
Log.d(TAG, "MastodonAPI isn't initialised, so follow requests can't be responded to.");
|
Log.d(TAG, "MastodonApi isn't initialised, so follow requests can't be responded to.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ import com.keylesspalace.tusky.ViewVideoActivity;
|
||||||
import com.keylesspalace.tusky.entity.Relationship;
|
import com.keylesspalace.tusky.entity.Relationship;
|
||||||
import com.keylesspalace.tusky.entity.Status;
|
import com.keylesspalace.tusky.entity.Status;
|
||||||
import com.keylesspalace.tusky.interfaces.AdapterItemRemover;
|
import com.keylesspalace.tusky.interfaces.AdapterItemRemover;
|
||||||
import com.keylesspalace.tusky.network.MastodonAPI;
|
import com.keylesspalace.tusky.network.MastodonApi;
|
||||||
import com.keylesspalace.tusky.receiver.TimelineReceiver;
|
import com.keylesspalace.tusky.receiver.TimelineReceiver;
|
||||||
import com.keylesspalace.tusky.util.HtmlUtils;
|
import com.keylesspalace.tusky.util.HtmlUtils;
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ import retrofit2.Response;
|
||||||
public abstract class SFragment extends BaseFragment {
|
public abstract class SFragment extends BaseFragment {
|
||||||
protected String loggedInAccountId;
|
protected String loggedInAccountId;
|
||||||
protected String loggedInUsername;
|
protected String loggedInUsername;
|
||||||
protected MastodonAPI mastodonAPI;
|
protected MastodonApi mastodonAPI;
|
||||||
protected static int COMPOSE_RESULT = 1;
|
protected static int COMPOSE_RESULT = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,7 +76,7 @@ public abstract class SFragment extends BaseFragment {
|
||||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
BaseActivity activity = (BaseActivity) getActivity();
|
BaseActivity activity = (BaseActivity) getActivity();
|
||||||
mastodonAPI = activity.mastodonAPI;
|
mastodonAPI = activity.mastodonApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void reply(Status status) {
|
protected void reply(Status status) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ import com.keylesspalace.tusky.adapter.ThreadAdapter;
|
||||||
import com.keylesspalace.tusky.BaseActivity;
|
import com.keylesspalace.tusky.BaseActivity;
|
||||||
import com.keylesspalace.tusky.entity.Status;
|
import com.keylesspalace.tusky.entity.Status;
|
||||||
import com.keylesspalace.tusky.entity.StatusContext;
|
import com.keylesspalace.tusky.entity.StatusContext;
|
||||||
import com.keylesspalace.tusky.network.MastodonAPI;
|
import com.keylesspalace.tusky.network.MastodonApi;
|
||||||
import com.keylesspalace.tusky.R;
|
import com.keylesspalace.tusky.R;
|
||||||
import com.keylesspalace.tusky.interfaces.StatusActionListener;
|
import com.keylesspalace.tusky.interfaces.StatusActionListener;
|
||||||
import com.keylesspalace.tusky.receiver.TimelineReceiver;
|
import com.keylesspalace.tusky.receiver.TimelineReceiver;
|
||||||
|
@ -54,7 +54,7 @@ public class ViewThreadFragment extends SFragment implements
|
||||||
private SwipeRefreshLayout swipeRefreshLayout;
|
private SwipeRefreshLayout swipeRefreshLayout;
|
||||||
private RecyclerView recyclerView;
|
private RecyclerView recyclerView;
|
||||||
private ThreadAdapter adapter;
|
private ThreadAdapter adapter;
|
||||||
private MastodonAPI mastodonApi;
|
private MastodonApi mastodonApi;
|
||||||
private String thisThreadsStatusId;
|
private String thisThreadsStatusId;
|
||||||
private TimelineReceiver timelineReceiver;
|
private TimelineReceiver timelineReceiver;
|
||||||
|
|
||||||
|
@ -112,9 +112,9 @@ public class ViewThreadFragment extends SFragment implements
|
||||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
/* BaseActivity's MastodonAPI object isn't guaranteed to be valid until after its onCreate
|
/* BaseActivity's MastodonApi object isn't guaranteed to be valid until after its onCreate
|
||||||
* is run, so all calls that need it can't be done until here. */
|
* is run, so all calls that need it can't be done until here. */
|
||||||
mastodonApi = ((BaseActivity) getActivity()).mastodonAPI;
|
mastodonApi = ((BaseActivity) getActivity()).mastodonApi;
|
||||||
|
|
||||||
thisThreadsStatusId = getArguments().getString("id");
|
thisThreadsStatusId = getArguments().getString("id");
|
||||||
onRefresh();
|
onRefresh();
|
||||||
|
|
|
@ -43,7 +43,7 @@ import retrofit2.http.Part;
|
||||||
import retrofit2.http.Path;
|
import retrofit2.http.Path;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
public interface MastodonAPI {
|
public interface MastodonApi {
|
||||||
String ENDPOINT_AUTHORIZE = "/oauth/authorize";
|
String ENDPOINT_AUTHORIZE = "/oauth/authorize";
|
||||||
|
|
||||||
@GET("api/v1/timelines/home")
|
@GET("api/v1/timelines/home")
|
Loading…
Reference in New Issue