Skip to content

Commit 9dbe310

Browse files
committed
share button
1 parent 3a1538b commit 9dbe310

File tree

4 files changed

+38
-19
lines changed

4 files changed

+38
-19
lines changed

app/src/main/java/com/hazem/wazaker/App.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ public void onCreate() {
1919
private void createNotificationChannel() {
2020

2121
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
22-
NotificationChannel Channel1 = new NotificationChannel(getString(R.string.notifiaction_id), "Wazkar وذكر"
22+
NotificationChannel Channel1 = new NotificationChannel(getString(R.string.notifiaction_id), "Wazaker وذكر"
2323
, NotificationManager.IMPORTANCE_DEFAULT);
2424

25-
Channel1.setDescription("Wazkar وذكر");
25+
Channel1.setDescription("Wazaker وذكر");
2626
NotificationManager manager = getSystemService(NotificationManager.class);
2727

2828
manager.createNotificationChannel(Channel1);

app/src/main/java/com/hazem/wazaker/activities/AzkarActivity.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.content.ClipData;
55
import android.content.ClipboardManager;
66
import android.content.Context;
7+
import android.content.Intent;
78
import android.os.Bundle;
89
import android.view.View;
910
import android.widget.Button;
@@ -64,12 +65,23 @@ protected void onCreate(Bundle savedInstanceState) {
6465
copybtn.setOnClickListener(new View.OnClickListener() {
6566
@Override
6667
public void onClick(View v) {
68+
String zeker = zekerItems.get(viewPager.getCurrentItem()).getZeker();
69+
/*
6770
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
6871
ClipData clip = ClipData.newPlainText("Text", zekerItems.get(viewPager.getCurrentItem()));
6972
clipboard.setPrimaryClip(clip);
73+
*/
7074

7175

72-
Toast.makeText(AzkarActivity.this, "تم النسخ", Toast.LENGTH_SHORT).show();
76+
Intent sendIntent = new Intent();
77+
sendIntent.setAction(Intent.ACTION_SEND);
78+
sendIntent.putExtra(Intent.EXTRA_TEXT, zeker);
79+
sendIntent.setType("text/plain");
80+
81+
Intent shareIntent = Intent.createChooser(sendIntent, null);
82+
startActivity(shareIntent);
83+
84+
// Toast.makeText(AzkarActivity.this, "تم النسخ", Toast.LENGTH_SHORT).show();
7385
}
7486
});
7587

@@ -138,10 +150,10 @@ public void autoswap (ViewPager viewPager,int index ){
138150

139151

140152
if (x==y ){
141-
142-
143-
Toast.makeText(this, "Allah with you"+"", Toast.LENGTH_SHORT).show();
144-
}
153+
// get current viewpager, then increament it
154+
int next = viewPager.getCurrentItem() + 1;
155+
// set it to next one
156+
viewPager.setCurrentItem(next, true); }
145157

146158

147159

app/src/main/java/com/hazem/wazaker/activities/FortyActivity.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,12 @@
22

33
import androidx.appcompat.app.AppCompatActivity;
44
import androidx.viewpager.widget.ViewPager;
5-
6-
import android.content.ClipData;
7-
import android.content.ClipboardManager;
8-
import android.content.Context;
5+
import android.content.Intent;
96
import android.os.Bundle;
107
import android.view.View;
118
import android.widget.Button;
12-
import android.widget.Toast;
13-
149
import com.badoualy.stepperindicator.StepperIndicator;
1510
import com.hazem.wazaker.Adapters.SlideFortypagerAdapter;
16-
import com.hazem.wazaker.Fragments.FortyyFragment;
1711
import com.hazem.wazkar.R;
1812
import com.hazem.wazaker.data_layer.FortyDataSet;
1913

@@ -50,12 +44,21 @@ protected void onCreate(Bundle savedInstanceState) {
5044
copybtn.setOnClickListener(new View.OnClickListener() {
5145
@Override
5246
public void onClick(View v) {
53-
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
47+
String item = fortyItems[viewPager.getCurrentItem()];
48+
/* ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
5449
ClipData clip = (ClipData) ClipData.newPlainText("Text",fortyItems [viewPager.getCurrentItem()] );
5550
clipboard.setPrimaryClip(clip);
51+
*/
52+
Intent sendIntent = new Intent();
53+
sendIntent.setAction(Intent.ACTION_SEND);
54+
sendIntent.putExtra(Intent.EXTRA_TEXT, item);
55+
sendIntent.setType("text/plain");
5656

57+
Intent shareIntent = Intent.createChooser(sendIntent, null);
58+
startActivity(shareIntent);
5759

58-
Toast.makeText(FortyActivity.this, "تم النسخ", Toast.LENGTH_SHORT).show();
60+
61+
// Toast.makeText(FortyActivity.this, "تم النسخ", Toast.LENGTH_SHORT).show();
5962
}
6063
});
6164

@@ -68,6 +71,7 @@ public void onClick(View v) {
6871

6972

7073

74+
7175
}
7276

7377

app/src/main/java/com/hazem/wazaker/data_layer/ZekerDataSet.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ else if (index == 7) {
969969
,1));
970970
zekeritemList.add(new ZekeritemModel(
971971

972-
"اللَّهُمَّ إِنِّي أَسْأَلُكَ الْهُدَى وَالتُّقَى وَالْعَفَافَ وَالْغِنَ" + "\n" + "\n" +
972+
"اللَّهُمَّ إِنِّي أَسْأَلُكَ الْهُدَى وَالتُّقَى وَالْعَفَافَ وَالْغِنَي" + "\n" + "\n" +
973973

974974

975975
"رواه مسلم"
@@ -1036,7 +1036,8 @@ else if (index == 7) {
10361036
,1));
10371037
zekeritemList.add(new ZekeritemModel(
10381038

1039-
"للَّهُمَّ عَالِمَ الْغَيْبِ وَالشَّهَادَةِ، فَاطِرَ السَّمَوَاتِ وَالْأَرْضِ، رَبَّ كُلِّ شَيْءٍ وَمَلِيكَهُ، أَشْهَدُ أَنْ لَا إِلَهَ إِلَّا أَنْتَ، أَعُوذُ بِكَ مِنْ شَرِّ نَفْسِي وَشَرِّ الشَّيْطَانِ وَشِرْكِهِ " + "\n" + "\n" +
1039+
"اللَّهُمَّ عَالِمَ الْغَيْبِ وَالشَّهَادَةِ، فَاطِرَ السَّمَوَاتِ وَالْأَرْضِ، رَبَّ كُلِّ شَيْءٍ وَمَلِيكَهُ، أَشْهَدُ أَنْ لَا إِلَهَ إِلَّا أَنْتَ، أَعُوذُ" +
1040+
" بِكَ مِنْ شَرِّ نَفْسِي وَشَرِّ الشَّيْطَانِ وَشِرْكِهِ " + "\n" + "\n" +
10401041

10411042

10421043
"رواه الترمذي (3392) وغيره بإسناد صحيح عن أبي هريرة"
@@ -1066,7 +1067,7 @@ else if (index == 7) {
10661067
,1));
10671068

10681069
zekeritemList.add(new ZekeritemModel(
1069-
"رَبِّ أَعِنِّي وَلَا تُعِنْ عَلَيَّ، وَانْصُرْنِي وَلَا تَنْصُرْ عَلَيَّ، وَامْكُرْ لِي وَل َاتَمْكُرْ عَلَيَّ، وَاهْدِنِي وَيَسِّرِ الْهُدَى لِي، وَانْصُرْنِي عَلَى مَنْ بَغَى عَلَيَّ، رَبِّ اجْعَلْنِي لَكَ شَكَّارًا،" +
1070+
"رَبِّ أَعِنِّي وَلَا تُعِنْ عَلَيَّ، وَانْصُرْنِي وَلَا تَنْصُرْ عَلَيَّ، وَامْكُرْ لِي وَلا تَمْكُرْ عَلَيَّ، وَاهْدِنِي وَيَسِّرِ الْهُدَى لِي، وَانْصُرْنِي عَلَى مَنْ بَغَى عَلَيَّ، رَبِّ اجْعَلْنِي لَكَ شَكَّارًا،" +
10701071
" لَكَ ذَكَّارًا، لَكَ رَهَّابًا، لَكَ مِطْوَاعًا، لَكَ مُخْبِتًا إِلَيْكَ أَوَّاهًا مُنِيبًا، رَبِّ تَقَبَّلْ تَوْبَتِي وَاغْسِلْ حَوْبَتِي " +
10711072
"وَأَجِبْ دَعْوَتِي وَثَبِّتْ حُجَّتِي وَسَدِّدْ لِسَانِي وَاهْدِ قَلْبِي وَاسْلُلْ سَخِيمَةَ صَدْرِي" + "\n" + "\n" +
10721073

@@ -1201,6 +1202,8 @@ else if (index == 11) {
12011202

12021203

12031204
else if (index == 12) {
1205+
1206+
zekeritemList=new ArrayList<>();
12041207
zekeritemList.add(new ZekeritemModel("سُبْحَانَ اللَّهِ.\n" +
12051208
"\n" +
12061209
"مائة مرة.\n" +

0 commit comments

Comments
 (0)