fncdsjkc

                Never    
Java
       
package ftn.chocmail;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import ftn.chocmail.model.Folder;
import ftn.chocmail.network.FolderService;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by student Iva Stojanovic
 */

public class CreateFolderActivity extends AppCompatActivity {
    FolderService folderService;
    private Folder folder;
    private EditText folderName;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_create_folder);

        Toolbar toolbar = findViewById(R.id.create_folder_toolbar);
        setSupportActionBar(toolbar);

        ActionBar actionBar = getSupportActionBar();

        actionBar.setDisplayHomeAsUpEnabled(true);

        folderName = findViewById(R.id.create_folder_folder_name);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.create_folder_menu, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item)
    {
        int menuId = item.getItemId();
        if (menuId == android.R.id.home){
            onBackPressed();
            return true;
        } else if (menuId == R.id.create_folder_activity_save_button) {

            String name = folderName.getText().toString();
            folder.setName(name);
           // Call<Folder> callUpdateFolder = folderService.updateFolder(folder);
            //callUpdateFolder.enqueue(new Callback<Folder>() {
            //   @Override
            //   public void onResponse(Call<Folder> call, Response<Folder> response) {
            //       if(response.isSuccessful()) {
            //           Toast.makeText(CreateFolderActivity.this,"Success",Toast.LENGTH_SHORT).show();
            //       }
            //    }
            //   @Override
            //   public void onFailure(Call<Folder> call, Throwable t) {
            //   }
            //});
            //    Intent inte = new Intent(CreateFolderActivity.this, FoldersActivity.class);
            //   startActivity(inte);
            Toast.makeText(CreateFolderActivity.this, folder.getName(), Toast.LENGTH_SHORT).show();

            }

        return super.onOptionsItemSelected(item);
    }

    @Override
    protected void onStart() {
        super.onStart();
    }

    @Override
    protected void onStop() {
        super.onStop();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onRestart() {
        super.onRestart();
    }

    public void btnCancel(View view) {
        finish();
    }
}