Made settings work

This commit is contained in:
Denis 2015-01-08 15:55:21 +02:00
parent 9db5933bf1
commit 553f87e1a8
15 changed files with 12 additions and 54 deletions

View file

@ -7,7 +7,7 @@
tools:context="com.antonioleiva.materialeverywhere.SettingsActivity" > tools:context="com.antonioleiva.materialeverywhere.SettingsActivity" >
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/abp__toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
@ -24,7 +24,7 @@
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<ImageView <ImageView
android:id="@+id/abp__shadowView" android:id="@+id/shadowView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/abp__shadow_height" android:layout_height="@dimen/abp__shadow_height"
android:src="@drawable/preference_activity_action_bar_shadow" android:src="@drawable/preference_activity_action_bar_shadow"

View file

@ -16,8 +16,6 @@ public abstract class ActionBarPreferenceActivity extends PreferenceActivity {
private Toolbar _toolbar; private Toolbar _toolbar;
private View _shadowView; private View _shadowView;
protected abstract int getPreferencesXmlId();
public Toolbar getToolbar() { public Toolbar getToolbar() {
return _toolbar; return _toolbar;
} }
@ -27,14 +25,13 @@ public abstract class ActionBarPreferenceActivity extends PreferenceActivity {
protected void onCreate(final Bundle savedInstanceState) { protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.preference_activity); setContentView(R.layout.preference_activity);
_toolbar = (Toolbar) findViewById(R.id.abp__toolbar); _toolbar = (Toolbar) findViewById(R.id.toolbar);
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
_shadowView = findViewById(R.id.abp__shadowView); _shadowView = findViewById(R.id.shadowView);
final ViewGroup parent = (ViewGroup) _shadowView.getParent(); final ViewGroup parent = (ViewGroup) _shadowView.getParent();
parent.removeView(_shadowView); parent.removeView(_shadowView);
_shadowView = null; _shadowView = null;
} }
addPreferencesFromResource(getPreferencesXmlId());
_toolbar.setClickable(true); _toolbar.setClickable(true);
_toolbar.setNavigationIcon(getResIdFromAttribute(this, R.attr.homeAsUpIndicator)); _toolbar.setNavigationIcon(getResIdFromAttribute(this, R.attr.homeAsUpIndicator));
_toolbar.setNavigationOnClickListener(new View.OnClickListener() { _toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@ -58,7 +55,7 @@ public abstract class ActionBarPreferenceActivity extends PreferenceActivity {
ViewCompat.setElevation(_toolbar, enable ? 4 : 0); ViewCompat.setElevation(_toolbar, enable ? 4 : 0);
} else { } else {
if (_shadowView == null) if (_shadowView == null)
_shadowView = findViewById(R.id.abp__shadowView); _shadowView = findViewById(R.id.shadowView);
_shadowView.setVisibility(enable ? View.VISIBLE : View.GONE); _shadowView.setVisibility(enable ? View.VISIBLE : View.GONE);
} }
} }

View file

@ -134,8 +134,8 @@ public class MapActivity extends AccessibleActivity {
app = getMyApplication(); app = getMyApplication();
settings = app.getSettings(); settings = app.getSettings();
app.applyTheme(this); app.applyTheme(this);
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
// Full screen is not used here // Full screen is not used here
//getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main); setContentView(R.layout.main);

View file

@ -27,10 +27,6 @@ public class SettingsActivity extends SettingsBaseActivity {
private Preference routing; private Preference routing;
private Preference about; private Preference about;
@Override
protected int getPreferencesXmlId() {
return 0;
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {

View file

@ -300,20 +300,16 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
return false; return false;
} }
@Override
protected int getPreferencesXmlId() {
return 0;
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
((OsmandApplication) getApplication()).applyTheme(this); ((OsmandApplication) getApplication()).applyTheme(this);
//getToolbar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); //getToolbar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
//getToolbar().setDisplayHomeAsUpEnabled(true); //getToolbar().setDisplayHomeAsUpEnabled(true);
getToolbar().setTitle(R.string.settings_activity);
// R.drawable.tab_settings_screen_icon // R.drawable.tab_settings_screen_icon
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getToolbar().setTitle(R.string.settings_activity);
settings = getMyApplication().getSettings(); settings = getMyApplication().getSettings();
if (profileSettings) { if (profileSettings) {

View file

@ -62,10 +62,6 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
private ListPreference drivingRegionPreference; private ListPreference drivingRegionPreference;
@Override
protected int getPreferencesXmlId() {
return 0;
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {

View file

@ -92,6 +92,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
} }
}; };
private void createUI() { private void createUI() {
addPreferencesFromResource(R.xml.navigation_settings); addPreferencesFromResource(R.xml.navigation_settings);
PreferenceScreen screen = getPreferenceScreen(); PreferenceScreen screen = getPreferenceScreen();

View file

@ -33,10 +33,6 @@ public class SettingsAudioVideoActivity extends SettingsBaseActivity {
private static final Log log = PlatformUtil.getLog(AudioVideoNotesPlugin.class); private static final Log log = PlatformUtil.getLog(AudioVideoNotesPlugin.class);
@Override
protected int getPreferencesXmlId() {
return 0;
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {

View file

@ -26,11 +26,6 @@ import android.view.View;
public class SettingsDevelopmentActivity extends SettingsBaseActivity { public class SettingsDevelopmentActivity extends SettingsBaseActivity {
@Override
protected int getPreferencesXmlId() {
return 0;
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View file

@ -71,9 +71,9 @@ public class DownloadActivity extends BaseDownloadActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
getMyApplication().applyTheme(this); getMyApplication().applyTheme(this);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
updateDownloads(); updateDownloads();
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setProgressBarIndeterminateVisibility(false); setProgressBarIndeterminateVisibility(false);
setContentView(R.layout.tab_content); setContentView(R.layout.tab_content);

View file

@ -36,11 +36,6 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity {
super(true); super(true);
} }
@Override
protected int getPreferencesXmlId() {
return 0;
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

View file

@ -15,11 +15,6 @@ import android.text.InputType;
public class SettingsOsmEditingActivity extends SettingsBaseActivity { public class SettingsOsmEditingActivity extends SettingsBaseActivity {
@Override
protected int getPreferencesXmlId() {
return 0;
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View file

@ -35,11 +35,6 @@ public class SettingsOsMoActivity extends SettingsBaseActivity {
public static final int[] MINUTES = new int[] {2, 3, 5}; public static final int[] MINUTES = new int[] {2, 3, 5};
@Override
protected int getPreferencesXmlId() {
return 0;
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View file

@ -24,10 +24,6 @@ public class SettingsRasterMapsActivity extends SettingsBaseActivity {
public static final String MORE_VALUE = "MORE_VALUE"; public static final String MORE_VALUE = "MORE_VALUE";
public static final String DEFINE_EDIT = "DEFINE_EDIT"; public static final String DEFINE_EDIT = "DEFINE_EDIT";
@Override
protected int getPreferencesXmlId() {
return 0;
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {