Search in sources :

Example 16 with SessionManager

use of ingage.ingage.managers.SessionManager in project iNGAGE by davis123123.

the class ContactUsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_contact_us);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle(getResources().getString(R.string.contact_us_title));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    session = new SessionManager(this);
    HashMap<String, String> user = session.getUserDetails();
    final String email = user.get(SessionManager.KEY_EMAIL);
    // etSender = (EditText) findViewById(R.id.et_email_sender);
    etSubject = (EditText) findViewById(R.id.et_email_title);
    etMessage = (EditText) findViewById(R.id.et_email_content);
    btnEmailUs = (Button) findViewById(R.id.btnEmailUs);
    btnEmailUs.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String subject = String.valueOf(etSubject.getText());
            String message = String.valueOf(etMessage.getText());
            if (etSubject.getText().length() == 0) {
                Toast.makeText(ContactUsActivity.this, "Please enter subject line", Toast.LENGTH_SHORT).show();
            } else if (etMessage.getText().length() == 0) {
                Toast.makeText(ContactUsActivity.this, "Please enter your message", Toast.LENGTH_SHORT).show();
            } else {
                loadingDialog();
                String type = "submit";
                ContactUsHandler contactUsHandler = new ContactUsHandler(ContactUsActivity.this);
                contactUsHandler.execute(type, email, subject, message);
            }
        }
    });
}
Also used : SessionManager(ingage.ingage.managers.SessionManager) ContactUsHandler(ingage.ingage.handlers.ContactUsHandler) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Example 17 with SessionManager

use of ingage.ingage.managers.SessionManager in project iNGAGE by davis123123.

the class LoginActivity method onCreate.

// String thread_subs;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sign_in);
    session = new SessionManager(getApplicationContext());
    wifiManager = new WifiManager(getBaseContext());
    usernameEt = (EditText) findViewById(R.id.username);
    passwordEt = (EditText) findViewById(R.id.password);
    cbRemember = (CheckBox) findViewById(R.id.cbRememberMe);
    cbRemember.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            String key = getResources().getString(R.string.remember_user_checked);
            SharedPreferences.Editor prefEditor = PreferenceManager.getDefaultSharedPreferences(getBaseContext()).edit();
            if (cbRemember.isChecked()) {
                prefEditor.putBoolean(key, true);
            } else {
                prefEditor.putBoolean(key, false);
            }
            prefEditor.commit();
        }
    });
    LoginEt = (Button) findViewById(R.id.sign_in_button);
    signUpTV = (TextView) findViewById(R.id.signIn_textView_CreateNewAccount);
    signUpTV.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (wifiManager.checkInternet())
                goSignUp();
            else
                wifiErrorDialog();
        }
    });
    LoginEt.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (view == LoginEt) {
                if (wifiManager.checkInternet()) {
                    OnLogin();
                } else
                    wifiErrorDialog();
            }
        }
    });
    loadUserName();
    showEULA();
}
Also used : WifiManager(ingage.ingage.managers.WifiManager) SessionManager(ingage.ingage.managers.SessionManager) View(android.view.View) TextView(android.widget.TextView) CompoundButton(android.widget.CompoundButton)

Example 18 with SessionManager

use of ingage.ingage.managers.SessionManager in project iNGAGE by davis123123.

the class PostCommentActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_post_comment);
    session = new SessionManager(getApplicationContext());
    sidesSpinner = (Spinner) findViewById(R.id.spinner);
    mInsertComment = (EditText) findViewById(R.id.comment_edit_text);
    addListenerOnSpinnerItemSelection();
}
Also used : SessionManager(ingage.ingage.managers.SessionManager)

Example 19 with SessionManager

use of ingage.ingage.managers.SessionManager in project iNGAGE by davis123123.

the class ChatFragment method onCreateView.

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
    View v = create(inflater, container, savedInstanceState);
    // thread id for root of comments tree
    // getuser details
    chatRoomManager = new ChatRoomManager(getContext());
    HashMap<String, String> chat = chatRoomManager.getUserDetails();
    thread_id = chat.get(ChatRoomManager.THREAD_ID);
    user_side = chat.get(ChatRoomManager.SIDE);
    root = FirebaseDatabase.getInstance().getReference().child(thread_id);
    session = new SessionManager(getContext());
    HashMap<String, String> user = session.getUserDetails();
    username = user.get(SessionManager.KEY_NAME);
    username = user.get(SessionManager.KEY_NAME);
    return v;
}
Also used : SessionManager(ingage.ingage.managers.SessionManager) ChatRoomManager(ingage.ingage.managers.ChatRoomManager) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView)

Example 20 with SessionManager

use of ingage.ingage.managers.SessionManager in project iNGAGE by davis123123.

