Fixed UI in ViewMultiRedditDetailActivity. Add a share option in Settings -> About to let you easily share this app to other people. Version 2.0.0.

This commit is contained in:
Alex Ning 2019-12-19 21:09:58 +08:00
parent a914ed95ef
commit 2113d4a902
9 changed files with 42 additions and 15 deletions

View File

@ -6,8 +6,8 @@ android {
applicationId "ml.docilealligator.infinityforreddit"
minSdkVersion 21
targetSdkVersion 29
versionCode 24
versionName "1.6.2"
versionCode 25
versionName "2.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {

View File

@ -23,7 +23,7 @@
tools:replace="android:label">
<activity android:name=".Activity.ViewMultiRedditDetailActivity"
android:parentActivityName=".Activity.MainActivity"
android:theme="@style/AppTheme.NoActionBarWithTranslucentWindow" />
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".Activity.MultiRedditListingActivity"
android:label="@string/multi_reddit_listing_activity"

View File

@ -82,6 +82,7 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
private SortTypeBottomSheetFragment bestSortTypeBottomSheetFragment;
private SortTypeBottomSheetFragment popularAndAllSortTypeBottomSheetFragment;
private SortTypeBottomSheetFragment subredditSortTypeBottomSheetFragment;
private SortTypeBottomSheetFragment multiRedditSortTypeBottomSheetFragment;
private UserThingSortTypeBottomSheetFragment userThingSortTypeBottomSheetFragment;
private SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment;
private SortTimeBottomSheetFragment sortTimeBottomSheetFragment;
@ -228,9 +229,9 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
getSupportActionBar().setTitle(subredditNamePrefixed);
subredditSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
Bundle bottomSheetBundle = new Bundle();
bottomSheetBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true);
subredditSortTypeBottomSheetFragment.setArguments(bottomSheetBundle);
Bundle subredditSheetBundle = new Bundle();
subredditSheetBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true);
subredditSortTypeBottomSheetFragment.setArguments(subredditSheetBundle);
}
break;
case PostDataSource.TYPE_MULTI_REDDIT:
@ -243,10 +244,11 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
}
getSupportActionBar().setTitle(multiRedditName);
subredditSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
Bundle bottomSheetBundle = new Bundle();
bottomSheetBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true);
subredditSortTypeBottomSheetFragment.setArguments(bottomSheetBundle);
multiRedditSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
Bundle multiRedditBundle = new Bundle();
multiRedditBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true);
multiRedditBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_RANDOM_TYPE, true);
multiRedditSortTypeBottomSheetFragment.setArguments(multiRedditBundle);
break;
case PostDataSource.TYPE_USER:
String usernamePrefixed = "u/" + name;
@ -341,6 +343,9 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
subredditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), subredditSortTypeBottomSheetFragment.getTag());
}
break;
case PostDataSource.TYPE_MULTI_REDDIT:
multiRedditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), multiRedditSortTypeBottomSheetFragment.getTag());
break;
case PostDataSource.TYPE_USER:
userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag());
}

View File

@ -16,7 +16,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.Fragment;
import com.google.android.material.appbar.AppBarLayout;
@ -55,8 +54,6 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
private static final String ACCESS_TOKEN_STATE = "ATS";
private static final String ACCOUNT_NAME_STATE = "ANS";
@BindView(R.id.coordinator_layout_view_multi_reddit_detail_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.appbar_layout_view_multi_reddit_detail_activity)
AppBarLayout appBarLayout;
@BindView(R.id.collapsing_toolbar_layout_view_multi_reddit_detail_activity)

View File

@ -28,6 +28,7 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
Preference emailPreference = findPreference(SharedPreferencesUtils.EMAIL_KEY);
Preference redditAccountPreference = findPreference(SharedPreferencesUtils.REDDIT_ACCOUNT_KEY);
Preference subredditPreference = findPreference(SharedPreferencesUtils.SUBREDDIT_KEY);
Preference sharePreference = findPreference(SharedPreferencesUtils.SHARE_KEY);
Activity activity = getActivity();
@ -86,6 +87,20 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
return true;
});
}
if (sharePreference != null) {
sharePreference.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_this_app));
if (intent.resolveActivity(activity.getPackageManager()) != null) {
startActivity(intent);
} else {
Toast.makeText(activity, R.string.no_app, Toast.LENGTH_SHORT).show();
}
return true;
});
}
}
}
}

View File

@ -24,6 +24,7 @@ public class SharedPreferencesUtils {
public static final String EMAIL_KEY = "email";
public static final String REDDIT_ACCOUNT_KEY = "reddit_account";
public static final String SUBREDDIT_KEY = "subreddit";
public static final String SHARE_KEY = "share";
public static final String FONT_SIZE_KEY = "font_size";
public static final String TITLE_FONT_SIZE_KEY = "title_font_size";
public static final String CONTENT_FONT_SIZE_KEY = "content_font_size";

View File

@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/coordinator_layout_view_multi_reddit_detail_activity"
android:background="?attr/backgroundColor"
tools:context=".Activity.ViewMultiRedditDetailActivity">
@ -37,7 +36,7 @@
<FrameLayout
android:id="@+id/frame_layout_view_multi_reddit_detail_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -330,6 +330,8 @@
<string name="settings_reddit_account_summary">u/Hostilenemy</string>
<string name="settings_subreddit_title">Subreddit</string>
<string name="settings_subreddit_summary">r/Infinity_For_Reddit</string>
<string name="settings_share_title">Share</string>
<string name="settings_share_summary">Share this app to other people if you enjoy it</string>
<string name="no_link_available">Cannot get the link</string>
@ -350,6 +352,7 @@
<string name="share">Share</string>
<string name="no_email_client">No Email client found</string>
<string name="no_app">No app available</string>
<string name="comment_saved_success">Comment saved</string>
<string name="comment_saved_failed">Unable to save comment</string>
@ -377,4 +380,6 @@
<string name="error_getting_multi_reddit_data">Error getting multireddit data</string>
<string name="error_loading_multi_reddit_list">Cannot sync multireddits</string>
<string name="error_loading_subscriptions">Cannot sync subscriptions</string>
<string name="share_this_app">Check out Infinity for Reddit, an awesome Reddit client!\nhttps://play.google.com/store/apps/details?id=ml.docilealligator.infinityforreddit</string>
</resources>

View File

@ -35,4 +35,9 @@
app:title="@string/settings_subreddit_title"
app:summary="@string/settings_subreddit_summary" />
<Preference
android:key="share"
app:title="@string/settings_share_title"
app:summary="@string/settings_share_summary" />
</PreferenceScreen>