mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Share feature (#1338)
* added share app feature in About * added share app feature in About * a small fix
This commit is contained in:
parent
c6679edbda
commit
120130bfc7
5 changed files with 46 additions and 0 deletions
|
|
@ -12,6 +12,9 @@ import android.text.style.UnderlineSpan;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.support.customtabs.CustomTabsIntent;
|
import android.support.customtabs.CustomTabsIntent;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
@ -121,6 +124,28 @@ public class AboutActivity extends NavigationBaseActivity {
|
||||||
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Frequently-Asked-Questions\\"));
|
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Frequently-Asked-Questions\\"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
MenuInflater inflater = getMenuInflater();
|
||||||
|
inflater.inflate(R.menu.menu_about, menu);
|
||||||
|
return super.onCreateOptionsMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.share_app_icon:
|
||||||
|
Intent sendIntent = new Intent();
|
||||||
|
sendIntent.setAction(Intent.ACTION_SEND);
|
||||||
|
sendIntent.putExtra(Intent.EXTRA_TEXT, "http://play.google.com/store/apps/details?id=fr.free.nrw.commons");
|
||||||
|
sendIntent.setType("text/plain");
|
||||||
|
startActivity(Intent.createChooser(sendIntent, "Share app via..."));
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@OnClick(R.id.about_translate)
|
@OnClick(R.id.about_translate)
|
||||||
public void launchTranslate(View view) {
|
public void launchTranslate(View view) {
|
||||||
final ArrayAdapter<String> languageAdapter = new ArrayAdapter<String>(AboutActivity.this,
|
final ArrayAdapter<String> languageAdapter = new ArrayAdapter<String>(AboutActivity.this,
|
||||||
|
|
|
||||||
BIN
app/src/main/res/drawable-mdpi/share.png
Normal file
BIN
app/src/main/res/drawable-mdpi/share.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
5
app/src/main/res/drawable/ic_share_black_24dp.xml
Normal file
5
app/src/main/res/drawable/ic_share_black_24dp.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:alpha="0.84" android:height="32dp"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="32dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#ffffffff" android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
|
||||||
|
</vector>
|
||||||
|
|
@ -9,4 +9,5 @@
|
||||||
android:minHeight="?attr/actionBarSize"
|
android:minHeight="?attr/actionBarSize"
|
||||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||||
android:background="?attr/colorPrimaryDark">
|
android:background="?attr/colorPrimaryDark">
|
||||||
|
|
||||||
</android.support.v7.widget.Toolbar>
|
</android.support.v7.widget.Toolbar>
|
||||||
15
app/src/main/res/menu/menu_about.xml
Normal file
15
app/src/main/res/menu/menu_about.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context=".MainActivity"
|
||||||
|
>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/share_app_icon"
|
||||||
|
android:title="@string/refresh_button"
|
||||||
|
android:icon="@drawable/ic_share_black_24dp"
|
||||||
|
android:orderInCategory="1"
|
||||||
|
app:showAsAction="ifRoom"
|
||||||
|
/>
|
||||||
|
</menu>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue