Skip to content

Commit 4a39039

Browse files
committed
UPDATE Files 😉
1 parent 725b038 commit 4a39039

File tree

15 files changed

+227
-73
lines changed

15 files changed

+227
-73
lines changed

.idea/.gitignore

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

.idea/compiler.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.

.idea/gradle.xml

Lines changed: 2 additions & 3 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 & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,25 @@ apply plugin: 'com.android.application'
22

33
android {
44
compileSdkVersion 30
5-
buildToolsVersion "30.0.0"
5+
buildToolsVersion "30.0.2"
66

77
defaultConfig {
88
applicationId "com.rubancreation.notes"
99
minSdkVersion 16
1010
targetSdkVersion 30
11-
versionCode 2
12-
versionName "1.0.1"
11+
versionCode 3
12+
versionName "1.3"
1313

1414
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1515
}
1616

17+
android {
18+
compileOptions {
19+
sourceCompatibility JavaVersion.VERSION_1_8
20+
targetCompatibility JavaVersion.VERSION_1_8
21+
}
22+
}
23+
1724
buildTypes {
1825
release {
1926
minifyEnabled false
@@ -24,14 +31,18 @@ android {
2431

2532
dependencies {
2633
implementation fileTree(dir: "libs", include: ["*.jar"])
27-
implementation 'androidx.appcompat:appcompat:1.2.0'
28-
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
29-
implementation 'androidx.recyclerview:recyclerview:1.1.0'
30-
implementation 'androidx.mediarouter:mediarouter:1.1.0'
31-
implementation 'com.google.android.material:material:1.2.0'
32-
testImplementation 'junit:junit:4.12'
33-
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
34-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
34+
implementation 'androidx.appcompat:appcompat:1.3.1'
35+
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
36+
implementation 'androidx.recyclerview:recyclerview:1.2.1'
37+
implementation 'androidx.mediarouter:mediarouter:1.2.5'
38+
39+
//material io implementation
40+
implementation 'com.google.android.material:material:1.4.0'
41+
42+
testImplementation 'junit:junit:4.13.2'
43+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
44+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
45+
3546

3647
//Implementing Ted Permission to request runtime permission
3748
implementation 'gun0912.ted:tedpermission:2.2.0'

app/debug/output-metadata.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": 2,
3+
"artifactType": {
4+
"type": "APK",
5+
"kind": "Directory"
6+
},
7+
"applicationId": "com.rubancreation.notes",
8+
"variantName": "processDebugResources",
9+
"elements": [
10+
{
11+
"type": "SINGLE",
12+
"filters": [],
13+
"versionCode": 3,
14+
"versionName": "1.3",
15+
"outputFile": "app-debug.apk"
16+
}
17+
]
18+
}

app/src/main/java/com/rubancreation/notes/MainActivity.java

Lines changed: 88 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import android.widget.ArrayAdapter;
2121
import android.widget.ListView;
2222
import android.widget.Toast;
23+
24+
import com.google.android.material.floatingactionbutton.FloatingActionButton;
2325
import com.gun0912.tedpermission.PermissionListener;
2426
import com.gun0912.tedpermission.TedPermission;
2527
import java.util.ArrayList;
@@ -32,6 +34,7 @@ public class MainActivity extends AppCompatActivity {
3234
static ArrayAdapter<String> arrayAdapter;
3335
ListView listView;
3436

37+
3538
@Override
3639
public boolean onCreateOptionsMenu(Menu menu) {
3740

@@ -46,21 +49,30 @@ public boolean onCreateOptionsMenu(Menu menu) {
4649
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
4750
super.onOptionsItemSelected(item);
4851

49-
if (item.getItemId() == R.id.add_note) {
50-
Intent intent = new Intent(getApplicationContext(), NoteEditorActivity.class);
51-
startActivity(intent);
52+
if (item.getItemId() == R.id.share) {
53+
Intent sendIntent = new Intent();
54+
sendIntent.setAction(Intent.ACTION_SEND);
55+
sendIntent.putExtra(Intent.EXTRA_TEXT, "Hey!! Want to take notes? Try this amazing app now. Link: https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID);
56+
sendIntent.setType("text/plain");
57+
58+
Intent shareIntent = Intent.createChooser(sendIntent, null);
59+
startActivity(shareIntent);
60+
61+
return true;
62+
}
63+
64+
else if (item.getItemId() == R.id.rate){
65+
Toast.makeText(this, "Please wait", Toast.LENGTH_LONG).show();
5266

53-
Toast.makeText(getApplicationContext(), "Hey! New Note is Created, Tap the screen to edit.", Toast.LENGTH_LONG).show();
67+
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID)));
5468

5569
return true;
5670
}
5771

58-
else if (item.getItemId() == R.id.share){
59-
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
60-
sharingIntent.setType("text/plain");
61-
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Text");
62-
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
63-
startActivity(Intent.createChooser(sharingIntent, "Share using"));
72+
else if (item.getItemId() == R.id.about_us){
73+
aboutDialog();
74+
75+
return true;
6476
}
6577

6678
return false;
@@ -74,6 +86,7 @@ protected void onCreate(Bundle savedInstanceState) {
7486
setContentView(R.layout.activity_main);
7587

7688
listView = findViewById(R.id.listView);
89+
FloatingActionButton fab = findViewById(R.id.fab);
7790

7891
SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences("com.rubancreation.notes", Context.MODE_PRIVATE);
7992
HashSet<String> set = (HashSet<String>) sharedPreferences.getStringSet("notes", null);
@@ -84,10 +97,11 @@ protected void onCreate(Bundle savedInstanceState) {
8497
else {
8598
notes = new ArrayList(set);
8699
}
87-
100+
88101

89102
arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, notes);
90103
listView.setAdapter(arrayAdapter);
104+
listView.setDividerHeight(2);
91105
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
92106

93107
@Override
@@ -96,8 +110,6 @@ public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
96110
Intent intent = new Intent(getApplicationContext(), NoteEditorActivity.class);
97111
intent.putExtra("noteId", i);
98112
startActivity(intent);
99-
100-
101113
}
102114

103115
});
@@ -139,10 +151,26 @@ public void onClick(DialogInterface dialogInterface, int i) {
139151

140152
});
141153

154+
fab.setOnClickListener(new View.OnClickListener() {
155+
@Override
156+
public void onClick(View view) {
157+
Intent intent = new Intent(getApplicationContext(), NoteEditorActivity.class);
158+
startActivity(intent);
159+
160+
Toast.makeText(getApplicationContext(), "Hey! New Note is Created, Tap the screen to edit.", Toast.LENGTH_LONG).show();
161+
}
162+
});
163+
164+
SharedPreferences preferences = getSharedPreferences("preferences", MODE_PRIVATE);
165+
boolean firstStart = preferences.getBoolean("firstStart", true);
166+
if (firstStart) {
167+
showStartDialog();
168+
}
142169
}
143170

144171
//for Exit menu Item
145-
public void exit(MenuItem item) {
172+
public void exit(MenuItem item){
173+
Toast.makeText(this, "Thanks for using NOTES", Toast.LENGTH_LONG).show();
146174
finish();
147175
}
148176

@@ -154,29 +182,23 @@ public void checkPermission(MenuItem item) {
154182
public void onPermissionGranted() {
155183
Toast.makeText(MainActivity.this, "Please wait..", Toast.LENGTH_SHORT).show();
156184

157-
Log.d(" ", "send email: ");
158-
159-
String[] TO_EMAILS = {"rubancreations22@gmail.com"};
160-
//these CC and BCC
161-
String[] CC = {"rubancreations22@gmail.com"};
162-
String[] BCC = {"rubancreations22@gmail.com"};
185+
Log.d(" ", "Send Email: ");
186+
String[] TO_EMAILS = {"app.feedback.rubancreations@gmail.com"};
163187

164-
Intent intent = new Intent(Intent.ACTION_SENDTO);
165-
intent.setData(Uri.parse("mailto:"));
166-
intent.putExtra(Intent.EXTRA_EMAIL, TO_EMAILS);
167-
intent.putExtra(Intent.EXTRA_CC, CC);
168-
intent.putExtra(Intent.EXTRA_BCC, BCC);
188+
Intent intent = new Intent(Intent.ACTION_SENDTO);
189+
intent.setData(Uri.parse("mailto:"));
190+
intent.putExtra(Intent.EXTRA_EMAIL, TO_EMAILS);
169191

170-
intent.putExtra(Intent.EXTRA_SUBJECT, "This is a Subject");
171-
intent.putExtra(Intent.EXTRA_TEXT, "This is the body of the Email");
192+
intent.putExtra(Intent.EXTRA_SUBJECT, "Reported Problem");
193+
intent.putExtra(Intent.EXTRA_TEXT, "Hey Ruban Creations I've found a Bug/Problem inside your app. \nProblem Explanation: \n");
172194

173-
startActivity(Intent.createChooser(intent, "Choose your mail client.."));
195+
startActivity(Intent.createChooser(intent, "Choose your mail client: "));
174196

175197
}
176198

177199
@Override
178200
public void onPermissionDenied(ArrayList<String> deniedPermissions) {
179-
Toast.makeText(MainActivity.this, "Click allow to access Permission.", Toast.LENGTH_SHORT).show();
201+
Toast.makeText(MainActivity.this, "Check your internet connection.", Toast.LENGTH_SHORT).show();
180202
}
181203
};
182204

@@ -202,12 +224,46 @@ public void onPermissionDenied(ArrayList<String> deniedPermissions) {
202224
Toast.makeText(MainActivity.this, "Check Connection Settings", Toast.LENGTH_LONG).show();
203225
}
204226
};
205-
206-
207-
208227
TedPermission.with(MainActivity.this)
209228
.setPermissionListener(privacyPolicy)
210229
.setPermissions(Manifest.permission.INTERNET)
211230
.check();
212231
}
232+
233+
private void showStartDialog(){
234+
new AlertDialog.Builder(this)
235+
.setTitle("We are Updated!")
236+
.setMessage("Hello Buddies, We are updated our app This update includes \nBug Fixes \nFixed add button not working problem \nUpgraded performance \nAdded some menus to know about us \nRate us on google playstore :)")
237+
.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
238+
@Override
239+
public void onClick(DialogInterface dialogInterface, int i) {
240+
dialogInterface.dismiss();
241+
}
242+
})
243+
.create().show();
244+
245+
SharedPreferences preferences = getSharedPreferences("preferences", MODE_PRIVATE);
246+
SharedPreferences.Editor editor = preferences.edit();
247+
editor.putBoolean("firstStart", false);
248+
editor.apply();
249+
}
250+
251+
private void aboutDialog(){
252+
new AlertDialog.Builder(this)
253+
.setTitle("NOTES - Writing Master")
254+
.setMessage("Hello users, NOTES - Writing Master." +
255+
"One of our first development on PlayStore has surpassed 500+ users around the world" +
256+
"Users can write notes in our app" +
257+
"An User friendly application. We designed everything, what they expected. " +
258+
"We made it more. \n" +
259+
"\n" +
260+
"Version Name: 1.3")
261+
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
262+
@Override
263+
public void onClick(DialogInterface dialogInterface, int i) {
264+
dialogInterface.dismiss();
265+
}
266+
})
267+
.create().show();
268+
}
213269
}

