Example #1
0
 private void getUserDetailsFromParse() {
   parseUser = ParseUser.getCurrentUser();
   Log.e(
       LOG_TAG,
       "email is "
           + parseUser.getEmail()
           + ", username is "
           + parseUser.getUsername()
           + ", DOB is "
           + parseUser.getString("dob"));
   Toast.makeText(
           LoginActivity.this, "Welcome back " + parseUser.getUsername(), Toast.LENGTH_SHORT)
       .show();
   startMainActivity();
 }
Example #2
0
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem item = menu.findItem(R.id.action_sending);
    ParseUser currentUser = ParseUser.getCurrentUser();
    String[] list = getResources().getStringArray(R.array.admin_mail_address);
    item.setVisible(false);
    if (currentUser != null) {
      Log.e("Name", currentUser.getUsername());
      Log.e("Name", currentUser.getEmail());

    } else {
      Log.e("NULL USER", "NOT LOGGED IN");
    }
    if (currentUser != null) {
      for (String s : list) {
        if (currentUser.getEmail().equals(s)) {
          item.setVisible(true);
          Log.e("Vis", "TRUE");
          break;
        }
      }
    }
    super.onPrepareOptionsMenu(menu);
    return true;
  }
Example #3
0
  private void saveNewUser() {
    parseUser = ParseUser.getCurrentUser();
    parseUser.setUsername(name);
    parseUser.setEmail(email);

    //        Saving profile photo as a ParseFile
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    Bitmap bitmap = ((BitmapDrawable) mProfileImage.getDrawable()).getBitmap();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 70, stream);
    byte[] data = stream.toByteArray();
    String thumbName = parseUser.getUsername().replaceAll("\\s+", "");
    final ParseFile parseFile = new ParseFile(thumbName + "_thumb.jpg", data);

    parseFile.saveInBackground(
        new SaveCallback() {
          @Override
          public void done(ParseException e) {
            parseUser.put("profileThumb", parseFile);

            // Finally save all the user details
            parseUser.saveInBackground(
                new SaveCallback() {
                  @Override
                  public void done(ParseException e) {
                    Toast.makeText(
                            MainActivity.this,
                            "New user:"******" Signed up",
                            Toast.LENGTH_SHORT)
                        .show();
                  }
                });
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_user_list);

    currentUser = ParseUser.getCurrentUser();

    // ----------------------------------------------------------------------
    // Check if service is running.

    if (!MessageService.isMessageServiceRunning()) {

      // Start the service
      // registerReceiver(messageReceiver, messageFilter);

      Log.d("UserListActivity", "Starting message service");

      Intent messageservice = new Intent(this, MessageService.class);
      messageservice.putExtra("channel", currentUser.getUsername());
      startService(messageservice);
    }

    // ----------------------------------------------------------------------

    new RemoteDataTask().execute();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Don't show the Action Bar on the start screen
    getActionBar().hide();

    setFonts();

    buttonStart = (Button) findViewById(R.id.button_play);
    buttonStart.setVisibility(View.INVISIBLE);

    buttonFbLogin = (Button) findViewById(R.id.facebook);
    buttonFbLogin.setVisibility(View.INVISIBLE);

    ParseUser currentUser = ParseUser.getCurrentUser();

    if (currentUser != null) {
      System.out.println("doctor please");
      System.out.println(currentUser.getEmail());
      System.out.println(currentUser.getUsername());
    }

    progressBar = (ProgressBar) findViewById(R.id.progress_bar);
    progressBar.setVisibility(View.VISIBLE);

    new GetIdsAsync().execute("");
  }
Example #6
0
 private void saveNewUser(Bitmap profileImageBitmap) {
   parseUser = ParseUser.getCurrentUser();
   parseUser.setUsername(name);
   parseUser.setEmail(email);
   parseUser.put("dob", birthday);
   //        Saving profile photo as a ParseFile
   ByteArrayOutputStream stream = new ByteArrayOutputStream();
   profileImageBitmap.compress(Bitmap.CompressFormat.JPEG, 70, stream);
   byte[] data = stream.toByteArray();
   String thumbName = parseUser.getUsername().replaceAll("\\s+", "");
   final ParseFile parseFile = new ParseFile(thumbName + "_thumb.jpg", data);
   // we can use saveInBackground() in this method because this data is from Fb
   // so the user must have an internet connection
   parseFile.saveInBackground(
       new SaveCallback() {
         @Override
         public void done(ParseException e) {
           parseUser.put("profileThumb", parseFile);
           // Finally save all the user details
           parseUser.saveInBackground(
               new SaveCallback() {
                 @Override
                 public void done(ParseException e) {
                   Toast.makeText(
                           LoginActivity.this,
                           "New user: "******" Signed up",
                           Toast.LENGTH_SHORT)
                       .show();
                   // Only start the next activity after this one is done
                   startMainActivity();
                 }
               });
         }
       });
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mUserName = (TextView) findViewById(R.id.user_name);
    navImg = (ImageView) findViewById(R.id.nav_profile_img);

    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayShowHomeEnabled(true);

    ParseUser currentUser = ParseUser.getCurrentUser();

    /*String hash = ChatListAdapter.MD5Util.md5Hex(currentUser.getUsername());
    Log.w("Hash ", " - " + hash);
    Picasso.with(this).load("http://www.gravatar.com/avatar" + hash).into(navImg);*/

    Picasso.with(MainActivity.this)
        .load(ChatListAdapter.getProfileUrl(currentUser.getUsername()))
        .into(navImg);

    drawerFragment =
        (FragmentDrawer)
            getSupportFragmentManager().findFragmentById(R.id.fragment_navigation_drawer);
    drawerFragment.setUp(
        R.id.fragment_navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout), mToolbar);
    drawerFragment.setDrawerListener(this);

    // display the first navigation drawer view on app launch
    displayView(0);
  }
Example #8
0
  @Override
  public void onBindViewHolder(final MessageViewHolder contactViewHolder, int i) {
    Message m = messageList.get(i);
    ParseUser u = m.user;

    contactViewHolder.messageTV.setText(Decoder.decodeMessage(m.text));
    if (!m.saved) {
      // enable text view that message is not sent
      contactViewHolder.notSentMessageTV.setVisibility(View.VISIBLE);
    }

    if (null != u) {
      // incomming message
      UserImage.showImage(u, contactViewHolder.userIV);
      contactViewHolder.userNameTV.setText(u.getUsername());

      long timeMil = m.date.getTime();
      // timeMil = (timeMil + mGMTOffset);
      contactViewHolder.dateTV.setText(DateFormat.getDateTimeInstance().format(timeMil));
    } else {
      // my message
      UserImage.showImage(m.userId, contactViewHolder.userIV);
      contactViewHolder.userNameTV.setText(m.userName);

      // get curr time
      long timeMil = new Date().getTime();
      // timeMil = (timeMil + mGMTOffset);
      contactViewHolder.dateTV.setText(DateFormat.getDateTimeInstance().format(timeMil));
    }

    if (animate && i == messageList.size() - 1) {
      contactViewHolder.itemView.startAnimation(animToMiddle);
      animate = false;
    }
  }
Example #9
0
  public static User getLoggedUser(Class<? extends SunshineUser> c) {
    ParseUser currentUser = ParseUser.getCurrentUser();
    if (currentUser != null) {

      if (user == null) user = new User();

      if (currentUser.get("facebookData") == null) {
        user.setImg(currentUser.getParseFile("img").getUrl());
      } else {

        try {
          JSONObject fb = new JSONObject(currentUser.getString("facebookData"));
          String id = fb.getString("id");
          user.setImg("https://graph.facebook.com/" + id + "/picture?type=large");
        } catch (JSONException e) {
          e.printStackTrace();
        }
      }
      user.setEmail(currentUser.getEmail());
      user.setName(currentUser.getString("name"));
      user.setUserName(currentUser.getUsername());
      user.setObjectId(currentUser.getObjectId());
      user.setCreatedAt(currentUser.getCreatedAt());
      user.setUpdateAt(currentUser.getUpdatedAt());
      return user;
    } else {
      return null;
    }
  }
Example #10
0
  @Override
  public void onResume() {
    super.onResume();

    //        SharedPreferences prefs = getActivity().getPreferences(Context.MODE_PRIVATE);
    //        String restoredText = prefs.getString("text", null);
    //        if (restoredText != null) {
    //            int selectionStart = prefs.getInt("selection-start", -1);
    //            int selectionEnd = prefs.getInt("selection-end", -1);
    //        }
    // this.getActivity().getSharedPreferences("com.ruu.blemco", Context.MODE_PRIVATE);

    mCurrentUser = ParseUser.getCurrentUser();
    mUsername = (TextView) getActivity().findViewById(R.id.username_in_profile_textview);
    strUser = mCurrentUser.getUsername().toString();
    mUsername.setText(strUser);

    mScore = (TextView) getActivity().findViewById(R.id.score_in_profile_textview);
    strScore = "80000";
    mScore.setText(strScore);

    mRealName = (TextView) getActivity().findViewById(R.id.real_name_in_profile_textview);
    mBio = (TextView) getActivity().findViewById(R.id.bio_in_profile_textview);

    // username/score/bio adapter
    if (mContainer == null) {
      mContainer = (PagerContainer) getView().findViewById(R.id.pager_container);
      ViewPager pager = mContainer.getViewPager();
      PagerAdapter adapter = new MyPagerAdapter();
      pager.setAdapter(adapter);

      // If hardware acceleration is enabled, you should also remove
      // clipping on the pager for its children.
      pager.setClipChildren(false);
    }

    ListView listView = (ListView) getView().findViewById(android.R.id.list);
    mProfileAdapter =
        new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, dummyValues);
    listView.setAdapter(mProfileAdapter);
    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            // int activePosts = 1;
            if (position == 0) {
              Intent intent = new Intent(getActivity(), ActivePostActivity.class);
              startActivity(intent);
            } else if (position == 1) {
              Intent intent = new Intent(getActivity(), ActivePostActivity.class);
              startActivity(intent);
            } else if (position == 2) {
              Intent intent = new Intent(getActivity(), SettingsActivity.class);
              startActivity(intent);
            }
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.create_job);

    ParseUser user = ParseUser.getCurrentUser();
    final String username = user.getUsername();

    Button btnChooseSkills = (Button) findViewById(R.id.btnChooseSkills);
    btnChooseSkills.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            startActivity(new Intent(CreateJob.this, Skills.class));
          }
        });

    Button btn = (Button) findViewById(R.id.btnPostAJob);
    btn.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            TextView title = (TextView) findViewById(R.id.txtJobTitle);
            TextView description = (TextView) findViewById(R.id.txtJobDescription);
            TextView city = (TextView) findViewById(R.id.txtJobCity);

            /* custom Dialog */

            skills.add("Fontaneria");
            skills.add("Barberia");

            ParseObject job = new ParseObject("Jobs");
            job.put("title", title.getText().toString());
            job.put("description", description.getText().toString());
            job.put("city", city.getText().toString());
            job.put("createdBy", username);
            job.put("closed", false);
            job.put("skills", skills);

            job.saveInBackground(
                new SaveCallback() {

                  @Override
                  public void done(ParseException arg0) {
                    if (arg0 == null) {
                      Toast.makeText(CreateJob.this, "Exito de Save", Toast.LENGTH_LONG).show();
                    } else {
                      Toast.makeText(CreateJob.this, arg0.getMessage(), Toast.LENGTH_LONG).show();
                    }
                  }
                });
          }
        });
  }
  private void populateFromUser(ParseUser user) {
    if (user == null) {
      user = ParseUser.getCurrentUser();
    }

    this.username.setText(user.getUsername());
    this.email.setText(user.getEmail());
    this.first.setText(user.getString(Constants.kFirstNameKey));
    this.last.setText(user.getString(Constants.kLastNameKey));
  }
Example #13
0
  public void autoSignIn() {
    ParseUser currentUser = ParseUser.getCurrentUser();

    if (currentUser.getUsername() != null) {
      Log.d("isCurrentUser", "There is a user and we start the MainActivity");
      // do stuff with the user

      Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
      intent.putExtra("userName", currentUser.getUsername().toString().trim());
      startActivity(intent);
      finish();
    } else {
      Log.d("noCurrentUser", "There is no current user and we start welcomeActivity");
      // show the signup or login screen
      // Intent intent2 = new Intent(WelcomeActivity.this, MainActivity.class);
      // startActivity(intent2);

    }
  }
Example #14
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    user = ParseUser.getCurrentUser();
    status = (String) user.get(getString(R.string.status));

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("");
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);

    viewPager = (ViewPager) findViewById(R.id.viewpager);
    setupViewPager(viewPager);

    tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);

    mDrawerList = (ListView) findViewById(R.id.navList);
    mCardview = (CardView) findViewById(R.id.nav_card_view);
    addDrawerItems();
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mActivityTitle = getTitle().toString();
    mDrawerList.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position == 0 || position == 1) displyDialog(position);
          }
        });
    setupDrawer();
    mTextview = (TextView) findViewById(R.id.nav_text_view);
    mTextview.setText(user.get("fullName").toString() + "\n" + user.getUsername());

    mImageView = (ImageView) findViewById(R.id.nav_pic);
    mImageView.setImageResource(R.drawable.person_default_image);

    mImageView.setOnLongClickListener(
        new View.OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {

            Intent i =
                new Intent(
                    Intent.ACTION_PICK,
                    android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

            startActivityForResult(i, RESULT_LOAD_IMAGE);
            return false;
          }
        });
  }
Example #15
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ParseAnalytics.trackAppOpenedInBackground(getIntent());

    ParseUser currentUser = ParseUser.getCurrentUser();
    if (currentUser == null) {
      navigateToLogin();
    } else {
      Log.i(TAG, currentUser.getUsername());
    }

    // Set up the action bar.
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    Log.d(TAG, "Before new SectionPageAdapter");
    mSectionsPagerAdapter = new SectionsPagerAdapter(this, getSupportFragmentManager());
    Log.d(TAG, "After new SectionPageAdapter");

    // Set up the ViewPager with the sections adapter.
    Log.d(TAG, "Before findViewById(R.id.pager)");
    mViewPager = (ViewPager) findViewById(R.id.pager);
    Log.d(TAG, "After findViewById(R.id.pager)");
    Log.d(TAG, "Before setAdapter");
    mViewPager.setAdapter(mSectionsPagerAdapter);
    Log.d(TAG, "After setAdapter");

    // When swiping between different sections, select the corresponding
    // tab. We can also use ActionBar.Tab#select() to do this if we have
    // a reference to the Tab.
    mViewPager.setOnPageChangeListener(
        new ViewPager.SimpleOnPageChangeListener() {
          @Override
          public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
          }
        });
    Log.d(TAG, "Before loop");
    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
      // Create a tab with text corresponding to the page title defined by
      // the adapter. Also specify this Activity object, which implements
      // the TabListener interface, as the callback (listener) for when
      // this tab is selected.
      actionBar.addTab(
          actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
    Log.d(TAG, "After loop");
  }
    @Override
    public View getView(int pos, View v, ViewGroup arg2) {
      if (v == null) v = getLayoutInflater().inflate(R.layout.chat_item, null);

      ParseUser c = getItem(pos);
      TextView lbl = (TextView) v;
      lbl.setText(c.getUsername());
      lbl.setCompoundDrawablesWithIntrinsicBounds(
          c.getBoolean("online") ? R.drawable.online : R.drawable.offline, 0, R.drawable.spin, 0);

      return v;
    }
Example #17
0
 private SphereUser(ParseUser sphereUser) {
   try {
     mSphereUser = sphereUser.fetch();
     mUsername = mSphereUser.getUsername();
     mEmail = mSphereUser.getEmail();
     mUserId = mSphereUser.getObjectId();
     mFullName = mSphereUser.getString(FULL_NAME);
     mTagLine = mSphereUser.getString(TAG_LINE);
     mUserPhotoFile = mSphereUser.getParseFile(USER_PHOTO);
   } catch (ParseException e) {
     Log.e(TAG, "error creating sphere user");
   }
 }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.login_activity);
   Log.d("User", "start login activity");
   // comment this if u want to see login and registration pages!
   ParseUser currentUser = ParseUser.getCurrentUser();
   if (currentUser != null) {
     Log.d("User", "user = " + currentUser.getUsername());
     loginOk();
   }
   entLogin = (TextView) findViewById(R.id.textLogin);
   entPassword = (TextView) findViewById(R.id.textPassword);
 }
Example #19
0
  public void testRun() {
    /** Given: I am logged into a valid user profile starting from the main restaurant list */
    // Wait for activity: 'com.woww.woww.BaseDrawer'
    solo.waitForActivity(com.woww.woww.BaseDrawer.class, 2000);
    // Set default small timeout to 23836 milliseconds
    Timeout.setSmallTimeout(23836);
    // Click on ImageView
    solo.clickOnView(solo.getView(android.widget.ImageButton.class, 0));
    // Click on Log In
    solo.clickOnText(java.util.regex.Pattern.quote("Log In"));
    // Wait for activity: 'com.woww.woww.LoginActivity'
    assertTrue(
        "com.woww.woww.LoginActivity is not found!",
        solo.waitForActivity(com.woww.woww.LoginActivity.class));
    // Enter the text: 'changed'
    solo.clearEditText((android.widget.EditText) solo.getView(com.woww.woww.R.id.userName));
    solo.enterText((android.widget.EditText) solo.getView(com.woww.woww.R.id.userName), "changed");
    // Enter the text: 'c'
    solo.clearEditText((android.widget.EditText) solo.getView(com.woww.woww.R.id.password));
    solo.enterText((android.widget.EditText) solo.getView(com.woww.woww.R.id.password), "c");
    // Click on Login
    solo.clickOnView(solo.getView(com.woww.woww.R.id.loginButton));
    // Click on ImageView
    solo.clickOnView(solo.getView(android.widget.ImageButton.class, 0));

    /** When: I go to the profile page */
    // Click on Profile
    solo.clickOnText(java.util.regex.Pattern.quote("Profile"));
    ParseUser user = ParseUser.getCurrentUser();
    TextView profile = (TextView) solo.getView(R.id.profileName);

    /** Then: It is my profile page */
    assertEquals(
        "check that on same user profile as login name", user.getUsername(), profile.getText());

    /** When: When I go to my reviews from the profile page */
    // Long click Restaurant:   Rubio's Rating:   Review:   itwas
    solo.clickLongInList(1, 1);
    // Wait for activity: 'com.woww.woww.ViewUserReviewsActivity'

    /** Then: I am brought to my reviews */
    assertTrue(
        "com.woww.woww.ViewUserReviewsActivity is not found!",
        solo.waitForActivity(com.woww.woww.ViewUserReviewsActivity.class));
    // Press menu back key
    solo.goBack();
    // Press menu back key
    solo.goBack();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    // setContentView(R.layout.rumour_new);
    setContentView(R.layout.new_rumour);

    post = (Button) findViewById(R.id.button1);
    ref = (Button) findViewById(R.id.button2);
    group = (TextView) findViewById(R.id.group_name);

    /*try
    {
    	ActionBar bar = getActionBar();
    	bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#009dde")));
    }
    catch (Exception e)
    {
    	Log.e("splash", e.getMessage());
    }*/

    if (isNetworkAvailable() == false) noInternetAccess();

    lv = getListView();
    refresh = false;

    ParseUser currentUser = ParseUser.getCurrentUser();
    if (currentUser == null) navigateToLogin();
    else Toast.makeText(this, currentUser.getUsername(), Toast.LENGTH_LONG).show();

    post.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            PostMessage();
          }
        });

    ref.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            RefreshRumours();
          }
        });
  }
