Skip to content

Commit 23fe1b2

Browse files
committed
Initial commit for Library
1 parent 1ef3db7 commit 23fe1b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1466
-0
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx

.idea/codeStyles/Project.xml

Lines changed: 116 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jarRepositories.xml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OptionsDialog/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

OptionsDialog/build.gradle

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
compileSdkVersion 29
5+
buildToolsVersion "30.0.2"
6+
7+
defaultConfig {
8+
minSdkVersion 21
9+
targetSdkVersion 29
10+
versionCode 1
11+
versionName "1.0"
12+
13+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14+
consumerProguardFiles "consumer-rules.pro"
15+
}
16+
17+
buildTypes {
18+
release {
19+
minifyEnabled false
20+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21+
}
22+
}
23+
compileOptions {
24+
sourceCompatibility JavaVersion.VERSION_1_8
25+
targetCompatibility JavaVersion.VERSION_1_8
26+
}
27+
}
28+
29+
dependencies {
30+
implementation fileTree(dir: "libs", include: ["*.jar"])
31+
implementation 'androidx.appcompat:appcompat:1.2.0'
32+
implementation 'androidx.cardview:cardview:1.0.0'
33+
testImplementation 'junit:junit:4.12'
34+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
35+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
36+
37+
}

OptionsDialog/consumer-rules.pro

Whitespace-only changes.

OptionsDialog/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.clk.optionsdialog;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
assertEquals("com.clk.optionsdialog.test", appContext.getPackageName());
25+
}
26+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.clk.optionsdialog">
3+
4+
/
5+
</manifest>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package com.clk.optionsdialog;
2+
3+
import android.app.Activity;
4+
import android.app.Dialog;
5+
import android.graphics.Color;
6+
import android.graphics.drawable.ColorDrawable;
7+
import android.util.DisplayMetrics;
8+
import android.view.Window;
9+
import android.view.WindowManager;
10+
import android.view.animation.Animation;
11+
import android.view.animation.AnimationUtils;
12+
import android.widget.LinearLayout;
13+
import android.widget.RelativeLayout;
14+
15+
public class DialogMethods {
16+
17+
public static void setWidth(Activity activity, Dialog dialog){
18+
DisplayMetrics metrics=activity.getResources().getDisplayMetrics();
19+
int w=metrics.widthPixels;
20+
21+
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
22+
dialog.getWindow().setLayout((w*95)/100, RelativeLayout.LayoutParams.WRAP_CONTENT);
23+
24+
}
25+
26+
public static void setFullWidth(Activity activity, Dialog dialog){
27+
DisplayMetrics metrics=activity.getResources().getDisplayMetrics();
28+
int w=metrics.widthPixels;
29+
30+
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
31+
dialog.getWindow().setLayout(w, RelativeLayout.LayoutParams.WRAP_CONTENT);
32+
33+
}
34+
35+
public static void setAnimation(Activity activity, RelativeLayout layout){
36+
Animation anim = AnimationUtils.loadAnimation(activity, R.anim.custom_window);
37+
anim.reset();
38+
layout.clearAnimation();
39+
layout.startAnimation(anim);
40+
}
41+
42+
public static void setAnimation(Activity activity, LinearLayout layout){
43+
Animation anim = AnimationUtils.loadAnimation(activity, R.anim.custom_window);
44+
anim.reset();
45+
layout.clearAnimation();
46+
layout.startAnimation(anim);
47+
}
48+
49+
public static void setGravity(Dialog dialog , int gravity){
50+
Window window = dialog.getWindow();
51+
WindowManager.LayoutParams wlp = window.getAttributes();
52+
53+
// gravity= Gravity.BOTTOM, Gravity.TOP vs
54+
wlp.gravity=gravity;
55+
56+
// to make lightest background of dialog
57+
//wlp.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND;
58+
window.setAttributes(wlp);
59+
}
60+
}

0 commit comments

Comments
 (0)