AmrDeveloper / CodeView

Android Library to make it easy to create an Code editor or IDE that support any languages and themes, with auto complete, auto indenting, snippets and more features
https://amrdeveloper.github.io/CodeView/
MIT License
378 stars 48 forks source link

The autocomplete and The keyboard #28

Closed danicaStarR closed 2 years ago

danicaStarR commented 2 years ago

1.The autocomplete box is in the wrong position 2.The keyboard blocks the input box

https://user-images.githubusercontent.com/103302052/166631466-4a09586d-2e0a-437e-8a43-2ad2aa8ee682.mp4

android version:6.0.1

Codes:

MainActivity.java

` @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);

    // Your language keywords
    String[] languageKeywords = {"hello","world"};
// List item custom layout 

// TextView id on your custom layout to put suggestion on it
    CodeView codeView = findViewById(R.id.codeView);

    codeView.setEnableLineNumber(true);
    codeView.setLineNumberTextColor(Color.GRAY);
    codeView.enablePairComplete(true);
    codeView.enablePairCompleteCenterCursor(true);
    Map<Character, Character> pairCompleteMap = new HashMap<>();
    pairCompleteMap.put('{', '}');
    pairCompleteMap.put('[', ']');
    pairCompleteMap.put('(', ')');
    pairCompleteMap.put('<', '>');
    pairCompleteMap.put('"', '"');
    codeView.setPairCompleteMap(pairCompleteMap);
    codeView.addSyntaxPattern(Pattern.compile("[0-9]+") , Color.RED);
    codeView.setLineNumberTextSize(15);

// Create ArrayAdapter object that contain all information
    ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.list,R.id.v_m_c, languageKeywords);
// Set the adapter on CodeView object
    codeView.setAdapter(adapter);

    Snackbar.make(codeView,"By Ds",Snackbar.LENGTH_SHORT).show();
}

`

activity_main.xml

` <?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent">

    <com.amrdeveloper.codeview.CodeView
        android:id="@+id/codeView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colo"
        android:dropDownWidth="150dp"
        android:dropDownHorizontalOffset="0dp"
        android:dropDownSelector="@color/colo"
        android:gravity="top|start" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

`

AmrDeveloper commented 2 years ago

Hello @danicaStarR,

Thanks for your report and information, I will test it on old versions and find the problem,

Thanks Amr Hesham

danicaStarR commented 2 years ago

oh,Thank u.😝

AmrDeveloper commented 2 years ago

The problem is from vertical offset calculation, i will modify it and test it first with many devices and versions before release it

Thanks bro Amr Hesham

m-anshuman2166 commented 2 years ago

Well kinda same issue in my case too

AmrDeveloper commented 2 years ago

Hello guys @danicaStarR @m-anshuman2166,

I have fixed the problem in Android 6 and below and tested it with different versions, please try to test the example app too on many different devices so we can make sure it is good and fix the problem before we release 1.3.5, I will keep testing 👍🏻

Thanks Amr Hesham

danicaStarR commented 2 years ago

OK 😆

m-anshuman2166 commented 2 years ago

image Looks better !

m-anshuman2166 commented 2 years ago

@danicaStarR is your issue solved ?

danicaStarR commented 2 years ago

@m-anshuman2166 I've been busy lately and haven't tried the new version

AmrDeveloper commented 2 years ago

This issue is solved in the last version