Example #21
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.inject(this);

    // Creating The Toolbar and setting it as the Toolbar for the activity
    toolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    toolbar.setTitleTextColor(getResources().getColor(R.color.text_color));

    ParseAnalytics.trackAppOpenedInBackground(getIntent());
    ParseUser currentUser = ParseUser.getCurrentUser();

    if (currentUser == null) {
      navigateToLogin();
    } else {
      Log.i(TAG, currentUser.getUsername());
    }

    // Creating The ViewPagerAdapter and Passing Fragment Manager, Titles fot the Tabs and Number Of
    // Tabs.
    adapter = new ViewPagerAdapter(getSupportFragmentManager(), Titles, Numboftabs);

    // Assigning ViewPager View and setting the adapter
    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(adapter);

    // Assiging the Sliding Tab Layout View
    tabs = (SlidingTabLayout) findViewById(R.id.tabs);

    tabs.setDistributeEvenly(
        true); // To make the Tabs Fixed set this true, This makes the tabs Space Evenly in
               // Available width

    // Setting Custom Color for the Scroll bar indicator of the Tab View
    tabs.setCustomTabColorizer(
        new SlidingTabLayout.TabColorizer() {

          @Override
          public int getIndicatorColor(int position) {
            return getResources().getColor(R.color.tabsScrollColor);
          }
        });

    // Setting the ViewPager For the SlidingTabsLayout
    tabs.setViewPager(pager);
  }
  protected void onCreate(Bundle savedInstanceState, View view) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_menu_layout);

    init();

    // Get current user
    ParseUser currentUser = ParseUser.getCurrentUser();
    if (currentUser == null) {
      // It's an anonymous user - show login screen
      getInstance().moveToHome(view);
    } else {
      // User is logged in
      Log.i(TAG, currentUser.getUsername());
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "oncreate");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_monitoring);

    // Retrieve current user from Parse.com
    ParseUser currentUser = ParseUser.getCurrentUser();

    // Convert currentUser into String
    String struser = currentUser.getUsername().toString();

    // Locate TextView in welcome.xml
    TextView txtuser = (TextView) findViewById(R.id.txtuser);

    // Set the currentUser String into TextView
    txtuser.setText("You are logged in as " + struser);

    // Locate Button in welcome.xml
    logout = (Button) findViewById(R.id.logout);

    // Logout Button Click Listener
    logout.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View arg0) {
            // Logout current user
            ParseUser.logOut();
            finish();
          }
        });

    verifyBluetooth();
    iBeaconManager.bind(this);

    new Handler()
        .postDelayed(
            new Runnable() {
              @Override
              public void run() {
                Intent myIntent = new Intent(MonitoringActivity.this, RangingActivity.class);
                startActivity(myIntent);
                finish();
              }
            },
            TIME_OUT);
  }
Example #24
0
 public void createRelation(final ParseUser user) {
   ParseObject relation = new ParseObject("Friends");
   relation.put("fromUser", currentUser.getObjectId() + "");
   relation.put("toUser", user.getObjectId() + "");
   relation.put("areFriends", false);
   relation.saveInBackground();
   new AlertDialog.Builder(Friends.this)
       .setTitle("Request Sent to " + user.getUsername() + "!")
       .setPositiveButton(
           "OK",
           new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int which) {
               add.setEnabled(true);
             }
           })
       .show();
 }
Example #25
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_profile);

    // implementation !! Check how current user is being shown for visibility of edit button !!
    ParseUser currentUser = ParseUser.getCurrentUser();
    Log.d("demo", "Current user is: " + currentUser);

    // receive list
    if (getIntent().getExtras() != null) {
      profile = (Profile) getIntent().getExtras().getSerializable("PROFILE");
      profiles = (ArrayList<Profile>) getIntent().getExtras().getSerializable("PROFILES");
    }

    TextView tvName = (TextView) findViewById(R.id.textViewProfileName);
    tvName.setText(profile.getName());

    TextView tvGender = (TextView) findViewById(R.id.textViewProfileGender);
    tvGender.setText(profile.getGender());

    ImageView iv = (ImageView) findViewById(R.id.imageViewProfilePic);
    Picasso.with(ProfileDetail.this).load(profile.getImageUrl()).into(iv);

    Button butEdit = (Button) findViewById(R.id.buttonEdit);
    if (currentUser.getUsername().equals(profile.getUserName())) {
      butEdit.setEnabled(true);
      butEdit.setVisibility(View.INVISIBLE);

    } else {
      butEdit.setText("Send Message");
      butEdit.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Intent i = new Intent(getBaseContext(), ComposeMessage.class);
              i.putExtra("PROFILE", profile);
              i.putExtra("PROFILES", profiles);
              i.putExtra(
                  "TOUSER",
                  profile.getUserName()); // !! Needs to be changed to userId in implementation !!
              startActivity(i);
            }
          });
    }
  }
