mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-01 13:57:10 +01:00
Add go to subreddit, go to user, and random to FAB options.
This commit is contained in:
parent
2b6f04a283
commit
b8783c2488
@ -576,6 +576,15 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SEARCH:
|
||||
fab.setImageResource(R.drawable.ic_search_black_24dp);
|
||||
break;
|
||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
||||
fab.setImageResource(R.drawable.ic_subreddit_24dp);
|
||||
break;
|
||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
||||
fab.setImageResource(R.drawable.ic_user_24dp);
|
||||
break;
|
||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM:
|
||||
fab.setImageResource(R.drawable.ic_random_24dp);
|
||||
break;
|
||||
default:
|
||||
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
||||
break;
|
||||
@ -601,6 +610,15 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
||||
goToSubreddit();
|
||||
break;
|
||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
||||
goToUser();
|
||||
break;
|
||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM:
|
||||
randomThing();
|
||||
break;
|
||||
default:
|
||||
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
||||
break;
|
||||
@ -1166,6 +1184,21 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
startActivity(intent);
|
||||
break;
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_SUBREDDIT: {
|
||||
goToSubreddit();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_USER: {
|
||||
goToUser();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_RANDOM: {
|
||||
randomThing();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void goToSubreddit() {
|
||||
EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null);
|
||||
thingEditText.requestFocus();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
@ -1191,9 +1224,9 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
}
|
||||
})
|
||||
.show();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_USER: {
|
||||
|
||||
private void goToUser() {
|
||||
EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null);
|
||||
thingEditText.requestFocus();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
@ -1219,17 +1252,14 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
}
|
||||
})
|
||||
.show();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_RANDOM: {
|
||||
|
||||
private void randomThing() {
|
||||
RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean(RandomBottomSheetFragment.EXTRA_IS_NSFW, mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false));
|
||||
randomBottomSheetFragment.setArguments(bundle);
|
||||
randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -681,6 +681,15 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH:
|
||||
fab.setImageResource(R.drawable.ic_search_black_24dp);
|
||||
break;
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
||||
fab.setImageResource(R.drawable.ic_subreddit_24dp);
|
||||
break;
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
||||
fab.setImageResource(R.drawable.ic_user_24dp);
|
||||
break;
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM:
|
||||
fab.setImageResource(R.drawable.ic_random_24dp);
|
||||
break;
|
||||
default:
|
||||
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
||||
break;
|
||||
@ -707,6 +716,15 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
||||
goToSubreddit();
|
||||
break;
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
||||
goToUser();
|
||||
break;
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM:
|
||||
random();
|
||||
break;
|
||||
default:
|
||||
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
||||
break;
|
||||
@ -1071,6 +1089,21 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
startActivity(intent);
|
||||
break;
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_SUBREDDIT: {
|
||||
goToSubreddit();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_USER: {
|
||||
goToUser();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_RANDOM: {
|
||||
random();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void goToSubreddit() {
|
||||
EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null);
|
||||
thingEditText.requestFocus();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
@ -1096,9 +1129,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
}
|
||||
})
|
||||
.show();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_USER: {
|
||||
|
||||
private void goToUser() {
|
||||
EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null);
|
||||
thingEditText.requestFocus();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
@ -1124,17 +1157,14 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
}
|
||||
})
|
||||
.show();
|
||||
break;
|
||||
}
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_RANDOM: {
|
||||
|
||||
private void random() {
|
||||
RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean(RandomBottomSheetFragment.EXTRA_IS_NSFW, mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false));
|
||||
randomBottomSheetFragment.setArguments(bundle);
|
||||
randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -179,6 +179,9 @@ public class SharedPreferencesUtils {
|
||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE = 2;
|
||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT = 3;
|
||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SEARCH = 4;
|
||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT = 5;
|
||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER = 6;
|
||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM = 7;
|
||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HOME = 0;
|
||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SUBSCRIPTIONS = 1;
|
||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_INBOX = 2;
|
||||
@ -189,6 +192,9 @@ public class SharedPreferencesUtils {
|
||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE = 2;
|
||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT = 3;
|
||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH = 4;
|
||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT = 5;
|
||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER = 6;
|
||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM = 7;
|
||||
|
||||
public static final String NSFW_AND_SPOILER_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.nsfw_and_spoiler";
|
||||
public static final String NSFW_BASE = "_nsfw";
|
||||
|
@ -257,6 +257,9 @@
|
||||
<item>Change sort type</item>
|
||||
<item>Change post layout</item>
|
||||
<item>Search</item>
|
||||
<item>Go to Subreddit</item>
|
||||
<item>Go to User</item>
|
||||
<item>Random</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="settings_swipe_action_threshold">
|
||||
|
Loading…
Reference in New Issue
Block a user