Failed to resolve dependencies in my app

I want to add a library to my project.
This is my build.gradle file:

apply plugin: 'com.android.application'
repositories {
    mavenCentral()
    maven {
        credentials {
            username "XXXXX"
            password "XXXXX"
        }
        url "https://developers.interpay.se/nexus/content/repositories/Interpay/"
    }
}
android {
    compileSdkVersion 25
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "interpay.XXX.XXX.com.interpay"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'se.interpay:terminal:0.7.7'
}

but I get this error:

Error:(38, 13) Failed to resolve: se.interpay:terminal:0.7.7  
<a href="openFile:D:/XXXX/XXXX/Interpay/app/build.gradle">Show in File</a><br>  
<a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>  

Capture Full Webview to Bitmap

I want to ask about webview :
I can’t capture full page in webview. I can only capture the view that appears on the screen only, as I want to capture the full page. How to?

This is my webview :

            public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                        WebView.enableSlowWholeDocumentDraw();
                    }
                    setContentView(R.layout.main_activity);

                    final WebView webview = (WebView) findViewById(R.id.WebViewLayout);
                    webview.getSettings().setJavaScriptEnabled(true);
                    webview.setWebViewClient(new WebViewClient() {
                        @Override
                        public void onPageFinished(WebView view, String url) {
                            super.onPageFinished(webview, url);
                        }
                    });
                    webview.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
                    webview.setDrawingCacheEnabled(true);
                    webview.loadUrl("https://example.com");

                    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

                    if (mBluetoothAdapter == null) {
                        Toast.makeText(this, "Bluetooth is not available",
                                Toast.LENGTH_LONG).show();
                        finish();
                    }
                }

and this is to convert into bitmap

            private void Print_BMP(){

                    Bitmap mBitmap = Bitmap.createBitmap(imageViewPicture.getDrawingCache());
                    int nMode = 0;
                    int nPaperWidth = 384;
                    if(width_58mm.isChecked())
                        nPaperWidth = 384;
                    if(mBitmap != null)
                    {
                        byte[] data = PrintPicture.POS_PrintBMP(mBitmap, nPaperWidth, nMode);

                        SendDataByte(Command.ESC_Init);
                        SendDataByte(Command.LF);
                        SendDataByte(data);
                        SendDataByte(PrinterCommand.POS_Set_PrtAndFeedPaper(30));
                        SendDataByte(PrinterCommand.POS_Set_Cut(1));
                        SendDataByte(PrinterCommand.POS_Set_PrtInit());
                    }       
                }

and this is for keylistener

            private void KeyListenerInit() {

                    btnScanButton = (Button)findViewById(R.id.button_scan);
                    btnScanButton.setOnClickListener(this);

                    width_58mm = (RadioButton)findViewById(R.id.width_58mm);
                    width_58mm.setOnClickListener(this);

                    imageViewPicture = (WebView) findViewById(R.id.WebViewLayout);
                    imageViewPicture.setOnClickListener(this);
                }

What is the standard approach to building cross-platform mobile libraries? [on hold]

I’m an Android developer looking to build out libraries that can be used across Android and iOS, but unsure what the “best” approach for this is.

Some libraries I’d like to build are:

  1. Exposing a REST API to both clients.
  2. Sharing a common set of data models.
  3. Reusable UI components for a consistent user experience.

I think React Native would be a good approach for the UI, but what is the generally accepted approach for building out shared logic across platforms? Is that something that can be done using React Native? Can libraries built through Xamarin be easily reusable across either platform? Ideally, I’d like to distribute these libraries through Gradle and CocoaPods as well.

Strange behaviour of Firebase RecyclerView

