1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| public class MainActivity extends AppCompatActivity {
private AppBarConfiguration mAppBarConfiguration;
Integer objectif,DEJi,Nbjour,Calsemaine;
Boolean up;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow, R.id.nav_alim, R.id.nav_dej)
.setDrawerLayout(drawer)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
Nbjour=0;
Calsemaine=0;
File chemin = getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
File fich = new File(chemin, "DataBase.txt");
List<String> textlu = new ArrayList<>();
DecimalFormat df = new DecimalFormat("###");
home();
}//end create
// public void home (View v){
private void home() {
File chemin = getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
File fich = new File(chemin, "DataBase.txt");
View view = LayoutInflater.from(this).inflate(R.layout.fragment_home, null);
TextView textbienvenue = (TextView) view.findViewById(R.id.textbienvenue);
//TextView textbienvenue = (TextView) findViewById(R.id.textbienvenue);
if (fich.exists()) //Toast.makeText(this, getString(R.string.retour), Toast.LENGTH_SHORT).show();
textbienvenue.setText("Content de vous revoir");
else Toast.makeText(this, getString(R.string.bienvenue), Toast.LENGTH_SHORT).show();
//textbienvenue.setText(getString(R.string.bienvenue));
WebView webView =(WebView)view.findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webView.loadUrl("https://letrainingdepam.com/paroles-de-sportifs");
} |
Partager