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);
}
}
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;
}
Aggregations