Search in sources :

Example 1 with Rewrites

use of ee.ioc.phon.android.speak.model.Rewrites in project K6nele by Kaljurand.

the class RewritesActivity method setRewrites.

private void setRewrites(String name, String[] errors) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    Resources res = getResources();
    mRewrites = new Rewrites(prefs, res, name);
    int ruleCount = mRewrites.getRules().length;
    String subtitle = res.getQuantityString(R.plurals.statusLoadRewrites, ruleCount, ruleCount);
    if (errors != null) {
        int errorCount = errors.length;
        if (errorCount > 0) {
            String errorMessage = res.getQuantityString(R.plurals.statusLoadRewritesErrors, errorCount, errorCount);
            showErrors(errorMessage, errors);
            subtitle += " ยท " + errorMessage;
        }
    }
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setTitle(name);
        actionBar.setSubtitle(subtitle);
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) Rewrites(ee.ioc.phon.android.speak.model.Rewrites) Resources(android.content.res.Resources) ExecutableString(ee.ioc.phon.android.speak.ExecutableString) ActionBar(android.app.ActionBar)

Example 2 with Rewrites

use of ee.ioc.phon.android.speak.model.Rewrites in project K6nele by Kaljurand.

the class RewritesAdapter method getView.

@Override
@NonNull
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
    View view;
    if (convertView == null) {
        LayoutInflater inflator = context.getLayoutInflater();
        view = inflator.inflate(R.layout.list_item_rewrites, null);
        final ViewHolder viewHolder = new ViewHolder();
        viewHolder.id = (TextView) view.findViewById(R.id.rewritesId);
        viewHolder.isSelected = (TextView) view.findViewById(R.id.rewritesIsSelected);
        view.setTag(viewHolder);
    } else {
        view = convertView;
    }
    ViewHolder holder = (ViewHolder) view.getTag();
    Rewrites rewrites = list.get(position);
    holder.id.setText(rewrites.getId());
    if (rewrites.isSelected()) {
        holder.isSelected.setVisibility(View.VISIBLE);
    } else {
        holder.isSelected.setVisibility(View.INVISIBLE);
    }
    return view;
}
Also used : LayoutInflater(android.view.LayoutInflater) Rewrites(ee.ioc.phon.android.speak.model.Rewrites) TextView(android.widget.TextView) View(android.view.View) NonNull(android.support.annotation.NonNull)

Aggregations

Rewrites (ee.ioc.phon.android.speak.model.Rewrites)2 ActionBar (android.app.ActionBar)1 SharedPreferences (android.content.SharedPreferences)1 Resources (android.content.res.Resources)1 NonNull (android.support.annotation.NonNull)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 TextView (android.widget.TextView)1 ExecutableString (ee.ioc.phon.android.speak.ExecutableString)1