Fix issue #57 - Allow to share channel and account links
This commit is contained in:
parent
b61b6868a6
commit
fe3546e282
|
@ -14,6 +14,7 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
|
@ -133,6 +134,17 @@ public class ShowAccountActivity extends AppCompatActivity {
|
||||||
});
|
});
|
||||||
AlertDialog alertDialog = dialogBuilder.create();
|
AlertDialog alertDialog = dialogBuilder.create();
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
|
}else if( item.getItemId() == R.id.action_share && account != null) {
|
||||||
|
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||||
|
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.shared_via));
|
||||||
|
String extra_text = account.getUrl();
|
||||||
|
sendIntent.putExtra(Intent.EXTRA_TEXT, extra_text);
|
||||||
|
sendIntent.setType("text/plain");
|
||||||
|
try {
|
||||||
|
startActivity(Intent.createChooser(sendIntent, getString(R.string.share_with)));
|
||||||
|
} catch (Exception e) {
|
||||||
|
Toasty.error(ShowAccountActivity.this, getString(R.string.toast_error), Toasty.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,6 +159,17 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
});
|
});
|
||||||
androidx.appcompat.app.AlertDialog alertDialog = dialogBuilder.create();
|
androidx.appcompat.app.AlertDialog alertDialog = dialogBuilder.create();
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
|
} else if( item.getItemId() == R.id.action_share && channel != null) {
|
||||||
|
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||||
|
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.shared_via));
|
||||||
|
String extra_text = channel.getUrl();
|
||||||
|
sendIntent.putExtra(Intent.EXTRA_TEXT, extra_text);
|
||||||
|
sendIntent.setType("text/plain");
|
||||||
|
try {
|
||||||
|
startActivity(Intent.createChooser(sendIntent, getString(R.string.share_with)));
|
||||||
|
} catch (Exception e) {
|
||||||
|
Toasty.error(ShowChannelActivity.this, getString(R.string.toast_error), Toasty.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,9 @@
|
||||||
android:icon="@drawable/ic_baseline_report_24"
|
android:icon="@drawable/ic_baseline_report_24"
|
||||||
android:title="@string/report"
|
android:title="@string/report"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_share"
|
||||||
|
android:icon="@drawable/ic_baseline_share_24"
|
||||||
|
android:title="@string/share"
|
||||||
|
app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
||||||
|
|
Loading…
Reference in New Issue