Fix actionbar offset

This commit is contained in:
Phillip Thelen 2015-06-29 17:43:03 +02:00
parent ef177cef0f
commit 50ba0e07ab
6 changed files with 26 additions and 93 deletions

View file

@ -1,11 +1,11 @@
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:id="@+id/drawer_layout"
tools:context=".MainActivityNew">
tools:context=".MainActivity">
<com.github.florent37.materialviewpager.MaterialViewPager
android:id="@+id/materialViewPager"
@ -19,7 +19,6 @@
app:viewpager_logo="@layout/avatar_with_bars"
app:viewpager_hideLogoWithFade="true"
app:viewpager_hideToolbarAndTitle="false"
app:viewpager_enableToolbarElevation="false"
app:viewpager_parallaxHeaderFactor="1.5" />
app:viewpager_enableToolbarElevation="false" />
</android.support.v4.widget.DrawerLayout>

View file

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="240dp"
android:layout_height="match_parent"
android:id="@+id/left_drawer"
android:background="#111"
android:layout_gravity="start">
<LinearLayout
android:orientation="vertical"
android:id="@+id/update_to_premium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
/>
<TextView
android:id="@+id/TV_drawer_tag_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/tags_section_title"
android:layout_alignParentTop="true"
android:textColor="@color/white"
style="?android:attr/listSeparatorTextViewStyle"/>
<ListView
android:id="@+id/LV_drawer_tag"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_above="@id/update_to_premium"
android:layout_below="@id/TV_drawer_tag_title"
android:choiceMode="multipleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
tools:listitem="@layout/drawer_list_item"/>
</RelativeLayout>

View file

@ -1,17 +1,3 @@
<resources>
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
<item name="android:listSeparatorTextViewStyle">@style/MyOwnListSeperatorTextViewStyle
</item>
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>

View file

@ -1,12 +1,3 @@
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.NoActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>

View file

@ -3,11 +3,29 @@
<!-- Application theme. -->
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
<style name="AppTheme" parent="@style/MaterialDrawerTheme.Light.DarkToolbar.TranslucentStatus">
<item name="android:listSeparatorTextViewStyle">@style/MyOwnListSeperatorTextViewStyle</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<!-- ...and here we setting appcompats color theming attrs -->
<item name="colorPrimary">@color/brand</item>
<item name="colorPrimaryDark">@color/brand</item>
<item name="colorAccent">@color/md_amber_200</item>
<!-- MaterialDrawer specific values -->
<item name="material_drawer_background">@color/material_drawer_background</item>
<item name="material_drawer_icons">@color/material_drawer_icons</item>
<item name="material_drawer_primary_text">@color/material_drawer_primary_text</item>
<item name="material_drawer_primary_icon">@color/material_drawer_primary_icon</item>
<item name="material_drawer_secondary_text">@color/material_drawer_secondary_text</item>
<item name="material_drawer_hint_text">@color/material_drawer_hint_text</item>
<item name="material_drawer_divider">@color/material_drawer_divider</item>
<item name="material_drawer_selected">@color/material_drawer_selected</item>
<item name="material_drawer_selected_text">@color/brand</item>
<item name="material_drawer_header_selection_text">@color/material_drawer_header_selection_text</item>
</style>
@ -73,22 +91,7 @@
<item name="color">@color/drawerArrowColor</item>
</style>
<style name="CustomTheme" parent="style/MaterialDrawerTheme.TranslucentStatus">
<!-- ...and here we setting appcompats color theming attrs -->
<item name="colorPrimary">@color/brand</item>
<item name="colorPrimaryDark">@color/brand</item>
<item name="colorAccent">@color/md_amber_200</item>
<style name="CustomTheme" parent="">
<!-- MaterialDrawer specific values -->
<item name="material_drawer_background">@color/material_drawer_background</item>
<item name="material_drawer_icons">@color/material_drawer_icons</item>
<item name="material_drawer_primary_text">@color/material_drawer_primary_text</item>
<item name="material_drawer_primary_icon">@color/material_drawer_primary_icon</item>
<item name="material_drawer_secondary_text">@color/material_drawer_secondary_text</item>
<item name="material_drawer_hint_text">@color/material_drawer_hint_text</item>
<item name="material_drawer_divider">@color/material_drawer_divider</item>
<item name="material_drawer_selected">@color/material_drawer_selected</item>
<item name="material_drawer_selected_text">@color/material_drawer_selected_text</item>
<item name="material_drawer_header_selection_text">@color/material_drawer_header_selection_text</item>
</style>
</resources>

View file

@ -1,7 +1,6 @@
package com.habitrpg.android.habitica;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
@ -12,11 +11,9 @@ import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Toast;
@ -26,7 +23,6 @@ import com.habitrpg.android.habitica.callbacks.TaskCreationCallback;
import com.habitrpg.android.habitica.callbacks.TaskDeletionCallback;
import com.habitrpg.android.habitica.callbacks.TaskScoringCallback;
import com.habitrpg.android.habitica.callbacks.TaskUpdateCallback;
import com.habitrpg.android.habitica.databinding.SidebarHeaderBinding;
import com.habitrpg.android.habitica.prefs.PrefsActivity;
import com.habitrpg.android.habitica.ui.AvatarWithBarsViewModel;
import com.habitrpg.android.habitica.ui.EditTextDrawer;
@ -87,7 +83,7 @@ public class MainActivity extends InstabugAppCompatActivity implements OnTaskCre
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_new);
setContentView(R.layout.activity_main);
// Inject Controls
ButterKnife.inject(this);
@ -95,7 +91,6 @@ public class MainActivity extends InstabugAppCompatActivity implements OnTaskCre
this.hostConfig = PrefsActivity.fromContext(this);
toolbar = materialViewPager.getToolbar();
setSupportActionBar(toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
@ -125,7 +120,6 @@ public class MainActivity extends InstabugAppCompatActivity implements OnTaskCre
.withActivity(this)
.withToolbar(toolbar)
.withHeaderDivider(false)
.withTranslucentStatusBar(true)
.withAnimateDrawerItems(true)
.addDrawerItems(
new PrimaryDrawerItem().withName("Tasks"),
@ -214,7 +208,7 @@ public class MainActivity extends InstabugAppCompatActivity implements OnTaskCre
}
});
materialViewPager.getViewPager().setCurrentItem(1);
materialViewPager.getViewPager().setCurrentItem(0);
}