Skip to content

Commit

Permalink
Merge pull request #22 from KosratDAhmad/master
Browse files Browse the repository at this point in the history
Resolve issue #17
  • Loading branch information
davcpas1234 authored Oct 26, 2017
2 parents 3987ba9 + e11f513 commit 4db179d
Showing 1 changed file with 33 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
package uk.verscreative.materialsettings;

import android.app.Dialog;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.PreferenceActivity;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.preference.Preference;

import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.preference.RingtonePreference;
import android.support.design.widget.AppBarLayout;
import android.support.v7.widget.AppCompatCheckBox;
import android.support.v7.widget.AppCompatCheckedTextView;
import android.support.v7.widget.AppCompatEditText;
import android.support.v7.widget.AppCompatRadioButton;
import android.support.v7.widget.AppCompatSpinner;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.net.Uri;
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.widget.LinearLayout;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.support.v7.widget.Toolbar;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.util.TypedValue;
import android.preference.PreferenceScreen;
import android.app.Dialog;


public class SettingsExampleActivity extends PreferenceActivity {
Expand Down Expand Up @@ -215,7 +214,25 @@ public void setUpNestedScreen(PreferenceScreen preferenceScreen) {
ViewGroup mRootView = (ViewGroup) dialog.findViewById(android.R.id.content);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
LinearLayout root = (LinearLayout) dialog.findViewById(android.R.id.list).getParent().getParent();
LinearLayout root = null;
try {
root = (LinearLayout) dialog.findViewById(android.R.id.list).getParent();
} catch (Exception e) {
e.printStackTrace();
}

try {
root = (LinearLayout) dialog.findViewById(android.R.id.list).getParent().getParent();
} catch (Exception e) {
e.printStackTrace();
}

try {
root = (LinearLayout) dialog.findViewById(android.R.id.list).getParent().getParent().getParent();
} catch (Exception e) {
e.printStackTrace();
}

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) {
Expand Down

0 comments on commit 4db179d

Please sign in to comment.