Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
kosratdev committed Jul 18, 2017
2 parents 5068f56 + 3987ba9 commit 861dc3f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 37 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
The open repository with a global support for Android 5 Toolbar within any Settings Activity (`PreferenceActivity`), compatible with API 10 and above.

##Sample App
[<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png" width="200" alt="Google Play">](https://play.google.com/store/apps/details?id=uk.verscreative.materialsettings)
<!-- [<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png" width="200" alt="Google Play">](https://play.google.com/store/apps/details?id=uk.verscreative.materialsettings)-->
>Being Updated! - Watch this space :)
##IMPORTANT - Compatibility
###Element Tinting
Expand Down Expand Up @@ -46,9 +47,10 @@ public View onCreateView(String name, Context context, AttributeSet attrs) {
In order to handle nested `PreferenceScreens` correctly `onConfigurationChanged()` must be overriden in your `SettingsActivity` as below:

```java
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
```

and so this code is called, add the following to your `SettingsActivity` declaration in your `AndroidManifest.xml`:
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import android.content.Context;
import android.content.pm.PackageInfo;
import android.preference.Preference;
import android.app.NotificationManager;

import android.preference.PreferenceManager;
import android.preference.RingtonePreference;
Expand All @@ -18,17 +17,13 @@
import android.support.v7.widget.AppCompatRadioButton;
import android.support.v7.widget.AppCompatSpinner;
import android.text.TextUtils;
import android.util.Log;
import android.net.Uri;
import android.support.v7.app.NotificationCompat;
import android.graphics.Color;
import android.content.res.Configuration;
import android.util.AttributeSet;
import android.view.View;
import android.os.Build;
import android.os.Bundle;
import android.content.pm.PackageManager;
import android.view.Window;
import android.widget.LinearLayout;
import android.view.LayoutInflater;
import android.view.ViewGroup;
Expand Down Expand Up @@ -189,6 +184,7 @@ public View onCreateView(String name, Context context, AttributeSet attrs) {
return null;
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
Expand Down Expand Up @@ -222,8 +218,7 @@ public void setUpNestedScreen(PreferenceScreen preferenceScreen) {
LinearLayout root = (LinearLayout) dialog.findViewById(android.R.id.list).getParent().getParent();
appBar = (AppBarLayout) LayoutInflater.from(this).inflate(R.layout.toolbar_settings, root, false);
root.addView(appBar, 0);
}
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
LinearLayout root = (LinearLayout) dialog.findViewById(android.R.id.list).getParent();
appBar = (AppBarLayout) LayoutInflater.from(this).inflate(R.layout.toolbar_settings, root, false);
root.addView(appBar, 0);
Expand All @@ -245,10 +240,6 @@ else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mRootView.addView(LL);
}

if(listRoot != null){
listRoot.setPadding(0, listRoot.getPaddingTop(), 0, listRoot.getPaddingBottom());
}

Toolbar Tbar = (Toolbar) appBar.getChildAt(0);

Tbar.setTitle(preferenceScreen.getTitle());
Expand All @@ -260,4 +251,14 @@ public void onClick(View v) {
}
});
}

@Override
protected void onSaveInstanceState(Bundle outState) {

}

@Override
protected void onRestoreInstanceState(Bundle state) {

}
}
37 changes: 18 additions & 19 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.SettingsTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="titleTextStyle">@color/colorTitleText</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.SettingsTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="titleTextStyle">@color/colorTitleText</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.SettingsTheme.Toolbar" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
</style>
<style name="AppTheme.SettingsTheme.Toolbar" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

</resources>

0 comments on commit 861dc3f

Please sign in to comment.