diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-02-22 05:34:24 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-02-22 05:34:24 +0000 |
commit | 1293eac5c84340c4bdb4c9bef283de3e2710c7da (patch) | |
tree | fa2b8679c49066122436eb685971adf764057e98 | |
parent | 82d97cf73208f3f187b965fca4460f68af33f6b7 (diff) | |
download | infinity-for-reddit-1293eac5c84340c4bdb4c9bef283de3e2710c7da.tar infinity-for-reddit-1293eac5c84340c4bdb4c9bef283de3e2710c7da.tar.gz infinity-for-reddit-1293eac5c84340c4bdb4c9bef283de3e2710c7da.tar.bz2 infinity-for-reddit-1293eac5c84340c4bdb4c9bef283de3e2710c7da.tar.lz infinity-for-reddit-1293eac5c84340c4bdb4c9bef283de3e2710c7da.tar.xz infinity-for-reddit-1293eac5c84340c4bdb4c9bef283de3e2710c7da.tar.zst infinity-for-reddit-1293eac5c84340c4bdb4c9bef283de3e2710c7da.zip |
Add a search view in MainActivity and add a SearchActivity.
Diffstat (limited to '')
-rw-r--r-- | .idea/assetWizardSettings.xml | 21 | ||||
-rw-r--r-- | .idea/caches/build_file_checksums.ser | bin | 533 -> 533 bytes | |||
-rw-r--r-- | .idea/caches/gradle_models.ser | bin | 296267 -> 303289 bytes | |||
-rw-r--r-- | app/build.gradle | 2 | ||||
-rw-r--r-- | app/src/main/AndroidManifest.xml | 14 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java | 84 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java | 20 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java | 88 | ||||
-rw-r--r-- | app/src/main/res/drawable/ic_search_white_24dp.xml | 5 | ||||
-rw-r--r-- | app/src/main/res/layout/activity_search.xml | 43 | ||||
-rw-r--r-- | app/src/main/res/layout/app_bar_main.xml | 32 | ||||
-rw-r--r-- | app/src/main/res/menu/main_activity.xml | 9 | ||||
-rw-r--r-- | app/src/main/res/menu/menu_search.xml | 10 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 10 | ||||
-rw-r--r-- | app/src/main/res/values/styles.xml | 12 | ||||
-rw-r--r-- | app/src/main/res/xml/searchable.xml | 6 |
16 files changed, 324 insertions, 32 deletions
diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml index 3c5b9551..626d196f 100644 --- a/.idea/assetWizardSettings.xml +++ b/.idea/assetWizardSettings.xml @@ -16,11 +16,26 @@ <entry key="vectorAssetStep"> <value> <PersistentState> + <option name="children"> + <map> + <entry key="clipartAsset"> + <value> + <PersistentState> + <option name="values"> + <map> + <entry key="url" value="jar:file:/home/alex/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/action/ic_search_black_24dp.xml" /> + </map> + </option> + </PersistentState> + </value> + </entry> + </map> + </option> <option name="values"> <map> - <entry key="assetSourceType" value="FILE" /> - <entry key="outputName" value="ic_outline_account_circle_24px" /> - <entry key="sourceFile" value="$USER_HOME$/Downloads/outline-account_circle-24px.svg" /> + <entry key="color" value="ffffff" /> + <entry key="outputName" value="ic_search_white_24dp" /> + <entry key="sourceFile" value="$USER_HOME$/Downloads/outline-search-24px.svg" /> </map> </option> </PersistentState> diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser Binary files differindex f6fe2a95..9f603d1b 100644 --- a/.idea/caches/build_file_checksums.ser +++ b/.idea/caches/build_file_checksums.ser diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser Binary files differindex 22d52437..64b76d98 100644 --- a/.idea/caches/gradle_models.ser +++ b/.idea/caches/gradle_models.ser diff --git a/app/build.gradle b/app/build.gradle index c7388dd5..9dbee2b3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,6 +37,7 @@ dependencies { implementation 'com.google.android.material:material:1.1.0-alpha03' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.legacy:legacy-support-v13:1.0.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.1.2-alpha01' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01' @@ -74,4 +75,5 @@ dependencies { implementation "ru.noties:markwon-syntax-highlight:2.0.1" implementation "ru.noties:markwon-view:2.0.1" implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16' + implementation 'com.github.Ferfalk:SimpleSearchView:0.1.3' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5d815b6d..0d43f71f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -11,21 +11,25 @@ android:maxSdkVersion="22" /> <application - android:allowBackup="true" android:name=".Infinity" + android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true"> + <activity android:name=".SearchActivity" + android:theme="@style/AppTheme.NoActionBar" + android:label="@string/search_activity_label" + android:parentActivityName=".MainActivity"> + </activity> <activity android:name=".MainActivity" android:label="@string/app_name" - android:theme="@style/AppTheme.NoActionBar"> + android:theme="@style/AppTheme.NoActionBarWithTransparentStatusBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> @@ -47,11 +51,11 @@ <activity android:name=".ViewSubredditDetailActivity" android:parentActivityName=".MainActivity" - android:theme="@style/AppTheme.NoActionBarWithTranslucentStatusBar" /> + android:theme="@style/AppTheme.NoActionBarWithTranslucentWindow" /> <activity android:name=".ViewUserDetailActivity" android:parentActivityName=".MainActivity" - android:theme="@style/AppTheme.NoActionBarWithTranslucentStatusBar" /> + android:theme="@style/AppTheme.NoActionBarWithTranslucentWindow" /> </application> </manifest>
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java index bbd6e60c..3aec9917 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java @@ -1,19 +1,11 @@ package ml.docilealligator.infinityforreddit; -import androidx.lifecycle.ViewModelProviders; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.graphics.Color; import android.os.AsyncTask; import android.os.Bundle; -import androidx.fragment.app.Fragment; -import androidx.core.view.GravityCompat; -import androidx.drawerlayout.widget.DrawerLayout; -import androidx.appcompat.app.ActionBarDrawerToggle; -import androidx.appcompat.app.AppCompatActivity; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.appcompat.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -23,6 +15,7 @@ import android.widget.TextView; import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; +import com.ferfalk.simplesearchview.SimpleSearchView; import java.util.ArrayList; import java.util.List; @@ -41,6 +34,15 @@ import SubscribedUserDatabase.SubscribedUserDao; import SubscribedUserDatabase.SubscribedUserData; import SubscribedUserDatabase.SubscribedUserRoomDatabase; import SubscribedUserDatabase.SubscribedUserViewModel; +import androidx.appcompat.app.ActionBarDrawerToggle; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.core.view.GravityCompat; +import androidx.drawerlayout.widget.DrawerLayout; +import androidx.fragment.app.Fragment; +import androidx.lifecycle.ViewModelProviders; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; import butterknife.ButterKnife; import de.hdodenhof.circleimageview.CircleImageView; @@ -56,6 +58,8 @@ public class MainActivity extends AppCompatActivity { private static final String FETCH_USER_INFO_STATE = "FUIS"; private static final String INSERT_SUBSCRIBED_SUBREDDIT_STATE = "ISSS"; + @BindView(R.id.search_view_main_activity) SimpleSearchView simpleSearchView; + @BindView(R.id.transparent_overlay_main_activity) View transparentOverlay; @BindView(R.id.subscribed_subreddit_recycler_view_main_activity) RecyclerView subscribedSubredditRecyclerView; @BindView(R.id.subscriptions_label_main_activity) TextView subscriptionsLabelTextView; @BindView(R.id.subscribed_user_recycler_view_main_activity) RecyclerView subscribedUserRecyclerView; @@ -111,6 +115,52 @@ public class MainActivity extends AppCompatActivity { drawer.addDrawerListener(toggle); toggle.syncState(); + transparentOverlay.setOnClickListener(view -> simpleSearchView.onBackPressed()); + + simpleSearchView.setOnQueryTextListener(new SimpleSearchView.OnQueryTextListener() { + @Override + public boolean onQueryTextSubmit(String query) { + Intent intent = new Intent(MainActivity.this, SearchActivity.class); + intent.putExtra(SearchActivity.QUERY_KEY, query); + startActivity(intent); + return false; + } + + @Override + public boolean onQueryTextChange(String newText) { + return false; + } + + @Override + public boolean onQueryTextCleared() { + return false; + } + }); + + simpleSearchView.setOnSearchViewListener(new SimpleSearchView.SearchViewListener() { + @Override + public void onSearchViewShown() { + transparentOverlay.setVisibility(View.VISIBLE); + getWindow().setStatusBarColor(Color.GRAY); + } + + @Override + public void onSearchViewClosed() { + transparentOverlay.setVisibility(View.GONE); + getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark)); + } + + @Override + public void onSearchViewShownAnimation() { + + } + + @Override + public void onSearchViewClosedAnimation() { + + } + }); + String accessToken = getSharedPreferences(SharedPreferencesUtils.AUTH_CODE_FILE_KEY, Context.MODE_PRIVATE).getString(SharedPreferencesUtils.ACCESS_TOKEN_KEY, ""); if (accessToken.equals("")) { Intent loginIntent = new Intent(this, LoginActivity.class); @@ -266,8 +316,20 @@ public class MainActivity extends AppCompatActivity { } @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (simpleSearchView.onActivityResult(requestCode, resultCode, data)) { + return; + } + + super.onActivityResult(requestCode, resultCode, data); + } + + @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main_activity, menu); + + simpleSearchView.setMenuItem(menu.findItem(R.id.action_search_main_activity)); + return true; } @@ -292,6 +354,10 @@ public class MainActivity extends AppCompatActivity { if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { + if (simpleSearchView.onBackPressed()) { + return; + } + super.onBackPressed(); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java index 39344b73..95d0f173 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java @@ -3,13 +3,11 @@ package ml.docilealligator.infinityforreddit; import java.util.Map; import retrofit2.Call; -import retrofit2.http.DELETE; import retrofit2.http.FieldMap; import retrofit2.http.FormUrlEncoded; import retrofit2.http.GET; import retrofit2.http.HeaderMap; import retrofit2.http.POST; -import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query; @@ -53,15 +51,21 @@ public interface RedditAPI { @POST("api/subscribe") Call<String> subredditSubscription(@HeaderMap Map<String, String> headers, @FieldMap Map<String, String> params); - @PUT("api/v1/me/friends/username") - Call<String> subscribeUser(@HeaderMap Map<String, String> headers); - - @DELETE("api/v1/me/friends/username") - Call<String> unsubscribeUser(@HeaderMap Map<String, String> headers); - @GET("api/morechildren?api_type=json&raw_json=1") Call<String> getMoreChildren(@Query("link_id") String linkId, @Query("children") String children); @GET("{subredditNamePrefixed}/api/info.json?raw_json=1") Call<String> getInfo(@Path("subredditNamePrefixed") String subredditNamePrefixed, @Query("id") String id); + + @GET("subreddits/search.json?raw_json=1&include_over_18=on") + Call<String> searchSubreddits(@Query("q") String subredditName, @Query("after") String after); + + @GET("/profiles/search.json?raw_json=1") + Call<String> searchProfiles(@Query("q") String profileName, @Query("after") String after); + + @GET("/search.json?raw_json=1") + Call<String> searchPosts(@Query("q") String query, @Query("after") String after); + + @GET("/r/{subredditName}/search.json?raw_json=1&restrict_sr=true") + Call<String> searchPostsInSpecificSubreddit(@Query("q") String query, @Query("after") String after); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java new file mode 100644 index 00000000..51099a9a --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java @@ -0,0 +1,88 @@ +package ml.docilealligator.infinityforreddit; + +import android.content.Intent; +import android.os.Bundle; +import android.view.MenuItem; + +import com.google.android.material.tabs.TabLayout; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; +import androidx.viewpager.widget.PagerAdapter; +import androidx.viewpager.widget.ViewPager; + +public class SearchActivity extends AppCompatActivity { + static final String QUERY_KEY = "QK"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_search); + + Toolbar toolbar = findViewById(R.id.toolbar_search_activity); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + + ViewPager viewPager = findViewById(R.id.view_pager_search_activity); + PagerAdapter pagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); + viewPager.setAdapter(pagerAdapter); + TabLayout tabLayout = findViewById(R.id.tab_layout_search_activity); + tabLayout.setupWithViewPager(viewPager); + + // Get the intent, verify the action and get the query + Intent intent = getIntent(); + String query = intent.getExtras().getString(QUERY_KEY); + if(query != null) { + setTitle(query); + } + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + onBackPressed(); + return true; + } + return super.onOptionsItemSelected(item); + } + + public class SectionsPagerAdapter extends FragmentPagerAdapter { + + public SectionsPagerAdapter(FragmentManager fm) { + super(fm); + } + + @Override + public Fragment getItem(int position) { + // getItem is called to instantiate the fragment for the given page. + // Return a PlaceholderFragment (defined as a static inner class below). + PostFragment mFragment = new PostFragment(); + Bundle bundle = new Bundle(); + bundle.putInt(PostFragment.POST_TYPE_KEY, PostDataSource.TYPE_FRONT_PAGE); + mFragment.setArguments(bundle); + return mFragment; + } + + @Override + public int getCount() { + return 3; + } + + @Override + public CharSequence getPageTitle(int position) { + switch (position) { + case 0: + return "Posts"; + case 1: + return "Subreddits"; + case 2: + return "Users"; + } + return null; + } + } +} diff --git a/app/src/main/res/drawable/ic_search_white_24dp.xml b/app/src/main/res/drawable/ic_search_white_24dp.xml new file mode 100644 index 00000000..be5ad99c --- /dev/null +++ b/app/src/main/res/drawable/ic_search_white_24dp.xml @@ -0,0 +1,5 @@ +<vector android:height="24dp" android:tint="#FFFFFF" + android:viewportHeight="24.0" android:viewportWidth="24.0" + android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="#FF000000" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/> +</vector> diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml new file mode 100644 index 00000000..bd440eac --- /dev/null +++ b/app/src/main/res/layout/activity_search.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appbar_search_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:theme="@style/AppTheme.AppBarOverlay"> + + <androidx.appcompat.widget.Toolbar + android:id="@+id/toolbar_search_activity" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + app:popupTheme="@style/AppTheme.PopupOverlay" /> + + <com.google.android.material.tabs.TabLayout + android:id="@+id/tab_layout_search_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@color/colorPrimary" + app:tabGravity="fill" + app:tabMode="fixed" + app:tabIndicatorColor="@android:color/white" + app:tabIndicatorHeight="3dp" + app:tabSelectedTextColor="@android:color/white" + app:tabTextColor="@android:color/white" + app:tabRippleColor="?attr/colorControlHighlight" + app:tabUnboundedRipple="false"/> + + </com.google.android.material.appbar.AppBarLayout> + + <androidx.viewpager.widget.ViewPager + android:id="@+id/view_pager_search_activity" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".SearchActivity" /> + +</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index f8894bda..9c1dfa84 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -11,15 +11,37 @@ android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar" + <FrameLayout + android:id="@+id/toolbar_frame_layout_main_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - android:background="?attr/colorPrimary" - app:popupTheme="@style/AppTheme.PopupOverlay" /> + android:layout_height="wrap_content"> + + <androidx.appcompat.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + app:popupTheme="@style/AppTheme.PopupOverlay" /> + + <com.ferfalk.simplesearchview.SimpleSearchView + android:id="@+id/search_view_main_activity" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:textColor="@android:color/white" + app:voiceSearch="true"/> + + </FrameLayout> </com.google.android.material.appbar.AppBarLayout> + <View + android:id="@+id/transparent_overlay_main_activity" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="#40000000" + android:elevation="1dp" + android:visibility="gone"/> + <include layout="@layout/content_main" /> </androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/app/src/main/res/menu/main_activity.xml b/app/src/main/res/menu/main_activity.xml index 2be22f5f..2a4357aa 100644 --- a/app/src/main/res/menu/main_activity.xml +++ b/app/src/main/res/menu/main_activity.xml @@ -5,8 +5,15 @@ tools:context="ml.docilealligator.infinityforreddit.MainActivity"> <item android:id="@+id/action_refresh_main_activity" - android:orderInCategory="1" + android:orderInCategory="2" android:title="@string/action_refresh" android:icon="@drawable/ic_refresh_white_24dp" app:showAsAction="never" /> + + <item + android:id="@+id/action_search_main_activity" + android:orderInCategory="1" + android:title="@string/action_search" + android:icon="@drawable/ic_search_white_24dp" + app:showAsAction="always" /> </menu>
\ No newline at end of file diff --git a/app/src/main/res/menu/menu_search.xml b/app/src/main/res/menu/menu_search.xml new file mode 100644 index 00000000..afd34627 --- /dev/null +++ b/app/src/main/res/menu/menu_search.xml @@ -0,0 +1,10 @@ +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + tools:context="ml.docilealligator.infinityforreddit.SearchActivity"> + <item + android:id="@+id/action_search_search_activity" + android:orderInCategory="1" + android:title="@string/action_search" + app:showAsAction="always" /> +</menu> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 486fd853..a8058872 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,6 +1,7 @@ <resources> <string name="app_name">Infinity</string> <string name="login_activity_label">Login</string> + <string name="search_activity_label">Search</string> <string name="navigation_drawer_open">Open navigation drawer</string> <string name="navigation_drawer_close">Close navigation drawer</string> @@ -8,6 +9,7 @@ <string name="action_settings">Settings</string> <string name="action_download">Download</string> <string name="action_refresh">Refresh</string> + <string name="action_search">Search</string> <string name="tap_to_retry">Error loading image. Tap to retry.</string> <string name="load_posts_error">Error loading posts.\nTap to retry.</string> @@ -51,4 +53,12 @@ <string name="content_description_banner_imageview">Subreddit Banner Image</string> <string name="error_loading_posts">Error loading post</string> + + <string name="app_label">Infinity</string> + <string name="search_hint">Search anything</string> + <string name="title_activity_search">Search</string> + <string name="section_format">Hello World from section: %1$d</string> + <string name="tab_text_1">Tab 1</string> + <string name="tab_text_2">Tab 2</string> + <string name="tab_text_3">Tab 3</string> </resources> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 1ea7c276..1b770151 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -13,10 +13,13 @@ <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> + </style> + + <style name="AppTheme.NoActionBarWithTransparentStatusBar" parent="AppTheme.NoActionBar"> <item name="android:statusBarColor">@android:color/transparent</item> </style> - <style name="AppTheme.NoActionBarWithTranslucentStatusBar" parent="AppTheme.NoActionBar"> + <style name="AppTheme.NoActionBarWithTranslucentWindow" parent="AppTheme.NoActionBarWithTransparentStatusBar"> <item name="android:windowTranslucentStatus">true</item> </style> @@ -37,4 +40,11 @@ <item name="android:windowIsTranslucent">true</item> </style> + <style name="CustomTabLayout" parent="Widget.Design.TabLayout"> + <item name="tabIndicatorColor">@android:color/white</item> + <item name="tabIndicatorHeight">3dp</item> + <item name="tabBackground">?attr/selectableItemBackground</item> + <item name="tabSelectedTextColor">@android:color/white</item> + </style> + </resources> diff --git a/app/src/main/res/xml/searchable.xml b/app/src/main/res/xml/searchable.xml new file mode 100644 index 00000000..9b87146c --- /dev/null +++ b/app/src/main/res/xml/searchable.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<searchable xmlns:android="http://schemas.android.com/apk/res/android" + android:label="@string/app_label" + android:hint="@string/search_hint" + android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" > +</searchable>
\ No newline at end of file |