Here is code for when the Firebase RecyclerView is set, here RecyclerView is used to show a different type of post like events, discussion, requirement, etc. for events a different linear-layout is shown to the user. but this event is displayed in the posts which do not have that data. This same error is seen in the images too. the posts which don’t have image also shows images from other posts.

    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(layoutManager);
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.DATE, -30);

    adapter = new FirebaseRecyclerAdapter<Post, PostAdapterViewHolder>(Post.class, R.layout.post_list_item, PostAdapterViewHolder.class, databaseReference.orderByChild("timestamp").startAt(calendar.getTimeInMillis()).endAt(System.currentTimeMillis())) {
        public void populateViewHolder(final PostAdapterViewHolder postAdapterViewHolder, final Post post, final int position) {
            final String key = this.getRef(position).getKey();
            Log.d("whatiskey",""+key);

            documentref.child(key).addListenerForSingleValueEvent(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {
                    String value=String.valueOf(dataSnapshot.child("documentUrl").getValue());


                   if(value.equals(null)||value.equals("null"))
                   {
                       postAdapterViewHolder.removedocumentimage();
                   }
                   else
                   {
                       getFileName(value);
                       postAdapterViewHolder.setDocumentimage();
                   }
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {

                }
            });

            postAdapterViewHolder.setKey(key);
            postAdapterViewHolder.setContext(getActivity().getApplicationContext());
            postAdapterViewHolder.setCommunityId(CommunityId);
            postAdapterViewHolder.setDescription(post.getText(),post.getType());
            postAdapterViewHolder.setUser(post.getCreator());
            postAdapterViewHolder.setTime(post.getTimestamp());
            postAdapterViewHolder.setImage(post.getImageUrl(),post.getType());
            postAdapterViewHolder.setType(post.getType());
            postAdapterViewHolder.postdata(key,CommunityId);
            postAdapterViewHolder.setLike(post.getLikesCount());
            postAdapterViewHolder.setBookmark();
            postAdapterViewHolder.time.setVisibility(View.INVISIBLE);
            postAdapterViewHolder.activitybar.setVisibility(View.GONE);
            postAdapterViewHolder.setReadMark();
        }
    };
    recyclerView.setAdapter(adapter);

here is the recyclerview’s layout for every views:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/swiplayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:background="@drawable/recycler_bg"
android:orientation="horizontal"
app:cardElevation="2dp">

<TextView
    android:id="@+id/title"
    android:layout_width="7dp"
    android:layout_height="match_parent"
    android:background="@drawable/blueside" />

