Search in sources :

Example 1 with UIHandler

use of com.cpjd.roblu.ui.UIHandler in project Roblu by wdavies973.

the class MetricEditor method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.add_element, menu);
    new UIHandler(this, menu).updateMenu();
    return true;
}
Also used : UIHandler(com.cpjd.roblu.ui.UIHandler) MenuInflater(android.view.MenuInflater)

Example 2 with UIHandler

use of com.cpjd.roblu.ui.UIHandler in project Roblu by wdavies973.

the class PredefinedFormSelector method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.predefined, menu);
    new UIHandler(this, menu).updateMenu();
    return true;
}
Also used : UIHandler(com.cpjd.roblu.ui.UIHandler) MenuInflater(android.view.MenuInflater)

Example 3 with UIHandler

use of com.cpjd.roblu.ui.UIHandler in project Roblu by wdavies973.

the class PredefinedFormSelector method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_predefined);
    /*
         * Setup UI
         */
    // Toolbar
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setTitle("Template forms");
        getSupportActionBar().setSubtitle("You can still edit predefined forms later");
    }
    /*
		 * Load and process predefined forms
		 */
    try {
        forms = new ArrayList<>();
        String[] files = getAssets().list("predefinedForms");
        items = new String[files.length];
        sub_items = new String[files.length];
        for (int i = 0; i < files.length; i++) {
            forms.add(processForm(i, files[i]));
        }
    } catch (IOException e) {
        Log.d("RBS", "Unable to process predefined forms.");
    }
    // Bind predefined forms to the list
    ListView sharingView = findViewById(R.id.listView1);
    List<Map<String, String>> data = new ArrayList<>();
    for (int i = 0; i < items.length; i++) {
        Map<String, String> datum = new HashMap<>(2);
        datum.put("item", items[i]);
        datum.put("description", sub_items[i]);
        data.add(datum);
    }
    SimpleAdapter adapter = new SimpleAdapter(this, data, android.R.layout.simple_list_item_2, new String[] { "item", "description" }, new int[] { android.R.id.text1, android.R.id.text2 });
    sharingView.setAdapter(adapter);
    sharingView.setOnItemClickListener(this);
    // Sync UI with user settings
    new UIHandler(this, toolbar).update();
}
Also used : UIHandler(com.cpjd.roblu.ui.UIHandler) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) SimpleAdapter(android.widget.SimpleAdapter) IOException(java.io.IOException) ListView(android.widget.ListView) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Toolbar(android.support.v7.widget.Toolbar)

Example 4 with UIHandler

use of com.cpjd.roblu.ui.UIHandler in project Roblu by wdavies973.

the class Drawing method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.drawing, menu);
    new UIHandler(this, menu).updateMenu();
    return true;
}
Also used : UIHandler(com.cpjd.roblu.ui.UIHandler)

Example 5 with UIHandler

use of com.cpjd.roblu.ui.UIHandler in project Roblu by wdavies973.

the class TBAEventSelector method onCreateOptionsMenu.

/**
 * Syncs the menu items with the UI
 * @param menu the menu to sync
 * @return true if the menu was created successfully here
 */
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.api_eventpicker, menu);
    new UIHandler(this, menu).updateMenu();
    return true;
}
Also used : UIHandler(com.cpjd.roblu.ui.UIHandler) MenuInflater(android.view.MenuInflater)

Aggregations

UIHandler (com.cpjd.roblu.ui.UIHandler)26 Toolbar (android.support.v7.widget.Toolbar)14 IO (com.cpjd.roblu.io.IO)10 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)5 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)5 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)4 MenuInflater (android.view.MenuInflater)4 RForm (com.cpjd.roblu.models.RForm)4 ArrayList (java.util.ArrayList)4 RecyclerView (android.support.v7.widget.RecyclerView)3 IntentFilter (android.content.IntentFilter)2 View (android.view.View)2 AdapterView (android.widget.AdapterView)2 ListView (android.widget.ListView)2 SimpleAdapter (android.widget.SimpleAdapter)2 TextView (android.widget.TextView)2 RUI (com.cpjd.roblu.models.RUI)2 MaterialSearchView (com.miguelcatalan.materialsearchview.MaterialSearchView)2 HashMap (java.util.HashMap)2 AlertDialog (android.app.AlertDialog)1