app/src/main/java/com/rubancreation/notes/NoteEditorActivity.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ public boolean onCreateOptionsMenu(Menu menu) {
3434
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
3535
super.onOptionsItemSelected(item);
3636
if (item.getItemId() == R.id.share_menu){
37-
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
38-
sharingIntent.setType("text/plain");
39-
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Text");
40-
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
41-
startActivity(Intent.createChooser(sharingIntent, "Share using"));
37+
Intent sendIntent = new Intent();
38+
sendIntent.setAction(Intent.ACTION_SEND);
39+
sendIntent.putExtra(Intent.EXTRA_TEXT, "Hey!! Want to take notes? Try this amazing app now. Link: https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID);
40+
sendIntent.setType("text/plain");
41+
42+
Intent shareIntent = Intent.createChooser(sendIntent, null);
43+
startActivity(shareIntent);
4244

4345
return true;
4446
}
@@ -55,6 +57,9 @@ protected void onCreate(Bundle savedInstanceState) {
5557
//enable back button to main activity
5658
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
5759

60+
//Setting the title
61+
getSupportActionBar().setTitle("Write Here");
62+
5863
//Implement menu Inflater
5964

6065

@@ -101,5 +106,6 @@ public void afterTextChanged(Editable editable) {
101106
}
102107
});
103108

109+
104110
}
105111
}

0 commit comments

Comments
 (0)