<LinearLayout
    android:background="?android:attr/selectableItemBackground"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <RelativeLayout
        android:id="@+id/head"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_centerVertical="true"
            android:layout_marginBottom="5dp"
            android:layout_marginLeft="15dp"
            android:scaleType="fitXY"
            android:src="@drawable/user" />

        <LinearLayout
            android:id="@+id/linearLayout2"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginBottom="5dp"
            android:layout_marginLeft="10dp"
            android:layout_toEndOf="@+id/imageView2"
            android:layout_toRightOf="@+id/imageView2"
            android:orientation="vertical">

            <TextView
                android:id="@+id/username"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="5dp"
                android:gravity="start"
                android:text="User Name"
                android:textColor="#485866"
                android:textSize="14sp"
              />

            <TextView
                android:id="@+id/designation"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:text="Role"
                android:textSize="12sp" />

        </LinearLayout>

        <LinearLayout
            android:layout_marginTop="10dp"
            android:id="@+id/linearLayout3"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignBottom="@+id/linearLayout2"
            android:layout_marginEnd="11dp"
            android:layout_marginRight="11dp"
            android:layout_toLeftOf="@+id/bookmark"
            android:layout_toStartOf="@+id/bookmark"
            android:gravity="end"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tag"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="11dp"
                android:layout_marginRight="11dp"
                android:background="@drawable/bluebutton"
                android:gravity="center"
                android:layout_gravity="center_vertical"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:text="Post type"
                android:textColor="@color/white"
                android:textSize="6pt" />

            <TextView
                android:id="@+id/date"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginEnd="15dp"
                android:layout_marginRight="15dp"
                android:gravity="end"
                android:text="Time"
                android:textSize="5pt"
                android:visibility="invisible" />
        </LinearLayout>
        <ImageView
            android:id="@+id/bookmark"
            android:layout_width="25dp"
            android:layout_height="40dp"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_gravity="center"
            android:layout_marginEnd="14dp"
            android:layout_marginRight="14dp"
            android:layout_marginTop="3dp"
            android:layout_weight="1"
            android:src="@drawable/fav_clicked_change" />

    </RelativeLayout>
    <LinearLayout
        android:id="@+id/documenttext"
        android:layout_width="match_parent"
        android:paddingRight="10dp"
        android:layout_height="30dp"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:background="@drawable/grayrect"
        android:orientation="horizontal"
        android:layout_gravity="center"
        android:gravity="center">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.3"
            app:srcCompat="@drawable/darkattachment"
            android:padding="5dp"/>
        <TextView
            android:id="@+id/docname"
            android:layout_weight="0.5"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
                android:gravity="center_vertical"
            android:text="Document Attached"/>

    </LinearLayout>

    <LinearLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/description"
            android:layout_width="0dp"
            android:autoLink="web|email|phone"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:layout_marginEnd="5dp"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="5dp"
            android:layout_marginStart="15dp"
            android:layout_marginTop="5dp"
            android:layout_weight="3.8"
            android:gravity="start"
            android:maxLines="10"
            android:textColor="@color/grey"
            android:textSize="6pt" />

        <ImageView
            android:id="@+id/imageview"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_gravity="center"
            android:layout_marginBottom="5dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:scaleType="fitCenter"
            app:srcCompat="@drawable/ic_launcher_background"
            android:transitionName="simple_activity_transition"
            android:visibility="gone"
            tools:ignore="UnusedAttribute" />

    </LinearLayout>

    <LinearLayout
        android:background="@drawable/graybutton"
        android:id="@+id/eventLayout"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="10dp"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:orientation="vertical"
            android:layout_marginTop="3dp"
            android:layout_marginBottom="3dp"
            android:gravity="center"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <ImageView
                android:layout_marginRight="5dp"
                android:visibility="gone"
                android:id="@+id/event_image"
                android:layout_gravity="center"
                android:layout_width="150dp"
                android:layout_height="100dp" />

            <TextView
                android:textColor="@color/grey"
                android:layout_marginTop="3dp"
                android:gravity="center"
                android:layout_marginRight="5dp"
                android:id="@+id/post_eventName"
                android:textSize="17sp"
                android:textStyle="bold"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Name"/>

            <LinearLayout
                android:padding="3dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:gravity="center"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <ImageView
                    android:layout_width="25dp"
                    android:layout_height="20dp"
                    app:srcCompat="@drawable/locationpin"/>

                <TextView
                    android:paddingLeft="10dp"
                    android:layout_gravity="center"
                    android:id="@+id/post_eventVenue"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Venue"/>

            </LinearLayout>

        </LinearLayout>

        <LinearLayout
            android:layout_marginBottom="5dp"
            android:weightSum="2"
            android:layout_marginLeft="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:text="Event timings"
                android:layout_width="wrap_content"
                android:layout_marginRight="5dp"
                android:layout_height="wrap_content"
                android:id="@+id/post_event_timings" />

        </LinearLayout>

        <TextView
            android:id="@+id/event_description"
            android:layout_width="match_parent"
            android:autoLink="web|email|phone"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginEnd="5dp"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="5dp"
            android:layout_marginStart="15dp"
            android:layout_marginTop="5dp"
            android:layout_weight="3.8"
            android:gravity="start"
            android:text="This is some random text"
            android:maxLines="10"
            android:textColor="@color/grey"
            android:textSize="6pt" />

        <LinearLayout
            android:id="@+id/post_feedback_box"
            android:layout_marginTop="5dp"
            android:layout_marginBottom="10dp"
            android:weightSum="3"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:background="@drawable/bluecurve"
                android:id="@+id/post_eventNo"
                android:textColor="@color/white"
                android:layout_weight="1"
                android:text="No"
                android:gravity="center"
                android:layout_width="wrap_content"
                android:layout_height="30dp" />

            <TextView
                android:layout_marginLeft="5dp"
                android:background="@drawable/bluecurve"
                android:id="@+id/post_eventMaybe"
                android:textColor="@color/white"
                android:layout_weight="1"
                android:text="Maybe"
                android:gravity="center"
                android:layout_width="wrap_content"
                android:layout_height="30dp" />

            <TextView
                android:layout_marginLeft="5dp"
                android:layout_width="wrap_content"
                android:background="@drawable/bluecurve"
                android:id="@+id/post_eventYes"
                android:textColor="@color/white"
                android:text="Yes"
                android:layout_weight="1"
                android:gravity="center"
                android:layout_height="30dp" />

        </LinearLayout>

    </LinearLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:layout_marginTop="2dp"
            android:layout_marginBottom="3dp"
            android:layout_alignParentEnd="true"
            android:id="@+id/readMark"
            android:layout_marginRight="14dp"
            android:layout_width="9dp"
            android:layout_height="9dp"
            app:srcCompat="@drawable/orangecircle"
            android:layout_alignParentRight="true" />

    </RelativeLayout>

    <LinearLayout
        android:id="@+id/activitybar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="3">


        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center">

            <ImageView
                android:id="@+id/like"
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:src="@drawable/emptyup" />

            <TextView
                android:id="@+id/likecount"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:gravity="center"
                android:text="0"
                android:textSize="8pt" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="2dp"
            android:layout_weight="1"
            android:gravity="center">

            <ImageView
                android:layout_width="25dp"
                android:layout_height="19dp"
                android:src="@drawable/chat" />

            <TextView
                android:layout_width="30dp"
                android:layout_height="30dp"

                android:gravity="center"
                android:text="0"
                android:textSize="8pt" />

        </LinearLayout>


        <ImageView
            android:id="@+id/sharebutton"
            android:layout_width="20dp"
            android:layout_height="18dp"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:src="@drawable/share" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="10dp"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/userdata"
            android:layout_width="2dp"
            android:layout_height="10dp"
            android:gravity="center"
            android:textColor="@color/white" />

        <TextView
            android:id="@+id/postdata"
            android:layout_width="match_parent"
            android:layout_height="10dp"
            android:gravity="center"
            android:textColor="@color/white"
            android:textSize="5pt" />

    </LinearLayout>