Example #26
0
  public static void updateUserProfile(final String nickName, Bitmap profilePic) {
    final ParseUser user = ParseUser.getCurrentUser();

    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    profilePic.compress(Bitmap.CompressFormat.JPEG, 100, stream);
    byte[] bytearray = stream.toByteArray();
    final ParseFile imgFile = new ParseFile(user.getUsername() + "_profile.jpg", bytearray);
    imgFile.saveInBackground(
        new SaveCallback() {
          @Override
          public void done(ParseException e) {
            user.put(Common.OBJECT_USER_NICK, nickName);
            user.put(Common.OBJECT_USER_PROFILE_PIC, imgFile);
            user.saveInBackground();
          }
        });
  }
  private ArrayList<StudentCourse> GetSearchResults() {
    ArrayList<StudentCourse> results = new ArrayList<StudentCourse>();
    ArrayList<StudentCourse> new_results = new ArrayList<StudentCourse>();
    ArrayList<StudentCourse> final_results = new ArrayList<StudentCourse>();
    ArrayList<StudentCourse> schedule = new ArrayList<StudentCourse>();
    ArrayList<StudentCourse> new_schedule = new ArrayList<StudentCourse>();

    ParseUser currentUser = ParseUser.getCurrentUser();
    user_id = currentUser.getUsername().toString();

    Calendar c = Calendar.getInstance();
    int month = c.get(Calendar.MONTH);

    if (month < 6) {
      // spring semester - > generate schedule for fall semester
      results =
          (ArrayList<StudentCourse>)
              dbHelper.getAllFallCoursesNotTakenByStudent(user_id, "false", "Fall");
      new_results =
          (ArrayList<StudentCourse>)
              dbHelper.getAllBothSemesterCoursesNotTakenByStudent(user_id, "false", "Both");
    }

    if (month > 7) {
      // fall semester - > generate schedule for spring semester
      results =
          (ArrayList<StudentCourse>)
              dbHelper.getAllFallCoursesNotTakenByStudent(user_id, "false", "Spring");
      new_results =
          (ArrayList<StudentCourse>)
              dbHelper.getAllBothSemesterCoursesNotTakenByStudent(user_id, "false", "Both");
    }

    final_results.addAll(new_results);
    final_results.addAll(results);

    Collections.sort(final_results);

    schedule.addAll(final_results);
    new_schedule = checkRequirements(schedule);

    return new_schedule;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);

    // Show the Up button in the action bar.
    setupActionBar();
    actionBar = getActionBar();
    actionBar.setIcon(getResources().getDrawable(R.drawable.logo));

    sharedpreferences = getSharedPreferences(SignUpActivity.MyPREFERENCES, Context.MODE_PRIVATE);

    mListviewSettings = (ListView) findViewById(R.id.settingsListView);

    if (ParseUser.getCurrentUser() != null) currentUser = ParseUser.getCurrentUser();

    MyCustomAdapter mAdapter;

    mAdapter = new MyCustomAdapter();

    mAdapter.addSeparatorItem("CURRENT ACCOUNT:");
    mAdapter.addItem("Username: "******"Email: " + "Change Email Id via FB.");
    } else mAdapter.addItem("Email: " + currentUser.getEmail());
    mAdapter.addItem("Change Profile Picture ");

    mAdapter.addSeparatorItem("SPREAD THE WORD:");
    mAdapter.addItem("Invite Your Friends");

    mAdapter.addSeparatorItem("MORE INFO:");
    mAdapter.addItem("Terms of Use");
    mAdapter.addItem("Privacy Policy");
    mAdapter.addItem("Getting Started");

    mListviewSettings.setAdapter(mAdapter);
    // setListAdapter(mAdapter);

    mListviewSettings.setOnItemClickListener(this);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_meetings);

    ParseUser user = ParseUser.getCurrentUser();
    ArrayList<String> groups = sb.getGroupsByUser(user.getUsername());
    ArrayList<String> meetingDetails = new ArrayList();

    for (int i = 0; i < groups.size(); i++) {
      meetingDetails.addAll(sb.getMeetingDetails(groups.get(i)));
    }

    ListView meetingList = (ListView) findViewById(R.id.meetingList);

    meetingList.setAdapter(null);
    final ArrayAdapter listAdapter =
        new ArrayAdapter(Meetings.this, R.layout.row, R.id.group_name_row, meetingDetails);
    meetingList.setAdapter(listAdapter);
  }
Example #30
0
  private void checkUser() {
    if (ParseAnonymousUtils.isLinked(ParseUser.getCurrentUser())) {
      Intent intent = new Intent(SplashActivity.this, LoginActivity.class);
      startActivity(intent);
      finish();

    } else {
      ParseUser currentUser = ParseUser.getCurrentUser();
      if (currentUser != null) {
        Intent intent = new Intent(SplashActivity.this, TabActivity.class);
        intent.putExtra("user", currentUser.getUsername());
        startActivity(intent);
        finish();
      } else {
        Intent intent = new Intent(SplashActivity.this, LoginActivity.class);
        startActivity(intent);
        finish();
      }
    }
  }