use of android.support.v7.app.AppCompatActivity in project Atom_Android by Rogrand-Dev.
the class SimpleFragment method setToolBar.
protected void setToolBar(Toolbar toolbar, String title) {
AppCompatActivity mAppCompatActivity = (AppCompatActivity) mActivity;
toolbar.setTitle(title);
mAppCompatActivity.setSupportActionBar(toolbar);
if (mAppCompatActivity.getSupportActionBar() != null) {
mAppCompatActivity.getSupportActionBar().setDisplayHomeAsUpEnabled(false);
mAppCompatActivity.getSupportActionBar().setDisplayShowHomeEnabled(false);
}
}
use of android.support.v7.app.AppCompatActivity in project ETSMobile-Android2 by ApplETS.
the class BottinFragment method updateUI.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
void updateUI() {
// Get le contenu dans la bd
AppCompatActivity activity = (AppCompatActivity) getActivity();
DatabaseHelper dbHelper = new DatabaseHelper(activity);
try {
// Création du queryBuilder, permettant de lister les employés par leur nom de service
QueryBuilder<FicheEmploye, String> queryBuilder = (QueryBuilder<FicheEmploye, String>) dbHelper.getDao(FicheEmploye.class).queryBuilder();
queryBuilder.orderBy("Service", true);
PreparedQuery<FicheEmploye> preparedQuery = queryBuilder.prepare();
List<FicheEmploye> listEmployes = dbHelper.getDao(FicheEmploye.class).query(preparedQuery);
// Si le contenu n'est pas vide, l'ajouter au listDataHeader et listDataChild
if (listEmployes.size() > 0) {
String nomService = "";
String previousNomService = "";
listDataHeader.clear();
ArrayList<FicheEmploye> listEmployesOfService = new ArrayList<>();
// Pour le premier élément dans la liste
FicheEmploye employe = listEmployes.get(0);
nomService = employe.Service;
listDataHeader.add(nomService);
listEmployesOfService.add(employe);
previousNomService = nomService;
// Pour les prochains éléments dans la liste
for (int i = 1; i < listEmployes.size(); i++) {
employe = listEmployes.get(i);
nomService = employe.Service;
if (!listDataHeader.contains(nomService)) {
listDataHeader.add(nomService);
listDataChild.put(previousNomService, listEmployesOfService);
listEmployesOfService = new ArrayList<>();
previousNomService = nomService;
}
listEmployesOfService.add(employe);
}
// Pour les derniers éléments dans la liste
listDataChild.put(previousNomService, listEmployesOfService);
listAdapter = new ExpandableListAdapter(getActivity(), listDataHeader, listDataChild);
expListView.setAdapter(listAdapter);
if (activity != null) {
activity.runOnUiThread(new Runnable() {
public void run() {
listAdapter.notifyDataSetChanged();
}
});
}
// Si le contenu est vide, télécharger le bottin
} else {
// Si l'appareil est connecté sur internet, télécharger le bottin en ligne
if (Utility.isNetworkAvailable(getActivity())) {
try {
mProgressDialog = ProgressDialog.show(getActivity(), null, getString(R.string.dialog_Loading_Directory), true);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
DataManager datamanager = DataManager.getInstance(getActivity());
datamanager.getDataFromSignet(DataManager.SignetMethods.BOTTIN_GET_LIST_SERVICE_AND_EMP, ApplicationManager.userCredentials, this);
} catch (Exception e1) {
e1.printStackTrace();
}
// Si l'appareil n'est pas connecté sur internet, envoyer un message
} else {
Toast.makeText(getActivity(), getString(R.string.toast_Connection_Required), Toast.LENGTH_LONG).show();
}
}
} catch (Exception e) {
Log.e("BD FicheEmploye", e.getMessage());
}
}
use of android.support.v7.app.AppCompatActivity in project ETSMobile-Android2 by ApplETS.
the class BandwithFragment method updateProgressBarColorItems.
private void updateProgressBarColorItems(double bandwidthQuota) {
final int[] colorChoice = new int[] { R.color.red_bandwith, R.color.blue_bandwith, R.color.green_bandwith, R.color.purple_bandwith };
int[] legendColors = new int[values.length];
final AppCompatActivity activity = (AppCompatActivity) getActivity();
progressBar.clearProgressItems();
bandwidthQuota = bandwidthQuota / 1024;
for (int i = 0, color = 0; i < values.length - 1; ++i) {
ProgressItem progressItem = new ProgressItem(colorChoice[color], (values[i] / bandwidthQuota) * 100);
progressBar.addProgressItem(progressItem);
legendColors[i] = colorChoice[color];
color++;
if (color == colorChoice.length)
color = 0;
}
if (values.length > 0) {
int lastValue = values.length - 1;
ProgressItem progressItem = new ProgressItem(R.color.grey_bandwith, (values[lastValue] / bandwidthQuota) * 100);
legendColors[lastValue] = R.color.grey_bandwith;
progressBar.addProgressItem(progressItem);
}
if (activity != null) {
final int[] colors = legendColors;
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
grid.setAdapter(new LegendAdapter(activity, rooms, colors));
}
});
}
}
use of android.support.v7.app.AppCompatActivity in project ETSMobile-Android2 by ApplETS.
the class SecuriteFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.security, container, false);
final AppCompatActivity activity = (AppCompatActivity) getActivity();
listView = (ListView) v.findViewById(android.R.id.list);
final ViewGroup viewGroup = (ViewGroup) inflater.inflate(R.layout.secu_list_header, (ViewGroup) v.findViewById(R.id.secu_list_header_layout));
listView.addHeaderView(viewGroup, null, false);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(final AdapterView<?> arg0, final View arg1, final int arg2, final long arg3) {
final Intent intent = new Intent(activity, UrgenceActivity.class);
intent.putExtra("id", arg2);
startActivity(intent);
}
});
listView.setAdapter(new ArrayAdapter<String>(activity, R.layout.row_text_with_arrow, R.id.titleTextView, activity.getResources().getStringArray(R.array.secu_urgence)));
viewGroup.findViewById(R.id.secu_list_header_phone).setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
final String phoneNumber = ((TextView) v).getText().toString();
final String uri = "tel:" + phoneNumber.trim();
final Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse(uri));
AnalyticsHelper.getInstance(getActivity()).sendActionEvent(getClass().getSimpleName(), UrgenceActivity.APPEL_D_URGENCE);
startActivity(intent);
}
});
AnalyticsHelper.getInstance(getActivity()).sendScreenEvent(getClass().getSimpleName());
return v;
}
use of android.support.v7.app.AppCompatActivity in project Douya by DreaminginCodeZH.
the class TintHelper method onPanelMenuCreated.
public static void onPanelMenuCreated(int featureId, Menu menu, AppCompatActivity activity) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
Context context = activity.getSupportActionBar().getThemedContext();
ColorStateList menuTintList = ViewUtils.getColorStateListFromAttrRes(R.attr.colorControlNormal, context);
int popupThemeResId = ViewUtils.getResIdFromAttrRes(R.attr.popupTheme, 0, context);
ColorStateList subMenuTintList;
if (popupThemeResId != 0) {
Context popupContext = new ContextThemeWrapper(context, popupThemeResId);
subMenuTintList = ViewUtils.getColorStateListFromAttrRes(R.attr.colorControlNormal, popupContext);
} else {
subMenuTintList = menuTintList;
}
tintMenuItemIcon(menu, menuTintList, subMenuTintList);
}
}
Aggregations