</LinearLayout>

and Inside PopulateviewGolder of the recyclerview I do this for events:

 if (type.contentEquals("Requirement")) {

        tag.setText("Requirement");
        title.setBackgroundResource(R.drawable.yellowside);
        tag.setBackgroundResource(R.drawable.yellowbutton);

    } else if (type.contentEquals("Offerings")) {

        tag.setText("Offering");
        title.setBackgroundResource(R.drawable.greenside);
        tag.setBackgroundResource(R.drawable.greenbutton);

    } else if (type.contentEquals("Question")) {

        tag.setText("Question");
        title.setBackgroundResource(R.drawable.blueside);
        tag.setBackgroundResource(R.drawable.bluebutton);

    } else if (type.contentEquals("Announcement")) {

        tag.setText("Announcement");
        title.setBackgroundResource(R.drawable.redside);
        tag.setBackgroundResource(R.drawable.redbutton);

    } else if (type.contentEquals("JLT")) {

        tag.setText("JLT");
        title.setBackgroundResource(R.drawable.blueside);
        tag.setBackgroundResource(R.drawable.bluebutton);

    } else if (type.contentEquals("Event")) {

        tag.setText("Event");
        eventLayout.setVisibility(View.VISIBLE);
        setEvent(key);
        title.setBackgroundResource(R.drawable.redside);
        tag.setBackgroundResource(R.drawable.redbutton);

    } else {

        tag.setText("Discussion");
        title.setBackgroundResource(R.drawable.blueside);
        tag.setBackgroundResource(R.drawable.bluebutton);

    }

the function of setting event data is:

eventName = itemView.findViewById(R.id.post_eventName);
    eventVenue = itemView.findViewById(R.id.post_eventVenue);
    eventTimings = itemView.findViewById(R.id.post_event_timings);

    DatabaseReference eventDBrefence = FirebaseDatabase.getInstance().getReference().child("Posts").child(CommunityId).child("posts").child(key).child("eventDetails");
    eventDBrefence.addListenerForSingleValueEvent(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            Event event = dataSnapshot.getValue(Event.class);
            eventName.setText(event.getEventName());
            if (event.getFromDate().equals(event.getToDate())) {
                eventTimings.setText("At " + event.getFromDate() + " from " + event.getFromTime() + " to " + event.getToTime());
            } else {
                eventTimings.setText("From " + event.getFromDate() + " at " + event.getFromTime() + " to " + event.getToDate() + " at " + event.getToTime());
            }
            eventVenue.setText(event.getEventVenue());
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });

Displaying SplashScreen while user waits authentication from FirebaseAuth

I’m trying to display a splash screen on my App and I’ve managed to do it using a Handler and a Runnable object that constructs an intent and after 2 seconds changes activities to my login activity using the intent constructed

However, now I’ve set up the Firebase Authentication. I’ve tried to construct the intent to match the expected behavior:
(user signedIn –> show SplashScreen –> Skip LoginActivity)
(user notSignedIn –> show SplashScreen –> Show LoginActivity)
Here’s the code I’m currently working on:

public class SplashScreenActivity extends AppCompatActivity {


    private FirebaseAuth mAuth = null;
    private FirebaseAuth.AuthStateListener mAuthListener;

    /** Duration of wait **/
    private final int SPLASH_DISPLAY_LENGTH = 1000;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.activity_splash_screen);

        new Handler().postDelayed(new Runnable(){
            @Override
            public void run() {
                mAuth = FirebaseAuth.getInstance();
                mAuthListener = new FirebaseAuth.AuthStateListener() {
                    @Override
                    public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {

                        FirebaseUser user = firebaseAuth.getCurrentUser();
                        if (user != null) {
                            // User is signed in, send to mainmenu
                            Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
                            startActivity(new Intent(SplashScreenActivity.this, MainMenuActivity.class));
                        } else {
                            // User is signed out, send to register/login
                            startActivity(new Intent(SplashScreenActivity.this, MainActivity.class));
                        }
                    }
                };
            }
        }, SPLASH_DISPLAY_LENGTH);

    }
}

I’ve ommited the imports to shorten the code. The problem is that the app stay indefinetely in the splashscreen.

How to move data from an SQL dump file into an SQLITE database for use with Room Persistence Library Android?

I am building an Android application that will perform statistical analysis on some sample data. The sample data is in the form of an SQL dump file (.sql).

I have followed the guide on Google to setup Room, but I don’t know how to transfer the data from the dump file into this database.