Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b153376 authored by Danesh M's avatar Danesh M Committed by Adnan Begovic
Browse files

Settings : Preserve title id

Change-Id: Ieea43e5ebe955ae31190daa0db635611c4ec7f49
parent 0c63527f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -982,7 +982,7 @@ public class Settings extends PreferenceActivity
        } else {
            Intent i = new Intent(this, SubSettings.class);
            i.putExtra(EXTRA_SHOW_FRAGMENT, info.fragment);
            i.putExtra(EXTRA_SHOW_FRAGMENT_TITLE_TEXT, info.parentTitle);
            i.putExtra(EXTRA_SHOW_FRAGMENT_TITLE, info.parentTitle);
            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(i);
        }
+4 −5
Original line number Diff line number Diff line
@@ -296,14 +296,13 @@ public class SearchPopulator extends IntentService {
                    populateFromXml(subXmlId, null, level + 1, header.iconRes,
                            fragment, title.resourceId);
                    dbHelper.insertEntry(preferenceTitle, level, fragment,
                            header.iconRes, getString(titleRes));
                            header.iconRes, titleRes);
                } else if (header != null) {
                    header.title = preferenceTitle;
                    header.titleRes = 0;
                    dbHelper.insertHeader(header, getString(titleRes));
                    dbHelper.insertHeader(header, titleRes);
                } else {
                    dbHelper.insertEntry(preferenceTitle, level, prefFragment,
                            iconRes, getString(titleRes));
                            iconRes, titleRes);
                }

                sa.recycle();
@@ -344,7 +343,7 @@ public class SearchPopulator extends IntentService {
                info.fragment = c.getString(fragmentIndex);
                info.title = c.getString(titleIndex);
                info.iconRes = c.getInt(iconIndex);
                info.parentTitle = c.getString(parentIndex);
                info.parentTitle = c.getInt(parentIndex);
                infos.add(info);
            }
            c.close();
+6 −6
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ public class SettingsSearchDatabaseHelper extends SQLiteOpenHelper {
    // general database configuration and tables
    private static final String sDatabaseName = "search.db";

    protected static final int DATABASE_VERSION = 1;
    protected static final int DATABASE_VERSION = 2;
    private Context mContext;

    public static SettingsSearchDatabaseHelper getInstance(Context context) {
@@ -56,7 +56,7 @@ public class SettingsSearchDatabaseHelper extends SQLiteOpenHelper {
                DatabaseContract.Settings.ACTION_ICON + " INTEGER," +
                DatabaseContract.Settings.ACTION_LEVEL + " INTEGER," +
                DatabaseContract.Settings.ACTION_FRAGMENT + " TEXT," +
                DatabaseContract.Settings.ACTION_PARENT_TITLE + " TEXT" +
                DatabaseContract.Settings.ACTION_PARENT_TITLE + " INTEGER" +
                ");");
        db.execSQL(builder.toString());
    }
@@ -73,10 +73,10 @@ public class SettingsSearchDatabaseHelper extends SQLiteOpenHelper {
    }

    public void insertHeader(Header header) {
        insertHeader(header, null);
        insertHeader(header, 0);
    }

    public void insertHeader(Header header, String parentTitle) {
    public void insertHeader(Header header, int parentTitle) {
        if (header == null) {
            return;
        }
@@ -93,7 +93,7 @@ public class SettingsSearchDatabaseHelper extends SQLiteOpenHelper {
    }

    public void insertEntry(String title, int level, String fragment,
            int iconRes, String parentTitle) {
            int iconRes, int parentTitle) {
        if (TextUtils.isEmpty(title)) {
            return;
        }
@@ -101,7 +101,7 @@ public class SettingsSearchDatabaseHelper extends SQLiteOpenHelper {
    }

    private void insertEntry(Header header, String title, int level, String fragment,
            int iconRes, String parentTitle) {
            int iconRes, int parentTitle) {
        SQLiteDatabase database = getWritableDatabase();
        ContentValues values = new ContentValues();
        if (header != null) {
+7 −4
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ public class SettingsSearchFilterAdapter extends ArrayAdapter<SearchInfo> implem
        public String fragment;
        public String title;
        public int iconRes;
        public String parentTitle;
        public int parentTitle;
    }

    public SettingsSearchFilterAdapter(Context context, int resourceId,
@@ -97,9 +97,12 @@ public class SettingsSearchFilterAdapter extends ArrayAdapter<SearchInfo> implem
                holder.titleView.setText(info.title);
            }
            if (holder.parentView != null) {
                if (info.parentTitle != 0) {
                    holder.parentView.setText(info.parentTitle);
                holder.parentView.setVisibility(
                        info.parentTitle != null ? View.VISIBLE : View.GONE);
                    holder.parentView.setVisibility(View.VISIBLE);
                } else {
                    holder.parentView.setVisibility(View.GONE);
                }
            }
        }
        return v;