Skip to content

Commit

Permalink
Replaced toolbar elevation with a shadow drawable so that it is visib…
Browse files Browse the repository at this point in the history
…le on all Android versions

Fixed issue of progress bar appearing between the toolbar and its shadow instead of the middle of the view repository screen
  • Loading branch information
Mustafa Ali committed Jan 8, 2015
1 parent 4b6533d commit ef080b7
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 44 deletions.
8 changes: 8 additions & 0 deletions app/res/drawable/toolbar_shadow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#55000000"
android:endColor="#00000000"
android:angle="270"/>
</shape>
28 changes: 18 additions & 10 deletions app/res/layout/pager_with_tabs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,34 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<com.github.mobile.ui.SlidingTabLayout
android:layout_alignParentTop="true"
android:id="@+id/sliding_tabs_layout"
android:background="@color/primary"
android:layout_width="match_parent"
android:elevation="8dp"
android:layout_height="wrap_content" />

<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="0dp" />

<com.github.mobile.ui.ViewPager
android:id="@+id/vp_pages"
android:layout_below="@id/sliding_tabs_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
android:layout_height="8dp"
android:layout_below="@id/sliding_tabs_layout"
android:background="@drawable/toolbar_shadow" />

<ProgressBar
android:id="@+id/progress_bar"
style="@style/ListSpinner"
android:layout_centerInParent="true"
android:visibility="gone"/>

</RelativeLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected void onCreate(Bundle savedInstanceState) {

repository = getSerializableExtra(EXTRA_REPOSITORY);

loadingBar = finder.find(R.id.pb_loading);
loadingBar = finder.find(R.id.progress_bar);

User owner = repository.getOwner();

Expand Down Expand Up @@ -154,29 +154,29 @@ private void configurePager() {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.m_star:
starRepository();
return true;
case R.id.m_fork:
forkRepository();
return true;
case R.id.m_contributors:
startActivity(RepositoryContributorsActivity.createIntent(repository));
return true;
case R.id.m_share:
shareRepository();
return true;
case R.id.m_refresh:
checkStarredRepositoryStatus();
return super.onOptionsItemSelected(item);
case android.R.id.home:
finish();
Intent intent = UserViewActivity.createIntent(repository.getOwner());
intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
return true;
default:
return super.onOptionsItemSelected(item);
case R.id.m_star:
starRepository();
return true;
case R.id.m_fork:
forkRepository();
return true;
case R.id.m_contributors:
startActivity(RepositoryContributorsActivity.createIntent(repository));
return true;
case R.id.m_share:
shareRepository();
return true;
case R.id.m_refresh:
checkStarredRepositoryStatus();
return super.onOptionsItemSelected(item);
case android.R.id.home:
finish();
Intent intent = UserViewActivity.createIntent(repository.getOwner());
intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
return true;
default:
return super.onOptionsItemSelected(item);
}
}

Expand All @@ -198,16 +198,16 @@ protected int getContentView() {
@Override
protected String getIcon(int position) {
switch (position) {
case 0:
return ICON_NEWS;
case 1:
return ICON_CODE;
case 2:
return ICON_COMMIT;
case 3:
return ICON_ISSUE_OPEN;
default:
return super.getIcon(position);
case 0:
return ICON_NEWS;
case 1:
return ICON_CODE;
case 2:
return ICON_COMMIT;
case 3:
return ICON_ISSUE_OPEN;
default:
return super.getIcon(position);
}
}

Expand Down

0 comments on commit ef080b7

Please sign in to comment.