This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class QRCodesScannerActivity : AppCompatActivity() { | |
private val TAG = "CameraPermission" | |
private val CAMERA_REQUEST_CODE = 101 | |
private lateinit var barcodeDetector: BarcodeDetector | |
private lateinit var cameraSource: CameraSource | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Расчёт количества столбцов относительно размеров экрана и ориентации | |
public static int getGridColumnsCount(Context context){ | |
boolean landscape = context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; | |
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); | |
float hi=displayMetrics.heightPixels/displayMetrics.xdpi; | |
float wi=displayMetrics.widthPixels/displayMetrics.ydpi; | |
float screenWidthInch = landscape ? Math.max(wi, hi) : Math.min(wi, hi); | |
float screenWidthCm = screenWidthInch * 2.54f; | |
int columns = (int)(screenWidthCm/2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ChatPageTabFragmentsAdapter extends FragmentPagerAdapter { | |
private List<Fragment> fragmentList = new ArrayList<>(); | |
private ManagerModel[] managers; | |
public ChatPageTabFragmentsAdapter(FragmentManager fm, ManagerModel[] managerModels) { | |
super(fm); | |
this.managers = managerModels; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MessageItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |
private List<MessageModel> messages; | |
private String managerPhotoUrl; | |
public MessageItemAdapter(List<MessageModel> messages) { | |
this.messages = messages; | |
} | |
public void setManagerPhotoUrl(String url) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ChatFragment extends Fragment { | |
private static final String ARG_MANAGER = "manager"; | |
private List<MessageModel> messages = new ArrayList<>(); | |
private MessageItemAdapter messageItemAdapter = new MessageItemAdapter(messages); | |
private Unbinder unbinder; | |
@BindView(R.id.progressbar_loading_container) | |
FrameLayout progressbarLoadingView; | |
@BindView(R.id.recyclerView_messagesContainer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ChatActivity extends AppCompatActivity { | |
private ActivityCommonUtils activityCommonUtils = new ActivityCommonUtils(this); | |
private ManagerModel[] managerModels; | |
@BindView(R.id.tabLayout_container) | |
TabLayout tabsContainer; | |
@BindView(R.id.viewPager_tabsPager) | |
ViewPager fragmentPager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*************** Архитектура асинхронные запросы в Андроид | |
//Имеются общие классы для запросов : | |
// обертка над любыми запросами | |
public class RequestWrapper <T> { | |
public String apiVersion = "2.0"; | |
public String accessToken; | |
public T requestData; |