Skip to content

Commit

Permalink
share button
Browse files Browse the repository at this point in the history
  • Loading branch information
hamza94max committed May 18, 2020
1 parent 3a1538b commit 9dbe310
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 19 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/hazem/wazaker/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public void onCreate() {
private void createNotificationChannel() {

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

Channel1.setDescription("Wazkar وذكر");
Channel1.setDescription("Wazaker وذكر");
NotificationManager manager = getSystemService(NotificationManager.class);

manager.createNotificationChannel(Channel1);
Expand Down
22 changes: 17 additions & 5 deletions app/src/main/java/com/hazem/wazaker/activities/AzkarActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
Expand Down Expand Up @@ -64,12 +65,23 @@ protected void onCreate(Bundle savedInstanceState) {
copybtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String zeker = zekerItems.get(viewPager.getCurrentItem()).getZeker();
/*
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("Text", zekerItems.get(viewPager.getCurrentItem()));
clipboard.setPrimaryClip(clip);
*/


Toast.makeText(AzkarActivity.this, "تم النسخ", Toast.LENGTH_SHORT).show();
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, zeker);
sendIntent.setType("text/plain");

Intent shareIntent = Intent.createChooser(sendIntent, null);
startActivity(shareIntent);

// Toast.makeText(AzkarActivity.this, "تم النسخ", Toast.LENGTH_SHORT).show();
}
});

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


if (x==y ){


Toast.makeText(this, "Allah with you"+"", Toast.LENGTH_SHORT).show();
}
// get current viewpager, then increament it
int next = viewPager.getCurrentItem() + 1;
// set it to next one
viewPager.setCurrentItem(next, true); }



Expand Down
22 changes: 13 additions & 9 deletions app/src/main/java/com/hazem/wazaker/activities/FortyActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.badoualy.stepperindicator.StepperIndicator;
import com.hazem.wazaker.Adapters.SlideFortypagerAdapter;
import com.hazem.wazaker.Fragments.FortyyFragment;
import com.hazem.wazkar.R;
import com.hazem.wazaker.data_layer.FortyDataSet;

Expand Down Expand Up @@ -50,12 +44,21 @@ protected void onCreate(Bundle savedInstanceState) {
copybtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
String item = fortyItems[viewPager.getCurrentItem()];
/* ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = (ClipData) ClipData.newPlainText("Text",fortyItems [viewPager.getCurrentItem()] );
clipboard.setPrimaryClip(clip);
*/
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, item);
sendIntent.setType("text/plain");

Intent shareIntent = Intent.createChooser(sendIntent, null);
startActivity(shareIntent);

Toast.makeText(FortyActivity.this, "تم النسخ", Toast.LENGTH_SHORT).show();

// Toast.makeText(FortyActivity.this, "تم النسخ", Toast.LENGTH_SHORT).show();
}
});

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




}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ else if (index == 7) {
,1));
zekeritemList.add(new ZekeritemModel(

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


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

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


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

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

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


else if (index == 12) {

zekeritemList=new ArrayList<>();
zekeritemList.add(new ZekeritemModel("سُبْحَانَ اللَّهِ.\n" +
"\n" +
"مائة مرة.\n" +
Expand Down

0 comments on commit 9dbe310

Please # to comment.