mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-27 07:49:28 +00:00
Created constants class
This commit is contained in:
parent
a2f510c468
commit
7a8737fef2
@ -0,0 +1,36 @@
|
||||
package org.communiquons.android.comunic.client.ui;
|
||||
|
||||
/**
|
||||
* UI constants
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
public final class Constants {
|
||||
|
||||
/**
|
||||
* Intents request codes
|
||||
*/
|
||||
public final class IntentRequestCode {
|
||||
|
||||
/**
|
||||
* Find user ID intent for conversation update
|
||||
*/
|
||||
public static final int CONVERSATION_UPDATE_FIND_USER_ID_INTENT = 0;
|
||||
|
||||
/**
|
||||
* Pick image for conversation message
|
||||
*/
|
||||
public static final int CONVERSATION_MESSAGE_PICK_PHOTO = 1;
|
||||
|
||||
/**
|
||||
* Pick image for post creation form
|
||||
*/
|
||||
public static final int POST_CREATE_FORM_PICK_PHOTO = 2;
|
||||
|
||||
/**
|
||||
* Intent code : search a user
|
||||
*/
|
||||
public static final int MAIN_ACTIVITY_SEARCH_USER_INTENT = 3;
|
||||
}
|
||||
|
||||
}
|
@ -49,6 +49,8 @@ import org.communiquons.android.comunic.client.ui.listeners.updateConversationLi
|
||||
import org.communiquons.android.comunic.client.ui.utils.UiUtils;
|
||||
import org.communiquons.android.comunic.client.ui.views.NavigationBar;
|
||||
|
||||
import static org.communiquons.android.comunic.client.ui.Constants.IntentRequestCode.MAIN_ACTIVITY_SEARCH_USER_INTENT;
|
||||
|
||||
|
||||
/**
|
||||
* Main activity of the application
|
||||
@ -64,11 +66,6 @@ public class MainActivity extends AppCompatActivity implements
|
||||
*/
|
||||
private static final String TAG = "MainActivity";
|
||||
|
||||
/**
|
||||
* Intent code : search a user
|
||||
*/
|
||||
private static final int SEARCH_USER_INTENT = 3;
|
||||
|
||||
/**
|
||||
* Account object
|
||||
*/
|
||||
@ -364,7 +361,7 @@ public class MainActivity extends AppCompatActivity implements
|
||||
|
||||
switch (requestCode) {
|
||||
|
||||
case SEARCH_USER_INTENT:
|
||||
case MAIN_ACTIVITY_SEARCH_USER_INTENT:
|
||||
assert data.getData() != null;
|
||||
openUserPage(Integer.decode(data.getData().getQueryParameter("userID")));
|
||||
break;
|
||||
@ -650,7 +647,7 @@ public class MainActivity extends AppCompatActivity implements
|
||||
|
||||
//Make intent
|
||||
Intent intent = new Intent(this, SearchUserActivity.class);
|
||||
startActivityForResult(intent, SEARCH_USER_INTENT);
|
||||
startActivityForResult(intent, MAIN_ACTIVITY_SEARCH_USER_INTENT);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -26,20 +26,20 @@ import android.widget.Toast;
|
||||
|
||||
import org.communiquons.android.comunic.client.R;
|
||||
import org.communiquons.android.comunic.client.data.arrays.ConversationMessagesList;
|
||||
import org.communiquons.android.comunic.client.data.models.NewConversationMessage;
|
||||
import org.communiquons.android.comunic.client.ui.asynctasks.SafeAsyncTask;
|
||||
import org.communiquons.android.comunic.client.data.helpers.ConversationMessagesHelper;
|
||||
import org.communiquons.android.comunic.client.data.helpers.ConversationsListHelper;
|
||||
import org.communiquons.android.comunic.client.data.helpers.DatabaseHelper;
|
||||
import org.communiquons.android.comunic.client.data.helpers.GetUsersHelper;
|
||||
import org.communiquons.android.comunic.client.data.models.ConversationMessage;
|
||||
import org.communiquons.android.comunic.client.data.models.ConversationsInfo;
|
||||
import org.communiquons.android.comunic.client.data.models.NewConversationMessage;
|
||||
import org.communiquons.android.comunic.client.data.models.UserInfo;
|
||||
import org.communiquons.android.comunic.client.data.runnables.ConversationRefreshRunnable;
|
||||
import org.communiquons.android.comunic.client.data.utils.AccountUtils;
|
||||
import org.communiquons.android.comunic.client.ui.activities.MainActivity;
|
||||
import org.communiquons.android.comunic.client.ui.adapters.ConversationMessageAdapter;
|
||||
import org.communiquons.android.comunic.client.ui.asynctasks.DeleteConversationMessageTask;
|
||||
import org.communiquons.android.comunic.client.ui.asynctasks.SafeAsyncTask;
|
||||
import org.communiquons.android.comunic.client.ui.asynctasks.SendConversationMessageTask;
|
||||
import org.communiquons.android.comunic.client.ui.asynctasks.UpdateConversationMessageContentTask;
|
||||
import org.communiquons.android.comunic.client.ui.listeners.OnConversationMessageActionsListener;
|
||||
@ -53,6 +53,7 @@ import java.io.FileNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
import static org.communiquons.android.comunic.client.ui.Constants.IntentRequestCode.CONVERSATION_MESSAGE_PICK_PHOTO;
|
||||
|
||||
/**
|
||||
* Conversation fragment
|
||||
@ -68,11 +69,6 @@ public class ConversationFragment extends Fragment
|
||||
OnScrollChangeDetectListener, OnConversationMessageActionsListener,
|
||||
PopupMenu.OnMenuItemClickListener {
|
||||
|
||||
/**
|
||||
* Pick image request number
|
||||
*/
|
||||
public static final int PICK_PHOTO = 1;
|
||||
|
||||
/**
|
||||
* Debug tag
|
||||
*/
|
||||
@ -233,7 +229,7 @@ public class ConversationFragment extends Fragment
|
||||
switch (requestCode) {
|
||||
|
||||
//If the response if for the photos
|
||||
case PICK_PHOTO :
|
||||
case CONVERSATION_MESSAGE_PICK_PHOTO:
|
||||
pick_image_callback(resultCode, data);
|
||||
break;
|
||||
}
|
||||
@ -528,7 +524,7 @@ public class ConversationFragment extends Fragment
|
||||
private void pick_image(){
|
||||
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
|
||||
photoPickerIntent.setType("image/*");
|
||||
startActivityForResult(photoPickerIntent, PICK_PHOTO);
|
||||
startActivityForResult(photoPickerIntent, CONVERSATION_MESSAGE_PICK_PHOTO);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,14 +1,14 @@
|
||||
package org.communiquons.android.comunic.client.ui.fragments;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -30,6 +30,7 @@ import org.communiquons.android.comunic.client.ui.utils.UiUtils;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
import static org.communiquons.android.comunic.client.ui.Constants.IntentRequestCode.POST_CREATE_FORM_PICK_PHOTO;
|
||||
|
||||
/**
|
||||
* Posts creation form
|
||||
@ -50,11 +51,6 @@ public class PostsCreateFormFragment extends Fragment {
|
||||
*/
|
||||
public static final String PAGE_TYPE_ARG = "PAGE_TYPE";
|
||||
|
||||
/**
|
||||
* Intent : request to pick a picture
|
||||
*/
|
||||
public static final int PICK_PHOTO = 2;
|
||||
|
||||
/**
|
||||
* Page type : user page
|
||||
*/
|
||||
@ -143,7 +139,7 @@ public class PostsCreateFormFragment extends Fragment {
|
||||
|
||||
switch (requestCode){
|
||||
|
||||
case PICK_PHOTO:
|
||||
case POST_CREATE_FORM_PICK_PHOTO:
|
||||
pick_picture_callback(resultCode, data);
|
||||
break;
|
||||
|
||||
@ -158,7 +154,7 @@ public class PostsCreateFormFragment extends Fragment {
|
||||
//Make an intent
|
||||
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
|
||||
photoPickerIntent.setType("image/*");
|
||||
startActivityForResult(photoPickerIntent, PICK_PHOTO);
|
||||
startActivityForResult(photoPickerIntent, POST_CREATE_FORM_PICK_PHOTO);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
package org.communiquons.android.comunic.client.ui.fragments;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.ArrayMap;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.LayoutInflater;
|
||||
@ -22,21 +22,23 @@ import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.communiquons.android.comunic.client.ui.activities.MainActivity;
|
||||
import org.communiquons.android.comunic.client.R;
|
||||
import org.communiquons.android.comunic.client.ui.activities.SearchUserActivity;
|
||||
import org.communiquons.android.comunic.client.data.utils.AccountUtils;
|
||||
import org.communiquons.android.comunic.client.data.helpers.ConversationsListHelper;
|
||||
import org.communiquons.android.comunic.client.data.helpers.DatabaseHelper;
|
||||
import org.communiquons.android.comunic.client.data.helpers.GetUsersHelper;
|
||||
import org.communiquons.android.comunic.client.data.models.UserInfo;
|
||||
import org.communiquons.android.comunic.client.ui.adapters.UsersAsysncInfoAdapter;
|
||||
import org.communiquons.android.comunic.client.data.models.ConversationsInfo;
|
||||
import org.communiquons.android.comunic.client.data.helpers.ConversationsListHelper;
|
||||
import org.communiquons.android.comunic.client.data.models.UserInfo;
|
||||
import org.communiquons.android.comunic.client.data.utils.AccountUtils;
|
||||
import org.communiquons.android.comunic.client.ui.activities.MainActivity;
|
||||
import org.communiquons.android.comunic.client.ui.activities.SearchUserActivity;
|
||||
import org.communiquons.android.comunic.client.ui.adapters.UsersAsysncInfoAdapter;
|
||||
import org.communiquons.android.comunic.client.ui.listeners.openConversationListener;
|
||||
import org.communiquons.android.comunic.client.ui.views.AppBarLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.communiquons.android.comunic.client.ui.Constants.IntentRequestCode.CONVERSATION_UPDATE_FIND_USER_ID_INTENT;
|
||||
|
||||
/**
|
||||
* Create and / or update a conversation fragment
|
||||
*
|
||||
@ -56,11 +58,6 @@ public class UpdateConversationFragment extends Fragment {
|
||||
*/
|
||||
public static final String ARG_CONVERSATION_ID = "conversation_id";
|
||||
|
||||
/**
|
||||
* Find user ID intent
|
||||
*/
|
||||
public static final int FIND_USER_ID_INTENT = 0;
|
||||
|
||||
/**
|
||||
* Action : create a conversation
|
||||
*/
|
||||
@ -258,7 +255,7 @@ public class UpdateConversationFragment extends Fragment {
|
||||
|
||||
//Make intent
|
||||
Intent intent = new Intent(getActivity(), SearchUserActivity.class);
|
||||
startActivityForResult(intent, FIND_USER_ID_INTENT);
|
||||
startActivityForResult(intent, CONVERSATION_UPDATE_FIND_USER_ID_INTENT);
|
||||
|
||||
}
|
||||
|
||||
@ -271,7 +268,7 @@ public class UpdateConversationFragment extends Fragment {
|
||||
|
||||
switch(requestCode){
|
||||
|
||||
case FIND_USER_ID_INTENT:
|
||||
case CONVERSATION_UPDATE_FIND_USER_ID_INTENT:
|
||||
addMemberID(Integer.decode(data.getData().getQueryParameter("userID")));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user