Skip to content

dev-chetan/BaseAndroid

Repository files navigation

Lib version

dependencies {
    implementation 'com.github.dev-chetan:BaseAndroid:1.3.4'
}

Android Users Permission

String[] perms = {Manifest.permission.CALL_PHONE};
        PermissionUtil.permission(((AppCompatActivity) context), perms, new PermissionHandler() {
            @Override
            public void onGranted() {
                Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + number));
                context.startActivity(intent);
            }

            @Override
            public void onDenied() {
                toast(context.getString(R.string.txt_permission_deny), context);
            }
        });

Then, add to your manifest Manifest.xml

        <activity android:name="com.android.rb.helper.PermissionActivity"
            android:theme="@style/Permissions.TransparentTheme" />

Load Image Functions

Load PDF form ImageView

String pdfUrl = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf";
loadNetworkPDF(pdfUrl, (ImageView) findViewById(R.id.iv));

Load Image form ImageView

String imageUrl = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.png";

loadNetworkImage(imageUrl, (ImageView) findViewById(R.id.iv));
loadNetworkProfile(imageUrl, (ImageView) findViewById(R.id.iv));

String localImageUrl = "<Local Image Path>";
oadStorageImage("", (ImageView) findViewById(R.id.iv));

Dialog Functions

Information Popup Dialog Single Button

showInfoDialog(response.body().getMsg());

Information Popup Dialog Two Button With Action

new DialogHelper("Are you sure you want to delete?", getContext().getString(R.string.txt_cancel), getContext().getString(R.string.txt_delete), new DialogHelper.DialogCallBack() {
                    @Override
                    public void onResult(int resultCode) {
                        if (resultCode == 1) {
                            
                        }
                    }
}, DialogStatus.DIALOG_DEFAULT).show(((AppCompatActivity) getContext()).getSupportFragmentManager(), "");

#Bottom Sheet Dialog

Types Of Bottom Sheet BottomSheetHelper.Type.multipleSelection Multiple selection BottomSheetHelper.Type.singleSelection Single selection BottomSheetHelper.Type.singleSearch Single selection with search BottomSheetHelper.Type.multipleSearch Multiple selection with search

new BottomSheetHelper(getContext(), "" + text.getHint(), list, new BottomSheetHelper.OnBottomSheetResult() {
            @Override
            public void onResult(List<BottomSheetData> arrayList) {
            }
        }, BottomSheetHelper.Type.singleSearch);

Set fields as required.

  • If you want to set asterisk sign(*) to input fields then use this method lik below
   setRequired(textInputUser)
  • Output : Username*

Set cursor to last index in input field.

   edtFirstName.setText("John");
   edtFirstName.setSelection(getSelection(edtFirstName));

This method is used to remove last char from string content

   removeLastChar("Hello,"); // remove last char
   removeLastChar("Hello,,",2); // remove last no of 2 char

This method is used to remove last char from string content

   saveContact(this,"99134***","abc","abc@123")

This method is used to get multiple image with crop

    rbImageMultiPicker(new RBMultipleImagePickerListener() {
                       @Override
                       public void onRBPickerResult(ArrayList<DialogMultiImageHelper.ImageData> arrayList) {
                           Log.e(TAG, "onRBPickerResult: " + arrayList.size());
                       }
                   });

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages