Skip to content

Commit

Permalink
Merge pull request #4 from SlaVcE14/v1.2.1
Browse files Browse the repository at this point in the history
V1.2.1
  • Loading branch information
SlaVcE14 authored Apr 4, 2022
2 parents c6a8c11 + dde91cc commit 6ec5bac
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 64 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
.externalNativeBuild
.cxx
local.properties
/app
/app
/.idea
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/compiler.xml

This file was deleted.

20 changes: 0 additions & 20 deletions .idea/gradle.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/misc.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dependencyResolutionManagement {
}
rootProject.name = "My Library 2"
include ':sjlibrary'
include ':app'
5 changes: 2 additions & 3 deletions sjlibrary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ android {

defaultConfig {
minSdk 23
targetSdk 31
versionCode 3
versionName "1.2"
versionCode 4
versionName "1.2.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import android.app.Dialog;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
Expand All @@ -19,6 +21,7 @@
public class SetupDialog {
public Dialog dialog;
public Button button1, button2;
private int maxWidth = 600;

public SetupDialog (){

Expand Down Expand Up @@ -52,7 +55,7 @@ public SetupDialog DialogBuilder(Context context,String Title,String Text, Strin
TextView msg = (TextView)dialog.findViewById(R.id.textView);
msg.setText(Text);
}
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
SetDialogSize(context);
TextView TitleTv = (TextView)dialog.findViewById(R.id.TitleText);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
button1 = (Button)dialog.findViewById(R.id.Btn1);
Expand All @@ -77,6 +80,21 @@ public void onClick(View v) {
return this;
}

public void dismiss(){
dialog.dismiss();
}

private void SetDialogSize(Context context){
Configuration configuration = context.getResources().getConfiguration();
if (configuration.screenWidthDp > maxWidth)
dialog.getWindow().setLayout(dpToPixels(context,maxWidth), ViewGroup.LayoutParams.WRAP_CONTENT);
else dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}

private int dpToPixels(Context context, float dp) {
Resources r = context.getResources();
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics());
}


public void onButtonClick(DialogButtonEvents dialogButtonEvents){
Expand Down
4 changes: 2 additions & 2 deletions sjlibrary/src/main/res/layout/popup_panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"

>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
android:background="@drawable/background"
android:gravity="bottom"
android:layout_marginHorizontal="10dp"
android:orientation="vertical">

<TextView
Expand Down
20 changes: 9 additions & 11 deletions sjlibrary/src/main/res/layout/popup_panel_long.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
android:layout_marginHorizontal="10dp"
android:background="@drawable/background"
android:gravity="bottom"
android:orientation="vertical">
Expand All @@ -19,32 +18,31 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:text="Title"
android:textAlignment="center"
android:textSize="25dp"
android:layout_marginTop="20dp"
/>
android:textSize="25dp" />

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:text="message here"
android:layout_marginHorizontal="20dp"
android:textAlignment="center"
android:textSize="20dp"
android:layout_marginTop="20dp"
/>
android:textSize="20dp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:layout_marginBottom="20dp">
android:layout_marginBottom="20dp"
android:orientation="horizontal">


<Button
Expand Down

0 comments on commit 6ec5bac

Please sign in to comment.