the class PostThreadActivity method onCreate.

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    session = new SessionManager(getApplicationContext());
    setContentView(R.layout.activity_post_thread);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
    thread = new ThreadsHelper();
    rlPage1 = (RelativeLayout) findViewById(R.id.rlPage1);
    rlPage2 = (RelativeLayout) findViewById(R.id.rlPage2);
    mInsertThreadContent = (EditText) findViewById(R.id.insert_thread_content_text_view);
    mInsertThreadTitle = (EditText) findViewById(R.id.insert_thread_title_text_view);
    imageToUpload = (ImageView) findViewById(R.id.uploadImageView);
    llUploadImage = (LinearLayout) findViewById(R.id.llUploadImage);
    btnCategorySpinner = (Button) findViewById(R.id.btnCategorySpinner);
    btnNext = (Button) findViewById(R.id.btnNext);
    btnSubmit = (Button) findViewById(R.id.btnSubmit);
    ivIcon1 = (ImageView) findViewById(R.id.ivIcon1);
    ivIcon2 = (ImageView) findViewById(R.id.ivIcon2);
    Resources res = getResources();
    activeColor = res.getColor(R.color.colorPrimary);
    inactiveColor = res.getColor(R.color.gray);
    ivIcon1.setColorFilter(activeColor, PorterDuff.Mode.SRC_ATOP);
    ivIcon2.setColorFilter(inactiveColor, PorterDuff.Mode.SRC_ATOP);
    btnCategorySpinner.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            FragmentManager fm = getFragmentManager();
            f = ListDialogFragment.newInstance();
            f.show(fm, "");
        }
    });
    btnNext.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String threadContent = mInsertThreadContent.getText().toString();
            String threadTitle = mInsertThreadTitle.getText().toString();
            String cSpinner = (String) btnCategorySpinner.getText();
            // USER INSERT
            HashMap<String, String> user = session.getUserDetails();
            String threadBy = user.get(SessionManager.KEY_NAME);
            thread.setThread_title(threadTitle);
            thread.setThread_content(threadContent);
            thread.setThread_category(cSpinner);
            thread.setThread_by(threadBy);
            if (threadTitle.length() == 0) {
                Toast.makeText(PostThreadActivity.this, "Please provide a title.", Toast.LENGTH_SHORT).show();
                return;
            }
            if (threadContent.length() == 0) {
                Toast.makeText(PostThreadActivity.this, "Please provide a description", Toast.LENGTH_SHORT).show();
                return;
            }
            if (btnCategorySpinner.getText().equals(getResources().getString(R.string.category_default)) || btnCategorySpinner.getText() == null) {
                Toast.makeText(PostThreadActivity.this, "Please select a category", Toast.LENGTH_SHORT).show();
                return;
            }
            ivIcon2.setColorFilter(activeColor, PorterDuff.Mode.SRC_ATOP);
            rlPage1.setVisibility(View.GONE);
            rlPage2.setVisibility(View.VISIBLE);
        }
    });
    btnSubmit.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String imageTitle = thread.getThread_title().replaceAll("\\s+", "");
            // submit image
            if (usedImage) {
                image = ((BitmapDrawable) imageToUpload.getDrawable()).getBitmap();
                image_link = "http://107.170.232.60/images/" + imageTitle + ".JPG";
            }
            showConfirmationDialog();
        }
    });
    imageToUpload.setVisibility(View.INVISIBLE);
    setUploadImageLayout();
    llUploadImage.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            goUploadImage();
        }
    });
    imageToUpload.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            goUploadImage();
        }
    });
}
Also used : FragmentManager(android.app.FragmentManager) HashMap(java.util.HashMap) SessionManager(ingage.ingage.managers.SessionManager) Resources(android.content.res.Resources) BitmapDrawable(android.graphics.drawable.BitmapDrawable) ImageView(android.widget.ImageView) CropImageView(com.theartofdev.edmodo.cropper.CropImageView) View(android.view.View) ThreadsHelper(ingage.ingage.helpers.ThreadsHelper)

Aggregations

SessionManager (ingage.ingage.managers.SessionManager)24 View (android.view.View)7 ExecutionException (java.util.concurrent.ExecutionException)6 TextView (android.widget.TextView)5 ImageView (android.widget.ImageView)4 ChatRoomManager (ingage.ingage.managers.ChatRoomManager)4 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3 RecyclerView (android.support.v7.widget.RecyclerView)3 Bundle (android.os.Bundle)2 ActionBar (android.support.v7.app.ActionBar)2 ThreadListAdapter (ingage.ingage.adapters.ThreadListAdapter)2 ChatRoomHandler (ingage.ingage.handlers.ChatRoomHandler)2 QueryThreadsHandler (ingage.ingage.handlers.QueryThreadsHandler)2 SpectateRoomHandler (ingage.ingage.handlers.SpectateRoomHandler)2 HashMap (java.util.HashMap)2 FragmentManager (android.app.FragmentManager)1 Context (android.content.Context)1 Intent (android.content.Intent)1 Resources (android.content.res.Resources)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1