diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-08-06 13:00:16 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-08-06 13:00:16 +0000 |
commit | 77d83654aa8063b0c4d9f95ba91bd3d77be84ad9 (patch) | |
tree | 10bfe521a48062d323ec560765ec96414aa0b3b8 /app | |
parent | 71d6f803e06a64376a7ec3f9fb3d8652aa6d0089 (diff) | |
download | infinity-for-reddit-77d83654aa8063b0c4d9f95ba91bd3d77be84ad9.tar infinity-for-reddit-77d83654aa8063b0c4d9f95ba91bd3d77be84ad9.tar.gz infinity-for-reddit-77d83654aa8063b0c4d9f95ba91bd3d77be84ad9.tar.bz2 infinity-for-reddit-77d83654aa8063b0c4d9f95ba91bd3d77be84ad9.tar.lz infinity-for-reddit-77d83654aa8063b0c4d9f95ba91bd3d77be84ad9.tar.xz infinity-for-reddit-77d83654aa8063b0c4d9f95ba91bd3d77be84ad9.tar.zst infinity-for-reddit-77d83654aa8063b0c4d9f95ba91bd3d77be84ad9.zip |
Bugs fixed related to submitting link and text posts.
Diffstat (limited to '')
-rw-r--r-- | app/src/main/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java | 2 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java | 14 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java | 27 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java | 25 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java | 14 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPostService.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/PostMediaService.java) | 8 | ||||
-rw-r--r-- | app/src/main/res/layout/activity_post_link.xml | 2 |
8 files changed, 51 insertions, 43 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index bebae40b..67fd13cc 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -22,7 +22,7 @@ android:theme="@style/AppTheme" android:usesCleartextTraffic="true"> <service - android:name=".PostMediaService" + android:name=".SubmitPostService" android:enabled="true" android:exported="false"></service> diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java index 6dca6581..3f93717a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java @@ -25,5 +25,5 @@ interface AppComponent { void inject(FlairBottomSheetFragment flairBottomSheetFragment); void inject(RulesActivity rulesActivity); void inject(CommentsListingFragment commentsListingFragment); - void inject(PostMediaService postMediaService); + void inject(SubmitPostService submitPostService); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java index 5dd8934f..74e19f3a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java @@ -349,14 +349,14 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS subredditName = subreditNameTextView.getText().toString(); } - Intent intent = new Intent(this, PostMediaService.class); + Intent intent = new Intent(this, SubmitPostService.class); intent.setData(imageUri); - intent.putExtra(PostMediaService.EXTRA_SUBREDDIT_NAME, subredditName); - intent.putExtra(PostMediaService.EXTRA_TITLE, titleEditText.getText().toString()); - intent.putExtra(PostMediaService.EXTRA_FLAIR, flair); - intent.putExtra(PostMediaService.EXTRA_IS_SPOILER, isSpoiler); - intent.putExtra(PostMediaService.EXTRA_IS_NSFW, isNSFW); - intent.putExtra(PostMediaService.EXTRA_POST_TYPE, PostMediaService.EXTRA_POST_TYPE_IMAGE); + intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName); + intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString()); + intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair); + intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler); + intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW); + intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TYPE_IMAGE); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { startForegroundService(intent); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java index bbbd5540..ed537d78 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java @@ -97,6 +97,8 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh ButterKnife.bind(this); + EventBus.getDefault().register(this); + ((Infinity) getApplication()).getmAppComponent().inject(this); setSupportActionBar(toolbar); @@ -241,8 +243,8 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh getMenuInflater().inflate(R.menu.post_link_activity, menu); mMemu = menu; if(isPosting) { - mMemu.findItem(R.id.action_send_post_image_activity).setEnabled(false); - mMemu.findItem(R.id.action_send_post_image_activity).getIcon().setAlpha(130); + mMemu.findItem(R.id.action_send_post_link_activity).setEnabled(false); + mMemu.findItem(R.id.action_send_post_link_activity).getIcon().setAlpha(130); } return true; } @@ -259,6 +261,8 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh return true; } + isPosting = true; + item.setEnabled(false); item.getIcon().setAlpha(130); Snackbar postingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE); @@ -271,15 +275,16 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh subredditName = subredditNameTextView.getText().toString(); } - Intent intent = new Intent(this, PostMediaService.class); - intent.putExtra(PostMediaService.EXTRA_SUBREDDIT_NAME, subredditName); - intent.putExtra(PostMediaService.EXTRA_TITLE, titleEditText.getText().toString()); - intent.putExtra(PostMediaService.EXTRA_CONTENT, contentEditText.getText().toString()); - intent.putExtra(PostMediaService.EXTRA_KIND, RedditUtils.KIND_LINK); - intent.putExtra(PostMediaService.EXTRA_FLAIR, flair); - intent.putExtra(PostMediaService.EXTRA_IS_SPOILER, isSpoiler); - intent.putExtra(PostMediaService.EXTRA_IS_NSFW, isNSFW); - intent.putExtra(PostMediaService.EXTRA_POST_TYPE, PostMediaService.EXTRA_POST_TYPE_IMAGE); + Intent intent = new Intent(this, SubmitPostService.class); + intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName); + intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString()); + intent.putExtra(SubmitPostService.EXTRA_CONTENT, contentEditText.getText().toString()); + intent.putExtra(SubmitPostService.EXTRA_KIND, RedditUtils.KIND_LINK); + intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair); + intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler); + intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW); + intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TEXT_OR_LINK); + startService(intent); return true; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java index fd485e4b..d96dddc6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java @@ -248,8 +248,8 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh getMenuInflater().inflate(R.menu.post_text_activity, menu); mMemu = menu; if(isPosting) { - mMemu.findItem(R.id.action_send_post_image_activity).setEnabled(false); - mMemu.findItem(R.id.action_send_post_image_activity).getIcon().setAlpha(130); + mMemu.findItem(R.id.action_send_post_text_activity).setEnabled(false); + mMemu.findItem(R.id.action_send_post_text_activity).getIcon().setAlpha(130); } return true; } @@ -266,6 +266,8 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh return true; } + isPosting = true; + item.setEnabled(false); item.getIcon().setAlpha(130); mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE); @@ -278,15 +280,16 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh subredditName = subreditNameTextView.getText().toString(); } - Intent intent = new Intent(this, PostMediaService.class); - intent.putExtra(PostMediaService.EXTRA_SUBREDDIT_NAME, subredditName); - intent.putExtra(PostMediaService.EXTRA_TITLE, titleEditText.getText().toString()); - intent.putExtra(PostMediaService.EXTRA_CONTENT, contentEditText.getText().toString()); - intent.putExtra(PostMediaService.EXTRA_KIND, RedditUtils.KIND_SELF); - intent.putExtra(PostMediaService.EXTRA_FLAIR, flair); - intent.putExtra(PostMediaService.EXTRA_IS_SPOILER, isSpoiler); - intent.putExtra(PostMediaService.EXTRA_IS_NSFW, isNSFW); - intent.putExtra(PostMediaService.EXTRA_POST_TYPE, PostMediaService.EXTRA_POST_TYPE_IMAGE); + Intent intent = new Intent(this, SubmitPostService.class); + intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName); + intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString()); + intent.putExtra(SubmitPostService.EXTRA_CONTENT, contentEditText.getText().toString()); + intent.putExtra(SubmitPostService.EXTRA_KIND, RedditUtils.KIND_SELF); + intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair); + intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler); + intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW); + intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TEXT_OR_LINK); + startService(intent); return true; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java index 9f3f14fb..6df6134a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java @@ -345,14 +345,14 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS subredditName = subreditNameTextView.getText().toString(); } - Intent intent = new Intent(this, PostMediaService.class); + Intent intent = new Intent(this, SubmitPostService.class); intent.setData(videoUri); - intent.putExtra(PostMediaService.EXTRA_SUBREDDIT_NAME, subredditName); - intent.putExtra(PostMediaService.EXTRA_TITLE, titleEditText.getText().toString()); - intent.putExtra(PostMediaService.EXTRA_FLAIR, flair); - intent.putExtra(PostMediaService.EXTRA_IS_SPOILER, isSpoiler); - intent.putExtra(PostMediaService.EXTRA_IS_NSFW, isNSFW); - intent.putExtra(PostMediaService.EXTRA_POST_TYPE, PostMediaService.EXTRA_POST_TYPE_VIDEO); + intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName); + intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString()); + intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair); + intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler); + intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW); + intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TYPE_VIDEO); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { startForegroundService(intent); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostMediaService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPostService.java index 21f12cd4..b78f4ab2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostMediaService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPostService.java @@ -32,7 +32,7 @@ import javax.inject.Named; import retrofit2.Retrofit; -public class PostMediaService extends Service { +public class SubmitPostService extends Service { static final String EXTRA_SUBREDDIT_NAME = "ESN"; static final String EXTRA_TITLE = "ET"; static final String EXTRA_CONTENT = "EC"; @@ -65,7 +65,7 @@ public class PostMediaService extends Service { @Named("auth_info") SharedPreferences sharedPreferences; - public PostMediaService() { + public SubmitPostService() { } @Override @@ -158,7 +158,7 @@ public class PostMediaService extends Service { @Override public void submitSuccessful(Post post) { EventBus.getDefault().post(new SubmitImagePostEvent(true, null)); - Toast.makeText(PostMediaService.this, R.string.image_is_processing, Toast.LENGTH_SHORT).show(); + Toast.makeText(SubmitPostService.this, R.string.image_is_processing, Toast.LENGTH_SHORT).show(); stopForeground(true); stopSelf(); @@ -202,7 +202,7 @@ public class PostMediaService extends Service { @Override public void submitSuccessful(Post post) { EventBus.getDefault().post(new SubmitVideoPostEvent(true, false, null)); - Toast.makeText(PostMediaService.this, R.string.video_is_processing, Toast.LENGTH_SHORT).show(); + Toast.makeText(SubmitPostService.this, R.string.video_is_processing, Toast.LENGTH_SHORT).show(); stopForeground(true); stopSelf(); diff --git a/app/src/main/res/layout/activity_post_link.xml b/app/src/main/res/layout/activity_post_link.xml index 52d1215e..664cccd2 100644 --- a/app/src/main/res/layout/activity_post_link.xml +++ b/app/src/main/res/layout/activity_post_link.xml @@ -148,7 +148,7 @@ android:gravity="top" android:padding="16dp" android:hint="@string/post_link_hint" - android:inputType="textCapSentences|textMultiLine" + android:inputType="textMultiLine" android:textSize="18sp" android:background="#00000000" android:textColor="@color/primaryTextColor" /> |