aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java33
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java19
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java22
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPost.java14
-rw-r--r--app/src/main/res/layout/activity_main.xml4
-rw-r--r--app/src/main/res/values/strings.xml2
13 files changed, 109 insertions, 36 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java
index 85a01ff2..012e7479 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java
@@ -1,18 +1,27 @@
package ml.docilealligator.infinityforreddit;
import android.content.Intent;
+import android.content.res.Configuration;
+import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
import android.widget.EditText;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
+import androidx.core.content.ContextCompat;
import com.google.android.material.snackbar.Snackbar;
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+
import javax.inject.Inject;
import javax.inject.Named;
@@ -62,6 +71,16 @@ public class CommentActivity extends AppCompatActivity {
((Infinity) getApplication()).getAppComponent().inject(this);
+ EventBus.getDefault().register(this);
+
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ Window window = getWindow();
+ if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
+ window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
+ }
+ window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
+ }
+
if(savedInstanceState == null) {
getCurrentAccount();
} else {
@@ -83,6 +102,9 @@ public class CommentActivity extends AppCompatActivity {
}
setSupportActionBar(toolbar);
+
+ commentEditText.requestFocus();
+ getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}
private void getCurrentAccount() {
@@ -156,4 +178,15 @@ public class CommentActivity extends AppCompatActivity {
outState.putBoolean(NULL_ACCESS_TOKEN_STATE, mNullAccessToken);
outState.putString(ACCESS_TOKEN_STATE, mAccessToken);
}
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ EventBus.getDefault().unregister(this);
+ }
+
+ @Subscribe
+ public void onAccountSwitchEvent(SwitchAccountEvent event) {
+ finish();
+ }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java
index db413238..0570f133 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java
@@ -8,6 +8,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
+import android.view.WindowManager;
import android.widget.EditText;
import android.widget.Toast;
@@ -82,6 +83,9 @@ public class EditCommentActivity extends AppCompatActivity {
mFullName = getIntent().getExtras().getString(EXTRA_FULLNAME);
mAccessToken = getIntent().getExtras().getString(EXTRA_ACCESS_TOKEN);
contentEditText.setText(getIntent().getExtras().getString(EXTRA_CONTENT));
+
+ contentEditText.requestFocus();
+ getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}
@Override
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java
index a3ab5efe..29282fe1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java
@@ -8,6 +8,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
+import android.view.WindowManager;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
@@ -82,6 +83,9 @@ public class EditPostActivity extends AppCompatActivity {
mAccessToken = getIntent().getExtras().getString(EXTRA_ACCESS_TOKEN);
titleTextView.setText(getIntent().getExtras().getString(EXTRA_TITLE));
contentEditText.setText(getIntent().getExtras().getString(EXTRA_CONTENT));
+
+ contentEditText.requestFocus();
+ getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}
@Override
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
index b398b201..7c5a3da9 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
@@ -23,6 +23,7 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.view.GravityCompat;
+import androidx.core.widget.NestedScrollView;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
@@ -88,6 +89,7 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
@BindView(R.id.view_pager_main_activity) ViewPager viewPager;
@BindView(R.id.collapsing_toolbar_layout_main_activity) CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.toolbar) Toolbar toolbar;
+ @BindView(R.id.nested_scroll_view_main_activity) NestedScrollView nestedScrollView;
@BindView(R.id.all_drawer_items_linear_layout_main_activity) LinearLayout allDrawerItemsLinearLayout;
@BindView(R.id.account_label_main_activity) TextView accountLabelTextView;
@BindView(R.id.profile_linear_layout_main_activity) LinearLayout profileLinearLayout;
@@ -192,9 +194,12 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
if (navBarResourceId > 0) {
+ int navBarHeight = resources.getDimensionPixelSize(navBarResourceId);
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
- params.bottomMargin = resources.getDimensionPixelSize(navBarResourceId);
+ params.bottomMargin = navBarHeight;
fab.setLayoutParams(params);
+
+ nestedScrollView.setPadding(0, 0, 0, navBarHeight);
}
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java
index a4080fcf..7343f259 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java
@@ -143,6 +143,8 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
mGlide = Glide.with(this);
+ mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
+
if(savedInstanceState != null) {
mNullAccessToken = savedInstanceState.getBoolean(NULL_ACCESS_TOKEN_STATE);
mAccessToken = savedInstanceState.getString(ACCESS_TOKEN_STATE);
@@ -178,7 +180,6 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
displaySubredditIcon();
if(isPosting) {
- mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
mPostingSnackbar.show();
}
@@ -364,6 +365,11 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
return true;
}
+ if(titleEditText.getText() == null || titleEditText.getText().toString().equals("")) {
+ Snackbar.make(coordinatorLayout, R.string.title_required, Snackbar.LENGTH_SHORT).show();
+ return true;
+ }
+
if(imageUri == null) {
Snackbar.make(coordinatorLayout, R.string.select_an_image, Snackbar.LENGTH_SHORT).show();
return true;
@@ -373,7 +379,7 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
item.setEnabled(false);
item.getIcon().setAlpha(130);
- mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
+
mPostingSnackbar.show();
String subredditName;
@@ -482,6 +488,7 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
@Subscribe
public void onSubmitImagePostEvent(SubmitImagePostEvent submitImagePostEvent) {
isPosting = false;
+ mPostingSnackbar.dismiss();
if(submitImagePostEvent.postSuccess) {
Intent intent = new Intent(PostImageActivity.this, ViewUserDetailActivity.class);
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY,
@@ -489,7 +496,6 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
startActivity(intent);
finish();
} else {
- mPostingSnackbar.dismiss();
mMemu.getItem(R.id.action_send_post_image_activity).setEnabled(true);
mMemu.getItem(R.id.action_send_post_image_activity).getIcon().setAlpha(255);
if (submitImagePostEvent.errorMessage == null || submitImagePostEvent.errorMessage.equals("")) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java
index 34bf0236..a5ee9022 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java
@@ -119,6 +119,8 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
mGlide = Glide.with(this);
+ mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
+
if(savedInstanceState != null) {
mNullAccessToken = savedInstanceState.getBoolean(NULL_ACCESS_TOKEN_STATE);
mAccessToken = savedInstanceState.getString(ACCESS_TOKEN_STATE);
@@ -148,7 +150,6 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
displaySubredditIcon();
if(isPosting) {
- mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
mPostingSnackbar.show();
}
@@ -296,12 +297,22 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
return true;
}
+ if(titleEditText.getText() == null || titleEditText.getText().toString().equals("")) {
+ Snackbar.make(coordinatorLayout, R.string.title_required, Snackbar.LENGTH_SHORT).show();
+ return true;
+ }
+
+ if(contentEditText.getText() == null || contentEditText.getText().toString().equals("")) {
+ Snackbar.make(coordinatorLayout, R.string.link_required, Snackbar.LENGTH_SHORT).show();
+ return true;
+ }
+
isPosting = true;
item.setEnabled(false);
item.getIcon().setAlpha(130);
- Snackbar postingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
- postingSnackbar.show();
+
+ mPostingSnackbar.show();
String subredditName;
if(subredditIsUser) {
@@ -387,13 +398,13 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
@Subscribe
public void onSubmitLinkPostEvent(SubmitTextOrLinkPostEvent submitTextOrLinkPostEvent) {
isPosting = false;
+ mPostingSnackbar.dismiss();
if(submitTextOrLinkPostEvent.postSuccess) {
Intent intent = new Intent(PostLinkActivity.this, ViewPostDetailActivity.class);
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_DATA, submitTextOrLinkPostEvent.post);
startActivity(intent);
finish();
} else {
- mPostingSnackbar.dismiss();
mMemu.findItem(R.id.action_send_post_link_activity).setEnabled(true);
mMemu.findItem(R.id.action_send_post_link_activity).getIcon().setAlpha(255);
if(submitTextOrLinkPostEvent.errorMessage == null) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
index 815e12a8..bbdc016b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
@@ -119,6 +119,8 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
mGlide = Glide.with(this);
+ mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
+
if(savedInstanceState != null) {
subredditName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
iconUrl = savedInstanceState.getString(SUBREDDIT_ICON_STATE);
@@ -141,7 +143,6 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
displaySubredditIcon();
if(isPosting) {
- mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
mPostingSnackbar.show();
}
@@ -236,16 +237,6 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
});
}
- private void getCurrentAccountName() {
- new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
- if(account == null) {
- mNullAccessToken = true;
- } else {
- mAccessToken = account.getAccessToken();
- }
- }).execute();
- }
-
private void displaySubredditIcon() {
if(iconUrl != null && !iconUrl.equals("")) {
mGlide.load(iconUrl)
@@ -292,11 +283,16 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
return true;
}
+ if(titleEditText.getText() == null || titleEditText.getText().toString().equals("")) {
+ Snackbar.make(coordinatorLayout, R.string.title_required, Snackbar.LENGTH_SHORT).show();
+ return true;
+ }
+
isPosting = true;
item.setEnabled(false);
item.getIcon().setAlpha(130);
- mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
+
mPostingSnackbar.show();
String subredditName;
@@ -383,13 +379,13 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
@Subscribe
public void onSubmitTextPostEvent(SubmitTextOrLinkPostEvent submitTextOrLinkPostEvent) {
isPosting = false;
+ mPostingSnackbar.dismiss();
if(submitTextOrLinkPostEvent.postSuccess) {
Intent intent = new Intent(PostTextActivity.this, ViewPostDetailActivity.class);
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_DATA, submitTextOrLinkPostEvent.post);
startActivity(intent);
finish();
} else {
- mPostingSnackbar.dismiss();
mMemu.findItem(R.id.action_send_post_text_activity).setEnabled(true);
mMemu.findItem(R.id.action_send_post_text_activity).getIcon().setAlpha(255);
if(submitTextOrLinkPostEvent.errorMessage == null) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java
index 4b0e03ef..f9204444 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java
@@ -142,6 +142,8 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
mGlide = Glide.with(this);
+ mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
+
if(savedInstanceState != null) {
subredditName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
iconUrl = savedInstanceState.getString(SUBREDDIT_ICON_STATE);
@@ -176,7 +178,6 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
displaySubredditIcon();
if(isPosting) {
- mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
mPostingSnackbar.show();
}
@@ -359,6 +360,11 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
return true;
}
+ if(titleEditText.getText() == null || titleEditText.getText().toString().equals("")) {
+ Snackbar.make(coordinatorLayout, R.string.title_required, Snackbar.LENGTH_SHORT).show();
+ return true;
+ }
+
if(videoUri == null) {
Snackbar.make(coordinatorLayout, R.string.select_an_image, Snackbar.LENGTH_SHORT).show();
return true;
@@ -368,7 +374,7 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
item.setEnabled(false);
item.getIcon().setAlpha(130);
- mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
+
mPostingSnackbar.show();
String subredditName;
@@ -482,6 +488,7 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
@Subscribe
public void onSubmitVideoPostEvent(SubmitVideoPostEvent submitVideoPostEvent) {
isPosting = false;
+ mPostingSnackbar.dismiss();
if(submitVideoPostEvent.postSuccess) {
Intent intent = new Intent(this, ViewUserDetailActivity.class);
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY,
@@ -491,7 +498,6 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
} else if(submitVideoPostEvent.errorProcessingVideo) {
Snackbar.make(coordinatorLayout, R.string.error_processing_video, Snackbar.LENGTH_SHORT).show();
} else {
- mPostingSnackbar.dismiss();
mMemu.getItem(R.id.action_send_post_video_activity).setEnabled(true);
mMemu.getItem(R.id.action_send_post_video_activity).getIcon().setAlpha(255);
if (submitVideoPostEvent.errorMessage == null || submitVideoPostEvent.errorMessage.equals("")) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java
index eb1c111a..e44c6bf5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java
@@ -29,6 +29,7 @@ import butterknife.ButterKnife;
public class SearchActivity extends AppCompatActivity {
+ static final String EXTRA_QUERY = "EQ";
static final String EXTRA_SUBREDDIT_NAME = "ESN";
static final String EXTRA_SUBREDDIT_IS_USER = "ESIU";
static final String EXTRA_SEARCH_ONLY_SUBREDDITS = "ESOS";
@@ -46,6 +47,7 @@ public class SearchActivity extends AppCompatActivity {
@BindView(R.id.subreddit_name_relative_layout_search_activity) RelativeLayout subredditNameRelativeLayout;
@BindView(R.id.subreddit_name_text_view_search_activity) TextView subredditNameTextView;
+ private String query;
private String subredditName;
private boolean subredditIsUser;
@@ -135,6 +137,8 @@ public class SearchActivity extends AppCompatActivity {
} else {
subredditNameTextView.setText(subredditName);
}
+ } else {
+ query = getIntent().getStringExtra(EXTRA_QUERY);
}
if(searchOnlySubreddits) {
@@ -160,6 +164,13 @@ public class SearchActivity extends AppCompatActivity {
super.onStart();
simpleSearchView.showSearch(false);
simpleSearchView.getSearchEditText().requestFocus();
+
+ if(query != null) {
+ simpleSearchView.getSearchEditText().setText(query);
+ simpleSearchView.getSearchEditText().setSelection(query.length());
+ query = null;
+ }
+
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java
index 56814364..7e15c4b1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java
@@ -193,6 +193,7 @@ public class SearchResultActivity extends AppCompatActivity implements SearchPos
case R.id.action_search_search_result_activity:
Intent intent = new Intent(this, SearchActivity.class);
intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_SUBREDDITS, false);
+ intent.putExtra(SearchActivity.EXTRA_QUERY, mQuery);
finish();
startActivity(intent);
return true;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPost.java
index d55b227b..e0a9dcc8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPost.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPost.java
@@ -103,7 +103,6 @@ class SubmitPost {
uploadMediaToAWS.enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
- Log.i("responsesese", "aws" + response.body());
if(response.isSuccessful()) {
new ParseXMLReponseFromAWSAsyncTask(response.body(), new ParseXMLReponseFromAWSAsyncTask.ParseXMLResponseFromAWSListener() {
@Override
@@ -142,7 +141,6 @@ class SubmitPost {
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
- Log.i("asfasdfsd", "failedddddddddd" + t.getMessage());
submitPostListener.submitFailed(t.getMessage());
}
});
@@ -150,7 +148,7 @@ class SubmitPost {
@Override
public void parseFailed() {
- submitPostListener.submitFailed("Parse from aws failed");
+ submitPostListener.submitFailed(null);
}
}).execute();
} else {
@@ -205,7 +203,6 @@ class SubmitPost {
submitPostCall.enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) {
- Log.i("code", "asfd" + response.body());
if(response.isSuccessful()) {
try {
getSubmittedPost(response.body(), kind, oauthRetrofit, accessToken,
@@ -216,7 +213,7 @@ class SubmitPost {
}
} else {
Log.i("call_failed", response.message());
- submitPostListener.submitFailed(null);
+ submitPostListener.submitFailed(response.message());
}
}
@@ -259,7 +256,6 @@ class SubmitPost {
uploadMediaToAWS.enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
- Log.i("responsesese", "aws" + response.body());
if(response.isSuccessful()) {
new ParseXMLReponseFromAWSAsyncTask(response.body(), new ParseXMLReponseFromAWSAsyncTask.ParseXMLResponseFromAWSListener() {
@Override
@@ -273,14 +269,12 @@ class SubmitPost {
}
}).execute();
} else {
- Log.i("asfasdfsd", "failedddddddddd" + response.code());
uploadImageListener.uploadFailed("Error: " + response.code());
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
- Log.i("asfasdfsd", "failedddddddddd" + t.getMessage());
uploadImageListener.uploadFailed(t.getMessage());
}
});
@@ -288,7 +282,7 @@ class SubmitPost {
@Override
public void parseFailed() {
- uploadImageListener.uploadFailed("Parse from aws failed");
+ uploadImageListener.uploadFailed(null);
}
}).execute();
} else {
@@ -456,14 +450,12 @@ class SubmitPost {
}
});
} else {
- Log.i("call_failed", response.message());
submitPostListener.submitFailed(response.message());
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
- Log.i("call_failed", call.request().url().toString());
submitPostListener.submitFailed(t.getMessage());
}
});
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 83aebc66..6d85662b 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -19,9 +19,11 @@
android:layout_gravity="start">
<androidx.core.widget.NestedScrollView
+ android:id="@+id/nested_scroll_view_main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:scrollbars="vertical">
+ android:scrollbars="vertical"
+ android:clipToPadding="false">
<LinearLayout
android:layout_width="match_parent"
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 77b3dcd2..f2b482a3 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -110,6 +110,8 @@
<string name="parse_sent_comment_failed">The comment is sent but unable to get the sent comment</string>
<string name="select_a_subreddit">Please select a subreddit first</string>
+ <string name="title_required">The post need a good title</string>
+ <string name="link_required">Hey where is the link?</string>
<string name="select_an_image">Please select an image first</string>
<string name="posting">Posting</string>
<string name="post_failed">Could not post it</string>