mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-25 10:28:22 +01:00
Bugs fixed related to submitting link and text posts.
This commit is contained in:
parent
71d6f803e0
commit
77d83654aa
@ -22,7 +22,7 @@
|
|||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true">
|
||||||
<service
|
<service
|
||||||
android:name=".PostMediaService"
|
android:name=".SubmitPostService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="false"></service>
|
android:exported="false"></service>
|
||||||
|
|
||||||
|
@ -25,5 +25,5 @@ interface AppComponent {
|
|||||||
void inject(FlairBottomSheetFragment flairBottomSheetFragment);
|
void inject(FlairBottomSheetFragment flairBottomSheetFragment);
|
||||||
void inject(RulesActivity rulesActivity);
|
void inject(RulesActivity rulesActivity);
|
||||||
void inject(CommentsListingFragment commentsListingFragment);
|
void inject(CommentsListingFragment commentsListingFragment);
|
||||||
void inject(PostMediaService postMediaService);
|
void inject(SubmitPostService submitPostService);
|
||||||
}
|
}
|
||||||
|
@ -349,14 +349,14 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
|
|||||||
subredditName = subreditNameTextView.getText().toString();
|
subredditName = subreditNameTextView.getText().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(this, PostMediaService.class);
|
Intent intent = new Intent(this, SubmitPostService.class);
|
||||||
intent.setData(imageUri);
|
intent.setData(imageUri);
|
||||||
intent.putExtra(PostMediaService.EXTRA_SUBREDDIT_NAME, subredditName);
|
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||||
intent.putExtra(PostMediaService.EXTRA_TITLE, titleEditText.getText().toString());
|
intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString());
|
||||||
intent.putExtra(PostMediaService.EXTRA_FLAIR, flair);
|
intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair);
|
||||||
intent.putExtra(PostMediaService.EXTRA_IS_SPOILER, isSpoiler);
|
intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler);
|
||||||
intent.putExtra(PostMediaService.EXTRA_IS_NSFW, isNSFW);
|
intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW);
|
||||||
intent.putExtra(PostMediaService.EXTRA_POST_TYPE, PostMediaService.EXTRA_POST_TYPE_IMAGE);
|
intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TYPE_IMAGE);
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
startForegroundService(intent);
|
startForegroundService(intent);
|
||||||
|
@ -97,6 +97,8 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
|
|||||||
|
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
|
EventBus.getDefault().register(this);
|
||||||
|
|
||||||
((Infinity) getApplication()).getmAppComponent().inject(this);
|
((Infinity) getApplication()).getmAppComponent().inject(this);
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
@ -241,8 +243,8 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
|
|||||||
getMenuInflater().inflate(R.menu.post_link_activity, menu);
|
getMenuInflater().inflate(R.menu.post_link_activity, menu);
|
||||||
mMemu = menu;
|
mMemu = menu;
|
||||||
if(isPosting) {
|
if(isPosting) {
|
||||||
mMemu.findItem(R.id.action_send_post_image_activity).setEnabled(false);
|
mMemu.findItem(R.id.action_send_post_link_activity).setEnabled(false);
|
||||||
mMemu.findItem(R.id.action_send_post_image_activity).getIcon().setAlpha(130);
|
mMemu.findItem(R.id.action_send_post_link_activity).getIcon().setAlpha(130);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -259,6 +261,8 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isPosting = true;
|
||||||
|
|
||||||
item.setEnabled(false);
|
item.setEnabled(false);
|
||||||
item.getIcon().setAlpha(130);
|
item.getIcon().setAlpha(130);
|
||||||
Snackbar postingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
|
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();
|
subredditName = subredditNameTextView.getText().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(this, PostMediaService.class);
|
Intent intent = new Intent(this, SubmitPostService.class);
|
||||||
intent.putExtra(PostMediaService.EXTRA_SUBREDDIT_NAME, subredditName);
|
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||||
intent.putExtra(PostMediaService.EXTRA_TITLE, titleEditText.getText().toString());
|
intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString());
|
||||||
intent.putExtra(PostMediaService.EXTRA_CONTENT, contentEditText.getText().toString());
|
intent.putExtra(SubmitPostService.EXTRA_CONTENT, contentEditText.getText().toString());
|
||||||
intent.putExtra(PostMediaService.EXTRA_KIND, RedditUtils.KIND_LINK);
|
intent.putExtra(SubmitPostService.EXTRA_KIND, RedditUtils.KIND_LINK);
|
||||||
intent.putExtra(PostMediaService.EXTRA_FLAIR, flair);
|
intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair);
|
||||||
intent.putExtra(PostMediaService.EXTRA_IS_SPOILER, isSpoiler);
|
intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler);
|
||||||
intent.putExtra(PostMediaService.EXTRA_IS_NSFW, isNSFW);
|
intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW);
|
||||||
intent.putExtra(PostMediaService.EXTRA_POST_TYPE, PostMediaService.EXTRA_POST_TYPE_IMAGE);
|
intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TEXT_OR_LINK);
|
||||||
|
startService(intent);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -248,8 +248,8 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
|
|||||||
getMenuInflater().inflate(R.menu.post_text_activity, menu);
|
getMenuInflater().inflate(R.menu.post_text_activity, menu);
|
||||||
mMemu = menu;
|
mMemu = menu;
|
||||||
if(isPosting) {
|
if(isPosting) {
|
||||||
mMemu.findItem(R.id.action_send_post_image_activity).setEnabled(false);
|
mMemu.findItem(R.id.action_send_post_text_activity).setEnabled(false);
|
||||||
mMemu.findItem(R.id.action_send_post_image_activity).getIcon().setAlpha(130);
|
mMemu.findItem(R.id.action_send_post_text_activity).getIcon().setAlpha(130);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -266,6 +266,8 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isPosting = true;
|
||||||
|
|
||||||
item.setEnabled(false);
|
item.setEnabled(false);
|
||||||
item.getIcon().setAlpha(130);
|
item.getIcon().setAlpha(130);
|
||||||
mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
|
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();
|
subredditName = subreditNameTextView.getText().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(this, PostMediaService.class);
|
Intent intent = new Intent(this, SubmitPostService.class);
|
||||||
intent.putExtra(PostMediaService.EXTRA_SUBREDDIT_NAME, subredditName);
|
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||||
intent.putExtra(PostMediaService.EXTRA_TITLE, titleEditText.getText().toString());
|
intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString());
|
||||||
intent.putExtra(PostMediaService.EXTRA_CONTENT, contentEditText.getText().toString());
|
intent.putExtra(SubmitPostService.EXTRA_CONTENT, contentEditText.getText().toString());
|
||||||
intent.putExtra(PostMediaService.EXTRA_KIND, RedditUtils.KIND_SELF);
|
intent.putExtra(SubmitPostService.EXTRA_KIND, RedditUtils.KIND_SELF);
|
||||||
intent.putExtra(PostMediaService.EXTRA_FLAIR, flair);
|
intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair);
|
||||||
intent.putExtra(PostMediaService.EXTRA_IS_SPOILER, isSpoiler);
|
intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler);
|
||||||
intent.putExtra(PostMediaService.EXTRA_IS_NSFW, isNSFW);
|
intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW);
|
||||||
intent.putExtra(PostMediaService.EXTRA_POST_TYPE, PostMediaService.EXTRA_POST_TYPE_IMAGE);
|
intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TEXT_OR_LINK);
|
||||||
|
startService(intent);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -345,14 +345,14 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
|
|||||||
subredditName = subreditNameTextView.getText().toString();
|
subredditName = subreditNameTextView.getText().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(this, PostMediaService.class);
|
Intent intent = new Intent(this, SubmitPostService.class);
|
||||||
intent.setData(videoUri);
|
intent.setData(videoUri);
|
||||||
intent.putExtra(PostMediaService.EXTRA_SUBREDDIT_NAME, subredditName);
|
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||||
intent.putExtra(PostMediaService.EXTRA_TITLE, titleEditText.getText().toString());
|
intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString());
|
||||||
intent.putExtra(PostMediaService.EXTRA_FLAIR, flair);
|
intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair);
|
||||||
intent.putExtra(PostMediaService.EXTRA_IS_SPOILER, isSpoiler);
|
intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler);
|
||||||
intent.putExtra(PostMediaService.EXTRA_IS_NSFW, isNSFW);
|
intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW);
|
||||||
intent.putExtra(PostMediaService.EXTRA_POST_TYPE, PostMediaService.EXTRA_POST_TYPE_VIDEO);
|
intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TYPE_VIDEO);
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
startForegroundService(intent);
|
startForegroundService(intent);
|
||||||
|
@ -32,7 +32,7 @@ import javax.inject.Named;
|
|||||||
|
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
public class PostMediaService extends Service {
|
public class SubmitPostService extends Service {
|
||||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||||
static final String EXTRA_TITLE = "ET";
|
static final String EXTRA_TITLE = "ET";
|
||||||
static final String EXTRA_CONTENT = "EC";
|
static final String EXTRA_CONTENT = "EC";
|
||||||
@ -65,7 +65,7 @@ public class PostMediaService extends Service {
|
|||||||
@Named("auth_info")
|
@Named("auth_info")
|
||||||
SharedPreferences sharedPreferences;
|
SharedPreferences sharedPreferences;
|
||||||
|
|
||||||
public PostMediaService() {
|
public SubmitPostService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -158,7 +158,7 @@ public class PostMediaService extends Service {
|
|||||||
@Override
|
@Override
|
||||||
public void submitSuccessful(Post post) {
|
public void submitSuccessful(Post post) {
|
||||||
EventBus.getDefault().post(new SubmitImagePostEvent(true, null));
|
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);
|
stopForeground(true);
|
||||||
stopSelf();
|
stopSelf();
|
||||||
@ -202,7 +202,7 @@ public class PostMediaService extends Service {
|
|||||||
@Override
|
@Override
|
||||||
public void submitSuccessful(Post post) {
|
public void submitSuccessful(Post post) {
|
||||||
EventBus.getDefault().post(new SubmitVideoPostEvent(true, false, null));
|
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);
|
stopForeground(true);
|
||||||
stopSelf();
|
stopSelf();
|
@ -148,7 +148,7 @@
|
|||||||
android:gravity="top"
|
android:gravity="top"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
android:hint="@string/post_link_hint"
|
android:hint="@string/post_link_hint"
|
||||||
android:inputType="textCapSentences|textMultiLine"
|
android:inputType="textMultiLine"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:background="#00000000"
|
android:background="#00000000"
|
||||||
android:textColor="@color/primaryTextColor" />
|
android:textColor="@color/primaryTextColor" />
|
||||||
|
Loading…
Reference in New Issue
Block a user